[Xfce4-commits] [apps/mousepad] 37/45: Add fullscreen support

noreply at xfce.org noreply at xfce.org
Fri Jul 11 13:03:42 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 a3a9517357d28aa6a7701fd600b5cfc327076ecb
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Thu Jul 10 14:59:03 2014 -0700

    Add fullscreen support
    
    Also remove "close window" button from the toolbar.
---
 mousepad/mousepad-settings.h           |    1 +
 mousepad/mousepad-window-ui.xml        |    4 +++-
 mousepad/mousepad-window.c             |   31 +++++++++++++++++++++++++++++++
 mousepad/org.xfce.Mousepad.gschema.xml |    7 +++++++
 4 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/mousepad/mousepad-settings.h b/mousepad/mousepad-settings.h
index 8aef4d2..b5bf091 100644
--- a/mousepad/mousepad-settings.h
+++ b/mousepad/mousepad-settings.h
@@ -41,6 +41,7 @@ G_BEGIN_DECLS
 #define MOUSEPAD_SETTING_SEARCH_REPLACE_ALL_LOCATION "/state/search/replace-all-location"
 #define MOUSEPAD_SETTING_WINDOW_HEIGHT               "/state/window/height"
 #define MOUSEPAD_SETTING_WINDOW_WIDTH                "/state/window/width"
+#define MOUSEPAD_SETTING_WINDOW_FULLSCREEN           "/state/window/fullscreen"
 
 void     mousepad_settings_init       (void);
 void     mousepad_settings_finalize   (void);
diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index 494b5b1..07e5afb 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -101,6 +101,8 @@
       <separator />
       <menuitem action="toolbar" />
       <menuitem action="statusbar" />
+      <separator />
+      <menuitem action="fullscreen" />
     </menu>
 
     <menu action="document-menu">
@@ -152,7 +154,7 @@
       <toolitem action="replace" />
       <toolitem action="go-to" />
       <separator />
-      <toolitem action="close-window" />
+      <toolitem action="fullscreen" />
   </toolbar>
 
   <popup action="tab-menu">
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 40fc9ee..783f7dc 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -330,6 +330,8 @@ static void              mousepad_window_action_statusbar_overwrite   (MousepadW
                                                                        gboolean                overwrite);
 static void              mousepad_window_action_statusbar             (GtkToggleAction        *action,
                                                                        MousepadWindow         *window);
+static void              mousepad_window_action_fullscreen            (GtkToggleAction        *action,
+                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_language              (GtkToggleAction        *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_auto_indent           (GtkToggleAction        *action,
@@ -478,6 +480,7 @@ static const GtkToggleActionEntry toggle_action_entries[] =
   { "line-numbers", NULL, N_("Line N_umbers"), NULL, N_("Show line numbers"), G_CALLBACK (mousepad_window_action_line_numbers), FALSE, },
   { "toolbar", NULL, N_("_Toolbar"), NULL, N_("Change the visibility of the toolbar"), G_CALLBACK (mousepad_window_action_toolbar), FALSE, },
   { "statusbar", NULL, N_("St_atusbar"), NULL, N_("Change the visibility of the statusbar"), G_CALLBACK (mousepad_window_action_statusbar), FALSE, },
+  { "fullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), NULL, N_("Make the window fullscreen"), G_CALLBACK (mousepad_window_action_fullscreen), FALSE, },
   { "auto-indent", NULL, N_("_Auto Indent"), NULL, N_("Auto indent a new line"), G_CALLBACK (mousepad_window_action_auto_indent), FALSE, },
   { "insert-spaces", NULL, N_("Insert _Spaces"), NULL, N_("Insert spaces when the tab button is pressed"), G_CALLBACK (mousepad_window_action_insert_spaces), FALSE, },
   { "word-wrap", NULL, N_("_Word Wrap"), NULL, N_("Toggle breaking lines in between words"), G_CALLBACK (mousepad_window_action_word_wrap), FALSE, },
@@ -700,6 +703,10 @@ mousepad_window_init (MousepadWindow *window)
   /* update the toolbar visibility with the setting */
   MOUSEPAD_SETTING_BIND (TOOLBAR_VISIBLE, toolbar, "visible", G_SETTINGS_BIND_DEFAULT);
 
+  /* update the window fullscreen state when setting changes */
+  action = gtk_action_group_get_action (window->action_group, "fullscreen");
+  MOUSEPAD_SETTING_BIND (WINDOW_FULLSCREEN, action, "active", G_SETTINGS_BIND_DEFAULT);
+
   /* check if we need to add the root warning */
   if (G_UNLIKELY (geteuid () == 0))
     {
@@ -4863,6 +4870,30 @@ mousepad_window_action_statusbar (GtkToggleAction *action,
 
 
 static void
+mousepad_window_action_fullscreen (GtkToggleAction *action,
+                                   MousepadWindow  *window)
+{
+  gboolean fullscreen;
+
+  fullscreen = MOUSEPAD_SETTING_GET_BOOLEAN (WINDOW_FULLSCREEN);
+
+  if (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"));
+    }
+  else
+    {
+      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"));
+    }
+}
+
+
+
+static void
 mousepad_window_action_language (GtkToggleAction *action,
                                  MousepadWindow  *window)
 {
diff --git a/mousepad/org.xfce.Mousepad.gschema.xml b/mousepad/org.xfce.Mousepad.gschema.xml
index 7f994b6..17dd78f 100644
--- a/mousepad/org.xfce.Mousepad.gschema.xml
+++ b/mousepad/org.xfce.Mousepad.gschema.xml
@@ -284,6 +284,13 @@
       <summary>window width</summary>
       <description>The width of windows in pixels.</description>
     </key>
+    <key name="fullscreen" type="b">
+      <default>false</default>
+      <summary>window fullscreen</summary>
+      <description>
+        When true the window will be fullscreen, when false it won't be.
+      </description>
+    </key>
   </schema>
 
 </schemalist>

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


More information about the Xfce4-commits mailing list