gnome-commander r1642 - in branches/gcmd-1-3: . src



Author: epiotr
Date: Thu Mar 13 17:29:10 2008
New Revision: 1642
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1642&view=rev

Log:
Added GnomeCmdUserActions iterators for accessing registered GdkEventKeys

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/src/gnome-cmd-user-actions.cc
   branches/gcmd-1-3/src/gnome-cmd-user-actions.h

Modified: branches/gcmd-1-3/src/gnome-cmd-user-actions.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-user-actions.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-user-actions.cc	Thu Mar 13 17:29:10 2008
@@ -400,7 +400,7 @@
         g_free (action_name);
     }
 
-    for (map<GdkEventKey, UserAction>::const_iterator i=action.begin(); i!=action.end(); ++i)
+    for (ACTIONS_COLL::const_iterator i=action.begin(); i!=action.end(); ++i)
     {
         string path = section_path + key2str(i->first);
 
@@ -472,7 +472,7 @@
     if (!func)
         return FALSE;
 
-    for (map<GdkEventKey, UserAction>::const_iterator i=action.begin(); i!=action.end(); ++i)
+    for (ACTIONS_COLL::const_iterator i=action.begin(); i!=action.end(); ++i)
         if (i->second.func==func)
             return TRUE;
 

Modified: branches/gcmd-1-3/src/gnome-cmd-user-actions.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-user-actions.h	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-user-actions.h	Thu Mar 13 17:29:10 2008
@@ -53,7 +53,10 @@
     static DICT<GnomeCmdUserActionFunc> action_func;
     static DICT<GnomeCmdUserActionFunc> action_name;
 
-    std::map <GdkEventKey, UserAction> action;
+    typedef std::map<GdkEventKey, UserAction> ACTIONS_COLL;
+
+    ACTIONS_COLL action;
+
 
   public:
 
@@ -83,6 +86,21 @@
     GdkEventKey str2key(gchar *s, guint &state, guint &key_val);
     GdkEventKey str2key(gchar *s, GdkEventKey &event)                       {  return str2key(s, event.state, event.keyval);             }
     GdkEventKey str2key(gchar *s);
+
+  public:
+
+    struct const_iterator: ACTIONS_COLL::iterator
+    {
+        const_iterator (const ACTIONS_COLL::iterator &i): ACTIONS_COLL::iterator(i)   {}
+
+        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 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]