Commit 875342af authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

support setting a context even if the viewed container's children_type is

2006-08-31  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainerview.c
	(gimp_container_view_real_set_container)
	(gimp_container_view_real_set_context)
	(gimp_container_view_item_selected)
	(gimp_container_view_thaw): support setting a context even if
	the viewed container's children_type is *not* a property of
	GimpContext. This removes a major restriction of container
	views and allows to get rid of some hacks:

	* app/widgets/gimpitemtreeview.[ch]: removed GimpContext member
	and implement GimpContainerView::set_context() instead of
	GimpDocked::set_context().

	* app/widgets/gimpchanneltreeview.c
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimpdrawabletreeview.c
	* app/widgets/gimplayertreeview.c: use GimpContainerView's context
	instead of GimpItemTreeView's and implement GimpContainerView's
	set_context() instead of GimpDocked's.

	* app/actions/actions.c (action_data_get_gimp)
	(action_data_get_context): don't special-case GimpItemTreeView any
	more, it's just like a normal GimpContainerView now.

	* app/widgets/gimpcontrollerlist.c
	(gimp_controller_list_constructor): set a context on the
	GimpContainerView so its renderers have a context to use.
parent c1456a33
2006-08-31 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainerview.c
(gimp_container_view_real_set_container)
(gimp_container_view_real_set_context)
(gimp_container_view_item_selected)
(gimp_container_view_thaw): support setting a context even if
the viewed container's children_type is *not* a property of
GimpContext. This removes a major restriction of container
views and allows to get rid of some hacks:
* app/widgets/gimpitemtreeview.[ch]: removed GimpContext member
and implement GimpContainerView::set_context() instead of
GimpDocked::set_context().
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimpcontainergridview.c
* app/widgets/gimpcontainertreeview.c
* app/widgets/gimpdrawabletreeview.c
* app/widgets/gimplayertreeview.c: use GimpContainerView's context
instead of GimpItemTreeView's and implement GimpContainerView's
set_context() instead of GimpDocked's.
* app/actions/actions.c (action_data_get_gimp)
(action_data_get_context): don't special-case GimpItemTreeView any
more, it's just like a normal GimpContainerView now.
* app/widgets/gimpcontrollerlist.c
(gimp_controller_list_constructor): set a context on the
GimpContainerView so its renderers have a context to use.
2006-08-31 Michael Natterer <mitch@gimp.org> 2006-08-31 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpthumbbox.[ch]: remember the context passed to * app/widgets/gimpthumbbox.[ch]: remember the context passed to
......
...@@ -256,8 +256,6 @@ action_data_get_gimp (gpointer data) ...@@ -256,8 +256,6 @@ action_data_get_gimp (gpointer data)
return data; return data;
else if (GIMP_IS_DOCK (data)) else if (GIMP_IS_DOCK (data))
context = ((GimpDock *) data)->context; context = ((GimpDock *) data)->context;
else if (GIMP_IS_ITEM_TREE_VIEW (data))
context = ((GimpItemTreeView *) data)->context;
else if (GIMP_IS_CONTAINER_VIEW (data)) else if (GIMP_IS_CONTAINER_VIEW (data))
context = gimp_container_view_get_context ((GimpContainerView *) data); context = gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data)) else if (GIMP_IS_CONTAINER_EDITOR (data))
...@@ -285,8 +283,6 @@ action_data_get_context (gpointer data) ...@@ -285,8 +283,6 @@ action_data_get_context (gpointer data)
return gimp_get_user_context (data); return gimp_get_user_context (data);
else if (GIMP_IS_DOCK (data)) else if (GIMP_IS_DOCK (data))
return ((GimpDock *) data)->context; return ((GimpDock *) data)->context;
else if (GIMP_IS_ITEM_TREE_VIEW (data))
return ((GimpItemTreeView *) data)->context;
else if (GIMP_IS_CONTAINER_VIEW (data)) else if (GIMP_IS_CONTAINER_VIEW (data))
return gimp_container_view_get_context ((GimpContainerView *) data); return gimp_container_view_get_context ((GimpContainerView *) data);
else if (GIMP_IS_CONTAINER_EDITOR (data)) else if (GIMP_IS_CONTAINER_EDITOR (data))
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
static void gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *iface); static void gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *iface);
static void gimp_channel_tree_view_docked_iface_init (GimpDockedInterface *iface);
static GObject * gimp_channel_tree_view_constructor (GType type, static GObject * gimp_channel_tree_view_constructor (GType type,
guint n_params, guint n_params,
...@@ -66,23 +65,19 @@ static void gimp_channel_tree_view_set_image (GimpItemTreeView *item_v ...@@ -66,23 +65,19 @@ static void gimp_channel_tree_view_set_image (GimpItemTreeView *item_v
GimpImage *image); GimpImage *image);
static GimpItem * gimp_channel_tree_view_item_new (GimpImage *image); static GimpItem * gimp_channel_tree_view_item_new (GimpImage *image);
static void gimp_channel_tree_view_set_view_size (GimpContainerView *view); static void gimp_channel_tree_view_set_context (GimpContainerView *view,
static void gimp_channel_tree_view_set_context (GimpDocked *docked,
GimpContext *context); GimpContext *context);
static void gimp_channel_tree_view_set_view_size (GimpContainerView *view);
G_DEFINE_TYPE_WITH_CODE (GimpChannelTreeView, gimp_channel_tree_view, G_DEFINE_TYPE_WITH_CODE (GimpChannelTreeView, gimp_channel_tree_view,
GIMP_TYPE_DRAWABLE_TREE_VIEW, GIMP_TYPE_DRAWABLE_TREE_VIEW,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW,
gimp_channel_tree_view_view_iface_init) gimp_channel_tree_view_view_iface_init))
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
gimp_channel_tree_view_docked_iface_init))
#define parent_class gimp_channel_tree_view_parent_class #define parent_class gimp_channel_tree_view_parent_class
static GimpContainerViewInterface *parent_view_iface = NULL; static GimpContainerViewInterface *parent_view_iface = NULL;
static GimpDockedInterface *parent_docked_iface = NULL;
static void static void
...@@ -129,17 +124,10 @@ gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *view_iface) ...@@ -129,17 +124,10 @@ gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *view_iface)
{ {
parent_view_iface = g_type_interface_peek_parent (view_iface); parent_view_iface = g_type_interface_peek_parent (view_iface);
view_iface->set_context = gimp_channel_tree_view_set_context;
view_iface->set_view_size = gimp_channel_tree_view_set_view_size; view_iface->set_view_size = gimp_channel_tree_view_set_view_size;
} }
static void
gimp_channel_tree_view_docked_iface_init (GimpDockedInterface *docked_iface)
{
parent_docked_iface = g_type_interface_peek_parent (docked_iface);
docked_iface->set_context = gimp_channel_tree_view_set_context;
}
static void static void
gimp_channel_tree_view_init (GimpChannelTreeView *view) gimp_channel_tree_view_init (GimpChannelTreeView *view)
{ {
...@@ -295,7 +283,7 @@ gimp_channel_tree_view_set_image (GimpItemTreeView *item_view, ...@@ -295,7 +283,7 @@ gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
gimp_component_editor_new (view_size, gimp_component_editor_new (view_size,
GIMP_EDITOR (item_view)->menu_factory); GIMP_EDITOR (item_view)->menu_factory);
gimp_docked_set_context (GIMP_DOCKED (channel_view->component_editor), gimp_docked_set_context (GIMP_DOCKED (channel_view->component_editor),
item_view->context); gimp_container_view_get_context (view));
gtk_box_pack_start (GTK_BOX (item_view), channel_view->component_editor, gtk_box_pack_start (GTK_BOX (item_view), channel_view->component_editor,
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (item_view), gtk_box_reorder_child (GTK_BOX (item_view),
...@@ -341,32 +329,29 @@ gimp_channel_tree_view_item_new (GimpImage *image) ...@@ -341,32 +329,29 @@ gimp_channel_tree_view_item_new (GimpImage *image)
/* GimpContainerView methods */ /* GimpContainerView methods */
static void static void
gimp_channel_tree_view_set_view_size (GimpContainerView *view) gimp_channel_tree_view_set_context (GimpContainerView *view,
GimpContext *context)
{ {
GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (view); GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (view);
gint view_size;
parent_view_iface->set_view_size (view); parent_view_iface->set_context (view, context);
view_size = gimp_container_view_get_view_size (view, NULL);
if (channel_view->component_editor) if (channel_view->component_editor)
gimp_component_editor_set_view_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor), gimp_docked_set_context (GIMP_DOCKED (channel_view->component_editor),
view_size); context);
} }
/* GimpDocked methods */
static void static void
gimp_channel_tree_view_set_context (GimpDocked *docked, gimp_channel_tree_view_set_view_size (GimpContainerView *view)
GimpContext *context)
{ {
GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (docked); GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (view);
gint view_size;
parent_docked_iface->set_context (docked, context); parent_view_iface->set_view_size (view);
view_size = gimp_container_view_get_view_size (view, NULL);
if (channel_view->component_editor) if (channel_view->component_editor)
gimp_docked_set_context (GIMP_DOCKED (channel_view->component_editor), gimp_component_editor_set_view_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
context); view_size);
} }
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "gimpcontainergridview.h" #include "gimpcontainergridview.h"
#include "gimpcontainerview.h" #include "gimpcontainerview.h"
#include "gimpdocked.h"
#include "gimpview.h" #include "gimpview.h"
#include "gimpviewrenderer.h" #include "gimpviewrenderer.h"
#include "gimpwidgets-utils.h" #include "gimpwidgets-utils.h"
...@@ -52,8 +51,7 @@ enum ...@@ -52,8 +51,7 @@ enum
}; };
static void gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface); static void gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface);
static void gimp_container_grid_view_docked_iface_init (GimpDockedInterface *iface);
static gboolean gimp_container_grid_view_move_cursor (GimpContainerGridView *view, static gboolean gimp_container_grid_view_move_cursor (GimpContainerGridView *view,
GtkMovementStep step, GtkMovementStep step,
...@@ -62,6 +60,8 @@ static gboolean gimp_container_grid_view_focus (GtkWidget *w ...@@ -62,6 +60,8 @@ static gboolean gimp_container_grid_view_focus (GtkWidget *w
GtkDirectionType direction); GtkDirectionType direction);
static gboolean gimp_container_grid_view_popup_menu (GtkWidget *widget); static gboolean gimp_container_grid_view_popup_menu (GtkWidget *widget);
static void gimp_container_grid_view_set_context (GimpContainerView *view,
GimpContext *context);
static gpointer gimp_container_grid_view_insert_item (GimpContainerView *view, static gpointer gimp_container_grid_view_insert_item (GimpContainerView *view,
GimpViewable *viewable, GimpViewable *viewable,
gint index); gint index);
...@@ -80,8 +80,6 @@ static gboolean gimp_container_grid_view_select_item (GimpContainerView *v ...@@ -80,8 +80,6 @@ static gboolean gimp_container_grid_view_select_item (GimpContainerView *v
gpointer insert_data); gpointer insert_data);
static void gimp_container_grid_view_clear_items (GimpContainerView *view); static void gimp_container_grid_view_clear_items (GimpContainerView *view);
static void gimp_container_grid_view_set_view_size (GimpContainerView *view); static void gimp_container_grid_view_set_view_size (GimpContainerView *view);
static void gimp_container_grid_view_set_context (GimpDocked *docked,
GimpContext *context);
static gboolean gimp_container_grid_view_item_selected(GtkWidget *widget, static gboolean gimp_container_grid_view_item_selected(GtkWidget *widget,
GdkEventButton *bevent, GdkEventButton *bevent,
...@@ -105,14 +103,11 @@ static gboolean gimp_container_grid_view_button_press (GtkWidget *w ...@@ -105,14 +103,11 @@ static gboolean gimp_container_grid_view_button_press (GtkWidget *w
G_DEFINE_TYPE_WITH_CODE (GimpContainerGridView, gimp_container_grid_view, G_DEFINE_TYPE_WITH_CODE (GimpContainerGridView, gimp_container_grid_view,
GIMP_TYPE_CONTAINER_BOX, GIMP_TYPE_CONTAINER_BOX,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW,
gimp_container_grid_view_view_iface_init) gimp_container_grid_view_view_iface_init))
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
gimp_container_grid_view_docked_iface_init))
#define parent_class gimp_container_grid_view_parent_class #define parent_class gimp_container_grid_view_parent_class
static GimpContainerViewInterface *parent_view_iface = NULL; static GimpContainerViewInterface *parent_view_iface = NULL;
static GimpDockedInterface *parent_docked_iface = NULL;
static guint grid_view_signals[LAST_SIGNAL] = { 0 }; static guint grid_view_signals[LAST_SIGNAL] = { 0 };
...@@ -170,6 +165,7 @@ gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface) ...@@ -170,6 +165,7 @@ gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface)
{ {
parent_view_iface = g_type_interface_peek_parent (iface); parent_view_iface = g_type_interface_peek_parent (iface);
iface->set_context = gimp_container_grid_view_set_context;
iface->insert_item = gimp_container_grid_view_insert_item; iface->insert_item = gimp_container_grid_view_insert_item;
iface->remove_item = gimp_container_grid_view_remove_item; iface->remove_item = gimp_container_grid_view_remove_item;
iface->reorder_item = gimp_container_grid_view_reorder_item; iface->reorder_item = gimp_container_grid_view_reorder_item;
...@@ -179,17 +175,6 @@ gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface) ...@@ -179,17 +175,6 @@ gimp_container_grid_view_view_iface_init (GimpContainerViewInterface *iface)
iface->set_view_size = gimp_container_grid_view_set_view_size; iface->set_view_size = gimp_container_grid_view_set_view_size;
} }
static void
gimp_container_grid_view_docked_iface_init (GimpDockedInterface *iface)
{
parent_docked_iface = g_type_interface_peek_parent (iface);
if (! parent_docked_iface)
parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED);
iface->set_context = gimp_container_grid_view_set_context;
}
static void static void
gimp_container_grid_view_init (GimpContainerGridView *grid_view) gimp_container_grid_view_init (GimpContainerGridView *grid_view)
{ {
...@@ -406,6 +391,25 @@ gimp_container_grid_view_popup_menu (GtkWidget *widget) ...@@ -406,6 +391,25 @@ gimp_container_grid_view_popup_menu (GtkWidget *widget)
grid_view); grid_view);
} }
static void
gimp_container_grid_view_set_context (GimpContainerView *view,
GimpContext *context)
{
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (view);
GtkWrapBoxChild *child;
parent_view_iface->set_context (view, context);
for (child = GTK_WRAP_BOX (grid_view->wrap_box)->children;
child;
child = child->next)
{
GimpView *view = GIMP_VIEW (child->widget);
gimp_view_renderer_set_context (view->renderer, context);
}
}
static gpointer static gpointer
gimp_container_grid_view_insert_item (GimpContainerView *container_view, gimp_container_grid_view_insert_item (GimpContainerView *container_view,
GimpViewable *viewable, GimpViewable *viewable,
...@@ -538,25 +542,6 @@ gimp_container_grid_view_set_view_size (GimpContainerView *view) ...@@ -538,25 +542,6 @@ gimp_container_grid_view_set_view_size (GimpContainerView *view)
gtk_widget_queue_resize (grid_view->wrap_box); gtk_widget_queue_resize (grid_view->wrap_box);
} }
static void
gimp_container_grid_view_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpContainerGridView *grid_view = GIMP_CONTAINER_GRID_VIEW (docked);
GtkWrapBoxChild *child;
parent_docked_iface->set_context (docked, context);
for (child = GTK_WRAP_BOX (grid_view->wrap_box)->children;
child;
child = child->next)
{
GimpView *view = GIMP_VIEW (child->widget);
gimp_view_renderer_set_context (view->renderer, context);
}
}
static gboolean static gboolean
gimp_container_grid_view_item_selected (GtkWidget *widget, gimp_container_grid_view_item_selected (GtkWidget *widget,
GdkEventButton *bevent, GdkEventButton *bevent,
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "gimpcontainertreeview-dnd.h" #include "gimpcontainertreeview-dnd.h"
#include "gimpcontainerview.h" #include "gimpcontainerview.h"
#include "gimpdnd.h" #include "gimpdnd.h"
#include "gimpdocked.h"
#include "gimpviewrenderer.h" #include "gimpviewrenderer.h"
#include "gimpwidgets-utils.h" #include "gimpwidgets-utils.h"
...@@ -52,8 +51,7 @@ enum ...@@ -52,8 +51,7 @@ enum
}; };
static void gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface); static void gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface);
static void gimp_container_tree_view_docked_iface_init (GimpDockedInterface *iface);
static GObject *gimp_container_tree_view_constructor (GType type, static GObject *gimp_container_tree_view_constructor (GType type,
guint n_params, guint n_params,
...@@ -65,6 +63,8 @@ static gboolean gimp_container_tree_view_popup_menu (GtkWidget *w ...@@ -65,6 +63,8 @@ static gboolean gimp_container_tree_view_popup_menu (GtkWidget *w
static void gimp_container_tree_view_set_container (GimpContainerView *view, static void gimp_container_tree_view_set_container (GimpContainerView *view,
GimpContainer *container); GimpContainer *container);
static void gimp_container_tree_view_set_context (GimpContainerView *view,
GimpContext *context);
static gpointer gimp_container_tree_view_insert_item (GimpContainerView *view, static gpointer gimp_container_tree_view_insert_item (GimpContainerView *view,
GimpViewable *viewable, GimpViewable *viewable,
gint index); gint index);
...@@ -87,9 +87,6 @@ static void gimp_container_tree_view_set_view_size (GimpContainerView *v ...@@ -87,9 +87,6 @@ static void gimp_container_tree_view_set_view_size (GimpContainerView *v
static void gimp_container_tree_view_name_canceled (GtkCellRendererText *cell, static void gimp_container_tree_view_name_canceled (GtkCellRendererText *cell,
GimpContainerTreeView *tree_view); GimpContainerTreeView *tree_view);
static void gimp_container_tree_view_set_context (GimpDocked *view,
GimpContext *context);
static void gimp_container_tree_view_selection_changed (GtkTreeSelection *sel, static void gimp_container_tree_view_selection_changed (GtkTreeSelection *sel,
GimpContainerTreeView *tree_view); GimpContainerTreeView *tree_view);
static gboolean gimp_container_tree_view_button_press (GtkWidget *widget, static gboolean gimp_container_tree_view_button_press (GtkWidget *widget,
...@@ -108,14 +105,11 @@ static GdkPixbuf * gimp_container_tree_view_drag_pixbuf (GtkWidget *w ...@@ -108,14 +105,11 @@ static GdkPixbuf * gimp_container_tree_view_drag_pixbuf (GtkWidget *w
G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view, G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view,
GIMP_TYPE_CONTAINER_BOX, GIMP_TYPE_CONTAINER_BOX,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW, G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW,
gimp_container_tree_view_view_iface_init) gimp_container_tree_view_view_iface_init))
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
gimp_container_tree_view_docked_iface_init))
#define parent_class gimp_container_tree_view_parent_class #define parent_class gimp_container_tree_view_parent_class
static GimpContainerViewInterface *parent_view_iface = NULL; static GimpContainerViewInterface *parent_view_iface = NULL;
static GimpDockedInterface *parent_docked_iface = NULL;
static void static void
...@@ -145,6 +139,7 @@ gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface) ...@@ -145,6 +139,7 @@ gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface)
parent_view_iface = g_type_interface_peek_parent (iface); parent_view_iface = g_type_interface_peek_parent (iface);
iface->set_container = gimp_container_tree_view_set_container; iface->set_container = gimp_container_tree_view_set_container;
iface->set_context = gimp_container_tree_view_set_context;
iface->insert_item = gimp_container_tree_view_insert_item; iface->insert_item = gimp_container_tree_view_insert_item;
iface->remove_item = gimp_container_tree_view_remove_item; iface->remove_item = gimp_container_tree_view_remove_item;
iface->reorder_item = gimp_container_tree_view_reorder_item; iface->reorder_item = gimp_container_tree_view_reorder_item;
...@@ -156,17 +151,6 @@ gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface) ...@@ -156,17 +151,6 @@ gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface)
iface->insert_data_free = (GDestroyNotify) g_free; iface->insert_data_free = (GDestroyNotify) g_free;
} }
static void
gimp_container_tree_view_docked_iface_init (GimpDockedInterface *iface)
{
parent_docked_iface = g_type_interface_peek_parent (iface);
if (! parent_docked_iface)
parent_docked_iface = g_type_default_interface_peek (GIMP_TYPE_DOCKED);
iface->set_context = gimp_container_tree_view_set_context;
}
static void static void
gimp_container_tree_view_init (GimpContainerTreeView *tree_view) gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
{ {
...@@ -494,6 +478,35 @@ gimp_container_tree_view_set_container (GimpContainerView *view, ...@@ -494,6 +478,35 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
parent_view_iface->set_container (view, container); parent_view_iface->set_container (view, container);
} }
static void
gimp_container_tree_view_set_context (GimpContainerView *view,
GimpContext *context)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
parent_view_iface->set_context (view, context);
if (tree_view->model)
{
GtkTreeIter iter;
gboolean iter_valid;
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter))
{
GimpViewRenderer *renderer;
gtk_tree_model_get (tree_view->model, &iter,
COLUMN_RENDERER, &renderer,
-1);
gimp_view_renderer_set_context (renderer, context);
g_object_unref (renderer);
}
}
}
static gpointer static gpointer
gimp_container_tree_view_insert_item (GimpContainerView *view, gimp_container_tree_view_insert_item (GimpContainerView *view,
GimpViewable *viewable, GimpViewable *viewable,
...@@ -760,38 +773,6 @@ gimp_container_tree_view_set_view_size (GimpContainerView *view) ...@@ -760,38 +773,6 @@ gimp_container_tree_view_set_view_size (GimpContainerView *view)
} }
/* GimpDocked methods */
static void
gimp_container_tree_view_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (docked);
parent_docked_iface->set_context (docked, context);
if (tree_view->model)
{
GtkTreeIter iter;
gboolean iter_valid;
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter))
{
GimpViewRenderer *renderer;
gtk_tree_model_get (tree_view->model, &iter,
COLUMN_RENDERER, &renderer,
-1);
gimp_view_renderer_set_context (renderer, context);
g_object_unref (renderer);
}
}
}
/* callbacks */ /* callbacks */
static void static void
......
...@@ -389,15 +389,23 @@ gimp_container_view_real_set_container (GimpContainerView *view, ...@@ -389,15 +389,23 @@ gimp_container_view_real_set_container (GimpContainerView *view,
if (private->context) if (private->context)
{ {
g_signal_handlers_disconnect_by_func (private->context, GType children_type = private->container->children_type;
gimp_container_view_context_changed, const gchar *signal_name;
view);
signal_name = gimp_context_type_to_signal_name (children_type);
if (private->dnd_widget) if (signal_name)
{ {
gtk_drag_dest_unset (private->dnd_widget); g_signal_handlers_disconnect_by_func (private->context,
gimp_dnd_viewable_dest_remove (private->dnd_widget, gimp_container_view_context_changed,
private->container->children_type); view);
if (private->dnd_widget)
{
gtk_drag_dest_unset (private->dnd_widget);
gimp_dnd_viewable_dest_remove (private->dnd_widget,
children_type);
}
} }
} }