gimp r27662 - in trunk: . app/widgets
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27662 - in trunk: . app/widgets
- Date: Sat, 15 Nov 2008 18:08:50 +0000 (UTC)
Author: martinn
Date: Sat Nov 15 18:08:50 2008
New Revision: 27662
URL: http://svn.gnome.org/viewvc/gimp?rev=27662&view=rev
Log:
* app/widgets/gimpcontainertreeview.[ch]: Don't expose class
instance struct members that is currently only used within the
GimpContainerTreeView implementation.
* app/widgets/gimpcontainertreeview-private.h: New file containing
the definition of the private struct.
* app/widgets/gimpcontainertreeview-dnd.c: Change accordingly.
* app/widgets/Makefile.am: Add new file.
Added:
trunk/app/widgets/gimpcontainertreeview-private.h
Modified:
trunk/ChangeLog
trunk/app/widgets/Makefile.am
trunk/app/widgets/gimpcontainertreeview-dnd.c
trunk/app/widgets/gimpcontainertreeview.c
trunk/app/widgets/gimpcontainertreeview.h
Modified: trunk/app/widgets/Makefile.am
==============================================================================
--- trunk/app/widgets/Makefile.am (original)
+++ trunk/app/widgets/Makefile.am Sat Nov 15 18:08:50 2008
@@ -83,6 +83,7 @@
gimpcontainertreeview.h \
gimpcontainertreeview-dnd.c \
gimpcontainertreeview-dnd.h \
+ gimpcontainertreeview-private.h \
gimpcontainerview.c \
gimpcontainerview.h \
gimpcontainerview-utils.c \
Modified: trunk/app/widgets/gimpcontainertreeview-dnd.c
==============================================================================
--- trunk/app/widgets/gimpcontainertreeview-dnd.c (original)
+++ trunk/app/widgets/gimpcontainertreeview-dnd.c Sat Nov 15 18:08:50 2008
@@ -30,6 +30,7 @@
#include "gimpcontainertreeview.h"
#include "gimpcontainertreeview-dnd.h"
+#include "gimpcontainertreeview-private.h"
#include "gimpcontainerview.h"
#include "gimpdnd.h"
#include "gimpviewrenderer.h"
@@ -184,7 +185,7 @@
g_print ("scroll_timeout: scrolling by %d\n", SCROLL_STEP);
#endif
- if (tree_view->scroll_dir == GDK_SCROLL_UP)
+ if (tree_view->priv->scroll_dir == GDK_SCROLL_UP)
new_value = gtk_adjustment_get_value (adj) - SCROLL_STEP;
else
new_value = gtk_adjustment_get_value (adj) + SCROLL_STEP;
@@ -193,12 +194,12 @@
gtk_adjustment_set_value (adj, new_value);
- if (tree_view->scroll_timeout_id)
+ if (tree_view->priv->scroll_timeout_id)
{
- g_source_remove (tree_view->scroll_timeout_id);
+ g_source_remove (tree_view->priv->scroll_timeout_id);
- tree_view->scroll_timeout_id =
- g_timeout_add (tree_view->scroll_timeout_interval,
+ tree_view->priv->scroll_timeout_id =
+ g_timeout_add (tree_view->priv->scroll_timeout_interval,
gimp_container_tree_view_scroll_timeout,
tree_view);
}
@@ -212,10 +213,10 @@
guint time,
GimpContainerTreeView *tree_view)
{
- if (tree_view->scroll_timeout_id)
+ if (tree_view->priv->scroll_timeout_id)
{
- g_source_remove (tree_view->scroll_timeout_id);
- tree_view->scroll_timeout_id = 0;
+ g_source_remove (tree_view->priv->scroll_timeout_id);
+ tree_view->priv->scroll_timeout_id = 0;
}
gtk_tree_view_set_drag_dest_row (tree_view->view, NULL, 0);
@@ -238,32 +239,32 @@
if (y < SCROLL_DISTANCE)
{
- tree_view->scroll_dir = GDK_SCROLL_UP;
+ tree_view->priv->scroll_dir = GDK_SCROLL_UP;
distance = MIN (-y, -1);
}
else
{
- tree_view->scroll_dir = GDK_SCROLL_DOWN;
+ tree_view->priv->scroll_dir = GDK_SCROLL_DOWN;
distance = MAX (widget->allocation.height - y, 1);
}
- tree_view->scroll_timeout_interval = SCROLL_INTERVAL * ABS (distance);
+ tree_view->priv->scroll_timeout_interval = SCROLL_INTERVAL * ABS (distance);
#ifdef SCROLL_DEBUG
g_print ("drag_motion: scroll_distance = %d scroll_interval = %d\n",
- distance, tree_view->scroll_timeout_interval);
+ distance, tree_view->priv->scroll_timeout_interval);
#endif
- if (! tree_view->scroll_timeout_id)
- tree_view->scroll_timeout_id =
- g_timeout_add (tree_view->scroll_timeout_interval,
+ if (! tree_view->priv->scroll_timeout_id)
+ tree_view->priv->scroll_timeout_id =
+ g_timeout_add (tree_view->priv->scroll_timeout_interval,
gimp_container_tree_view_scroll_timeout,
tree_view);
}
- else if (tree_view->scroll_timeout_id)
+ else if (tree_view->priv->scroll_timeout_id)
{
- g_source_remove (tree_view->scroll_timeout_id);
- tree_view->scroll_timeout_id = 0;
+ g_source_remove (tree_view->priv->scroll_timeout_id);
+ tree_view->priv->scroll_timeout_id = 0;
}
if (gimp_container_tree_view_drop_status (tree_view,
@@ -297,10 +298,10 @@
GdkAtom target;
GtkTreeViewDropPosition drop_pos;
- if (tree_view->scroll_timeout_id)
+ if (tree_view->priv->scroll_timeout_id)
{
- g_source_remove (tree_view->scroll_timeout_id);
- tree_view->scroll_timeout_id = 0;
+ g_source_remove (tree_view->priv->scroll_timeout_id);
+ tree_view->priv->scroll_timeout_id = 0;
}
if (gimp_container_tree_view_drop_status (tree_view,
Added: trunk/app/widgets/gimpcontainertreeview-private.h
==============================================================================
--- (empty file)
+++ trunk/app/widgets/gimpcontainertreeview-private.h Sat Nov 15 18:08:50 2008
@@ -0,0 +1,84 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpcontainertreeview-private.h
+ * Copyright (C) 2003-2004 Michael Natterer <mitch gimp org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_CONTAINER_TREE_VIEW_PRIVATE_H__
+#define __GIMP_CONTAINER_TREE_VIEW_PRIVATE_H__
+
+
+struct _GimpContainerTreeViewPriv
+{
+ GtkTreeSelection *selection;
+
+ GtkCellRenderer *name_cell;
+
+ GList *editable_cells;
+
+ GimpViewRenderer *dnd_renderer;
+
+ guint scroll_timeout_id;
+ guint scroll_timeout_interval;
+ GdkScrollDirection scroll_dir;
+};
+
+
+#endif /* __GIMP_CONTAINER_TREE_VIEW_PRIVATE_H__ */
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpcontainertreeview-private.h
+ * Copyright (C) 2003-2004 Michael Natterer <mitch gimp org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_CONTAINER_TREE_VIEW_PRIVATE_H__
+#define __GIMP_CONTAINER_TREE_VIEW_PRIVATE_H__
+
+
+struct _GimpContainerTreeViewPriv
+{
+ GtkTreeSelection *selection;
+
+ GtkCellRenderer *name_cell;
+
+ GList *editable_cells;
+
+ GimpViewRenderer *dnd_renderer;
+
+ guint scroll_timeout_id;
+ guint scroll_timeout_interval;
+ GdkScrollDirection scroll_dir;
+};
+
+
+#endif /* __GIMP_CONTAINER_TREE_VIEW_PRIVATE_H__ */
Modified: trunk/app/widgets/gimpcontainertreeview.c
==============================================================================
--- trunk/app/widgets/gimpcontainertreeview.c (original)
+++ trunk/app/widgets/gimpcontainertreeview.c Sat Nov 15 18:08:50 2008
@@ -36,6 +36,8 @@
#include "gimpcellrendererviewable.h"
#include "gimpcontainertreeview.h"
#include "gimpcontainertreeview-dnd.h"
+#include "gimpcontainertreeview.h"
+#include "gimpcontainertreeview-private.h"
#include "gimpcontainerview.h"
#include "gimpdnd.h"
#include "gimpviewrenderer.h"
@@ -137,6 +139,8 @@
klass->drop_svg = NULL;
klass->drop_component = NULL;
klass->drop_pixbuf = NULL;
+
+ g_type_class_add_private (klass, sizeof (GimpContainerTreeViewPriv));
}
static void
@@ -162,6 +166,10 @@
{
GimpContainerBox *box = GIMP_CONTAINER_BOX (tree_view);
+ tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_view,
+ GIMP_TYPE_CONTAINER_TREE_VIEW,
+ GimpContainerTreeViewPriv);
+
tree_view->n_model_columns = NUM_COLUMNS;
tree_view->model_columns[COLUMN_RENDERER] = GIMP_TYPE_VIEW_RENDERER;
@@ -227,28 +235,28 @@
"renderer", COLUMN_RENDERER,
NULL);
- tree_view->name_cell = gtk_cell_renderer_text_new ();
- g_object_set (tree_view->name_cell, "xalign", 0.0, NULL);
+ tree_view->priv->name_cell = gtk_cell_renderer_text_new ();
+ g_object_set (tree_view->priv->name_cell, "xalign", 0.0, NULL);
gtk_tree_view_column_pack_end (tree_view->main_column,
- tree_view->name_cell,
+ tree_view->priv->name_cell,
FALSE);
gtk_tree_view_column_set_attributes (tree_view->main_column,
- tree_view->name_cell,
+ tree_view->priv->name_cell,
"text", COLUMN_NAME,
"attributes", COLUMN_NAME_ATTRIBUTES,
NULL);
- g_signal_connect (tree_view->name_cell, "editing-canceled",
+ g_signal_connect (tree_view->priv->name_cell, "editing-canceled",
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->selection = gtk_tree_view_get_selection (tree_view->view);
+ tree_view->priv->selection = gtk_tree_view_get_selection (tree_view->view);
- g_signal_connect (tree_view->selection, "changed",
+ g_signal_connect (tree_view->priv->selection, "changed",
G_CALLBACK (gimp_container_tree_view_selection_changed),
tree_view);
@@ -289,10 +297,10 @@
tree_view->renderer_cells = NULL;
}
- if (tree_view->editable_cells)
+ if (tree_view->priv->editable_cells)
{
- g_list_free (tree_view->editable_cells);
- tree_view->editable_cells = NULL;
+ g_list_free (tree_view->priv->editable_cells);
+ tree_view->priv->editable_cells = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -303,10 +311,10 @@
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (widget);
- if (tree_view->scroll_timeout_id)
+ if (tree_view->priv->scroll_timeout_id)
{
- g_source_remove (tree_view->scroll_timeout_id);
- tree_view->scroll_timeout_id = 0;
+ g_source_remove (tree_view->priv->scroll_timeout_id);
+ tree_view->priv->scroll_timeout_id = 0;
}
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
@@ -330,7 +338,7 @@
*y += widget->allocation.y;
}
- if (gtk_tree_selection_get_selected (tree_view->selection, NULL,
+ if (gtk_tree_selection_get_selected (tree_view->priv->selection, NULL,
&selected_iter))
{
GtkTreePath *path;
@@ -408,16 +416,16 @@
g_return_if_fail (GIMP_IS_CONTAINER_TREE_VIEW (tree_view));
g_return_if_fail (callback != NULL);
- g_object_set (tree_view->name_cell,
+ g_object_set (tree_view->priv->name_cell,
"mode", GTK_CELL_RENDERER_MODE_EDITABLE,
"editable", TRUE,
NULL);
- if (! g_list_find (tree_view->editable_cells, tree_view->name_cell))
- tree_view->editable_cells = g_list_prepend (tree_view->editable_cells,
- tree_view->name_cell);
+ if (! g_list_find (tree_view->priv->editable_cells, tree_view->priv->name_cell))
+ tree_view->priv->editable_cells = g_list_prepend (tree_view->priv->editable_cells,
+ tree_view->priv->name_cell);
- g_signal_connect (tree_view->name_cell, "edited",
+ g_signal_connect (tree_view->priv->name_cell, "edited",
callback,
data);
}
@@ -610,7 +618,7 @@
container = gimp_container_view_get_container (view);
- selected = gtk_tree_selection_get_selected (tree_view->selection,
+ selected = gtk_tree_selection_get_selected (tree_view->priv->selection,
NULL, &selected_iter);
if (selected)
@@ -709,13 +717,13 @@
path = gtk_tree_model_get_path (tree_view->model, iter);
- g_signal_handlers_block_by_func (tree_view->selection,
+ g_signal_handlers_block_by_func (tree_view->priv->selection,
gimp_container_tree_view_selection_changed,
tree_view);
gtk_tree_view_set_cursor (tree_view->view, path, NULL, FALSE);
- g_signal_handlers_unblock_by_func (tree_view->selection,
+ g_signal_handlers_unblock_by_func (tree_view->priv->selection,
gimp_container_tree_view_selection_changed,
tree_view);
@@ -726,7 +734,7 @@
}
else
{
- gtk_tree_selection_unselect_all (tree_view->selection);
+ gtk_tree_selection_unselect_all (tree_view->priv->selection);
}
return TRUE;
@@ -826,7 +834,7 @@
{
GtkTreeIter iter;
- if (gtk_tree_selection_get_selected (tree_view->selection, NULL, &iter))
+ if (gtk_tree_selection_get_selected (tree_view->priv->selection, NULL, &iter))
{
GimpViewRenderer *renderer;
gchar *name;
@@ -914,7 +922,7 @@
GtkTreeViewColumn *column;
GtkTreePath *path;
- tree_view->dnd_renderer = NULL;
+ tree_view->priv->dnd_renderer = NULL;
if (! GTK_WIDGET_HAS_FOCUS (widget))
gtk_widget_grab_focus (widget);
@@ -936,7 +944,7 @@
COLUMN_RENDERER, &renderer,
-1);
- tree_view->dnd_renderer = renderer;
+ tree_view->priv->dnd_renderer = renderer;
gtk_tree_view_get_background_area (tree_view->view, path,
column, &column_area);
@@ -962,7 +970,7 @@
if (! toggled_cell && ! clicked_cell)
edit_cell =
gimp_container_tree_view_find_click_cell (widget,
- tree_view->editable_cells,
+ tree_view->priv->editable_cells,
column, &column_area,
bevent->x, bevent->y);
@@ -1025,7 +1033,7 @@
{
if (edit_cell)
{
- if (edit_cell == tree_view->name_cell)
+ if (edit_cell == tree_view->priv->name_cell)
{
const gchar *real_name;
@@ -1179,8 +1187,8 @@
if (context)
*context = gimp_container_view_get_context (GIMP_CONTAINER_VIEW (data));
- if (tree_view->dnd_renderer)
- return tree_view->dnd_renderer->viewable;
+ if (tree_view->priv->dnd_renderer)
+ return tree_view->priv->dnd_renderer->viewable;
return NULL;
}
@@ -1190,7 +1198,7 @@
gpointer data)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (data);
- GimpViewRenderer *renderer = tree_view->dnd_renderer;
+ GimpViewRenderer *renderer = tree_view->priv->dnd_renderer;
gint width;
gint height;
Modified: trunk/app/widgets/gimpcontainertreeview.h
==============================================================================
--- trunk/app/widgets/gimpcontainertreeview.h (original)
+++ trunk/app/widgets/gimpcontainertreeview.h Sat Nov 15 18:08:50 2008
@@ -35,37 +35,32 @@
typedef struct _GimpContainerTreeViewClass GimpContainerTreeViewClass;
+typedef struct _GimpContainerTreeViewPriv GimpContainerTreeViewPriv;
struct _GimpContainerTreeView
{
- GimpContainerBox parent_instance;
+ GimpContainerBox parent_instance;
- GtkTreeModel *model;
- gint n_model_columns;
- GType model_columns[16];
-
- gint model_column_renderer;
- gint model_column_name;
- gint model_column_name_attributes;
-
- GtkTreeView *view;
- GtkTreeSelection *selection;
-
- GtkTreeViewColumn *main_column;
- GtkCellRenderer *renderer_cell;
- GtkCellRenderer *name_cell;
-
- GList *toggle_cells;
- GList *renderer_cells;
- GList *editable_cells;
-
- gboolean dnd_drop_to_empty;
- Gimp *dnd_gimp; /* eek */
- GimpViewRenderer *dnd_renderer;
-
- guint scroll_timeout_id;
- guint scroll_timeout_interval;
- GdkScrollDirection scroll_dir;
+ GtkTreeModel *model;
+ gint n_model_columns;
+ GType model_columns[16];
+
+ gint model_column_renderer;
+ gint model_column_name;
+ gint model_column_name_attributes;
+
+ GtkTreeView *view;
+
+ GtkTreeViewColumn *main_column;
+ GtkCellRenderer *renderer_cell;
+
+ GList *toggle_cells;
+ GList *renderer_cells;
+
+ gboolean dnd_drop_to_empty;
+ Gimp *dnd_gimp; /* eek */
+
+ GimpContainerTreeViewPriv *priv;
};
struct _GimpContainerTreeViewClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]