[gimp] app: Add and use gimp_dock_window_set_dock()



commit c47c397332fc95d62c2507e4206bde2dc906f66a
Author: Martin Nordholts <martinn src gnome org>
Date:   Sat Sep 26 15:38:08 2009 +0200

    app: Add and use gimp_dock_window_set_dock()
    
    Add and use gimp_dock_window_set_dock() in preparation for making
    GimpDock a non-GimpDockWindow.

 app/widgets/gimpdockwindow.c |   52 ++++++++++++++++++++++++-----------------
 app/widgets/gimpdockwindow.h |    2 +
 2 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index 99fe4ee..ffffe7f 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -201,7 +201,6 @@ gimp_dock_window_constructor (GType                  type,
   GimpDockWindow *dock_window;
   GimpGuiConfig  *config;
   GtkAccelGroup  *accel_group;
-  GimpDock       *dock;
 
   /* Init */
   object      = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
@@ -238,27 +237,7 @@ gimp_dock_window_constructor (GType                  type,
                                 G_CALLBACK (gimp_dock_window_image_flush),
                                 dock_window);
 
-  /* Update window title now and when docks title is invalidated */
-  gimp_dock_window_update_title (dock_window);
-  dock = gimp_dock_window_get_dock (dock_window);
-  g_signal_connect_object (dock, "title-invalidated",
-                           G_CALLBACK (gimp_dock_window_update_title),
-                           dock_window,
-                           G_CONNECT_SWAPPED);
-
-  /* Some docks like the toolbox dock needs to maintain special hints
-   * on its container GtkWindow, allow those to do so
-   */
-  gimp_dock_set_host_geometry_hints (dock, GTK_WINDOW (dock_window));
-  g_signal_connect_object (dock, "geometry-invalidated",
-                           G_CALLBACK (gimp_dock_set_host_geometry_hints),
-                           dock_window, 0);
-
-  /* Destroy the dock window when the last book is removed */
-  g_signal_connect_object (dock, "book-removed",
-                           G_CALLBACK (gimp_dock_window_dock_book_removed),
-                           dock_window,
-                           G_CONNECT_SWAPPED);
+  gimp_dock_window_set_dock (dock_window, GIMP_DOCK (dock_window));
 
   /* Done! */
   return object;
@@ -522,6 +501,35 @@ gimp_dock_window_dock_book_removed (GimpDockWindow *dock_window,
     gtk_widget_destroy (GTK_WIDGET (dock_window));
 }
 
+void
+gimp_dock_window_set_dock (GimpDockWindow *dock_window,
+                           GimpDock       *dock)
+{
+  g_return_if_fail (GIMP_IS_DOCK_WINDOW (dock_window));
+  g_return_if_fail (GIMP_IS_DOCK (dock));
+
+  /* Update window title now and when docks title is invalidated */
+  gimp_dock_window_update_title (dock_window);
+  g_signal_connect_object (dock, "title-invalidated",
+                           G_CALLBACK (gimp_dock_window_update_title),
+                           dock_window,
+                           G_CONNECT_SWAPPED);
+
+  /* Some docks like the toolbox dock needs to maintain special hints
+   * on its container GtkWindow, allow those to do so
+   */
+  gimp_dock_set_host_geometry_hints (dock, GTK_WINDOW (dock_window));
+  g_signal_connect_object (dock, "geometry-invalidated",
+                           G_CALLBACK (gimp_dock_set_host_geometry_hints),
+                           dock_window, 0);
+
+  /* Destroy the dock window when the last book is removed */
+  g_signal_connect_object (dock, "book-removed",
+                           G_CALLBACK (gimp_dock_window_dock_book_removed),
+                           dock_window,
+                           G_CONNECT_SWAPPED);
+}
+
 gint
 gimp_dock_window_get_id (GimpDockWindow *dock_window)
 {
diff --git a/app/widgets/gimpdockwindow.h b/app/widgets/gimpdockwindow.h
index 54a9181..521b83a 100644
--- a/app/widgets/gimpdockwindow.h
+++ b/app/widgets/gimpdockwindow.h
@@ -55,6 +55,8 @@ struct _GimpDockWindowClass
 
 GType               gimp_dock_window_get_type       (void) G_GNUC_CONST;
 gint                gimp_dock_window_get_id         (GimpDockWindow *dock_window);
+void                gimp_dock_window_set_dock       (GimpDockWindow *dock_window,
+                                                     GimpDock       *dock);
 GimpUIManager *     gimp_dock_window_get_ui_manager (GimpDockWindow *dock_window);
 GimpDockWindow    * gimp_dock_window_from_dock      (GimpDock       *dock);
 GimpDock          * gimp_dock_window_get_dock       (GimpDockWindow *dock_window);



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