Commit 35c16876 authored by Martin Nordholts's avatar Martin Nordholts

app/widgets/gimpcontainertreeview.[ch] Make the renderer_cells and

* app/widgets/gimpcontainertreeview.[ch]
* app/widgets/gimpcontainertreeview-private.h: Make the
renderer_cells and toggle_cells members private.

(gimp_container_tree_view_set_main_column_title)
(gimp_container_tree_view_prepend_toggle_cell_renderer)
(gimp_container_tree_view_prepend_cell_renderer): New interface.

* app/widgets/gimptoolview.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpcontrollerlist.c: Use new interface.

svn path=/trunk/; revision=27675
parent 176f4c56
2008-11-16 Martin Nordholts <martinn@svn.gnome.org>
* app/widgets/gimpcontainertreeview.[ch]
* app/widgets/gimpcontainertreeview-private.h: Make the
renderer_cells and toggle_cells members private.
(gimp_container_tree_view_set_main_column_title)
(gimp_container_tree_view_prepend_toggle_cell_renderer)
(gimp_container_tree_view_prepend_cell_renderer): New interface.
* app/widgets/gimptoolview.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpcontrollerlist.c: Use new interface.
2008-11-16 Michael Natterer <mitch@gimp.org>
* app/dialogs/module-dialog.c
......
......@@ -25,19 +25,22 @@
struct _GimpContainerTreeViewPriv
{
GtkTreeSelection *selection;
GtkTreeSelection *selection;
GtkCellRenderer *name_cell;
GtkCellRenderer *name_cell;
GList *editable_cells;
GList *editable_cells;
GimpViewRenderer *dnd_renderer;
GimpViewRenderer *dnd_renderer;
guint scroll_timeout_id;
guint scroll_timeout_interval;
GdkScrollDirection scroll_dir;
GList *toggle_cells;
GList *renderer_cells;
gboolean dnd_drop_to_empty;
guint scroll_timeout_id;
guint scroll_timeout_interval;
GdkScrollDirection scroll_dir;
gboolean dnd_drop_to_empty;
};
......
......@@ -238,8 +238,8 @@ gimp_container_tree_view_constructor (GType type,
G_CALLBACK (gimp_container_tree_view_name_canceled),
tree_view);
tree_view->renderer_cells = g_list_prepend (tree_view->renderer_cells,
tree_view->renderer_cell);
tree_view->priv->renderer_cells = g_list_prepend (tree_view->priv->renderer_cells,
tree_view->renderer_cell);
tree_view->priv->selection = gtk_tree_view_get_selection (tree_view->view);
......@@ -272,16 +272,16 @@ gimp_container_tree_view_finalize (GObject *object)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (object);
if (tree_view->toggle_cells)
if (tree_view->priv->toggle_cells)
{
g_list_free (tree_view->toggle_cells);
tree_view->toggle_cells = NULL;
g_list_free (tree_view->priv->toggle_cells);
tree_view->priv->toggle_cells = NULL;
}
if (tree_view->renderer_cells)
if (tree_view->priv->renderer_cells)
{
g_list_free (tree_view->renderer_cells);
tree_view->renderer_cells = NULL;
g_list_free (tree_view->priv->renderer_cells);
tree_view->priv->renderer_cells = NULL;
}
if (tree_view->priv->editable_cells)
......@@ -395,6 +395,38 @@ gimp_container_tree_view_new (GimpContainer *container,
return GTK_WIDGET (tree_view);
}
void
gimp_container_tree_view_set_main_column_title (GimpContainerTreeView *tree_view,
const gchar *title)
{
g_return_if_fail (GIMP_IS_CONTAINER_TREE_VIEW (tree_view));
gtk_tree_view_column_set_title (tree_view->main_column,
title);
}
void
gimp_container_tree_view_prepend_toggle_cell_renderer (GimpContainerTreeView *tree_view,
GtkCellRenderer *cell_renderer)
{
g_return_if_fail (GIMP_IS_CONTAINER_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell_renderer));
tree_view->priv->toggle_cells = g_list_prepend (tree_view->priv->toggle_cells,
cell_renderer);
}
void
gimp_container_tree_view_prepend_cell_renderer (GimpContainerTreeView *tree_view,
GtkCellRenderer *cell_renderer)
{
g_return_if_fail (GIMP_IS_CONTAINER_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell_renderer));
tree_view->priv->renderer_cells = g_list_prepend (tree_view->priv->renderer_cells,
cell_renderer);
}
void
gimp_container_tree_view_set_dnd_drop_to_empty (GimpContainerTreeView *tree_view,
gboolean dnd_drop_to_empty)
......@@ -590,7 +622,7 @@ gimp_container_tree_view_remove_item (GimpContainerView *view,
{
GList *list;
for (list = tree_view->renderer_cells; list; list = list->next)
for (list = tree_view->priv->renderer_cells; list; list = list->next)
g_object_set (list->data, "renderer", NULL, NULL);
}
}
......@@ -750,7 +782,7 @@ gimp_container_tree_view_clear_items (GimpContainerView *view)
{
GList *list;
for (list = tree_view->renderer_cells; list; list = list->next)
for (list = tree_view->priv->renderer_cells; list; list = list->next)
g_object_set (list->data, "renderer", NULL, NULL);
}
......@@ -793,7 +825,7 @@ gimp_container_tree_view_set_view_size (GimpContainerView *view)
if (! tree_widget)
return;
for (list = tree_view->toggle_cells; list; list = g_list_next (list))
for (list = tree_view->priv->toggle_cells; list; list = g_list_next (list))
{
gchar *stock_id;
GtkIconSize icon_size;
......@@ -952,14 +984,14 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
toggled_cell = (GimpCellRendererToggle *)
gimp_container_tree_view_find_click_cell (widget,
tree_view->toggle_cells,
tree_view->priv->toggle_cells,
column, &column_area,
bevent->x, bevent->y);
if (! toggled_cell)
clicked_cell = (GimpCellRendererViewable *)
gimp_container_tree_view_find_click_cell (widget,
tree_view->renderer_cells,
tree_view->priv->renderer_cells,
column, &column_area,
bevent->x, bevent->y);
......
......@@ -59,9 +59,6 @@ struct _GimpContainerTreeView
GtkTreeViewColumn *main_column;
GtkCellRenderer *renderer_cell;
GList *toggle_cells;
GList *renderer_cells;
Gimp *dnd_gimp; /* eek */
GimpContainerTreeViewPriv *priv;
......@@ -114,6 +111,18 @@ GtkWidget * gimp_container_tree_view_new (GimpContainer *container,
gint view_size,
gint view_border_width);
void gimp_container_tree_view_set_main_column_title
(GimpContainerTreeView *tree_view,
const gchar *title);
void gimp_container_tree_view_prepend_toggle_cell_renderer
(GimpContainerTreeView *tree_view,
GtkCellRenderer *cell_renderer);
void gimp_container_tree_view_prepend_cell_renderer
(GimpContainerTreeView *tree_view,
GtkCellRenderer *cell_renderer);
void gimp_container_tree_view_set_dnd_drop_to_empty
(GimpContainerTreeView *tree_view,
gboolean dnd_drop_to_emtpy);
......
......@@ -270,8 +270,8 @@ gimp_controller_list_init (GimpControllerList *list)
icon_size, &icon_width, &icon_height);
list->dest = gimp_container_tree_view_new (NULL, NULL, icon_height, 0);
gtk_tree_view_column_set_title (GIMP_CONTAINER_TREE_VIEW (list->dest)->main_column,
_("Active Controllers"));
gimp_container_tree_view_set_main_column_title (GIMP_CONTAINER_TREE_VIEW (list->dest),
_("Active Controllers"));
gtk_tree_view_set_headers_visible (GIMP_CONTAINER_TREE_VIEW (list->dest)->view,
TRUE);
gtk_box_pack_start (GTK_BOX (list->hbox), list->dest, TRUE, TRUE, 0);
......
......@@ -298,8 +298,8 @@ gimp_item_tree_view_constructor (GType type,
item_view->model_column_visible,
NULL);
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
item_view->eye_cell);
gimp_container_tree_view_prepend_toggle_cell_renderer (tree_view,
item_view->eye_cell);
g_signal_connect (item_view->eye_cell, "clicked",
G_CALLBACK (gimp_item_tree_view_eye_clicked),
......@@ -315,8 +315,8 @@ gimp_item_tree_view_constructor (GType type,
item_view->model_column_linked,
NULL);
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
item_view->chain_cell);
gimp_container_tree_view_prepend_toggle_cell_renderer (tree_view,
item_view->chain_cell);
g_signal_connect (item_view->chain_cell, "clicked",
G_CALLBACK (gimp_item_tree_view_chain_clicked),
......
......@@ -364,8 +364,8 @@ gimp_layer_tree_view_constructor (GType type,
layer_view->model_column_mask_visible,
NULL);
tree_view->renderer_cells = g_list_prepend (tree_view->renderer_cells,
layer_view->mask_cell);
gimp_container_tree_view_prepend_cell_renderer (tree_view,
layer_view->mask_cell);
g_signal_connect (tree_view->renderer_cell, "clicked",
G_CALLBACK (gimp_layer_tree_view_layer_clicked),
......
......@@ -179,8 +179,8 @@ gimp_tool_view_new (GimpViewType view_type,
tree_view,
NULL);
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
eye_cell);
gimp_container_tree_view_prepend_toggle_cell_renderer (tree_view,
eye_cell);
g_signal_connect (eye_cell, "clicked",
G_CALLBACK (gimp_tool_view_eye_clicked),
......
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