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.
This commit is contained in:
committed by
Michael Natterer
parent
c1456a3371
commit
875342af5d
@ -48,7 +48,6 @@
|
||||
|
||||
|
||||
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,
|
||||
guint n_params,
|
||||
@ -66,23 +65,19 @@ static void gimp_channel_tree_view_set_image (GimpItemTreeView *item_v
|
||||
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 (GimpDocked *docked,
|
||||
static void gimp_channel_tree_view_set_context (GimpContainerView *view,
|
||||
GimpContext *context);
|
||||
static void gimp_channel_tree_view_set_view_size (GimpContainerView *view);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpChannelTreeView, gimp_channel_tree_view,
|
||||
GIMP_TYPE_DRAWABLE_TREE_VIEW,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONTAINER_VIEW,
|
||||
gimp_channel_tree_view_view_iface_init)
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
|
||||
gimp_channel_tree_view_docked_iface_init))
|
||||
gimp_channel_tree_view_view_iface_init))
|
||||
|
||||
#define parent_class gimp_channel_tree_view_parent_class
|
||||
|
||||
static GimpContainerViewInterface *parent_view_iface = NULL;
|
||||
static GimpDockedInterface *parent_docked_iface = NULL;
|
||||
static GimpContainerViewInterface *parent_view_iface = NULL;
|
||||
|
||||
|
||||
static void
|
||||
@ -129,17 +124,10 @@ gimp_channel_tree_view_view_iface_init (GimpContainerViewInterface *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;
|
||||
}
|
||||
|
||||
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
|
||||
gimp_channel_tree_view_init (GimpChannelTreeView *view)
|
||||
{
|
||||
@ -295,7 +283,7 @@ gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
gimp_component_editor_new (view_size,
|
||||
GIMP_EDITOR (item_view)->menu_factory);
|
||||
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,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_reorder_child (GTK_BOX (item_view),
|
||||
@ -340,6 +328,19 @@ gimp_channel_tree_view_item_new (GimpImage *image)
|
||||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static void
|
||||
gimp_channel_tree_view_set_context (GimpContainerView *view,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (view);
|
||||
|
||||
parent_view_iface->set_context (view, context);
|
||||
|
||||
if (channel_view->component_editor)
|
||||
gimp_docked_set_context (GIMP_DOCKED (channel_view->component_editor),
|
||||
context);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_tree_view_set_view_size (GimpContainerView *view)
|
||||
{
|
||||
@ -354,19 +355,3 @@ gimp_channel_tree_view_set_view_size (GimpContainerView *view)
|
||||
gimp_component_editor_set_view_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
|
||||
view_size);
|
||||
}
|
||||
|
||||
|
||||
/* GimpDocked methods */
|
||||
|
||||
static void
|
||||
gimp_channel_tree_view_set_context (GimpDocked *docked,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpChannelTreeView *channel_view = GIMP_CHANNEL_TREE_VIEW (docked);
|
||||
|
||||
parent_docked_iface->set_context (docked, context);
|
||||
|
||||
if (channel_view->component_editor)
|
||||
gimp_docked_set_context (GIMP_DOCKED (channel_view->component_editor),
|
||||
context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user