aboutsummaryrefslogtreecommitdiff
path: root/share/patches/spice-gtk/toggle-menubar-0.35.patch
blob: a6d6d0c83cff3435d9d7baf3f07938523cdcea2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--- tools/spicy.c	2018-08-30 13:09:28.000000000 -0300
+++ tools/spicy.c	2018-11-16 19:17:35.566512247 -0200
@@ -469,6 +469,15 @@
     g_key_file_set_boolean(keyfile, "ui", "statusbar", state);
 }
 
+static void menu_cb_menubar(GtkToggleAction *action, gpointer data)
+{
+    SpiceWindow *win = data;
+    gboolean state = gtk_toggle_action_get_active(action);
+
+    gtk_widget_set_visible(win->menubar, state);
+    g_key_file_set_boolean(keyfile, "ui", "menubar", state);
+}
+
 static void menu_cb_about(GtkAction *action, void *data)
 {
     char *comments = "gtk test client app for the\n"
@@ -518,10 +527,14 @@
             gboolean state;
             GtkAction *toggle;
 
-            gtk_widget_show(win->menubar);
+            toggle = gtk_action_group_get_action(win->ag, "Menubar");
+            state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
+            gtk_widget_set_visible(win->menubar, state);
+
             toggle = gtk_action_group_get_action(win->ag, "Toolbar");
             state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
             gtk_widget_set_visible(win->toolbar, state);
+
             toggle = gtk_action_group_get_action(win->ag, "Statusbar");
             state = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(toggle));
             gtk_widget_set_visible(win->statusbar, state);
@@ -677,6 +690,10 @@
     }
     g_clear_error(&error);
 
+    state = g_key_file_get_boolean(keyfile, "ui", "menubar", &error);
+    if (error == NULL)
+        gtk_widget_set_visible(win->menubar, state);
+    g_clear_error(&error);
 
     state = g_key_file_get_boolean(keyfile, "ui", "toolbar", &error);
     if (error == NULL)
@@ -850,6 +867,11 @@
         .name        = "Toolbar",
         .label       = "Toolbar",
         .callback    = G_CALLBACK(menu_cb_toolbar),
+    },{
+        .name        = "Menubar",
+        .label       = "Menubar",
+        .callback    = G_CALLBACK(menu_cb_menubar),
+        .accelerator = "<shift>F6",
     }
 };
 
@@ -924,6 +946,7 @@
 "      <menuitem action='Fullscreen'/>\n"
 "      <menuitem action='Toolbar'/>\n"
 "      <menuitem action='Statusbar'/>\n"
+"      <menuitem action='Menubar'/>\n"
 "    </menu>\n"
 "    <menu action='InputMenu'>\n"
 #ifdef USE_SMARTCARD