[goobox] fixed keyboard accelerators



commit fc17b5124bd43350c4d2403221f58dc9db96726d
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jun 3 14:10:40 2012 +0200

    fixed keyboard accelerators

 src/ui.h                |   70 ++++++++++++++++++++++++++++++++++++-----------
 src/ui/app-menu.ui      |    5 ++-
 src/ui/menu-toolbars.ui |   13 ++++++++-
 3 files changed, 69 insertions(+), 19 deletions(-)
---
diff --git a/src/ui.h b/src/ui.h
index 7cdf16c..830b9ad 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -30,11 +30,10 @@
 
 
 static GtkActionEntry action_entries[] = {
-	{ "CDMenu", NULL, N_("_Disc") },
 	{ "CDCoverMenu", NULL, N_("C_over") },
 
 	{ "TogglePlay", GOO_STOCK_PLAY,
-	  N_("_Play"), "space",
+	  N_("_Play"), NULL,
 	  N_("Play/Pause"),
 	  G_CALLBACK (activate_action_toggle_play) },
 	{ "Play", GOO_STOCK_PLAY,
@@ -50,39 +49,39 @@ static GtkActionEntry action_entries[] = {
 	  N_("Pause"),
 	  G_CALLBACK (activate_action_pause) },
 	{ "Stop", GOO_STOCK_STOP,
-	  N_("_Stop"), "Escape",
+	  N_("_Stop"), NULL,
 	  N_("Stop playing"),
 	  G_CALLBACK (activate_action_stop) },
 	{ "Next", GOO_STOCK_NEXT,
-	  N_("_Next"), "N",
+	  N_("_Next"), NULL,
 	  N_("Play the next track"),
 	  G_CALLBACK (activate_action_next) },
 	{ "Prev", GOO_STOCK_PREV,
-	  N_("Pre_v"), "P",
+	  N_("Pre_v"), NULL,
 	  N_("Play the previous track"),
 	  G_CALLBACK (activate_action_prev) },
 	{ "Eject", NULL,
-	  N_("_Eject"), "J",
+	  N_("_Eject"), NULL,
 	  N_("Eject the disc"),
 	  G_CALLBACK (activate_action_eject) },
 	{ "EjectToolBar", GOO_STOCK_EJECT,
-	  N_("_Eject"), "J",
+	  N_("_Eject"), NULL,
 	  N_("Eject the disc"),
 	  G_CALLBACK (activate_action_eject) },
-	{ "CopyDisc", GTK_STOCK_COPY,
-	  N_("_Copy Disc"), "C",
+	{ "CopyDisc", NULL,
+	  N_("_Copy Disc"), NULL,
 	  N_("Copy the content of this disc on another disc"),
 	  G_CALLBACK (activate_action_copy_disc) },
 	{ "Extract", GOO_STOCK_EXTRACT,
-	  N_("E_xtract Tracks"), "E",
+	  N_("E_xtract Tracks"), NULL,
 	  N_("Save the tracks to disk as files"),
 	  G_CALLBACK (activate_action_extract) },
 	{ "ExtractSelected", GOO_STOCK_EXTRACT,
-	  N_("E_xtract Tracks"), "E",
+	  N_("E_xtract Tracks"), NULL,
 	  N_("Save the selected tracks to disk as files"),
 	  G_CALLBACK (activate_action_extract_selected) },
 	{ "Properties", GTK_STOCK_PROPERTIES,
-	  NULL, "<Ctrl>Return",
+	  NULL, NULL,
 	  N_("Edit the disc artist, album and the tracks titles"),
 	  G_CALLBACK (activate_action_properties) },
 	{ "Close", GTK_STOCK_CLOSE,
@@ -94,7 +93,7 @@ static GtkActionEntry action_entries[] = {
 	  N_("Quit the application"),
 	  G_CALLBACK (activate_action_quit) },
 	{ "PickCoverFromDisk", GTK_STOCK_OPEN,
-	  N_("_Choose File..."), "",
+	  N_("_Choose File..."), NULL,
 	  N_("Choose a file to use as disc cover"),
 	  G_CALLBACK (activate_action_pick_cover_from_disk) },
 	{ "SearchCoverFromWeb", GTK_STOCK_FIND,
@@ -106,13 +105,52 @@ static GtkActionEntry action_entries[] = {
 	  N_("Remove current disc cover"),
 	  G_CALLBACK (activate_action_remove_cover) },
 	{ "ToggleVisibility", NULL,
-	  N_("_Hide Window"), NULL /*"H"*/,
+	  N_("_Hide Window"), NULL,
 	  N_("Hide the main window"),
 	  G_CALLBACK (activate_action_toggle_visibility) },
 	{ "Reload", GTK_STOCK_REFRESH,
-	  NULL, "<Ctrl>R",
+	  NULL, NULL,
+	  NULL,
+	  G_CALLBACK (activate_action_reload) },
+
+	/* accelerators */
+
+	{ "TogglePlayAccel", NULL,
+	  NULL, "space",
+	  NULL,
+	  G_CALLBACK (activate_action_toggle_play) },
+	{ "StopAccel", NULL,
+	  NULL, "Escape",
+	  NULL,
+	  G_CALLBACK (activate_action_stop) },
+	{ "NextAccel", NULL,
+	  NULL, "N",
+	  NULL,
+	  G_CALLBACK (activate_action_next) },
+	{ "PrevAccel", NULL,
+	  NULL, "P",
+	  NULL,
+	  G_CALLBACK (activate_action_prev) },
+	{ "EjectAccel", NULL,
+	  NULL, "J",
+	  NULL,
+	  G_CALLBACK (activate_action_eject) },
+	{ "CopyDiscAccel", NULL,
+	  NULL, "C",
+	  NULL,
+	  G_CALLBACK (activate_action_copy_disc) },
+	{ "ExtractAccel", NULL,
+	  NULL, "E",
+	  NULL,
+	  G_CALLBACK (activate_action_extract) },
+	{ "PropertiesAccel", NULL,
+	  NULL, "<Ctrl>Return",
+	  NULL,
+	  G_CALLBACK (activate_action_properties) },
+	{ "CloseAccel", NULL,
+	  NULL, "<Ctrl>W",
 	  NULL,
-	  G_CALLBACK (activate_action_reload) }
+	  G_CALLBACK (activate_action_close) }
 };
 static guint n_action_entries = G_N_ELEMENTS (action_entries);
 
diff --git a/src/ui/app-menu.ui b/src/ui/app-menu.ui
index f45a487..4fe3539 100644
--- a/src/ui/app-menu.ui
+++ b/src/ui/app-menu.ui
@@ -25,8 +25,8 @@
       <item>
         <attribute name="action">app.help</attribute>
         <attribute name="label" translatable="yes">_Help</attribute>
-      </item>
-    
+        <attribute name="accel">F1</attribute>
+      </item>    
       <item>
         <attribute name="action">app.about</attribute>
         <attribute name="label" translatable="yes">_About CD Player</attribute>
@@ -34,6 +34,7 @@
       <item>
         <attribute name="action">app.quit</attribute>
         <attribute name="label" translatable="yes">_Quit</attribute>
+        <attribute name="accel">&lt;Primary&gt;q</attribute>
       </item>
     </section>
   </menu>
diff --git a/src/ui/menu-toolbars.ui b/src/ui/menu-toolbars.ui
index 6c99d71..dc07d92 100644
--- a/src/ui/menu-toolbars.ui
+++ b/src/ui/menu-toolbars.ui
@@ -1,5 +1,5 @@
 <ui>
-  <toolbar  name="ToolBar">
+  <toolbar name="ToolBar">
     <toolitem action="TogglePlay"/>
     <toolitem action="Play"/>
     <toolitem action="Pause"/>
@@ -10,6 +10,8 @@
   <popup name="ListPopupMenu">
     <menuitem action="PlaySelected"/>
     <menuitem action="ExtractSelected"/>
+    <separator />
+    <menuitem action="Properties"/>
   </popup>
   <popup name="TrayPopupMenu">
     <menuitem action="TogglePlay"/>
@@ -32,4 +34,13 @@
     <separator />
     <menuitem action="Close"/>
   </popup>
+  <accelerator action="TogglePlayAccel" />
+  <accelerator action="StopAccel" />
+  <accelerator action="NextAccel" />
+  <accelerator action="PrevAccel" />
+  <accelerator action="EjectAccel" />
+  <accelerator action="CopyDiscAccel" />
+  <accelerator action="ExtractAccel" />
+  <accelerator action="PropertiesAccel" />
+  <accelerator action="CloseAccel" />
 </ui>
\ No newline at end of file



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