Commit 4cd97c8c 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.
(cherry picked from commit 076f375e)

This is not a bugfix, just to seamlessly pick the next commit...
parent 900cc410
......@@ -291,6 +291,7 @@ gimp_dock_window_constructed (GObject *object)
{
GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (object);
GimpGuiConfig *config;
GimpContext *factory_context;
GtkAccelGroup *accel_group;
Gimp *gimp;
GtkSettings *settings;
......@@ -312,6 +313,9 @@ gimp_dock_window_constructed (GObject *object)
dock_window->p->image_container = gimp->images;
dock_window->p->display_container = gimp->displays;
factory_context =
gimp_dialog_factory_get_context (dock_window->p->dialog_factory);
/* Setup hints */
gimp_window_set_hint (GTK_WINDOW (dock_window), config->dock_window_hint);
......@@ -347,7 +351,7 @@ gimp_dock_window_constructed (GObject *object)
GIMP_CONTEXT_DISPLAY_MASK),
FALSE);
gimp_context_set_parent (dock_window->p->context,
gimp_dialog_factory_get_context (dock_window->p->dialog_factory));
factory_context);
/* Setup widget hierarchy */
{
......@@ -424,21 +428,21 @@ gimp_dock_window_constructed (GObject *object)
if (dock_window->p->auto_follow_active)
{
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),
if (gimp_context_get_display (factory_context))
gimp_context_copy_property (factory_context,
dock_window->p->context,
GIMP_CONTEXT_PROP_DISPLAY);
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,
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),
dock_window,
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),
dock_window,
0);
......@@ -459,12 +463,12 @@ gimp_dock_window_constructed (GObject *object)
if (dock_window->p->auto_follow_active)
{
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),
if (gimp_context_get_display (factory_context))
gimp_context_copy_property (factory_context,
dock_window->p->context,
GIMP_CONTEXT_PROP_DISPLAY);
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,
GIMP_CONTEXT_PROP_IMAGE);
}
......@@ -862,15 +866,6 @@ gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window)
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
gimp_dock_window_image_flush (GimpImage *image,
gboolean invalidate_preview,
......@@ -974,6 +969,15 @@ gimp_dock_window_factory_image_changed (GimpContext *context,
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
gimp_dock_window_image_changed (GimpDockWindow *dock_window,
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