gnome-commander r1699 - trunk/src



Author: epiotr
Date: Sat Apr 12 12:34:34 2008
New Revision: 1699
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1699&view=rev

Log:
More work on keybindings GUI

Modified:
   trunk/src/gnome-cmd-key-shortcuts-dialog.cc
   trunk/src/gnome-cmd-user-actions.h

Modified: trunk/src/gnome-cmd-key-shortcuts-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-key-shortcuts-dialog.cc	(original)
+++ trunk/src/gnome-cmd-key-shortcuts-dialog.cc	Sat Apr 12 12:34:34 2008
@@ -298,11 +298,10 @@
 
 enum
 {
-    COL_SHORTCUT,       // FIXME: temporarily, to be removed
     COL_ACCEL_KEY,
     COL_ACCEL_MASK,
     COL_ACTION,
-    COL_ACCEL_CLOSURE,
+    COL_NAME,
     COL_OPTION,
     NUM_COLUMNS
 } ;
@@ -310,7 +309,6 @@
 
 enum
 {
-    SORTID_SHORTCUT,    // FIXME: temporarily, to be removed
     SORTID_ACCEL,
     SORTID_ACTION,
     SORTID_OPTION
@@ -332,14 +330,6 @@
 
     GtkTooltips *tips = gtk_tooltips_new ();
 
-    col = create_new_text_column (GTK_TREE_VIEW (view), renderer, COL_SHORTCUT, "test: [key-bindings]");               // FIXME: temporarily, to be removed
-    gtk_tooltips_set_tip (tips, col->button, "Keyboard shortcuts as specified in ~/.gnome2/gnome-commander", NULL);    // FIXME: temporarily, to be removed
-
-    g_object_set (renderer,
-                  "foreground-set", TRUE,
-                  "foreground", "DarkGray",
-                  NULL);
-
     col = create_new_accel_column (GTK_TREE_VIEW (view), renderer, COL_ACCEL_KEY, COL_ACCEL_MASK, _("Shortcut Key"));
     gtk_tooltips_set_tip (tips, col->button, _("Keyboard shortcut for selected action"), NULL);
     gtk_tree_view_column_set_sort_column_id (col, SORTID_ACCEL);
@@ -442,11 +432,10 @@
 inline GtkTreeModel *create_and_fill_model (GnomeCmdUserActions &user_actions)
 {
     GtkListStore *store = gtk_list_store_new (NUM_COLUMNS,
-                                              G_TYPE_STRING,            //  COL_SHORTCUT               // FIXME: temporarily, to be removed
                                               G_TYPE_UINT,              //  COL_ACCEL_KEY
                                               GDK_TYPE_MODIFIER_TYPE,   //  COL_ACCEL_MASK
                                               G_TYPE_STRING,            //  COL_ACTION
-                                              G_TYPE_CLOSURE,           //  COL_ACCEL_CLOSURE
+                                              G_TYPE_STRING,            //  COL_NAME
                                               G_TYPE_STRING);           //  COL_OPTION
 
     GtkTreeIter iter;
@@ -456,10 +445,10 @@
          {
              gtk_list_store_append (store, &iter);
              gtk_list_store_set (store, &iter,
-                                 COL_SHORTCUT, user_actions.key(i),     // FIXME: temporarily, to be removed
                                  COL_ACCEL_KEY, i->first.keyval,
                                  COL_ACCEL_MASK, i->first.state,
                                  COL_ACTION, user_actions.description(i),
+                                 COL_NAME, user_actions.name(i),
                                  COL_OPTION, user_actions.options(i),
                                  -1);
          }
@@ -589,9 +578,17 @@
     gint col = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
 
     if (gtk_tree_model_get_iter (model, &iter, path))
-        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                            col, new_text,
-                            -1);
+        if (col==COL_ACTION && GnomeCmdKeyShortcutsDialog::user_actions)
+            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                col, new_text,
+                                COL_NAME, GnomeCmdKeyShortcutsDialog::user_actions->name(new_text),
+                                -1);
+        else
+            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                col, new_text,
+                                -1);
+
+    gtk_tree_path_free (path);
 }
 
 
@@ -621,7 +618,7 @@
 
     GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
     gtk_widget_grab_focus (view);
-    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, gtk_tree_view_get_column (GTK_TREE_VIEW (view),1), TRUE);    // FIXME: temporarily, change col idx 1 -> 0
+    gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, gtk_tree_view_get_column (GTK_TREE_VIEW (view),0), TRUE);
     gtk_tree_path_free(path);
     // start editing accelerator
 }

Modified: trunk/src/gnome-cmd-user-actions.h
==============================================================================
--- trunk/src/gnome-cmd-user-actions.h	(original)
+++ trunk/src/gnome-cmd-user-actions.h	Sat Apr 12 12:34:34 2008
@@ -183,13 +183,13 @@
         const ACTIONS_COLL::key_type &operator * () const                   {  return (ACTIONS_COLL::iterator::operator * ()).first;  }
     };
 
-    const_iterator begin()                                                  {  return action.begin();                           }
-    const_iterator end()                                                    {  return action.end();                             }
+    const_iterator begin()                                                  {  return action.begin();                                 }
+    const_iterator end()                                                    {  return action.end();                                   }
 
-    const gchar *key(const_iterator &i)                                     {  return key2str(*i).c_str();                      }       // FIXME: temporarily, to be removed
-    const gchar *name(const_iterator &i)                                    {  return action_func[i->second.func].c_str();      }       // FIXME: temporarily, to be removed
-    const gchar *description(const_iterator &i)                             {  return _(action_name[i->second.func].c_str());   }
-    const gchar *options(const_iterator &i)                                 {  return i->second.user_data.c_str();              }
+    const gchar *name(const_iterator &i)                                    {  return action_func[i->second.func].c_str();            }
+    const gchar *name(const std::string description)                        {  return action_func[action_name[description]].c_str();  }
+    const gchar *description(const_iterator &i)                             {  return action_name[i->second.func].c_str();            }
+    const gchar *options(const_iterator &i)                                 {  return i->second.user_data.c_str();                    }
 };
 
 



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