[gnome-control-center] keyboard: Make clicking on description edit the shortcut



commit 0965294afd43da8c299eb92b44a4567b2ddeb537
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Feb 18 16:21:28 2012 +0100

    keyboard: Make clicking on description edit the shortcut
    
    As it used it, and broke when we moved to GNOME 3.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=661527

 panels/keyboard/keyboard-shortcuts.c |   41 +++++----------------------------
 1 files changed, 7 insertions(+), 34 deletions(-)
---
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index 57029a8..e27e369 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -795,13 +795,6 @@ section_selection_changed (GtkTreeSelection *selection, gpointer data)
     }
 }
 
-typedef struct
-{
-  GtkTreeView *tree_view;
-  GtkTreePath *path;
-  GtkTreeViewColumn *column;
-} IdleData;
-
 static gboolean
 edit_custom_shortcut (CcKeyboardItem *item)
 {
@@ -911,19 +904,6 @@ update_custom_shortcut (GtkTreeModel *model, GtkTreeIter *iter)
 }
 
 static gboolean
-real_start_editing_cb (IdleData *idle_data)
-{
-  gtk_widget_grab_focus (GTK_WIDGET (idle_data->tree_view));
-  gtk_tree_view_set_cursor (idle_data->tree_view,
-                            idle_data->path,
-                            idle_data->column,
-                            TRUE);
-  gtk_tree_path_free (idle_data->path);
-  g_free (idle_data);
-  return FALSE;
-}
-
-static gboolean
 start_editing_cb (GtkTreeView    *tree_view,
                   GdkEventButton *event,
                   gpointer        user_data)
@@ -940,17 +920,10 @@ start_editing_cb (GtkTreeView    *tree_view,
                                      &path, &column,
                                      NULL, NULL))
     {
-      IdleData *idle_data;
       GtkTreeModel *model;
       GtkTreeIter iter;
       CcKeyboardItem *item;
 
-      if (gtk_tree_path_get_depth (path) == 1)
-        {
-          gtk_tree_path_free (path);
-          return FALSE;
-        }
-
       model = gtk_tree_view_get_model (tree_view);
       gtk_tree_model_get_iter (model, &iter, path);
       gtk_tree_model_get (model, &iter,
@@ -970,15 +943,15 @@ start_editing_cb (GtkTreeView    *tree_view,
         }
       else
         {
-          idle_data = g_new (IdleData, 1);
-          idle_data->tree_view = tree_view;
-          idle_data->path = path;
-          idle_data->column = item->desc_editable ? column :
-                              gtk_tree_view_get_column (tree_view, 1);
-          g_idle_add ((GSourceFunc) real_start_editing_cb, idle_data);
-          block_accels = TRUE;
+          gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+          gtk_tree_view_set_cursor (tree_view,
+                                    path,
+                                    item->desc_editable ? column :
+                                    gtk_tree_view_get_column (tree_view, 1),
+                                    TRUE);
         }
       g_signal_stop_emission_by_name (tree_view, "button_press_event");
+      gtk_tree_path_free (path);
     }
   return TRUE;
 }



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