made the model column enum public and namespaced it.
2008-06-24 Michael Natterer <mitch@gimp.org> * app/widgets/gimpcontainercombobox.[ch]: made the model column enum public and namespaced it. * app/widgets/gimpsettingsbox.c: use the enum value instead of a magic number. * app/widgets/gimpsettingseditor.c: add a separator between recently used settings and favorites. svn path=/trunk/; revision=25979
This commit is contained in:

committed by
Michael Natterer

parent
57e9c9943e
commit
60ca4baeb6
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2008-06-24 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpcontainercombobox.[ch]: made the model column
|
||||
enum public and namespaced it.
|
||||
|
||||
* app/widgets/gimpsettingsbox.c: use the enum value instead of a
|
||||
magic number.
|
||||
|
||||
* app/widgets/gimpsettingseditor.c: add a separator between
|
||||
recently used settings and favorites.
|
||||
|
||||
2008-06-23 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimpfreeselecttool.c
|
||||
|
@ -43,12 +43,6 @@ enum
|
||||
PROP_ELLIPSIZE = GIMP_CONTAINER_VIEW_PROP_LAST + 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_RENDERER,
|
||||
COLUMN_NAME,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
static void gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface);
|
||||
|
||||
@ -144,7 +138,7 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
|
||||
GtkCellLayout *layout;
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
store = gtk_list_store_new (NUM_COLUMNS,
|
||||
store = gtk_list_store_new (GIMP_CONTAINER_COMBO_BOX_N_COLUMNS,
|
||||
GIMP_TYPE_VIEW_RENDERER,
|
||||
G_TYPE_STRING);
|
||||
|
||||
@ -157,7 +151,8 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
|
||||
cell = gimp_cell_renderer_viewable_new ();
|
||||
gtk_cell_layout_pack_start (layout, cell, FALSE);
|
||||
gtk_cell_layout_set_attributes (layout, cell,
|
||||
"renderer", COLUMN_RENDERER,
|
||||
"renderer",
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER,
|
||||
NULL);
|
||||
|
||||
combo_box->viewable_renderer = cell;
|
||||
@ -165,7 +160,8 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (layout, cell, TRUE);
|
||||
gtk_cell_layout_set_attributes (layout, cell,
|
||||
"text", COLUMN_NAME,
|
||||
"text",
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME,
|
||||
NULL);
|
||||
|
||||
combo_box->text_renderer = cell;
|
||||
@ -277,8 +273,8 @@ gimp_container_combo_box_set (GimpContainerComboBox *combo_box,
|
||||
view);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), iter,
|
||||
COLUMN_RENDERER, renderer,
|
||||
COLUMN_NAME, name,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME, name,
|
||||
-1);
|
||||
|
||||
g_object_unref (renderer);
|
||||
@ -308,7 +304,7 @@ gimp_container_combo_box_set_context (GimpContainerView *view,
|
||||
GimpViewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_view_renderer_set_context (renderer, context);
|
||||
@ -429,7 +425,7 @@ gimp_container_combo_box_rename_item (GimpContainerView *view,
|
||||
gchar *name = gimp_viewable_get_description (viewable, NULL);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), iter,
|
||||
COLUMN_NAME, name,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME, name,
|
||||
-1);
|
||||
|
||||
g_free (name);
|
||||
@ -494,7 +490,7 @@ gimp_container_combo_box_set_view_size (GimpContainerView *view)
|
||||
GimpViewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_view_renderer_set_size (renderer, view_size, border_width);
|
||||
@ -516,7 +512,7 @@ gimp_container_combo_box_changed (GtkComboBox *combo_box,
|
||||
GimpViewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (gtk_combo_box_get_model (combo_box), &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_container_view_item_selected (view, renderer->viewable);
|
||||
|
@ -23,6 +23,14 @@
|
||||
#define __GIMP_CONTAINER_COMBO_BOX_H__
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME,
|
||||
GIMP_CONTAINER_COMBO_BOX_N_COLUMNS
|
||||
};
|
||||
|
||||
|
||||
#define GIMP_TYPE_CONTAINER_COMBO_BOX (gimp_container_combo_box_get_type ())
|
||||
#define GIMP_CONTAINER_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTAINER_COMBO_BOX, GimpContainerComboBox))
|
||||
#define GIMP_CONTAINER_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONTAINER_COMBO_BOX, GimpContainerComboBoxClass))
|
||||
|
@ -459,13 +459,9 @@ gimp_settings_box_row_separator_func (GtkTreeModel *model,
|
||||
{
|
||||
gchar *name = NULL;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: dont use magic model column
|
||||
#endif
|
||||
gtk_tree_model_get (model, iter,
|
||||
1, &name,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME, &name,
|
||||
-1);
|
||||
|
||||
g_free (name);
|
||||
|
||||
return name == NULL;
|
||||
|
@ -63,6 +63,11 @@ static void gimp_settings_editor_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean
|
||||
gimp_settings_editor_row_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpSettingsEditor, gimp_settings_editor, GTK_TYPE_VBOX)
|
||||
|
||||
@ -127,6 +132,9 @@ gimp_settings_editor_constructor (GType type,
|
||||
view = gimp_container_tree_view_new (editor->container,
|
||||
gimp_get_user_context (editor->gimp),
|
||||
16, 0);
|
||||
gtk_tree_view_set_row_separator_func (GIMP_CONTAINER_TREE_VIEW (view)->view,
|
||||
gimp_settings_editor_row_separator_func,
|
||||
view, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (editor), view);
|
||||
gtk_widget_show (view);
|
||||
|
||||
@ -209,6 +217,22 @@ gimp_settings_editor_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_settings_editor_row_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerTreeView *view = GIMP_CONTAINER_TREE_VIEW (data);
|
||||
gchar *name = NULL;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
view->model_column_name, &name,
|
||||
-1);
|
||||
g_free (name);
|
||||
|
||||
return name == NULL;
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
Reference in New Issue
Block a user