[gimp] app: Make all GimpDialogFactory members private



commit 90d7ffde1afe1ddcc7dc3cc4f55345d94cf02ec9
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Dec 20 20:19:31 2009 +0100

    app: Make all GimpDialogFactory members private
    
    Add necessary trivial API that allows us to make remaining
    GimpDialogFactory instance members private, and make them private.

 app/actions/windows-actions.c      |    2 +-
 app/actions/windows-commands.c     |    9 ++-
 app/dialogs/dialogs-constructors.c |   68 ++++++++++----------
 app/dialogs/dialogs.c              |    2 +-
 app/display/gimpimagewindow.c      |    2 +-
 app/gui/gimpuiconfigurer.c         |    2 +-
 app/gui/session.c                  |    3 +-
 app/menus/windows-menu.c           |    2 +-
 app/tools/gimptexttool.c           |    4 +-
 app/widgets/gimpdialogfactory.c    |  127 ++++++++++++++++++++++++------------
 app/widgets/gimpdialogfactory.h    |   12 ++--
 app/widgets/gimpdockwindow.c       |   17 +++--
 12 files changed, 148 insertions(+), 102 deletions(-)
---
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index 990f5ce..33e1d73 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -144,7 +144,7 @@ windows_actions_setup (GimpActionGroup *group)
                            G_CALLBACK (windows_actions_dock_window_removed),
                            group, 0);
 
-  for (list = global_dock_window_factory->open_dialogs;
+  for (list = gimp_dialog_factory_get_open_dialogs (global_dock_window_factory);
        list;
        list = g_list_next (list))
     {
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 1742721..b099642 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -49,7 +49,9 @@ windows_commands_get_toolbox (GimpDialogFactory *toolbox_factory)
 {
   GList *list = NULL;
 
-  for (list = toolbox_factory->open_dialogs; list; list = list->next)
+  for (list = gimp_dialog_factory_get_open_dialogs (toolbox_factory);
+       list;
+       list = list->next)
     {
       /* The only toplevel widget in the toolbox factory is the
        * toolbox
@@ -112,8 +114,7 @@ windows_open_recent_cmd_callback (GtkAction *action,
   g_object_ref (info);
   gimp_container_remove (global_recent_docks, GIMP_OBJECT (info));
 
-  global_dock_window_factory->session_infos =
-    g_list_append (global_dock_window_factory->session_infos, info);
+  gimp_dialog_factory_add_session_info (global_dock_window_factory, info);
 
   gimp_session_info_restore (info, global_dock_window_factory);
   gimp_session_info_clear_info (info);
@@ -124,7 +125,7 @@ windows_show_toolbox (void)
 {
   GtkWidget *toolbox = NULL;
 
-  if (! global_toolbox_factory->open_dialogs)
+  if (! gimp_dialog_factory_get_open_dialogs (global_toolbox_factory))
     {
       toolbox = gimp_dialog_factory_dock_with_window_new (global_toolbox_factory,
                                                           gdk_screen_get_default ());
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index aa42773..629885e 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -307,7 +307,7 @@ dialogs_tool_options_new (GimpDialogFactory *factory,
                           gint               view_size)
 {
   return gimp_tool_options_editor_new (context->gimp,
-                                       factory->menu_factory);
+                                       gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -324,7 +324,7 @@ dialogs_error_console_new (GimpDialogFactory *factory,
                            gint               view_size)
 {
   return gimp_error_console_new (context->gimp,
-                                 factory->menu_factory);
+                                 gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -332,7 +332,7 @@ dialogs_cursor_view_new (GimpDialogFactory *factory,
                          GimpContext       *context,
                          gint               view_size)
 {
-  return gimp_cursor_view_new (factory->menu_factory);
+  return gimp_cursor_view_new (gimp_dialog_factory_get_menu_factory (factory));
 }
 
 
@@ -347,7 +347,7 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
                               context->gimp->images,
                               context,
                               view_size, 1,
-                              factory->menu_factory);
+                              gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -360,7 +360,7 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
                                       context,
                                       TRUE,
                                       view_size, 1,
-                                      factory->menu_factory);
+                                      gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -372,7 +372,7 @@ dialogs_dynamics_list_view_new (GimpDialogFactory *factory,
                                          context->gimp->dynamics_factory,
                                          context,
                                          view_size, 1,
-                                         factory->menu_factory);
+                                         gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -384,7 +384,7 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
                                         context->gimp->pattern_factory,
                                         context,
                                         view_size, 1,
-                                        factory->menu_factory);
+                                        gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -396,7 +396,7 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
                                      context->gimp->gradient_factory,
                                      context,
                                      view_size, 1,
-                                     factory->menu_factory, "<Gradients>",
+                                     gimp_dialog_factory_get_menu_factory (factory), "<Gradients>",
                                      "/gradients-popup",
                                      "gradients");
 }
@@ -410,7 +410,7 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
                                      context->gimp->palette_factory,
                                      context,
                                      view_size, 1,
-                                     factory->menu_factory, "<Palettes>",
+                                     gimp_dialog_factory_get_menu_factory (factory), "<Palettes>",
                                      "/palettes-popup",
                                      "palettes");
 }
@@ -424,7 +424,7 @@ dialogs_font_list_view_new (GimpDialogFactory *factory,
                              context->gimp->fonts,
                              context,
                              view_size, 1,
-                             factory->menu_factory);
+                             gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -436,7 +436,7 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
                                context->gimp->named_buffers,
                                context,
                                view_size, 1,
-                               factory->menu_factory);
+                               gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -448,7 +448,7 @@ dialogs_document_list_view_new (GimpDialogFactory *factory,
                                  context->gimp->documents,
                                  context,
                                  view_size, 0,
-                                 factory->menu_factory);
+                                 gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -460,7 +460,7 @@ dialogs_template_list_view_new (GimpDialogFactory *factory,
                                  context->gimp->templates,
                                  context,
                                  view_size, 0,
-                                 factory->menu_factory);
+                                 gimp_dialog_factory_get_menu_factory (factory));
 }
 
 
@@ -475,7 +475,7 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
                               context->gimp->images,
                               context,
                               view_size, 1,
-                              factory->menu_factory);
+                              gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -488,7 +488,7 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
                                       context,
                                       TRUE,
                                       view_size, 1,
-                                      factory->menu_factory);
+                                      gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -500,7 +500,7 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
                                         context->gimp->pattern_factory,
                                         context,
                                         view_size, 1,
-                                        factory->menu_factory);
+                                        gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -512,7 +512,7 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
                                      context->gimp->gradient_factory,
                                      context,
                                      view_size, 1,
-                                     factory->menu_factory, "<Gradients>",
+                                     gimp_dialog_factory_get_menu_factory (factory), "<Gradients>",
                                      "/gradients-popup",
                                      "gradients");
 }
@@ -526,7 +526,7 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
                                      context->gimp->palette_factory,
                                      context,
                                      view_size, 1,
-                                     factory->menu_factory, "<Palettes>",
+                                     gimp_dialog_factory_get_menu_factory (factory), "<Palettes>",
                                      "/palettes-popup",
                                      "palettes");
 }
@@ -540,7 +540,7 @@ dialogs_font_grid_view_new (GimpDialogFactory *factory,
                              context->gimp->fonts,
                              context,
                              view_size, 1,
-                             factory->menu_factory);
+                             gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -552,7 +552,7 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
                                context->gimp->named_buffers,
                                context,
                                view_size, 1,
-                               factory->menu_factory);
+                               gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -564,7 +564,7 @@ dialogs_document_grid_view_new (GimpDialogFactory *factory,
                                  context->gimp->documents,
                                  context,
                                  view_size, 0,
-                                 factory->menu_factory);
+                                 gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -576,7 +576,7 @@ dialogs_template_grid_view_new (GimpDialogFactory *factory,
                                  context->gimp->templates,
                                  context,
                                  view_size, 0,
-                                 factory->menu_factory);
+                                 gimp_dialog_factory_get_menu_factory (factory));
 }
 
 
@@ -593,7 +593,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
   return gimp_item_tree_view_new (GIMP_TYPE_LAYER_TREE_VIEW,
                                   view_size, 2,
                                   gimp_context_get_image (context),
-                                  factory->menu_factory, "<Layers>",
+                                  gimp_dialog_factory_get_menu_factory (factory), "<Layers>",
                                   "/layers-popup");
 }
 
@@ -608,7 +608,7 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
   return gimp_item_tree_view_new (GIMP_TYPE_CHANNEL_TREE_VIEW,
                                   view_size, 1,
                                   gimp_context_get_image (context),
-                                  factory->menu_factory, "<Channels>",
+                                  gimp_dialog_factory_get_menu_factory (factory), "<Channels>",
                                   "/channels-popup");
 }
 
@@ -623,7 +623,7 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
   return gimp_item_tree_view_new (GIMP_TYPE_VECTORS_TREE_VIEW,
                                   view_size, 1,
                                   gimp_context_get_image (context),
-                                  factory->menu_factory, "<Vectors>",
+                                  gimp_dialog_factory_get_menu_factory (factory), "<Vectors>",
                                   "/vectors-popup");
 }
 
@@ -634,7 +634,7 @@ dialogs_colormap_editor_new (GimpDialogFactory *factory,
 {
   GtkWidget *view;
 
-  view = gimp_colormap_editor_new (factory->menu_factory);
+  view = gimp_colormap_editor_new (gimp_dialog_factory_get_menu_factory (factory));
 
   g_signal_connect (view, "selected",
                     G_CALLBACK (dialogs_indexed_palette_selected),
@@ -656,7 +656,7 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
                               GimpContext       *context,
                               gint               view_size)
 {
-  return gimp_selection_editor_new (factory->menu_factory);
+  return gimp_selection_editor_new (gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -665,7 +665,7 @@ dialogs_undo_editor_new (GimpDialogFactory *factory,
                          gint               view_size)
 {
   return gimp_undo_editor_new (context->gimp->config,
-                               factory->menu_factory);
+                               gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -673,7 +673,7 @@ dialogs_sample_point_editor_new (GimpDialogFactory *factory,
                                  GimpContext       *context,
                                  gint               view_size)
 {
-  return gimp_sample_point_editor_new (factory->menu_factory);
+  return gimp_sample_point_editor_new (gimp_dialog_factory_get_menu_factory (factory));
 }
 
 
@@ -684,7 +684,7 @@ dialogs_navigation_editor_new (GimpDialogFactory *factory,
                                GimpContext       *context,
                                gint               view_size)
 {
-  return gimp_navigation_editor_new (factory->menu_factory);
+  return gimp_navigation_editor_new (gimp_dialog_factory_get_menu_factory (factory));
 }
 
 
@@ -709,7 +709,7 @@ dialogs_brush_editor_get (GimpDialogFactory *factory,
                           gint               view_size)
 {
   return gimp_brush_editor_new (context,
-                                factory->menu_factory);
+                                gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -718,7 +718,7 @@ dialogs_dynamics_editor_get (GimpDialogFactory *factory,
                           gint               view_size)
 {
   return gimp_dynamics_editor_new (context,
-                                   factory->menu_factory);
+                                   gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -727,7 +727,7 @@ dialogs_gradient_editor_get (GimpDialogFactory *factory,
                              gint               view_size)
 {
   return gimp_gradient_editor_new (context,
-                                   factory->menu_factory);
+                                   gimp_dialog_factory_get_menu_factory (factory));
 }
 
 GtkWidget *
@@ -736,7 +736,7 @@ dialogs_palette_editor_get (GimpDialogFactory *factory,
                             gint               view_size)
 {
   return gimp_palette_editor_new (context,
-                                  factory->menu_factory);
+                                  gimp_dialog_factory_get_menu_factory (factory));
 }
 
 
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index 5bb48cb..4a28e42 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -498,7 +498,7 @@ dialogs_get_toolbox (void)
 
   g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (global_toolbox_factory), NULL);
 
-  for (list = global_toolbox_factory->open_dialogs;
+  for (list = gimp_dialog_factory_get_open_dialogs (global_toolbox_factory);
        list;
        list = g_list_next (list))
     {
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index ddb2261..1bdcae8 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -260,7 +260,7 @@ gimp_image_window_constructor (GType                  type,
                     G_CALLBACK (gimp_image_window_hide_tooltip),
                     window);
 
-  config = GIMP_GUI_CONFIG (private->display_factory->context->gimp->config);
+  config = GIMP_GUI_CONFIG (gimp_dialog_factory_get_context (private->display_factory)->gimp->config);
 
   /* Create the window toplevel container */
   private->main_vbox = gtk_vbox_new (FALSE, 0);
diff --git a/app/gui/gimpuiconfigurer.c b/app/gui/gimpuiconfigurer.c
index 319ce7b..1dc9f4e 100644
--- a/app/gui/gimpuiconfigurer.c
+++ b/app/gui/gimpuiconfigurer.c
@@ -157,7 +157,7 @@ gimp_ui_configurer_move_docks_to_columns (GimpUIConfigurer  *ui_configurer,
                                           GimpDialogFactory *dialog_factory,
                                           GimpDockColumns   *dock_columns)
 {
-  GList *dialogs     = g_list_copy (dialog_factory->open_dialogs);
+  GList *dialogs     = g_list_copy (gimp_dialog_factory_get_open_dialogs (dialog_factory));
   GList *dialog_iter = NULL;
 
   for (dialog_iter = dialogs; dialog_iter; dialog_iter = dialog_iter->next)
diff --git a/app/gui/session.c b/app/gui/session.c
index 408fa36..0ef3be7 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -180,8 +180,7 @@ session_init (Gimp *gimp)
                                 "successfully parsed and added session info %p",
                                 info);
 
-                      factory->session_infos =
-                        g_list_append (factory->session_infos, info);
+                      gimp_dialog_factory_add_session_info (factory, info);
                     }
                   else
                     {
diff --git a/app/menus/windows-menu.c b/app/menus/windows-menu.c
index eb0be91..f4420bb 100644
--- a/app/menus/windows-menu.c
+++ b/app/menus/windows-menu.c
@@ -111,7 +111,7 @@ windows_menu_setup (GimpUIManager *manager,
                            G_CALLBACK (windows_menu_dock_window_removed),
                            manager, 0);
 
-  for (list = global_dock_window_factory->open_dialogs;
+  for (list = gimp_dialog_factory_get_open_dialogs (global_dock_window_factory);
        list;
        list = g_list_next (list))
     {
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index fb351bf..e075710 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -952,7 +952,7 @@ gimp_text_tool_get_popup (GimpTool         *tool,
           dialog_factory = gimp_dialog_factory_from_name ("toplevel");
 
           text_tool->ui_manager =
-            gimp_menu_factory_manager_new (dialog_factory->menu_factory,
+            gimp_menu_factory_manager_new (gimp_dialog_factory_get_menu_factory (dialog_factory),
                                            "<TextTool>",
                                            text_tool, FALSE);
 
@@ -2246,7 +2246,7 @@ gimp_text_tool_editor (GimpTextTool *text_tool)
     }
 
   text_tool->editor = gimp_text_options_editor_new (parent, options,
-                                                    dialog_factory->menu_factory,
+                                                    gimp_dialog_factory_get_menu_factory (dialog_factory),
                                                     _("GIMP Text Editor"),
                                                     text_tool->text_buffer);
 
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index 01973cf..3217e81 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -62,6 +62,12 @@ enum
 
 struct _GimpDialogFactoryPrivate
 {
+  GimpContext           *context;
+  GimpMenuFactory       *menu_factory;
+
+  GList                 *open_dialogs;
+  GList                 *session_infos;
+
   GimpDialogNewFunc      new_dock_window_func;
   GimpDialogNewDockFunc  new_dock_func;
   GimpDialogConstructor  constructor;
@@ -160,10 +166,6 @@ gimp_dialog_factory_init (GimpDialogFactory *factory)
                                             GIMP_TYPE_DIALOG_FACTORY,
                                             GimpDialogFactoryPrivate);
   factory->p->constructor = gimp_dialog_factory_default_constructor;
-
-  factory->menu_factory   = NULL;
-  factory->session_infos  = NULL;
-  factory->open_dialogs   = NULL;
 }
 
 static void
@@ -175,11 +177,11 @@ gimp_dialog_factory_dispose (GObject *object)
 
   /*  start iterating from the beginning each time we destroyed a
    *  toplevel because destroying a dock may cause lots of items
-   *  to be removed from factory->open_dialogs
+   *  to be removed from factory->p->open_dialogs
    */
-  while (factory->open_dialogs)
+  while (factory->p->open_dialogs)
     {
-      for (list = factory->open_dialogs; list; list = g_list_next (list))
+      for (list = factory->p->open_dialogs; list; list = g_list_next (list))
         {
           if (gtk_widget_is_toplevel (list->data))
             {
@@ -193,23 +195,23 @@ gimp_dialog_factory_dispose (GObject *object)
        */
       if (! list)
         {
-          g_warning ("%s: stale non-toplevel entries in factory->open_dialogs",
+          g_warning ("%s: stale non-toplevel entries in factory->p->open_dialogs",
                      G_STRFUNC);
           break;
         }
     }
 
-  if (factory->open_dialogs)
+  if (factory->p->open_dialogs)
     {
-      g_list_free (factory->open_dialogs);
-      factory->open_dialogs = NULL;
+      g_list_free (factory->p->open_dialogs);
+      factory->p->open_dialogs = NULL;
     }
 
-  if (factory->session_infos)
+  if (factory->p->session_infos)
     {
-      g_list_foreach (factory->session_infos, (GFunc) g_object_unref, NULL);
-      g_list_free (factory->session_infos);
-      factory->session_infos = NULL;
+      g_list_foreach (factory->p->session_infos, (GFunc) g_object_unref, NULL);
+      g_list_free (factory->p->session_infos);
+      factory->p->session_infos = NULL;
     }
 
   if (strcmp (gimp_object_get_name (factory), "toolbox") == 0)
@@ -286,8 +288,8 @@ gimp_dialog_factory_new (const gchar           *name,
   g_hash_table_insert (GIMP_DIALOG_FACTORY_GET_CLASS (factory)->factories,
                        key, factory);
 
-  factory->context              = context;
-  factory->menu_factory         = menu_factory;
+  factory->p->context           = context;
+  factory->p->menu_factory      = menu_factory;
   factory->p->new_dock_func     = new_dock_func;
   factory->p->toggle_visibility = toggle_visibility;
 
@@ -404,7 +406,7 @@ gimp_dialog_factory_find_session_info (GimpDialogFactory *factory,
   g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
   g_return_val_if_fail (identifier != NULL, NULL);
 
-  for (list = factory->session_infos; list; list = g_list_next (list))
+  for (list = factory->p->session_infos; list; list = g_list_next (list))
     {
       GimpSessionInfo *info = list->data;
 
@@ -513,7 +515,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
           GtkWidget *dockbook;
 
           dock     = gimp_dialog_factory_dock_with_window_new (factory, screen);
-          dockbook = gimp_dockbook_new (factory->menu_factory);
+          dockbook = gimp_dockbook_new (factory->p->menu_factory);
 
           gimp_dock_add_book (GIMP_DOCK (dock),
                               GIMP_DOCKBOOK (dockbook),
@@ -539,7 +541,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
                                           view_size);
       else
         dialog = factory->p->constructor (factory, entry,
-                                          factory->context,
+                                          factory->p->context,
                                           view_size);
 
       if (dialog)
@@ -656,13 +658,54 @@ gimp_dialog_factory_dialog_new (GimpDialogFactory *factory,
 
   return gimp_dialog_factory_dialog_new_internal (factory,
                                                   screen,
-                                                  factory->context,
+                                                  factory->p->context,
                                                   identifier,
                                                   view_size,
                                                   FALSE,
                                                   present);
 }
 
+GimpContext *
+gimp_dialog_factory_get_context (GimpDialogFactory *factory)
+{
+  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
+
+  return factory->p->context;
+}
+
+GimpMenuFactory *
+gimp_dialog_factory_get_menu_factory (GimpDialogFactory *factory)
+{
+  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
+
+  return factory->p->menu_factory;
+}
+
+GList *
+gimp_dialog_factory_get_open_dialogs (GimpDialogFactory *factory)
+{
+  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
+
+  return factory->p->open_dialogs;
+}
+
+GList *
+gimp_dialog_factory_get_session_infos (GimpDialogFactory *factory)
+{
+  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
+
+  return factory->p->session_infos;
+}
+
+void
+gimp_dialog_factory_add_session_info (GimpDialogFactory *factory,
+                                      GimpSessionInfo   *info)
+{
+  g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
+  
+  factory->p->session_infos = g_list_append (factory->p->session_infos, info);
+}
+
 /**
  * gimp_dialog_factory_dialog_raise:
  * @factory:      a #GimpDialogFactory
@@ -834,7 +877,7 @@ gimp_dialog_factory_dock_window_new (GimpDialogFactory *factory,
   g_return_val_if_fail (factory->p->new_dock_window_func != NULL, NULL);
 
   /* Create the dock window */
-  dock_window = factory->p->new_dock_window_func (factory, factory->context, 0);
+  dock_window = factory->p->new_dock_window_func (factory, factory->p->context, 0);
   gtk_window_set_screen (GTK_WINDOW (dock_window), screen);
   gimp_dialog_factory_set_widget_data (dock_window, factory, NULL);
   
@@ -856,7 +899,7 @@ gimp_dialog_factory_dock_new (GimpDialogFactory *factory,
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
   g_return_val_if_fail (ui_manager != NULL, NULL);
 
-  return factory->p->new_dock_func (factory, factory->context, ui_manager);
+  return factory->p->new_dock_func (factory, factory->p->context, ui_manager);
 }
 
 void
@@ -872,7 +915,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
   g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
   g_return_if_fail (GTK_IS_WIDGET (dialog));
 
-  if (g_list_find (factory->open_dialogs, dialog))
+  if (g_list_find (factory->p->open_dialogs, dialog))
     {
       g_warning ("%s: dialog already registered", G_STRFUNC);
       return;
@@ -894,7 +937,7 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
                 toplevel ? "toplevel" : "dockable",
                 entry->identifier);
 
-      for (list = factory->session_infos; list; list = g_list_next (list))
+      for (list = factory->p->session_infos; list; list = g_list_next (list))
         {
           GimpSessionInfo *current_info = list->data;
 
@@ -962,14 +1005,14 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
                               G_CALLBACK (gimp_dialog_factory_set_user_pos),
                               NULL);
 
-          factory->session_infos = g_list_append (factory->session_infos, info);
+          factory->p->session_infos = g_list_append (factory->p->session_infos, info);
         }
     }
   else /*  dialog is a GimpDockWindow  */
     {
       GIMP_LOG (DIALOG_FACTORY, "adding dock (dialog = %p)", dialog);
 
-      for (list = factory->session_infos; list; list = g_list_next (list))
+      for (list = factory->p->session_infos; list; list = g_list_next (list))
         {
           GimpSessionInfo *current_info = list->data;
 
@@ -1013,13 +1056,13 @@ gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
                             G_CALLBACK (gimp_dialog_factory_set_user_pos),
                             NULL);
 
-          factory->session_infos = g_list_append (factory->session_infos, info);
+          factory->p->session_infos = g_list_append (factory->p->session_infos, info);
         }
 
       g_signal_emit (factory, factory_signals[DOCK_WINDOW_ADDED], 0, dialog);
     }
 
-  factory->open_dialogs = g_list_prepend (factory->open_dialogs, dialog);
+  factory->p->open_dialogs = g_list_prepend (factory->p->open_dialogs, dialog);
 
   g_signal_connect_object (dialog, "destroy",
                            G_CALLBACK (gimp_dialog_factory_remove_dialog),
@@ -1087,13 +1130,13 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
   g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
   g_return_if_fail (GTK_IS_WIDGET (dialog));
 
-  if (! g_list_find (factory->open_dialogs, dialog))
+  if (! g_list_find (factory->p->open_dialogs, dialog))
     {
       g_warning ("%s: dialog not registered", G_STRFUNC);
       return;
     }
 
-  factory->open_dialogs = g_list_remove (factory->open_dialogs, dialog);
+  factory->p->open_dialogs = g_list_remove (factory->p->open_dialogs, dialog);
 
   dialog_factory = gimp_dialog_factory_from_widget (dialog, &entry);
 
@@ -1107,7 +1150,7 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
             entry ? entry->identifier : "dock",
             dialog);
 
-  for (list = factory->session_infos; list; list = g_list_next (list))
+  for (list = factory->p->session_infos; list; list = g_list_next (list))
     {
       GimpSessionInfo *session_info = list->data;
 
@@ -1137,7 +1180,7 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
           if (GIMP_IS_DOCK_WINDOW (dialog))
             {
               /*  don't save session info for empty docks  */
-              factory->session_infos = g_list_remove (factory->session_infos,
+              factory->p->session_infos = g_list_remove (factory->p->session_infos,
                                                       session_info);
               g_object_unref (session_info);
 
@@ -1423,7 +1466,7 @@ gimp_dialog_factory_dialog_configure (GtkWidget         *dialog,
   GimpDialogFactoryEntry *entry;
   GList                  *list;
 
-  if (! g_list_find (factory->open_dialogs, dialog))
+  if (! g_list_find (factory->p->open_dialogs, dialog))
     {
       g_warning ("%s: dialog not registered", G_STRFUNC);
       return FALSE;
@@ -1437,7 +1480,7 @@ gimp_dialog_factory_dialog_configure (GtkWidget         *dialog,
                                          dialog))
     return FALSE;
 
-  for (list = factory->session_infos; list; list = g_list_next (list))
+  for (list = factory->p->session_infos; list; list = g_list_next (list))
     {
       GimpSessionInfo *session_info = list->data;
 
@@ -1468,7 +1511,7 @@ gimp_dialog_factories_save_foreach (gconstpointer      key,
 {
   GList *infos;
 
-  for (infos = factory->session_infos; infos; infos = g_list_next (infos))
+  for (infos = factory->p->session_infos; infos; infos = g_list_next (infos))
     {
       GimpSessionInfo *info = infos->data;
 
@@ -1508,7 +1551,7 @@ gimp_dialog_factories_restore_foreach (gconstpointer      key,
 {
   GList *infos;
 
-  for (infos = factory->session_infos; infos; infos = g_list_next (infos))
+  for (infos = factory->p->session_infos; infos; infos = g_list_next (infos))
     {
       GimpSessionInfo *info = infos->data;
 
@@ -1533,7 +1576,7 @@ gimp_dialog_factories_clear_foreach (gconstpointer      key,
 {
   GList *list;
 
-  for (list = factory->session_infos; list; list = g_list_next (list))
+  for (list = factory->p->session_infos; list; list = g_list_next (list))
     {
       GimpSessionInfo *info = list->data;
 
@@ -1554,7 +1597,7 @@ gimp_dialog_factories_hide_foreach (gconstpointer      key,
   if (! factory->p->toggle_visibility)
     return;
 
-  for (list = factory->open_dialogs; list; list = g_list_next (list))
+  for (list = factory->p->open_dialogs; list; list = g_list_next (list))
     {
       GtkWidget *widget = list->data;
 
@@ -1591,7 +1634,7 @@ gimp_dialog_factories_show_foreach (gconstpointer      key,
 {
   GList *list;
 
-  for (list = factory->open_dialogs; list; list = g_list_next (list))
+  for (list = factory->p->open_dialogs; list; list = g_list_next (list))
     {
       GtkWidget *widget = list->data;
 
@@ -1631,7 +1674,7 @@ gimp_dialog_factories_set_busy_foreach (gconstpointer      key,
   GdkCursor  *cursor  = NULL;
   GList      *list;
 
-  for (list = factory->open_dialogs; list; list = g_list_next (list))
+  for (list = factory->p->open_dialogs; list; list = g_list_next (list))
     {
       GtkWidget *widget = list->data;
 
@@ -1667,7 +1710,7 @@ gimp_dialog_factories_unset_busy_foreach (gconstpointer      key,
 {
   GList *list;
 
-  for (list = factory->open_dialogs; list; list = g_list_next (list))
+  for (list = factory->p->open_dialogs; list; list = g_list_next (list))
     {
       GtkWidget *widget = list->data;
 
diff --git a/app/widgets/gimpdialogfactory.h b/app/widgets/gimpdialogfactory.h
index 57f6afb..4af49fc 100644
--- a/app/widgets/gimpdialogfactory.h
+++ b/app/widgets/gimpdialogfactory.h
@@ -91,12 +91,6 @@ struct _GimpDialogFactory
 {
   GimpObject                parent_instance;
 
-  GimpContext              *context;
-  GimpMenuFactory          *menu_factory;
-
-  GList                    *open_dialogs;
-  GList                    *session_infos;
-
   GimpDialogFactoryPrivate *p;
 };
 
@@ -146,6 +140,12 @@ GtkWidget *         gimp_dialog_factory_dialog_new           (GimpDialogFactory
                                                               const gchar             *identifier,
                                                               gint                     view_size,
                                                               gboolean                 present);
+GimpContext *       gimp_dialog_factory_get_context          (GimpDialogFactory       *factory);
+GimpMenuFactory *   gimp_dialog_factory_get_menu_factory     (GimpDialogFactory       *factory);
+GList *             gimp_dialog_factory_get_open_dialogs     (GimpDialogFactory       *factory);
+GList *             gimp_dialog_factory_get_session_infos    (GimpDialogFactory       *factory);
+void                gimp_dialog_factory_add_session_info     (GimpDialogFactory       *factory,
+                                                              GimpSessionInfo         *info);
 GtkWidget *         gimp_dialog_factory_dialog_raise         (GimpDialogFactory       *factory,
                                                               GdkScreen               *screen,
                                                               const gchar             *identifiers,
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index 2f7829c..c3bb8bd 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -368,23 +368,26 @@ gimp_dock_window_constructor (GType                  type,
                                   ~(GIMP_CONTEXT_IMAGE_MASK |
                                     GIMP_CONTEXT_DISPLAY_MASK),
                                   FALSE);
-  gimp_context_set_parent (dock_window->p->context, dock_window->p->dialog_factory->context);
+  gimp_context_set_parent (dock_window->p->context,
+                           gimp_dialog_factory_get_context (dock_window->p->dialog_factory));
 
   if (dock_window->p->auto_follow_active)
     {
-      if (gimp_context_get_display (dock_window->p->dialog_factory->context))
-        gimp_context_copy_property (dock_window->p->dialog_factory->context, dock_window->p->context,
+      if (gimp_context_get_display (gimp_dialog_factory_get_context (dock_window->p->dialog_factory)))
+        gimp_context_copy_property (gimp_dialog_factory_get_context (dock_window->p->dialog_factory),
+                                    dock_window->p->context,
                                     GIMP_CONTEXT_PROP_DISPLAY);
       else
-        gimp_context_copy_property (dock_window->p->dialog_factory->context, dock_window->p->context,
+        gimp_context_copy_property (gimp_dialog_factory_get_context (dock_window->p->dialog_factory),
+                                    dock_window->p->context,
                                     GIMP_CONTEXT_PROP_IMAGE);
     }
 
-  g_signal_connect_object (dock_window->p->dialog_factory->context, "display-changed",
+  g_signal_connect_object (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), "display-changed",
                            G_CALLBACK (gimp_dock_window_factory_display_changed),
                            dock_window,
                            0);
-  g_signal_connect_object (dock_window->p->dialog_factory->context, "image-changed",
+  g_signal_connect_object (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), "image-changed",
                            G_CALLBACK (gimp_dock_window_factory_image_changed),
                            dock_window,
                            0);
@@ -826,7 +829,7 @@ gimp_dock_window_auto_clicked (GtkWidget *widget,
 
   if (dock_window->p->auto_follow_active)
     {
-      gimp_context_copy_properties (dock_window->p->dialog_factory->context,
+      gimp_context_copy_properties (gimp_dialog_factory_get_context (dock_window->p->dialog_factory),
                                     dock_window->p->context,
                                     GIMP_CONTEXT_DISPLAY_MASK |
                                     GIMP_CONTEXT_IMAGE_MASK);



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