[Xfce4-commits] <ristretto:ristretto-0.0> Add sticky button to fullscreen-toolbar

Stephan Arts noreply at xfce.org
Sun Oct 23 19:14:57 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to 41f49ce624d31417b35e1f8b171148fda8ca5269 (commit)
       from 1e586ea0c33bed9d55245b85a508bc277da099ee (commit)

commit 41f49ce624d31417b35e1f8b171148fda8ca5269
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Apr 30 09:52:59 2009 +0200

    Add sticky button to fullscreen-toolbar

 ChangeLog              |   27 +++++++++++++++++++++------
 src/main_window.c      |   24 +++++++++++++++++++++++-
 src/main_window_ui.xml |    2 ++
 3 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f235304..e690db2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,30 @@
 2009-04-30  Stephan Arts <stephan at xfce.org>
 
 	* src/main_window.c
-	  src/picture_viewer.c
-	  src/picture_viewer.h: Let the pictureviewer figure out the fullscreen-
-	  state of it's parent-window by itself
+	  src/main_window_ui.xml: Add Sticky button to the fullscreen-toolbar.
+
+
+2009-04-30  Stephan Arts <stephan at xfce.org>
+
+	* src/main_window.c
+	  src/main_window_ui.xml: Set is_important hint on 'leave-fullscreen' 
+	  toolitem.
+
+
+2009-04-30  Stephan Arts <stephan at xfce.org>
+
 	* src/main_window.c
 	  src/main_window_ui.xml: Add 'fullscreen-toolbar' with controls when in
-	  fullscreen-mode.
+	  fullscreen-mode.  
+
+
+2009-04-30  Stephan Arts <stephan at xfce.org>
+
 	* src/main_window.c
-	  src/main_window_ui.xml: Set is_important hint on 'leave-fullscreen'
-	  toolitem.
+	  src/picture_viewer.c
+	  src/picture_viewer.h: Let the pictureviewer figure out the fullscreen-
+	  state of it's parent-window by itself
+
 
 2009-04-28  Stephan Arts <stephan at xfce.org>
 
diff --git a/src/main_window.c b/src/main_window.c
index 1c8a409..adb5711 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -59,6 +59,8 @@ struct _RsttoMainWindowPriv
 
     guint show_fs_toolbar_timeout_id;
     gint window_save_geometry_timer_id;
+    
+    gboolean fs_toolbar_sticky;
 
     RsttoNavigatorIter *iter;
 
@@ -183,6 +185,9 @@ cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_quit (GtkWidget *widget, RsttoMainWindow *window);
 
+static void
+cb_rstto_main_window_fullscreen_toolbar_sticky (GtkWidget *widget, RsttoMainWindow *window);
+
 static gboolean 
 cb_rstto_main_window_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer,
                                              GdkEventMotion *event,
@@ -248,6 +253,7 @@ static const GtkToggleActionEntry toggle_action_entries[] =
 {
     { "show-toolbar", NULL, N_ ("Show _Toolbar"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_toggle_show_toolbar), TRUE, },
     { "show-thumbnailbar", NULL, N_ ("Show Thumb_nailbar"), NULL, NULL, NULL, FALSE},
+    { "sticky", GTK_STOCK_ADD, N_("Sticky"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen_toolbar_sticky), FALSE }
 };
 
 
@@ -1520,7 +1526,7 @@ cb_rstto_main_window_picture_viewer_motion_notify_event (RsttoPictureViewer *vie
     RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
     if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
     {
-        if (event->state == 0)
+        if (event->state == 0 && (window->priv->fs_toolbar_sticky == FALSE))
         {
             /* TODO: implement timer to hide it again */
             gtk_widget_show (window->priv->fs_toolbar);
@@ -1540,3 +1546,19 @@ cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window)
     gtk_widget_hide (window->priv->fs_toolbar);
     return FALSE;
 }
+
+static void
+cb_rstto_main_window_fullscreen_toolbar_sticky (GtkWidget *widget, RsttoMainWindow *window)
+{
+    if (window->priv->show_fs_toolbar_timeout_id > 0)
+    {
+        g_source_remove (window->priv->show_fs_toolbar_timeout_id);
+        window->priv->show_fs_toolbar_timeout_id = 0;
+    }
+    window->priv->fs_toolbar_sticky = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget));
+
+    if (window->priv->fs_toolbar_sticky == FALSE)
+    {
+        window->priv->show_fs_toolbar_timeout_id = g_timeout_add (1500, (GSourceFunc)cb_rstto_main_window_show_fs_toolbar_timeout, window);
+    }
+}
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
index 2b0aa4a..c3ab245 100644
--- a/src/main_window_ui.xml
+++ b/src/main_window_ui.xml
@@ -72,6 +72,8 @@
 
     -->
     <toolbar name="fullscreen-toolbar">
+        <toolitem action="sticky"/>
+        <separator/>
         <toolitem action="back"/>
         <placeholder name="placeholder-slideshow" />
         <toolitem action="forward"/>


More information about the Xfce4-commits mailing list