[Spice-devel] Menubar toggle option

Submitted by Joel Reed on June 13, 2012, 7:34 p.m.

Details

Message ID 4FD8EB32.1000808@openarc.net
State New
Headers show

Not browsing as part of any series.

Commit Message

Joel Reed June 13, 2012, 7:34 p.m.
This very simple patch adds an option to toggle the menubar on spicy.
Helps maximize vertical resolution capacity without going fullscreen.
Please consider for inclusion.

jr

Patch hide | download patch | download mbox

diff --git a/gtk/spicy.c b/gtk/spicy.c
index cbc702e..2eeed16 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -499,6 +499,15 @@  static void menu_cb_statusbar(GtkToggleAction *action, gpointer data)
     g_key_file_set_boolean(keyfile, "ui", "statusbar", state);
 }
 
+static void menu_cb_menubar(GtkToggleAction *action, gpointer data)
+{
+    struct spice_window *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"
@@ -551,6 +560,9 @@  static gboolean window_state_cb(GtkWidget *widget, GdkEventWindowState *event,
             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);
+            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);
         }
     }
     return TRUE;
@@ -656,6 +668,11 @@  static void restore_configuration(struct spice_window *win)
     if (error == NULL)
         gtk_widget_set_visible(win->statusbar, state);
     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);
 }
 
 /* ------------------------------------------------------------------ */
@@ -801,6 +818,11 @@  static const GtkToggleActionEntry tentries[] = {
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
 #endif
+        .name        = "Menubar",
+        .label       = N_("Menubar"),
+        .callback    = G_CALLBACK(menu_cb_menubar),
+        .accelerator = "<shift>F7",
+    },{
         .name        = "Statusbar",
         .label       = N_("Statusbar"),
         .callback    = G_CALLBACK(menu_cb_statusbar),
@@ -826,6 +848,7 @@  static char ui_xml[] =
 "    </menu>\n"
 "    <menu action='ViewMenu'>\n"
 "      <menuitem action='Fullscreen'/>\n"
+"      <menuitem action='Menubar'/>\n"
 "      <menuitem action='Toolbar'/>\n"
 "      <menuitem action='Statusbar'/>\n"
 "    </menu>\n"
@@ -1252,6 +1275,10 @@  static spice_window *create_spice_window(spice_connection *conn, int id, SpiceCh
     state = gtk_widget_get_visible(win->statusbar);
     gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(toggle), state);
 
+    toggle = gtk_action_group_get_action(win->ag, "Menubar");
+    state = gtk_widget_get_visible(win->menubar);
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(toggle), state);
+
 #ifdef USE_SMARTCARD
     gboolean smartcard;
 

Comments

Have you looked at remote-viewer rather than spicy ?


----- Original Message -----
> From: "Joel Reed" <joelreed@openarc.net>
> To: spice-devel@lists.freedesktop.org
> Sent: Wednesday, June 13, 2012 3:34:10 PM
> Subject: [Spice-devel] [PATCH] Menubar toggle option
> 
> This very simple patch adds an option to toggle the menubar on spicy.
> Helps maximize vertical resolution capacity without going fullscreen.
> Please consider for inclusion.
> 
> jr
> 
> --
> Joel W. Reed
> Managing Partner
> OpenArc, LLC
> o: 724.234.1215
> c: 412.212.8418
> 
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>