Commit 155c45eb authored by Matthias Clasen's avatar Matthias Clasen

GtkPlacesSidebar: Fix editing of bookmarks

This was silently broken - the code was just assuming that the
text cell renderer is item no. 6 on the list of all cells. That
doesn't work so well if the cell renderers are set up elsewhere
and get rearranged.

Fix this by keeping an explicit pointer to the the text cell.
parent d576069c
......@@ -126,6 +126,7 @@ struct _GtkPlacesSidebar {
GtkTreeView *tree_view;
GtkCellRenderer *eject_icon_cell_renderer;
GtkCellRenderer *text_cell_renderer;
GtkListStore *store;
GtkBookmarksManager *bookmarks_manager;
GVolumeMonitor *volume_monitor;
......@@ -2462,8 +2463,6 @@ rename_selected_bookmark (GtkPlacesSidebar *sidebar)
GtkTreeIter iter;
GtkTreePath *path;
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
GList *renderers;
PlaceType type;
if (get_selected_iter (sidebar, &iter))
......@@ -2477,12 +2476,9 @@ rename_selected_bookmark (GtkPlacesSidebar *sidebar)
path = gtk_tree_model_get_path (GTK_TREE_MODEL (sidebar->store), &iter);
column = gtk_tree_view_get_column (GTK_TREE_VIEW (sidebar->tree_view), 0);
renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
cell = g_list_nth_data (renderers, 6);
g_list_free (renderers);
g_object_set (cell, "editable", TRUE, NULL);
g_object_set (sidebar->text_cell_renderer, "editable", TRUE, NULL);
gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (sidebar->tree_view),
path, column, cell, TRUE);
path, column, sidebar->text_cell_renderer, TRUE);
gtk_tree_path_free (path);
......@@ -3812,6 +3808,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
/* normal text renderer */
cell = gtk_cell_renderer_text_new ();
sidebar->text_cell_renderer = cell;
gtk_tree_view_column_pack_start (col, cell, TRUE);
g_object_set (G_OBJECT (cell), "editable", FALSE, NULL);
gtk_tree_view_column_set_attributes (col, cell,
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