[Xfce4-commits] [apps/mousepad] 05/09: Add menubar-visible and -in-fullscreen variants

noreply at xfce.org noreply at xfce.org
Sun Jul 13 05:10:23 CEST 2014


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit 666650c99f6cf4dbffd070540fcb7c905ed8401f
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Sat Jul 12 17:48:21 2014 -0700

    Add menubar-visible and -in-fullscreen variants
    
    To the menubar-visible, toolbar-visible and statusbar-visible prefs.
    Not added to the prefs dialog, but it's useful if you're picky about
    how fullscreen mode looks, you can still tweak the setting via
    gsettings, dconf-editor, etc.
---
 mousepad/mousepad-settings.h           |   64 ++++++++++++++++--------------
 mousepad/mousepad-window.c             |   38 +++++++++++++++---
 mousepad/org.xfce.mousepad.gschema.xml |   68 +++++++++++++++++++++++++-------
 3 files changed, 121 insertions(+), 49 deletions(-)

diff --git a/mousepad/mousepad-settings.h b/mousepad/mousepad-settings.h
index 152cb02..725ce97 100644
--- a/mousepad/mousepad-settings.h
+++ b/mousepad/mousepad-settings.h
@@ -7,36 +7,40 @@
 G_BEGIN_DECLS
 
 /* Setting names */
-#define MOUSEPAD_SETTING_AUTO_INDENT                "/preferences/view/auto-indent"
-#define MOUSEPAD_SETTING_FONT_NAME                  "/preferences/view/font-name"
-#define MOUSEPAD_SETTING_USE_DEFAULT_FONT           "/preferences/view/use-default-monospace-font"
-#define MOUSEPAD_SETTING_SHOW_WHITESPACE            "/preferences/view/show-whitespace"
-#define MOUSEPAD_SETTING_SHOW_LINE_ENDINGS          "/preferences/view/show-line-endings"
-#define MOUSEPAD_SETTING_HIGHLIGHT_CURRENT_LINE     "/preferences/view/highlight-current-line"
-#define MOUSEPAD_SETTING_INDENT_ON_TAB              "/preferences/view/indent-on-tab"
-#define MOUSEPAD_SETTING_INDENT_WIDTH               "/preferences/view/indent-width"
-#define MOUSEPAD_SETTING_INSERT_SPACES              "/preferences/view/insert-spaces"
-#define MOUSEPAD_SETTING_RIGHT_MARGIN_POSITION      "/preferences/view/right-margin-position"
-#define MOUSEPAD_SETTING_SHOW_LINE_MARKS            "/preferences/view/show-line-marks"
-#define MOUSEPAD_SETTING_SHOW_LINE_NUMBERS          "/preferences/view/show-line-numbers"
-#define MOUSEPAD_SETTING_SHOW_RIGHT_MARGIN          "/preferences/view/show-right-margin"
-#define MOUSEPAD_SETTING_SMART_HOME_END             "/preferences/view/smart-home-end"
-#define MOUSEPAD_SETTING_TAB_WIDTH                  "/preferences/view/tab-width"
-#define MOUSEPAD_SETTING_WORD_WRAP                  "/preferences/view/word-wrap"
-#define MOUSEPAD_SETTING_MATCH_BRACES               "/preferences/view/match-braces"
-#define MOUSEPAD_SETTING_COLOR_SCHEME               "/preferences/view/color-scheme"
-#define MOUSEPAD_SETTING_TOOLBAR_VISIBLE            "/preferences/window/toolbar-visible"
-#define MOUSEPAD_SETTING_TOOLBAR_STYLE              "/preferences/window/toolbar-style"
-#define MOUSEPAD_SETTING_TOOLBAR_ICON_SIZE          "/preferences/window/toolbar-icon-size"
-#define MOUSEPAD_SETTING_STATUSBAR_VISIBLE          "/preferences/window/statusbar-visible"
-#define MOUSEPAD_SETTING_ALWAYS_SHOW_TABS           "/preferences/window/always-show-tabs"
-#define MOUSEPAD_SETTING_CYCLE_TABS                 "/preferences/window/cycle-tabs"
-#define MOUSEPAD_SETTING_DEFAULT_TAB_SIZES          "/preferences/window/default-tab-sizes"
-#define MOUSEPAD_SETTING_PATH_IN_TITLE              "/preferences/window/path-in-title"
-#define MOUSEPAD_SETTING_RECENT_MENU_ITEMS          "/preferences/window/recent-menu-items"
-#define MOUSEPAD_SETTING_REMEMBER_SIZE              "/preferences/window/remember-size"
-#define MOUSEPAD_SETTING_REMEMBER_POSITION          "/preferences/window/remember-position"
-#define MOUSEPAD_SETTING_REMEMBER_STATE             "/preferences/window/remember-state"
+#define MOUSEPAD_SETTING_AUTO_INDENT                  "/preferences/view/auto-indent"
+#define MOUSEPAD_SETTING_FONT_NAME                    "/preferences/view/font-name"
+#define MOUSEPAD_SETTING_USE_DEFAULT_FONT             "/preferences/view/use-default-monospace-font"
+#define MOUSEPAD_SETTING_SHOW_WHITESPACE              "/preferences/view/show-whitespace"
+#define MOUSEPAD_SETTING_SHOW_LINE_ENDINGS            "/preferences/view/show-line-endings"
+#define MOUSEPAD_SETTING_HIGHLIGHT_CURRENT_LINE       "/preferences/view/highlight-current-line"
+#define MOUSEPAD_SETTING_INDENT_ON_TAB                "/preferences/view/indent-on-tab"
+#define MOUSEPAD_SETTING_INDENT_WIDTH                 "/preferences/view/indent-width"
+#define MOUSEPAD_SETTING_INSERT_SPACES                "/preferences/view/insert-spaces"
+#define MOUSEPAD_SETTING_RIGHT_MARGIN_POSITION        "/preferences/view/right-margin-position"
+#define MOUSEPAD_SETTING_SHOW_LINE_MARKS              "/preferences/view/show-line-marks"
+#define MOUSEPAD_SETTING_SHOW_LINE_NUMBERS            "/preferences/view/show-line-numbers"
+#define MOUSEPAD_SETTING_SHOW_RIGHT_MARGIN            "/preferences/view/show-right-margin"
+#define MOUSEPAD_SETTING_SMART_HOME_END               "/preferences/view/smart-home-end"
+#define MOUSEPAD_SETTING_TAB_WIDTH                    "/preferences/view/tab-width"
+#define MOUSEPAD_SETTING_WORD_WRAP                    "/preferences/view/word-wrap"
+#define MOUSEPAD_SETTING_MATCH_BRACES                 "/preferences/view/match-braces"
+#define MOUSEPAD_SETTING_COLOR_SCHEME                 "/preferences/view/color-scheme"
+#define MOUSEPAD_SETTING_TOOLBAR_STYLE                "/preferences/window/toolbar-style"
+#define MOUSEPAD_SETTING_TOOLBAR_ICON_SIZE            "/preferences/window/toolbar-icon-size"
+#define MOUSEPAD_SETTING_ALWAYS_SHOW_TABS             "/preferences/window/always-show-tabs"
+#define MOUSEPAD_SETTING_CYCLE_TABS                   "/preferences/window/cycle-tabs"
+#define MOUSEPAD_SETTING_DEFAULT_TAB_SIZES            "/preferences/window/default-tab-sizes"
+#define MOUSEPAD_SETTING_PATH_IN_TITLE                "/preferences/window/path-in-title"
+#define MOUSEPAD_SETTING_RECENT_MENU_ITEMS            "/preferences/window/recent-menu-items"
+#define MOUSEPAD_SETTING_REMEMBER_SIZE                "/preferences/window/remember-size"
+#define MOUSEPAD_SETTING_REMEMBER_POSITION            "/preferences/window/remember-position"
+#define MOUSEPAD_SETTING_REMEMBER_STATE               "/preferences/window/remember-state"
+#define MOUSEPAD_SETTING_MENUBAR_VISIBLE              "/preferences/window/menubar-visible"
+#define MOUSEPAD_SETTING_TOOLBAR_VISIBLE              "/preferences/window/toolbar-visible"
+#define MOUSEPAD_SETTING_STATUSBAR_VISIBLE            "/preferences/window/statusbar-visible"
+#define MOUSEPAD_SETTING_MENUBAR_VISIBLE_FULLSCREEN   "/preferences/window/menubar-visible-in-fullscreen"
+#define MOUSEPAD_SETTING_TOOLBAR_VISIBLE_FULLSCREEN   "/preferences/window/toolbar-visible-in-fullscreen"
+#define MOUSEPAD_SETTING_STATUSBAR_VISIBLE_FULLSCREEN "/preferences/window/statusbar-visible-in-fullscreen"
 
 /* State setting names */
 #define MOUSEPAD_SETTING_SEARCH_DIRECTION            "/state/search/direction"
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 81c875a..fd1f1b1 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -394,6 +394,7 @@ struct _MousepadWindow
   GtkWidget           *statusbar;
   GtkWidget           *replace_dialog;
   GtkWidget           *toolbar;
+  GtkWidget           *menubar;
 
   /* support to remember window geometry */
   guint                save_geometry_timer_id;
@@ -679,7 +680,6 @@ static void
 mousepad_window_init (MousepadWindow *window)
 {
   GtkAccelGroup *accel_group;
-  GtkWidget     *menubar;
   GtkWidget     *label;
   GtkWidget     *separator;
   GtkWidget     *ebox;
@@ -755,9 +755,9 @@ mousepad_window_init (MousepadWindow *window)
   gtk_container_add (GTK_CONTAINER (window), window->box);
   gtk_widget_show (window->box);
 
-  menubar = gtk_ui_manager_get_widget (window->ui_manager, "/main-menu");
-  gtk_box_pack_start (GTK_BOX (window->box), menubar, FALSE, FALSE, 0);
-  gtk_widget_show (menubar);
+  window->menubar = gtk_ui_manager_get_widget (window->ui_manager, "/main-menu");
+  gtk_box_pack_start (GTK_BOX (window->box), window->menubar, FALSE, FALSE, 0);
+  gtk_widget_show (window->menubar);
 
   window->toolbar = gtk_ui_manager_get_widget (window->ui_manager, "/main-toolbar");
   gtk_box_pack_start (GTK_BOX (window->box), window->toolbar, FALSE, FALSE, 0);
@@ -5017,7 +5017,8 @@ static void
 mousepad_window_action_fullscreen (GtkToggleAction *action,
                                    MousepadWindow  *window)
 {
-  gboolean       fullscreen;
+  gboolean       fullscreen, mb_visible, tb_visible, sb_visible;
+  gint           mb_visible_fs, tb_visible_fs, sb_visible_fs;
   GdkWindow     *gdk_window;
   GdkWindowState state;
 
@@ -5028,17 +5029,44 @@ mousepad_window_action_fullscreen (GtkToggleAction *action,
   gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
   state = gdk_window_get_state (gdk_window);
 
+  /* get the non-fullscreen settings */
+  mb_visible = MOUSEPAD_SETTING_GET_BOOLEAN (MENUBAR_VISIBLE);
+  tb_visible = MOUSEPAD_SETTING_GET_BOOLEAN (TOOLBAR_VISIBLE);
+  sb_visible = MOUSEPAD_SETTING_GET_BOOLEAN (STATUSBAR_VISIBLE);
+
+  /* get the fullscreen settings */
+  mb_visible_fs = MOUSEPAD_SETTING_GET_ENUM (MENUBAR_VISIBLE_FULLSCREEN);
+  tb_visible_fs = MOUSEPAD_SETTING_GET_ENUM (TOOLBAR_VISIBLE_FULLSCREEN);
+  sb_visible_fs = MOUSEPAD_SETTING_GET_ENUM (STATUSBAR_VISIBLE_FULLSCREEN);
+
+  /* set to true or false based on fullscreen setting */
+  mb_visible_fs = (mb_visible_fs == 0) ? mb_visible : (mb_visible_fs == 2);
+  tb_visible_fs = (tb_visible_fs == 0) ? tb_visible : (tb_visible_fs == 2);
+  sb_visible_fs = (sb_visible_fs == 0) ? sb_visible : (sb_visible_fs == 2);
+
+  /* entering fullscreen mode */
   if (fullscreen && !(state & GDK_WINDOW_STATE_FULLSCREEN))
     {
       gtk_window_fullscreen (GTK_WINDOW (window));
       gtk_action_set_stock_id (GTK_ACTION (action), GTK_STOCK_LEAVE_FULLSCREEN);
       gtk_action_set_tooltip (GTK_ACTION (action), _("Leave fullscreen mode"));
+
+      /* update main widgets visibility for fullscreen mode */
+      gtk_widget_set_visible (window->menubar, mb_visible_fs);
+      gtk_widget_set_visible (window->toolbar, tb_visible_fs);
+      gtk_widget_set_visible (window->statusbar, sb_visible_fs);
     }
+  /* leaving fullscreen mode */
   else if (state & GDK_WINDOW_STATE_FULLSCREEN)
     {
       gtk_window_unfullscreen (GTK_WINDOW (window));
       gtk_action_set_stock_id (GTK_ACTION (action), GTK_STOCK_FULLSCREEN);
       gtk_action_set_tooltip (GTK_ACTION (action), _("Make the window fullscreen"));
+
+      /* update main widgets visibility for normal mode */
+      gtk_widget_set_visible (window->menubar, mb_visible);
+      gtk_widget_set_visible (window->toolbar, tb_visible);
+      gtk_widget_set_visible (window->statusbar, sb_visible);
     }
 }
 
diff --git a/mousepad/org.xfce.mousepad.gschema.xml b/mousepad/org.xfce.mousepad.gschema.xml
index 055e087..a34ba65 100644
--- a/mousepad/org.xfce.mousepad.gschema.xml
+++ b/mousepad/org.xfce.mousepad.gschema.xml
@@ -25,6 +25,12 @@
     <value nick="dialog" value="6"/>
   </enum>
 
+  <enum id="org.xfce.mousepad.ShowInFullscreen">
+    <value nick="auto" value="0"/>
+    <value nick="no" value="1"/>
+    <value nick="yes" value="2"/>
+  </enum>
+
   <schema id="org.xfce.mousepad" path="/org/xfce/mousepad/" gettext-domain="mousepad">
     <child name="preferences" schema="org.xfce.mousepad.preferences"/>
     <child name="state" schema="org.xfce.mousepad.state"/>
@@ -185,13 +191,6 @@
 
   <!-- window preferences -->
   <schema id="org.xfce.mousepad.preferences.window" path="/org/xfce/mousepad/preferences/window/" gettext-domain="mousepad">
-    <key name="toolbar-visible" type="b">
-      <default>false</default>
-      <summary>Toolbar visible</summary>
-      <description>
-        When true the toolbar is visible, when false it is not visible.
-      </description>
-    </key>
     <key name="toolbar-style" enum="org.xfce.mousepad.ToolbarStyle">
       <default>'icons'</default>
       <summary>Toolbar style</summary>
@@ -207,13 +206,6 @@
         Controls the size of the toolbar icons (if visible).
       </description>
     </key>
-    <key name="statusbar-visible" type="b">
-      <default>false</default>
-      <summary>Statusbar visible</summary>
-      <description>
-        When true the statusbar is visible, when false it is not visible.
-      </description>
-    </key>
     <key name="always-show-tabs" type="b">
       <default>false</default>
       <summary>Always show tabs</summary>
@@ -282,6 +274,54 @@
         it when setting.
       </description>
     </key>
+    <key name="menubar-visible" type="b">
+      <default>true</default>
+      <summary>Menubar visible</summary>
+      <description>
+        When true the main menubar is visible, when false it is not visible.
+      </description>
+    </key>
+    <key name="toolbar-visible" type="b">
+      <default>false</default>
+      <summary>Toolbar visible</summary>
+      <description>
+        When true the toolbar is visible, when false it is not visible.
+      </description>
+    </key>
+    <key name="statusbar-visible" type="b">
+      <default>false</default>
+      <summary>Statusbar visible</summary>
+      <description>
+        When true the statusbar is visible, when false it is not visible.
+      </description>
+    </key>
+    <key name="menubar-visible-in-fullscreen" enum="org.xfce.mousepad.ShowInFullscreen">
+      <default>'auto'</default>
+      <summary>Menubar visible in fullscreen mode</summary>
+      <description>
+        A value of 'auto' means follow the main menubar-visible setting, 'no'
+        means the menubar is not visible in fullscreen, and 'yes' means that
+        it is always visible in fullscreen.
+      </description>
+    </key>
+    <key name="toolbar-visible-in-fullscreen" enum="org.xfce.mousepad.ShowInFullscreen">
+      <default>'auto'</default>
+      <summary>Toolbar visible in fullscreen mode</summary>
+      <description>
+        A value of 'auto' means follow the main toolbar-visible setting, 'no'
+        means the toolbar is not visible in fullscreen, and 'yes' means that
+        it is always visible in fullscreen.
+      </description>
+    </key>
+    <key name="statusbar-visible-in-fullscreen" enum="org.xfce.mousepad.ShowInFullscreen">
+      <default>'auto'</default>
+      <summary>Statusbar visible in fullscreen mode</summary>
+      <description>
+        A value of 'auto' means follow the main statusbar-visible setting, 'no'
+        means the statusbar is not visible in fullscreen, and 'yes' means that
+        it is always visible in fullscreen.
+      </description>
+    </key>
   </schema>
 
   <!-- search state -->

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list