app: Update docks with new context when switching to window modes

When moving dockables from a dock window to an image window, they need
to start listening to the user context. So update the dockables with
the new context when we switch window mode.
This commit is contained in:
Martin Nordholts 2010-01-06 13:33:47 +01:00
parent eae77112e1
commit 3015b0d0d0
5 changed files with 57 additions and 0 deletions

View File

@ -373,6 +373,29 @@ gimp_dock_invalidate_geometry (GimpDock *dock)
g_signal_emit (dock, dock_signals[GEOMETRY_INVALIDATED], 0);
}
/**
* gimp_dock_update_with_context:
* @dock:
* @context:
*
* Set the @context on all dockables in the @dock.
**/
void
gimp_dock_update_with_context (GimpDock *dock,
GimpContext *context)
{
GList *iter = NULL;
for (iter = gimp_dock_get_dockbooks (dock);
iter;
iter = g_list_next (iter))
{
GimpDockbook *dockbook = GIMP_DOCKBOOK (iter->data);
gimp_dockbook_update_with_context (dockbook, context);
}
}
/**
* gimp_dock_get_context:
* @dock:

View File

@ -71,6 +71,8 @@ void gimp_dock_invalidate_title (GimpDock *dock);
void gimp_dock_set_host_geometry_hints (GimpDock *dock,
GtkWindow *window);
void gimp_dock_invalidate_geometry (GimpDock *dock);
void gimp_dock_update_with_context (GimpDock *dock,
GimpContext *context);
GimpContext * gimp_dock_get_context (GimpDock *dock);
GimpDialogFactory * gimp_dock_get_dialog_factory (GimpDock *dock);
GimpUIManager * gimp_dock_get_ui_manager (GimpDock *dock);

View File

@ -545,6 +545,32 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
g_list_free (children);
}
/**
* gimp_dockbook_update_with_context:
* @dockbook:
* @context:
*
* Set @context on all dockables in @dockbook.
**/
void
gimp_dockbook_update_with_context (GimpDockbook *dockbook,
GimpContext *context)
{
GList *children = gtk_container_get_children (GTK_CONTAINER (dockbook));
GList *iter = NULL;
for (iter = children;
iter;
iter = g_list_next (iter))
{
GimpDockable *dockable = GIMP_DOCKABLE (iter->data);
gimp_dockable_set_context (dockable, context);
}
g_list_free (children);
}
GtkWidget *
gimp_dockbook_create_tab_widget (GimpDockbook *dockbook,
GimpDockable *dockable)

View File

@ -70,6 +70,8 @@ void gimp_dockbook_add (GimpDockbook *dockbo
gint position);
void gimp_dockbook_remove (GimpDockbook *dockbook,
GimpDockable *dockable);
void gimp_dockbook_update_with_context (GimpDockbook *dockbook,
GimpContext *context);
GtkWidget * gimp_dockbook_create_tab_widget (GimpDockbook *dockbook,
GimpDockable *dockable);
gboolean gimp_dockbook_drop_dockable (GimpDockbook *dockbook,

View File

@ -202,6 +202,8 @@ gimp_dock_columns_add_dock (GimpDockColumns *dock_columns,
dock_columns->p->docks = g_list_append (dock_columns->p->docks, dock);
gimp_dock_update_with_context (dock, dock_columns->p->context);
gimp_paned_box_add_widget (GIMP_PANED_BOX (dock_columns->p->paned_hbox),
GTK_WIDGET (dock),
index);
@ -226,6 +228,8 @@ gimp_dock_columns_remove_dock (GimpDockColumns *dock_columns,
dock_columns->p->docks = g_list_remove (dock_columns->p->docks, dock);
gimp_dock_update_with_context (dock, NULL);
g_signal_handlers_disconnect_by_func (dock,
gimp_dock_columns_dock_book_removed,
dock_columns);