Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to hide menubar #52

Closed
ghost opened this issue Jan 8, 2023 · 2 comments
Closed

Add option to hide menubar #52

ghost opened this issue Jan 8, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 8, 2023

How can I add the option to hide the menubar for GTKTerm in the source code similiar to konsole terminal application for example under the view menu in GTKTerm?

Screenshot_20230108_033945

@Jeija
Copy link
Collaborator

Jeija commented Jan 8, 2023

The patch below (apply with git apply filename.patch) will get you something like this, you can toggle the menu bar with F11:
screenshot

I don't think this functionality is really necessary / relevant for most users though, so I'm not sure if we should implement it in the master branch. I'm open to feedback on this though.

From fcbe4ee744d8d72a47bf3824d23e81f6a332e6ab Mon Sep 17 00:00:00 2001
From: Jeija <[email protected]>
Date: Sun, 8 Jan 2023 10:24:26 +0100
Subject: [PATCH] Add functionality to toggle menu bar visibility with F11

---
 src/interface.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/interface.c b/src/interface.c
index 32b8a24..d41c3fe 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -88,6 +88,7 @@ gboolean timestamp_on = 0;
 GtkWidget *StatusBar;
 GtkWidget *signals[6];
 static GtkWidget *Hex_Box;
+static GtkWidget *menu;
 GtkWidget *searchBar;
 GtkWidget *scrolled_window;
 GtkWidget *Fenetre;
@@ -126,6 +127,7 @@ void view_radio_callback(GtkAction *action, gpointer data);
 void view_hexadecimal_chars_radio_callback(GtkAction* action, gpointer data);
 void view_index_toggled_callback(GtkAction *action, gpointer data);
 void view_send_hex_toggled_callback(GtkAction *action, gpointer data);
+void view_hide_menubar_toggled_callback(GtkAction *action, gpointer data);
 void initialize_hexadecimal_display(void);
 gboolean Send_Hexadecimal(GtkWidget *, GdkEventKey *, gpointer);
 gboolean pop_message(void);
@@ -197,7 +199,8 @@ const GtkToggleActionEntry menu_toggle_entries[] =
 
 	/* View Menu */
 	{"ViewIndex", NULL, N_("Show _index"), NULL, NULL, G_CALLBACK(view_index_toggled_callback), FALSE},
-	{"ViewSendHexData", NULL, N_("_Send hexadecimal data"), NULL, NULL, G_CALLBACK(view_send_hex_toggled_callback), FALSE}
+	{"ViewSendHexData", NULL, N_("_Send hexadecimal data"), NULL, NULL, G_CALLBACK(view_send_hex_toggled_callback), FALSE},
+	{"ViewHideMenubar", NULL, N_("_Hide menu bar"), "F11", NULL, G_CALLBACK(view_hide_menubar_toggled_callback), FALSE}
 };
 
 const GtkRadioActionEntry menu_view_radio_entries[] =
@@ -271,6 +274,7 @@ static const char *ui_description =
     "      <menuitem action='ViewIndex'/>"
     "      <separator/>"
     "      <menuitem action='ViewSendHexData'/>"
+	"      <menuitem action='ViewHideMenubar'/>"
     "    </menu>"
     "    <menu action='Help'>"
     "      <menuitem action='HelpAbout'/>"
@@ -298,6 +302,14 @@ void view_send_hex_toggled_callback(GtkAction *action, gpointer data)
 		gtk_widget_hide(GTK_WIDGET(Hex_Box));
 }
 
+void view_hide_menubar_toggled_callback(GtkAction *action, gpointer data)
+{
+	if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
+		gtk_widget_hide(GTK_WIDGET(menu));
+	else
+		gtk_widget_show(GTK_WIDGET(menu));
+}
+
 void view_index_toggled_callback(GtkAction *action, gpointer data)
 {
 	show_index = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
@@ -465,7 +477,7 @@ void terminal_popup_menu_callback(GtkWidget *widget, gpointer data)
 
 void create_main_window(void)
 {
-	GtkWidget *menu, *main_vbox, *label;
+	GtkWidget *main_vbox, *label;
 	GtkWidget *hex_send_entry;
 	GtkAccelGroup *accel_group;
 	GError *error;
-- 
2.39.0

@ghost
Copy link
Author

ghost commented Jan 10, 2023

This was exactly what I wanted, thank you!

@Jeija Jeija closed this as completed Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant