[gthumb] hide the navigation buttons after opening the file tool options



commit 31c3eccf46c75b286cd2e091d2a19bf4b78ff116
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Dec 9 19:39:38 2014 +0100

    hide the navigation buttons after opening the file tool options

 gthumb/gth-browser.c |   23 +++++++++++++++++++++++
 gthumb/gth-toolbox.c |   25 ++++++++++++++++++++++++-
 gthumb/gth-toolbox.h |    3 +++
 3 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 27e783a..75fe1b3 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -53,6 +53,7 @@
 #include "gth-progress-dialog.h"
 #include "gth-sidebar.h"
 #include "gth-statusbar.h"
+#include "gth-toolbox.h"
 #include "gth-user-dir.h"
 #include "gth-viewer-page.h"
 #include "gth-window.h"
@@ -2856,6 +2857,23 @@ folder_tree_rename_cb (GthFolderTree *folder_tree,
 
 
 static void
+toolbox_options_visibility_cb (GthToolbox *toolbox,
+                              gboolean    toolbox_options_visible,
+                              GthBrowser *browser)
+{
+       if (toolbox_options_visible) {
+               gtk_widget_hide (browser->priv->next_image_button);
+               gtk_widget_hide (browser->priv->previous_image_button);
+               browser->priv->pointer_visible = FALSE;
+       }
+       else if (browser->priv->pointer_visible) {
+               gtk_widget_show (browser->priv->next_image_button);
+               gtk_widget_show (browser->priv->previous_image_button);
+       }
+}
+
+
+static void
 filterbar_changed_cb (GthFilterbar *filterbar,
                      GthBrowser   *browser)
 {
@@ -4495,6 +4513,11 @@ gth_browser_init (GthBrowser *browser)
                         ! browser->priv->file_properties_on_the_right,
                         FALSE);
 
+       g_signal_connect (gth_sidebar_get_toolbox (GTH_SIDEBAR (browser->priv->file_properties)),
+                         "options-visibility",
+                         G_CALLBACK (toolbox_options_visibility_cb),
+                         browser);
+
        /* the box that contains the file list and the filter bar.  */
 
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
diff --git a/gthumb/gth-toolbox.c b/gthumb/gth-toolbox.c
index cf23e0a..436e61d 100644
--- a/gthumb/gth-toolbox.c
+++ b/gthumb/gth-toolbox.c
@@ -33,6 +33,13 @@
 #define GRID_SPACING 20
 
 
+/* Signals */
+enum {
+        OPTIONS_VISIBILITY,
+        LAST_SIGNAL
+};
+
+
 enum  {
        GTH_TOOLBOX_DUMMY_PROPERTY,
        GTH_TOOLBOX_NAME
@@ -49,6 +56,8 @@ struct _GthToolboxPrivate {
 };
 
 
+static guint gth_toolbox_signals[LAST_SIGNAL] = { 0 };
+
 G_DEFINE_TYPE (GthToolbox, gth_toolbox, GTK_TYPE_STACK)
 
 
@@ -116,6 +125,18 @@ gth_toolbox_class_init (GthToolboxClass *klass)
                                                              "name",
                                                              NULL,
                                                              G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | 
G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+       /* signals */
+
+       gth_toolbox_signals[OPTIONS_VISIBILITY] =
+                g_signal_new ("options-visibility",
+                              G_TYPE_FROM_CLASS (klass),
+                              G_SIGNAL_RUN_LAST,
+                              G_STRUCT_OFFSET (GthToolboxClass, options_visibility),
+                              NULL, NULL,
+                              g_cclosure_marshal_VOID__BOOLEAN,
+                              G_TYPE_NONE,
+                              0);
 }
 
 
@@ -252,8 +273,9 @@ child_show_options_cb (GtkWidget *tool,
        gtk_image_set_from_icon_name (GTK_IMAGE (toolbox->priv->options_icon), gth_file_tool_get_icon_name 
(GTH_FILE_TOOL (tool)), GTK_ICON_SIZE_MENU);
        gtk_container_add (GTK_CONTAINER (toolbox->priv->options), options);
        gtk_stack_set_visible_child_name (GTK_STACK (toolbox), GTH_TOOLBOX_PAGE_OPTIONS);
-
        g_free (markup);
+
+       g_signal_emit (toolbox, gth_toolbox_signals[OPTIONS_VISIBILITY], 0, TRUE);
 }
 
 
@@ -272,6 +294,7 @@ child_hide_options_cb (GtkWidget *tool,
        gth_toolbox_update_sensitivity (GTH_TOOLBOX (toolbox));
 
        toolbox->priv->active_tool = NULL;
+       g_signal_emit (toolbox, gth_toolbox_signals[OPTIONS_VISIBILITY], 0, FALSE);
 }
 
 
diff --git a/gthumb/gth-toolbox.h b/gthumb/gth-toolbox.h
index c409c00..a896ae1 100644
--- a/gthumb/gth-toolbox.h
+++ b/gthumb/gth-toolbox.h
@@ -54,6 +54,9 @@ struct _GthToolbox
 struct _GthToolboxClass
 {
        GtkStackClass __parent_class;
+
+       void  (*options_visibility)  (GthToolbox *toolbox,
+                                     gboolean    visible);
 };
 
 GType          gth_toolbox_get_type              (void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]