chiark / gitweb /
Icons for lots of popup menus.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 6 Dec 2009 19:35:59 +0000 (19:35 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 6 Dec 2009 19:35:59 +0000 (19:35 +0000)
disobedience/added.c
disobedience/choose-menu.c
disobedience/playlists.c
disobedience/popup.c
disobedience/popup.h
disobedience/queue.c
disobedience/recent.c

index aa15f48..04e1d77 100644 (file)
@@ -80,10 +80,10 @@ static const struct queue_column added_columns[] = {
 
 /** @brief Pop-up menu for new tracks list */
 static struct menuitem added_menuitems[] = {
-  { "Track properties", ql_properties_activate, ql_properties_sensitive, 0, 0 },
-  { "Play track", ql_play_activate, ql_play_sensitive, 0, 0 },
-  { "Select all tracks", ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
-  { "Deselect all tracks", ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
+  { "Track properties", GTK_STOCK_PROPERTIES, ql_properties_activate, ql_properties_sensitive, 0, 0 },
+  { "Play track", GTK_STOCK_MEDIA_PLAY, ql_play_activate, ql_play_sensitive, 0, 0 },
+  { "Select all tracks", GTK_STOCK_SELECT_ALL, ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
+  { "Deselect all tracks", NULL, ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
 };
 
 struct queuelike ql_added = {
index 61943d2..b0f59b5 100644 (file)
@@ -265,6 +265,7 @@ static void choose_playchildren_played(void attribute((unused)) *v,
 static struct menuitem choose_menuitems[] = {
   {
     "Play track",
+    GTK_STOCK_MEDIA_PLAY,
     choose_play_activate,
     choose_play_sensitive,
     0,
@@ -272,6 +273,7 @@ static struct menuitem choose_menuitems[] = {
   },
   {
     "Track properties",
+    GTK_STOCK_PROPERTIES,
     choose_properties_activate,
     choose_properties_sensitive,
     0,
@@ -279,6 +281,7 @@ static struct menuitem choose_menuitems[] = {
   },
   {
     "Select children",
+    NULL,
     choose_selectchildren_activate,
     choose_selectchildren_sensitive,
     0,
@@ -286,6 +289,7 @@ static struct menuitem choose_menuitems[] = {
   },
   {
     "Play children",
+    NULL,
     choose_playchildren_activate,
     choose_selectchildren_sensitive,    /* re-use */
     0,
@@ -293,6 +297,7 @@ static struct menuitem choose_menuitems[] = {
   },
   {
     "Deselect all tracks",
+    NULL,
     choose_selectnone_activate,
     choose_selectnone_sensitive,
     0,
index 1f836ad..2762aa4 100644 (file)
@@ -151,12 +151,12 @@ static const struct queue_column playlist_columns[] = {
  * - select/deselect all work
  */
 static struct menuitem playlist_menuitems[] = {
-  { "Track properties", ql_properties_activate, ql_properties_sensitive, 0, 0 },
-  { "Play track", ql_play_activate, ql_play_sensitive, 0, 0 },
-  { "Play playlist", playlist_playall_activate, playlist_playall_sensitive, 0, 0 },
-  { "Remove track from playlist", playlist_remove_activate, playlist_remove_sensitive, 0, 0 },
-  { "Select all tracks", ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
-  { "Deselect all tracks", ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
+  { "Track properties", GTK_STOCK_PROPERTIES, ql_properties_activate, ql_properties_sensitive, 0, 0 },
+  { "Play track", GTK_STOCK_MEDIA_PLAY, ql_play_activate, ql_play_sensitive, 0, 0 },
+  { "Play playlist", NULL, playlist_playall_activate, playlist_playall_sensitive, 0, 0 },
+  { "Remove track from playlist", GTK_STOCK_CUT, playlist_remove_activate, playlist_remove_sensitive, 0, 0 },
+  { "Select all tracks", GTK_STOCK_SELECT_ALL, ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
+  { "Deselect all tracks", NULL, ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
 };
 
 static const GtkTargetEntry playlist_targets[] = {
@@ -995,6 +995,7 @@ static int playlist_picker_remove_sensitive(void *extra) {
 static struct menuitem playlist_picker_menuitems[] = {
   {
     "Select playlist",
+    NULL,
     playlist_picker_select_activate,
     playlist_picker_select_sensitive,
     0,
@@ -1002,6 +1003,7 @@ static struct menuitem playlist_picker_menuitems[] = {
   },
   {
     "Play playlist",
+    GTK_STOCK_MEDIA_PLAY, 
     playlist_picker_play_activate,
     playlist_picker_play_sensitive,
     0,
@@ -1009,6 +1011,7 @@ static struct menuitem playlist_picker_menuitems[] = {
   },
   {
     "Remove playlist",
+    GTK_STOCK_CUT,
     playlist_picker_remove_activate,
     playlist_picker_remove_sensitive,
     0,
index 1a7c2e5..d7e91f3 100644 (file)
@@ -34,7 +34,14 @@ void popup(GtkWidget **menup,
     g_signal_connect(menu, "destroy",
                      G_CALLBACK(gtk_widget_destroyed), menup);
     for(int n = 0; n < nitems; ++n) {
-      items[n].w = gtk_menu_item_new_with_label(items[n].name);
+      if(items[n].stock) {
+        GtkWidget *image = gtk_image_new_from_stock(items[n].stock,
+                                                    GTK_ICON_SIZE_MENU);
+        items[n].w = gtk_image_menu_item_new_with_label(items[n].name);
+        gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(items[n].w),
+                                      image);
+      } else
+        items[n].w = gtk_menu_item_new_with_label(items[n].name);
       /* TODO accelerators would be useful here.  There might be some
        * interaction with the main menu accelerators, _except_ for playlist
        * case!  */
index 9706e03..25726b2 100644 (file)
@@ -26,6 +26,9 @@ struct menuitem {
   /** @brief Menu item name */
   const char *name;
 
+  /** @brief Stock icon name */
+  const char *stock;
+
   /** @brief Called to activate the menu item */
   void (*activate)(GtkMenuItem *menuitem,
                    gpointer user_data);
index 6c0e136..d899d3e 100644 (file)
@@ -233,12 +233,12 @@ static const struct queue_column queue_columns[] = {
 
 /** @brief Pop-up menu for queue */
 static struct menuitem queue_menuitems[] = {
-  { "Track properties", ql_properties_activate, ql_properties_sensitive, 0, 0 },
-  { "Select all tracks", ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
-  { "Deselect all tracks", ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
-  { "Scratch playing track", ql_scratch_activate, ql_scratch_sensitive, 0, 0 },
-  { "Remove track from queue", ql_remove_activate, ql_remove_sensitive, 0, 0 },
-  { "Adopt track", ql_adopt_activate, ql_adopt_sensitive, 0, 0 },
+  { "Track properties", GTK_STOCK_PROPERTIES, ql_properties_activate, ql_properties_sensitive, 0, 0 },
+  { "Select all tracks", GTK_STOCK_SELECT_ALL, ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
+  { "Deselect all tracks", NULL, ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
+  { "Scratch playing track", GTK_STOCK_STOP, ql_scratch_activate, ql_scratch_sensitive, 0, 0 },
+  { "Remove track from queue", GTK_STOCK_CUT, ql_remove_activate, ql_remove_sensitive, 0, 0 },
+  { "Adopt track", NULL, ql_adopt_activate, ql_adopt_sensitive, 0, 0 },
 };
 
 static const GtkTargetEntry queue_targets[] = {
index 0e74feb..510aac9 100644 (file)
@@ -78,10 +78,10 @@ static const struct queue_column recent_columns[] = {
 
 /** @brief Pop-up menu for recently played list */
 static struct menuitem recent_menuitems[] = {
-  { "Track properties", ql_properties_activate, ql_properties_sensitive,0, 0 },
-  { "Play track", ql_play_activate, ql_play_sensitive, 0, 0 },
-  { "Select all tracks", ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
-  { "Deselect all tracks", ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
+  { "Track properties", GTK_STOCK_PROPERTIES, ql_properties_activate, ql_properties_sensitive,0, 0 },
+  { "Play track", GTK_STOCK_MEDIA_PLAY, ql_play_activate, ql_play_sensitive, 0, 0 },
+  { "Select all tracks", GTK_STOCK_SELECT_ALL, ql_selectall_activate, ql_selectall_sensitive, 0, 0 },
+  { "Deselect all tracks", NULL, ql_selectnone_activate, ql_selectnone_sensitive, 0, 0 },
 };
 
 struct queuelike ql_recent = {