summaryrefslogtreecommitdiff
path: root/gtk/gtkcombobox.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2004-11-09 16:38:57 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-11-09 16:38:57 +0000
commit05a16d62a9c476ad8dee9095c7174b90c696a020 (patch)
tree7d05e49c95929f316c7adf6b51cd3391a653a4cb /gtk/gtkcombobox.c
parentcad2d56ce254504278aa8b2b7b36ac98a928a1b8 (diff)
downloadgtk+-05a16d62a9c476ad8dee9095c7174b90c696a020.tar.gz
Use a row reference, not a path, to associate separators with their tree
2004-11-09 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcombobox.c (find_menu_by_path) (gtk_combo_box_menu_fill_level, gtk_combo_box_menu_row_inserted): Use a row reference, not a path, to associate separators with their tree row.
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r--gtk/gtkcombobox.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 9a4976a24a..c8cca85d81 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2384,6 +2384,7 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
gboolean is_separator;
gint i, n_children;
GtkWidget *last;
+ GtkTreePath *path;
n_children = gtk_tree_model_iter_n_children (model, parent);
@@ -2401,10 +2402,11 @@ gtk_combo_box_menu_fill_level (GtkComboBox *combo_box,
if (is_separator)
{
item = gtk_separator_menu_item_new ();
+ path = gtk_tree_model_get_path (model, &iter);
g_object_set_data_full (G_OBJECT (item),
"gtk-combo-box-item-path",
- gtk_tree_model_get_path (model, &iter),
- (GDestroyNotify)gtk_tree_path_free);
+ gtk_tree_row_reference_new (model, path),
+ (GDestroyNotify)gtk_tree_row_reference_free);
}
else
{
@@ -2754,6 +2756,7 @@ find_menu_by_path (GtkWidget *menu,
GList *i, *list;
GtkWidget *item;
GtkWidget *submenu;
+ GtkTreeRowReference *mref;
GtkTreePath *mpath;
gboolean skip;
@@ -2764,12 +2767,13 @@ find_menu_by_path (GtkWidget *menu,
{
if (GTK_IS_SEPARATOR_MENU_ITEM (i->data))
{
-
- mpath = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
- if (!mpath)
+ mref = g_object_get_data (G_OBJECT (i->data), "gtk-combo-box-item-path");
+ if (!mref)
continue;
-
- mpath = gtk_tree_path_copy (mpath);
+ else if (!gtk_tree_row_reference_valid (mref))
+ mpath = NULL;
+ else
+ mpath = gtk_tree_row_reference_get_path (mref);
}
else if (GTK_IS_CELL_VIEW (GTK_BIN (i->data)->child))
{
@@ -2914,8 +2918,8 @@ gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
item = gtk_separator_menu_item_new ();
g_object_set_data_full (G_OBJECT (item),
"gtk-combo-box-item-path",
- gtk_tree_path_copy (path),
- (GDestroyNotify)gtk_tree_path_free);
+ gtk_tree_row_reference_new (model, path),
+ (GDestroyNotify)gtk_tree_row_reference_free);
}
else
{