Commit e9153bf5 authored by Martin Nordholts's avatar Martin Nordholts

Don't expose class instance struct members that is currently only used

* 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.

svn path=/trunk/; revision=27662
parent a3eb78b5
2008-11-15 Martin Nordholts <martinn@svn.gnome.org>
* 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.
2008-11-15 Martin Nordholts <martinn@svn.gnome.org>
* app/widgets/gimpcontainertreeview.h: Remove unused instance
......
......@@ -83,6 +83,7 @@ libappwidgets_a_sources = \
gimpcontainertreeview.h \
gimpcontainertreeview-dnd.c \
gimpcontainertreeview-dnd.h \
gimpcontainertreeview-private.h \
gimpcontainerview.c \
gimpcontainerview.h \
gimpcontainerview-utils.c \
......
......@@ -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 @@ gimp_container_tree_view_scroll_timeout (gpointer data)
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 @@ gimp_container_tree_view_scroll_timeout (gpointer data)
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 @@ gimp_container_tree_view_drag_leave (GtkWidget *widget,
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 @@ gimp_container_tree_view_drag_motion (GtkWidget *widget,
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 @@ gimp_container_tree_view_drag_drop (GtkWidget *widget,
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,
......
/* 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__ */
......@@ -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 @@ gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass)
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 @@ gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
{
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 @@ gimp_container_tree_view_constructor (GType type,
"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 @@ gimp_container_tree_view_finalize (GObject *object)
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 @@ gimp_container_tree_view_unmap (GtkWidget *widget)
{
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 @@ gimp_container_tree_view_menu_position (GtkMenu *menu,
*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 @@ gimp_container_tree_view_connect_name_edited (GimpContainerTreeView *tree_view,
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 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
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 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
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 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
}
else
{
gtk_tree_selection_unselect_all (tree_view->selection);
gtk_tree_selection_unselect_all (tree_view->priv->selection);
}
return TRUE;
......@@ -826,7 +834,7 @@ gimp_container_tree_view_name_canceled (GtkCellRendererText *cell,
{
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 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
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 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
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 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
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 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
{
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 @@ gimp_container_tree_view_drag_viewable (GtkWidget *widget,
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 @@ gimp_container_tree_view_drag_pixbuf (GtkWidget *widget,
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;
......
......@@ -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];
GtkTreeModel *model;
gint n_model_columns;
GType model_columns[16];
gint model_column_renderer;
gint model_column_name;
gint model_column_name_attributes;
gint model_column_renderer;
gint model_column_name;
gint model_column_name_attributes;
GtkTreeView *view;
GtkTreeSelection *selection;
GtkTreeView *view;
GtkTreeViewColumn *main_column;
GtkCellRenderer *renderer_cell;
GtkCellRenderer *name_cell;
GtkTreeViewColumn *main_column;
GtkCellRenderer *renderer_cell;
GList *toggle_cells;
GList *renderer_cells;
GList *editable_cells;
GList *toggle_cells;
GList *renderer_cells;
gboolean dnd_drop_to_empty;
Gimp *dnd_gimp; /* eek */
GimpViewRenderer *dnd_renderer;
gboolean dnd_drop_to_empty;
Gimp *dnd_gimp; /* eek */
guint scroll_timeout_id;
guint scroll_timeout_interval;
GdkScrollDirection scroll_dir;
GimpContainerTreeViewPriv *priv;
};
struct _GimpContainerTreeViewClass
......
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