Commit 076f375e authored by Michael Natterer's avatar Michael Natterer 😴

app: make gimp_dock_window_constructed() more readable

by adding a local "factory_context" variable instead of calling
gimp_dialog_factory_get_context (dock_window->p->dialog_factory)
multiple times.
parent 8cc53bbb
...@@ -291,6 +291,7 @@ gimp_dock_window_constructed (GObject *object) ...@@ -291,6 +291,7 @@ gimp_dock_window_constructed (GObject *object)
{ {
GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (object); GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (object);
GimpGuiConfig *config; GimpGuiConfig *config;
GimpContext *factory_context;
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
Gimp *gimp; Gimp *gimp;
GtkSettings *settings; GtkSettings *settings;
...@@ -311,6 +312,9 @@ gimp_dock_window_constructed (GObject *object) ...@@ -311,6 +312,9 @@ gimp_dock_window_constructed (GObject *object)
dock_window->p->image_container = gimp->images; dock_window->p->image_container = gimp->images;
dock_window->p->display_container = gimp->displays; dock_window->p->display_container = gimp->displays;
factory_context =
gimp_dialog_factory_get_context (dock_window->p->dialog_factory);
/* Setup hints */ /* Setup hints */
gimp_window_set_hint (GTK_WINDOW (dock_window), config->dock_window_hint); gimp_window_set_hint (GTK_WINDOW (dock_window), config->dock_window_hint);
...@@ -346,7 +350,7 @@ gimp_dock_window_constructed (GObject *object) ...@@ -346,7 +350,7 @@ gimp_dock_window_constructed (GObject *object)
GIMP_CONTEXT_DISPLAY_MASK), GIMP_CONTEXT_DISPLAY_MASK),
FALSE); FALSE);
gimp_context_set_parent (dock_window->p->context, gimp_context_set_parent (dock_window->p->context,
gimp_dialog_factory_get_context (dock_window->p->dialog_factory)); factory_context);
/* Setup widget hierarchy */ /* Setup widget hierarchy */
{ {
...@@ -423,21 +427,21 @@ gimp_dock_window_constructed (GObject *object) ...@@ -423,21 +427,21 @@ gimp_dock_window_constructed (GObject *object)
if (dock_window->p->auto_follow_active) if (dock_window->p->auto_follow_active)
{ {
if (gimp_context_get_display (gimp_dialog_factory_get_context (dock_window->p->dialog_factory))) if (gimp_context_get_display (factory_context))
gimp_context_copy_property (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), gimp_context_copy_property (factory_context,
dock_window->p->context, dock_window->p->context,
GIMP_CONTEXT_PROP_DISPLAY); GIMP_CONTEXT_PROP_DISPLAY);
else else
gimp_context_copy_property (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), gimp_context_copy_property (factory_context,
dock_window->p->context, dock_window->p->context,
GIMP_CONTEXT_PROP_IMAGE); GIMP_CONTEXT_PROP_IMAGE);
} }
g_signal_connect_object (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), "display-changed", g_signal_connect_object (factory_context, "display-changed",
G_CALLBACK (gimp_dock_window_factory_display_changed), G_CALLBACK (gimp_dock_window_factory_display_changed),
dock_window, dock_window,
0); 0);
g_signal_connect_object (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), "image-changed", g_signal_connect_object (factory_context, "image-changed",
G_CALLBACK (gimp_dock_window_factory_image_changed), G_CALLBACK (gimp_dock_window_factory_image_changed),
dock_window, dock_window,
0); 0);
...@@ -458,12 +462,12 @@ gimp_dock_window_constructed (GObject *object) ...@@ -458,12 +462,12 @@ gimp_dock_window_constructed (GObject *object)
if (dock_window->p->auto_follow_active) if (dock_window->p->auto_follow_active)
{ {
if (gimp_context_get_display (gimp_dialog_factory_get_context (dock_window->p->dialog_factory))) if (gimp_context_get_display (factory_context))
gimp_context_copy_property (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), gimp_context_copy_property (factory_context,
dock_window->p->context, dock_window->p->context,
GIMP_CONTEXT_PROP_DISPLAY); GIMP_CONTEXT_PROP_DISPLAY);
else else
gimp_context_copy_property (gimp_dialog_factory_get_context (dock_window->p->dialog_factory), gimp_context_copy_property (factory_context,
dock_window->p->context, dock_window->p->context,
GIMP_CONTEXT_PROP_IMAGE); GIMP_CONTEXT_PROP_IMAGE);
} }
...@@ -861,15 +865,6 @@ gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window) ...@@ -861,15 +865,6 @@ gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window)
return should_add; return should_add;
} }
static void
gimp_dock_window_display_changed (GimpDockWindow *dock_window,
GimpObject *display,
GimpContext *context)
{
gimp_ui_manager_update (dock_window->p->ui_manager,
display);
}
static void static void
gimp_dock_window_image_flush (GimpImage *image, gimp_dock_window_image_flush (GimpImage *image,
gboolean invalidate_preview, gboolean invalidate_preview,
...@@ -973,6 +968,15 @@ gimp_dock_window_factory_image_changed (GimpContext *context, ...@@ -973,6 +968,15 @@ gimp_dock_window_factory_image_changed (GimpContext *context,
gimp_context_set_image (dock_window->p->context, image); gimp_context_set_image (dock_window->p->context, image);
} }
static void
gimp_dock_window_display_changed (GimpDockWindow *dock_window,
GimpObject *display,
GimpContext *context)
{
gimp_ui_manager_update (dock_window->p->ui_manager,
display);
}
static void static void
gimp_dock_window_image_changed (GimpDockWindow *dock_window, gimp_dock_window_image_changed (GimpDockWindow *dock_window,
GimpImage *image, GimpImage *image,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment