[gimp] app: Add GimpDialogFactory property to GimpDockWindow
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Add GimpDialogFactory property to GimpDockWindow
- Date: Sun, 13 Sep 2009 07:47:10 +0000 (UTC)
commit 88e6fe1e6281c497a0db67aabc00cda48c5f12a1
Author: Martin Nordholts <martinn src gnome org>
Date: Sun Sep 13 09:49:56 2009 +0200
app: Add GimpDialogFactory property to GimpDockWindow
Add a GimpDialogFactory property to GimpDockWindow so that it can get
rid of its GimpDock dependency. We need to call the property
"gimp-dialog-factory" instead of "dialog-factory" though as long as
GimpDock subclasses GimpDockWindow.
app/widgets/gimpdockwindow.c | 35 +++++++++++++++++++++++++++++------
app/widgets/gimpmenudock.c | 11 ++++++-----
app/widgets/gimptoolbox.c | 13 +++++++------
3 files changed, 42 insertions(+), 17 deletions(-)
---
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index d5f05c8..e1f0f11 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -34,7 +34,6 @@
#include "core/gimpcontainer.h"
#include "gimpdialogfactory.h"
-#include "gimpdock.h"
#include "gimpdockwindow.h"
#include "gimpmenufactory.h"
#include "gimpuimanager.h"
@@ -48,17 +47,20 @@ enum
{
PROP_0,
PROP_CONTEXT,
+ PROP_DIALOG_FACTORY,
PROP_UI_MANAGER_NAME,
};
struct _GimpDockWindowPrivate
{
- GimpContext *context;
+ GimpContext *context;
- gchar *ui_manager_name;
- GimpUIManager *ui_manager;
- GQuark image_flush_handler_id;
+ GimpDialogFactory *dialog_factory;
+
+ gchar *ui_manager_name;
+ GimpUIManager *ui_manager;
+ GQuark image_flush_handler_id;
};
static GObject * gimp_dock_window_constructor (GType type,
@@ -104,6 +106,13 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class, PROP_DIALOG_FACTORY,
+ g_param_spec_object ("gimp-dialog-factory",
+ NULL, NULL,
+ GIMP_TYPE_DIALOG_FACTORY,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_object_class_install_property (object_class, PROP_UI_MANAGER_NAME,
g_param_spec_string ("ui-manager-name",
NULL, NULL,
@@ -151,7 +160,7 @@ gimp_dock_window_constructor (GType type,
* dock window is the focused window
*/
dock_window->p->ui_manager =
- gimp_menu_factory_manager_new (gimp_dock_get_dialog_factory (GIMP_DOCK (dock_window))->menu_factory,
+ gimp_menu_factory_manager_new (dock_window->p->dialog_factory->menu_factory,
dock_window->p->ui_manager_name,
dock_window,
config->tearoff_menus);
@@ -196,6 +205,12 @@ gimp_dock_window_dispose (GObject *object)
dock_window->p->ui_manager = NULL;
}
+ if (dock_window->p->dialog_factory)
+ {
+ g_object_unref (dock_window->p->dialog_factory);
+ dock_window->p->dialog_factory = NULL;
+ }
+
if (dock_window->p->context)
{
g_object_unref (dock_window->p->context);
@@ -219,6 +234,10 @@ gimp_dock_window_set_property (GObject *object,
dock_window->p->context = g_value_dup_object (value);
break;
+ case PROP_DIALOG_FACTORY:
+ dock_window->p->dialog_factory = g_value_dup_object (value);
+ break;
+
case PROP_UI_MANAGER_NAME:
g_free (dock_window->p->ui_manager_name);
dock_window->p->ui_manager_name = g_value_dup_string (value);
@@ -244,6 +263,10 @@ gimp_dock_window_get_property (GObject *object,
g_value_set_object (value, dock_window->p->context);
break;
+ case PROP_DIALOG_FACTORY:
+ g_value_set_object (value, dock_window->p->dialog_factory);
+ break;
+
case PROP_UI_MANAGER_NAME:
g_value_set_string (value, dock_window->p->ui_manager_name);
break;
diff --git a/app/widgets/gimpmenudock.c b/app/widgets/gimpmenudock.c
index 6cf28a7..cf2aff2 100644
--- a/app/widgets/gimpmenudock.c
+++ b/app/widgets/gimpmenudock.c
@@ -389,11 +389,12 @@ gimp_menu_dock_new (GimpDialogFactory *dialog_factory,
"Dock Context", NULL);
menu_dock = g_object_new (GIMP_TYPE_MENU_DOCK,
- "role", "gimp-dock",
- "gimp-context", context,
- "context", context,
- "dialog-factory", dialog_factory,
- "ui-manager-name", "<Dock>",
+ "role", "gimp-dock",
+ "context", context,
+ "dialog-factory", dialog_factory,
+ "ui-manager-name", "<Dock>",
+ "gimp-context", context,
+ "gimp-dialog-factory", dialog_factory,
NULL);
g_object_unref (context);
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index c81b874..cd334d0 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -617,12 +617,13 @@ gimp_toolbox_new (GimpDialogFactory *dialog_factory,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
toolbox = g_object_new (GIMP_TYPE_TOOLBOX,
- "title", _("Toolbox"),
- "role", "gimp-toolbox",
- "gimp-context", context,
- "context", context,
- "dialog-factory", dialog_factory,
- "ui-manager-name", "<Toolbox>",
+ "title", _("Toolbox"),
+ "role", "gimp-toolbox",
+ "context", context,
+ "dialog-factory", dialog_factory,
+ "ui-manager-name", "<Toolbox>",
+ "gimp-context", context,
+ "gimp-dialog-factory", dialog_factory,
NULL);
return GTK_WIDGET (toolbox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]