[gimp] app: Remove gimp_dock_window_get_dock()



commit 4cda04da5c67cdb7b57b761f9837926b3bf3343f
Author: Martin Nordholts <martinn src gnome org>
Date:   Thu Mar 4 23:25:36 2010 +0100

    app: Remove gimp_dock_window_get_dock()
    
    Since the order of docks in a dock window is arbitrary, it can never
    be correct to only care about the first dock. Remove
    gimp_dock_window_get_dock() and correct that code that made use of
    it. (The function itself was introduced when there could only be one
    dock per dock window.)

 app/actions/actions.c        |   20 ++++----------------
 app/actions/dock-actions.c   |    9 ++++-----
 app/widgets/gimpdockwindow.c |   21 +++------------------
 app/widgets/gimpdockwindow.h |    1 -
 4 files changed, 11 insertions(+), 40 deletions(-)
---
diff --git a/app/actions/actions.c b/app/actions/actions.c
index 6dcf74c..3e39eef 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -282,10 +282,7 @@ action_data_get_gimp (gpointer data)
   else if (GIMP_IS_DOCK (data))
     context = gimp_dock_get_context (((GimpDock *) data));
   else if (GIMP_IS_DOCK_WINDOW (data))
-    {
-      GimpDock *dock = gimp_dock_window_get_dock (((GimpDockWindow *) data));
-      context = dock ? gimp_dock_get_context (dock) : NULL;
-    }
+    context = gimp_dock_window_get_context (((GimpDockWindow *) data));
   else if (GIMP_IS_CONTAINER_VIEW (data))
     context = gimp_container_view_get_context ((GimpContainerView *) data);
   else if (GIMP_IS_CONTAINER_EDITOR (data))
@@ -319,10 +316,7 @@ action_data_get_context (gpointer data)
   else if (GIMP_IS_DOCK (data))
     return gimp_dock_get_context ((GimpDock *) data);
   else if (GIMP_IS_DOCK_WINDOW (data))
-    {
-      GimpDock *dock = gimp_dock_window_get_dock (((GimpDockWindow *) data));
-      return dock ? gimp_dock_get_context (dock) : NULL;
-    }
+    return gimp_dock_window_get_context (((GimpDockWindow *) data));
   else if (GIMP_IS_CONTAINER_VIEW (data))
     return gimp_container_view_get_context ((GimpContainerView *) data);
   else if (GIMP_IS_CONTAINER_EDITOR (data))
@@ -356,10 +350,7 @@ action_data_get_image (gpointer data)
   else if (GIMP_IS_DOCK (data))
     context = gimp_dock_get_context ((GimpDock *) data);
   else if (GIMP_IS_DOCK_WINDOW (data))
-    {
-      GimpDock *dock = gimp_dock_window_get_dock (((GimpDockWindow *) data));
-      context = dock ? gimp_dock_get_context (dock) : NULL;
-    }
+    context = gimp_dock_window_get_context (((GimpDockWindow *) data));
   else if (GIMP_IS_ITEM_TREE_VIEW (data))
     return gimp_item_tree_view_get_image ((GimpItemTreeView *) data);
   else if (GIMP_IS_IMAGE_EDITOR (data))
@@ -395,10 +386,7 @@ action_data_get_display (gpointer data)
   else if (GIMP_IS_DOCK (data))
     context = gimp_dock_get_context ((GimpDock *) data);
   else if (GIMP_IS_DOCK_WINDOW (data))
-    {
-      GimpDock *dock = gimp_dock_window_get_dock (((GimpDockWindow *) data));
-      context = dock ? gimp_dock_get_context (dock) : NULL;
-    }
+    context = gimp_dock_window_get_context (((GimpDockWindow *) data));
   else if (GIMP_IS_NAVIGATION_EDITOR (data))
     context = ((GimpNavigationEditor *) data)->context;
 
diff --git a/app/actions/dock-actions.c b/app/actions/dock-actions.c
index 8a47efa..f24f0ca 100644
--- a/app/actions/dock-actions.c
+++ b/app/actions/dock-actions.c
@@ -104,12 +104,11 @@ dock_actions_update (GimpActionGroup *group,
 
   if (GIMP_IS_DOCK_WINDOW (toplevel))
     {
-      GimpDock *dock = gimp_dock_window_get_dock (GIMP_DOCK_WINDOW (toplevel));
-      
-      if (GIMP_IS_MENU_DOCK (dock))
-        {
-          GimpDockWindow *dock_window = gimp_dock_window_from_dock (dock);
+      GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (toplevel);
+      gboolean show_image_menu = ! gimp_dock_window_has_toolbox (dock_window);
 
+      if (show_image_menu)
+        {
           SET_VISIBLE ("dock-show-image-menu",    TRUE);
           SET_VISIBLE ("dock-auto-follow-active", TRUE);
 
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index 978fcf3..24a8bf7 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -613,7 +613,7 @@ gimp_dock_window_delete_event (GtkWidget   *widget,
                                GdkEventAny *event)
 {
   GimpDockWindow         *dock_window = GIMP_DOCK_WINDOW (widget);
-  GimpDock               *dock        = gimp_dock_window_get_dock (dock_window);
+  GList                  *docks       = gimp_dock_window_get_docks (dock_window);
   GimpSessionInfo        *info        = NULL;
   const gchar            *entry_name  = NULL;
   GimpDialogFactoryEntry *entry       = NULL;
@@ -622,7 +622,8 @@ gimp_dock_window_delete_event (GtkWidget   *widget,
    * recently closed dock since those can be brought back through the
    * normal Windows->Dockable Dialogs menu
    */
-  if (gimp_dock_get_n_dockables (dock) < 2)
+  if (g_list_length (docks) == 1 &&
+      gimp_dock_get_n_dockables (GIMP_DOCK (g_list_nth_data (docks, 0))) == 1)
     return FALSE;
 
   info = gimp_session_info_new ();
@@ -953,22 +954,6 @@ gimp_dock_window_get_docks (GimpDockWindow *dock_window)
   return gimp_dock_columns_get_docks (dock_window->p->dock_columns);
 }
 
-/**
- * gimp_dock_window_get_dock:
- * @dock_window:
- *
- * Get the #GimpDock within the #GimpDockWindow.
- *
- * Returns:
- **/
-GimpDock *
-gimp_dock_window_get_dock (GimpDockWindow *dock_window)
-{
-  GList *docks = gimp_dock_columns_get_docks (dock_window->p->dock_columns);
-
-  return g_list_length (docks) > 0 ? GIMP_DOCK (docks->data) : NULL;
-}
-
 gboolean
 gimp_dock_window_get_auto_follow_active (GimpDockWindow *dock_window)
 {
diff --git a/app/widgets/gimpdockwindow.h b/app/widgets/gimpdockwindow.h
index 8ece994..29c8411 100644
--- a/app/widgets/gimpdockwindow.h
+++ b/app/widgets/gimpdockwindow.h
@@ -71,7 +71,6 @@ GimpUIManager     * gimp_dock_window_get_ui_manager         (GimpDockWindow    *
 GimpContext       * gimp_dock_window_get_context            (GimpDockWindow    *dock);
 GimpDialogFactory * gimp_dock_window_get_dialog_factory     (GimpDockWindow    *dock);
 GList             * gimp_dock_window_get_docks              (GimpDockWindow    *dock_window);
-GimpDock          * gimp_dock_window_get_dock               (GimpDockWindow    *dock_window);
 gboolean            gimp_dock_window_get_auto_follow_active (GimpDockWindow    *menu_dock);
 void                gimp_dock_window_set_auto_follow_active (GimpDockWindow    *menu_dock,
                                                              gboolean           show);



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