@@ -86,6 +86,7 @@ typedef struct {
86
86
GtkTreeView * tree_view ;
87
87
GtkTreeViewColumn * eject_column ;
88
88
GtkCellRenderer * eject_icon_cell_renderer ;
89
+ GtkCellRenderer * editable_renderer ;
89
90
char * uri ;
90
91
GtkTreeStore * store ;
91
92
GtkTreeModel * store_filter ;
@@ -2620,8 +2621,6 @@ rename_selected_bookmark (NemoPlacesSidebar *sidebar)
2620
2621
GtkTreeIter iter ;
2621
2622
GtkTreePath * path ;
2622
2623
GtkTreeViewColumn * column ;
2623
- GtkCellRenderer * cell ;
2624
- GList * renderers ;
2625
2624
PlaceType type ;
2626
2625
2627
2626
if (get_selected_iter (sidebar , & iter )) {
@@ -2635,12 +2634,9 @@ rename_selected_bookmark (NemoPlacesSidebar *sidebar)
2635
2634
2636
2635
path = gtk_tree_model_get_path (GTK_TREE_MODEL (sidebar -> store_filter ), & iter );
2637
2636
column = gtk_tree_view_get_column (GTK_TREE_VIEW (sidebar -> tree_view ), 2 );
2638
- renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column ));
2639
- cell = g_list_nth_data (renderers , 5 );
2640
- g_list_free (renderers );
2641
- g_object_set (cell , "editable" , TRUE, NULL );
2637
+ g_object_set (sidebar -> editable_renderer , "editable" , TRUE, NULL );
2642
2638
gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (sidebar -> tree_view ),
2643
- path , column , cell , TRUE);
2639
+ path , column , sidebar -> editable_renderer , TRUE);
2644
2640
gtk_tree_path_free (path );
2645
2641
}
2646
2642
}
@@ -3708,11 +3704,17 @@ motion_notify_cb (GtkWidget *widget,
3708
3704
GtkTreeModel * model ;
3709
3705
GtkTreePath * path = NULL ;
3710
3706
GtkTreePath * store_path = NULL ;
3707
+ gboolean editing ;
3711
3708
3712
3709
if (event -> type != GDK_MOTION_NOTIFY ) {
3713
3710
return TRUE;
3714
3711
}
3715
3712
3713
+ g_object_get (sidebar -> editable_renderer , "editing" , & editing , NULL );
3714
+ if (editing ) {
3715
+ return GDK_EVENT_PROPAGATE ;
3716
+ }
3717
+
3716
3718
model = gtk_tree_view_get_model (GTK_TREE_VIEW (sidebar -> tree_view ));
3717
3719
3718
3720
if (over_eject_button (sidebar , event -> x , event -> y , & path )) {
@@ -3736,10 +3738,17 @@ leave_notify_cb (GtkWidget *widget,
3736
3738
GdkEventCrossing * event ,
3737
3739
NemoPlacesSidebar * sidebar )
3738
3740
{
3741
+ gboolean editing ;
3742
+
3739
3743
if (event -> type != GDK_LEAVE_NOTIFY ) {
3740
3744
return TRUE;
3741
3745
}
3742
3746
3747
+ g_object_get (sidebar -> editable_renderer , "editing" , & editing , NULL );
3748
+ if (editing ) {
3749
+ return GDK_EVENT_PROPAGATE ;
3750
+ }
3751
+
3743
3752
ClearHoverData data = { sidebar , NULL };
3744
3753
gtk_tree_model_foreach (GTK_TREE_MODEL (sidebar -> store ), (GtkTreeModelForeachFunc ) clear_eject_hover , & data );
3745
3754
@@ -4194,7 +4203,7 @@ nemo_places_sidebar_init (NemoPlacesSidebar *sidebar)
4194
4203
sidebar , NULL );
4195
4204
4196
4205
/* normal text renderer */
4197
- cell = nemo_cell_renderer_disk_new ();
4206
+ cell = sidebar -> editable_renderer = nemo_cell_renderer_disk_new ();
4198
4207
NEMO_CELL_RENDERER_DISK (cell )-> direction = gtk_widget_get_direction (GTK_WIDGET (tree_view ));
4199
4208
gtk_tree_view_column_pack_start (primary_column , cell , TRUE);
4200
4209
g_object_set (G_OBJECT (cell ), "editable" , FALSE, NULL );
0 commit comments