[gimp] app: Don't kill the toolbox window when removing the last dockbook



commit c7b8a67cfdd29e4147e1b68a51ebc12adc8739ab
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Sep 27 14:15:03 2009 +0200

    app: Don't kill the toolbox window when removing the last dockbook
    
    Add a "allow-dockbook-absence" property to the GimpDockWindow which is
    set to TRUE for the dock window for the toolbox so that it is not
    kiled when the last dockbook is removed.

 app/dialogs/dialogs-constructors.c |   18 ++++++++++--------
 app/widgets/gimpdockwindow.c       |   21 ++++++++++++++++++++-
 2 files changed, 30 insertions(+), 9 deletions(-)
---
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index 28520ad..5b81731 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -233,10 +233,11 @@ dialogs_toolbox_dock_window_new (GimpDialogFactory *factory,
                                  gint               view_size)
 {
   return g_object_new (GIMP_TYPE_DOCK_WINDOW,
-                       "role",            "gimp-toolbox",
-                       "ui-manager-name", "<Toolbox>",
-                       "dialog-factory",  factory,
-                       "context",         context,
+                       "role",                   "gimp-toolbox",
+                       "ui-manager-name",        "<Toolbox>",
+                       "allow-dockbook-absence", TRUE,
+                       "dialog-factory",         factory,
+                       "context",                context,
                        NULL);
 }
 
@@ -256,10 +257,11 @@ dialogs_dock_window_new (GimpDialogFactory *factory,
                          gint               view_size)
 {
   return g_object_new (GIMP_TYPE_DOCK_WINDOW,
-                       "role",            "gimp-dock",
-                       "ui-manager-name", "<Dock>",
-                       "dialog-factory",  factory,
-                       "context",         context,
+                       "role",                   "gimp-dock",
+                       "ui-manager-name",        "<Dock>",
+                       "allow-dockbook-absence", FALSE,
+                       "dialog-factory",         factory,
+                       "context",                context,
                        NULL);
 }
 
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index 0fc5a98..ebebbd3 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -59,6 +59,7 @@ enum
   PROP_CONTEXT,
   PROP_DIALOG_FACTORY,
   PROP_UI_MANAGER_NAME,
+  PROP_ALLOW_DOCKBOOK_ABSENCE
 };
 
 
@@ -72,6 +73,8 @@ struct _GimpDockWindowPrivate
   GimpUIManager     *ui_manager;
   GQuark             image_flush_handler_id;
 
+  gboolean           allow_dockbook_absence;
+
   guint              update_title_idle_id;
 
   gint               ID;
@@ -147,6 +150,13 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
+  g_object_class_install_property (object_class, PROP_ALLOW_DOCKBOOK_ABSENCE,
+                                   g_param_spec_boolean ("allow-dockbook-absence",
+                                                         NULL, NULL,
+                                                         FALSE,
+                                                         GIMP_PARAM_READWRITE |
+                                                         G_PARAM_CONSTRUCT_ONLY));
+
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("default-height",
                                                              NULL, NULL,
@@ -303,6 +313,10 @@ gimp_dock_window_set_property (GObject      *object,
       dock_window->p->ui_manager_name = g_value_dup_string (value);
       break;
 
+    case PROP_ALLOW_DOCKBOOK_ABSENCE:
+      dock_window->p->allow_dockbook_absence = g_value_get_boolean (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -331,6 +345,10 @@ gimp_dock_window_get_property (GObject    *object,
       g_value_set_string (value, dock_window->p->ui_manager_name);
       break;
 
+    case PROP_ALLOW_DOCKBOOK_ABSENCE:
+      g_value_set_boolean (value, dock_window->p->allow_dockbook_absence);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -502,7 +520,8 @@ gimp_dock_window_dock_book_removed (GimpDockWindow *dock_window,
 {
   g_return_if_fail (GIMP_IS_DOCK (dock));
 
-  if (gimp_dock_get_dockbooks (dock) == NULL)
+  if (gimp_dock_get_dockbooks (dock) == NULL &&
+      ! dock_window->p->allow_dockbook_absence)
     gtk_widget_destroy (GTK_WIDGET (dock_window));
 }
 



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