gimp r27666 - in trunk: . app/widgets



Author: martinn
Date: Sat Nov 15 20:01:55 2008
New Revision: 27666
URL: http://svn.gnome.org/viewvc/gimp?rev=27666&view=rev

Log:
* app/widgets/widgets-enums.h: Put the GimpContainerTreeView enums
here instead of exposing them through silly class instance
members.

* app/widgets/gimpcontainertreeview.c: 
* app/widgets/gimpcontainertreeview-dnd.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpsettingseditor.c
* app/widgets/gimptemplateview.c
* app/widgets/gimptoolview.c: Clean up and use new enum names.


Modified:
   trunk/ChangeLog
   trunk/app/widgets/gimpcontainertreeview-dnd.c
   trunk/app/widgets/gimpcontainertreeview.c
   trunk/app/widgets/gimpdatafactoryview.c
   trunk/app/widgets/gimpitemtreeview.c
   trunk/app/widgets/gimplayertreeview.c
   trunk/app/widgets/gimpsettingseditor.c
   trunk/app/widgets/gimptemplateview.c
   trunk/app/widgets/gimptoolview.c
   trunk/app/widgets/widgets-enums.h

Modified: trunk/app/widgets/gimpcontainertreeview-dnd.c
==============================================================================
--- trunk/app/widgets/gimpcontainertreeview-dnd.c	(original)
+++ trunk/app/widgets/gimpcontainertreeview-dnd.c	Sat Nov 15 20:01:55 2008
@@ -106,7 +106,7 @@
       gtk_tree_model_get_iter (tree_view->model, &iter, path);
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       dest_viewable = renderer->viewable;

Modified: trunk/app/widgets/gimpcontainertreeview.c
==============================================================================
--- trunk/app/widgets/gimpcontainertreeview.c	(original)
+++ trunk/app/widgets/gimpcontainertreeview.c	Sat Nov 15 20:01:55 2008
@@ -44,15 +44,6 @@
 #include "gimpwidgets-utils.h"
 
 
-enum
-{
-  COLUMN_RENDERER,
-  COLUMN_NAME,
-  COLUMN_NAME_ATTRIBUTES,
-  NUM_COLUMNS
-};
-
-
 static void  gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface);
 
 static GObject *gimp_container_tree_view_constructor  (GType                   type,
@@ -170,15 +161,11 @@
                                                  GIMP_TYPE_CONTAINER_TREE_VIEW,
                                                  GimpContainerTreeViewPriv);
 
-  tree_view->n_model_columns = NUM_COLUMNS;
+  tree_view->n_model_columns = GIMP_CONTAINER_TREE_VIEW_COLUMN_LAST;
 
-  tree_view->model_columns[COLUMN_RENDERER]        = GIMP_TYPE_VIEW_RENDERER;
-  tree_view->model_columns[COLUMN_NAME]            = G_TYPE_STRING;
-  tree_view->model_columns[COLUMN_NAME_ATTRIBUTES] = PANGO_TYPE_ATTR_LIST;
-
-  tree_view->model_column_renderer        = COLUMN_RENDERER;
-  tree_view->model_column_name            = COLUMN_NAME;
-  tree_view->model_column_name_attributes = COLUMN_NAME_ATTRIBUTES;
+  tree_view->model_columns[GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER]        = GIMP_TYPE_VIEW_RENDERER;
+  tree_view->model_columns[GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME]            = G_TYPE_STRING;
+  tree_view->model_columns[GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME_ATTRIBUTES] = PANGO_TYPE_ATTR_LIST;
 
   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (box->scrolled_win),
                                        GTK_SHADOW_IN);
@@ -209,7 +196,7 @@
 
   tree_view->view = g_object_new (GTK_TYPE_TREE_VIEW,
                                   "model",           list,
-                                  "search-column",   COLUMN_NAME,
+                                  "search-column",   GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME,
                                   "enable-search",   FALSE,
                                   "headers-visible", FALSE,
                                   "has-tooltip",     TRUE,
@@ -232,7 +219,7 @@
 
   gtk_tree_view_column_set_attributes (tree_view->main_column,
                                        tree_view->renderer_cell,
-                                       "renderer", COLUMN_RENDERER,
+                                       "renderer", GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER,
                                        NULL);
 
   tree_view->priv->name_cell = gtk_cell_renderer_text_new ();
@@ -243,8 +230,8 @@
 
   gtk_tree_view_column_set_attributes (tree_view->main_column,
                                        tree_view->priv->name_cell,
-                                       "text",       COLUMN_NAME,
-                                       "attributes", COLUMN_NAME_ATTRIBUTES,
+                                       "text",       GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME,
+                                       "attributes", GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME_ATTRIBUTES,
                                        NULL);
 
   g_signal_connect (tree_view->priv->name_cell, "editing-canceled",
@@ -457,8 +444,8 @@
   name = gimp_viewable_get_description (viewable, NULL);
 
   gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
-                      COLUMN_RENDERER, renderer,
-                      COLUMN_NAME,     name,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, renderer,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME,     name,
                       -1);
 
   g_free (name);
@@ -545,7 +532,7 @@
           GimpViewRenderer *renderer;
 
           gtk_tree_model_get (tree_view->model, &iter,
-                              COLUMN_RENDERER, &renderer,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                               -1);
 
           gimp_view_renderer_set_context (renderer, context);
@@ -626,7 +613,7 @@
           GimpViewRenderer *renderer;
 
           gtk_tree_model_get (tree_view->model, &selected_iter,
-                              COLUMN_RENDERER, &renderer,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                               -1);
 
           if (renderer->viewable != viewable)
@@ -688,11 +675,11 @@
       gchar *old_name;
 
       gtk_tree_model_get (tree_view->model, iter,
-                          COLUMN_NAME, &old_name,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, &old_name,
                           -1);
 
       gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
-                          COLUMN_NAME, name,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
                           -1);
 
       if (name && old_name && strlen (name) < strlen (old_name))
@@ -784,7 +771,7 @@
           GimpViewRenderer *renderer;
 
           gtk_tree_model_get (tree_view->model, &iter,
-                              COLUMN_RENDERER, &renderer,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                               -1);
 
           gimp_view_renderer_set_size (renderer, view_size, border_width);
@@ -840,13 +827,13 @@
       gchar            *name;
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       name = gimp_viewable_get_description (renderer->viewable, NULL);
 
       gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
-                          tree_view->model_column_name, name,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
                           -1);
 
       g_free (name);
@@ -865,7 +852,7 @@
       GimpViewRenderer *renderer;
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          COLUMN_RENDERER, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (tree_view),
@@ -941,7 +928,7 @@
       gtk_tree_model_get_iter (tree_view->model, &iter, path);
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          COLUMN_RENDERER, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       tree_view->priv->dnd_renderer = renderer;
@@ -1042,7 +1029,7 @@
 
                           gtk_list_store_set (GTK_LIST_STORE (tree_view->model),
                                               &iter,
-                                              tree_view->model_column_name,
+                                              GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME,
                                               real_name,
                                               -1);
                         }
@@ -1129,7 +1116,7 @@
     return FALSE;
 
   gtk_tree_model_get (tree_view->model, &iter,
-                      COLUMN_RENDERER, &renderer,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                       -1);
 
   if (renderer)

Modified: trunk/app/widgets/gimpdatafactoryview.c
==============================================================================
--- trunk/app/widgets/gimpdatafactoryview.c	(original)
+++ trunk/app/widgets/gimpdatafactoryview.c	Sat Nov 15 20:01:55 2008
@@ -250,7 +250,7 @@
       gchar            *name;
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       data = GIMP_DATA (renderer->viewable);
@@ -270,7 +270,7 @@
 
           name = gimp_viewable_get_description (renderer->viewable, NULL);
           gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
-                              tree_view->model_column_name, name,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
                               -1);
           g_free (name);
         }

Modified: trunk/app/widgets/gimpitemtreeview.c
==============================================================================
--- trunk/app/widgets/gimpitemtreeview.c	(original)
+++ trunk/app/widgets/gimpitemtreeview.c	Sat Nov 15 20:01:55 2008
@@ -845,7 +845,7 @@
       GError           *error = NULL;
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       item = GIMP_ITEM (renderer->viewable);
@@ -865,7 +865,7 @@
           gchar *name = gimp_viewable_get_description (renderer->viewable, NULL);
 
           gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
-                              tree_view->model_column_name, name,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
                               -1);
           g_free (name);
 
@@ -1006,7 +1006,7 @@
       context = gimp_container_view_get_context (GIMP_CONTAINER_VIEW (view));
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
       g_object_get (toggle,
                     "active", &active,
@@ -1031,7 +1031,7 @@
                                                       &iter))
             {
               gtk_tree_model_get (tree_view->model, &iter,
-                                  tree_view->model_column_renderer, &renderer,
+                                  GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                                   -1);
 
               if ((GimpItem *) renderer->viewable != item)

Modified: trunk/app/widgets/gimplayertreeview.c
==============================================================================
--- trunk/app/widgets/gimplayertreeview.c	(original)
+++ trunk/app/widgets/gimplayertreeview.c	Sat Nov 15 20:01:55 2008
@@ -866,7 +866,7 @@
 
       if (iter)
         gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
-                            tree_view->model_column_name_attributes,
+                            GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME_ATTRIBUTES,
                             layer_view->italic_attrs,
                             -1);
     }
@@ -884,7 +884,7 @@
 
           if (iter)
             gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
-                                tree_view->model_column_name_attributes,
+                                GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME_ATTRIBUTES,
                                 gimp_drawable_has_alpha (drawable) ?
                                 NULL : layer_view->bold_attrs,
                                 -1);
@@ -1225,7 +1225,7 @@
   GimpViewBorderType     layer_type = GIMP_VIEW_BORDER_BLACK;
 
   gtk_tree_model_get (tree_view->model, iter,
-                      tree_view->model_column_renderer, &layer_renderer,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &layer_renderer,
                       layer_view->model_column_mask,    &mask_renderer,
                       -1);
 
@@ -1373,7 +1373,7 @@
   GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
 
   gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
-                      tree_view->model_column_name_attributes,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME_ATTRIBUTES,
                       gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) ?
                       NULL : view->bold_attrs,
                       -1);

Modified: trunk/app/widgets/gimpsettingseditor.c
==============================================================================
--- trunk/app/widgets/gimpsettingseditor.c	(original)
+++ trunk/app/widgets/gimpsettingseditor.c	Sat Nov 15 20:01:55 2008
@@ -281,11 +281,10 @@
                                          GtkTreeIter  *iter,
                                          gpointer      data)
 {
-  GimpContainerTreeView *view = GIMP_CONTAINER_TREE_VIEW (data);
-  gchar                 *name = NULL;
+  gchar *name = NULL;
 
   gtk_tree_model_get (model, iter,
-                      view->model_column_name, &name,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, &name,
                       -1);
   g_free (name);
 
@@ -375,7 +374,7 @@
       gchar            *name;
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       object = GIMP_OBJECT (renderer->viewable);
@@ -405,7 +404,7 @@
 
           name = gimp_viewable_get_description (renderer->viewable, NULL);
           gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
-                              tree_view->model_column_name, name,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
                               -1);
           g_free (name);
         }

Modified: trunk/app/widgets/gimptemplateview.c
==============================================================================
--- trunk/app/widgets/gimptemplateview.c	(original)
+++ trunk/app/widgets/gimptemplateview.c	Sat Nov 15 20:01:55 2008
@@ -196,7 +196,7 @@
       const gchar      *old_name;
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       object = GIMP_OBJECT (renderer->viewable);
@@ -216,7 +216,7 @@
                                                        NULL);
 
           gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
-                              tree_view->model_column_name, name,
+                              GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
                               -1);
           g_free (name);
         }

Modified: trunk/app/widgets/gimptoolview.c
==============================================================================
--- trunk/app/widgets/gimptoolview.c	(original)
+++ trunk/app/widgets/gimptoolview.c	Sat Nov 15 20:01:55 2008
@@ -245,12 +245,11 @@
                               GtkTreeIter       *iter,
                               gpointer           data)
 {
-  GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (data);
-  GimpViewRenderer      *renderer;
-  gboolean               visible;
+  GimpViewRenderer *renderer;
+  gboolean          visible;
 
   gtk_tree_model_get (tree_model, iter,
-                      tree_view->model_column_renderer, &renderer,
+                      GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                       -1);
 
   g_object_get (renderer->viewable, "visible", &visible, NULL);
@@ -281,7 +280,7 @@
                     NULL);
 
       gtk_tree_model_get (tree_view->model, &iter,
-                          tree_view->model_column_renderer, &renderer,
+                          GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
                           -1);
 
       g_object_set (renderer->viewable, "visible", ! active, NULL);

Modified: trunk/app/widgets/widgets-enums.h
==============================================================================
--- trunk/app/widgets/widgets-enums.h	(original)
+++ trunk/app/widgets/widgets-enums.h	Sat Nov 15 20:01:55 2008
@@ -164,6 +164,14 @@
   GIMP_VIEW_BORDER_GREEN
 } GimpViewBorderType;
 
+typedef enum /*< skip >*/
+{
+  GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER,
+  GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME,
+  GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME_ATTRIBUTES,
+  GIMP_CONTAINER_TREE_VIEW_COLUMN_LAST
+} GimpContainerTreeViewColumn;
+
 typedef enum  /*< skip >*/
 {
   GIMP_DND_TYPE_NONE         = 0,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]