changeset 3389:c8d0d7bf26d4

merge again
author Cristi Magherusan <majeru@atheme-project.org>
date Sat, 11 Aug 2007 01:49:26 +0300
parents b01c8d41d35b (current diff) a6a76ab7ce0a (diff)
children 3a77e835874f
files
diffstat 3 files changed, 57 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui/playlist.ui	Fri Aug 10 23:06:35 2007 +0300
+++ b/src/audacious/ui/playlist.ui	Sat Aug 11 01:49:26 2007 +0300
@@ -10,6 +10,10 @@
 			<menuitem action="playlist remove all" />
 			<separator />
 			<menuitem action="queue toggle" />
+			<separator />
+			<menu action="plugins" name="plugins-menu">
+			   <menuitem action="dummy" name="plugins-menu-dummy" />
+			</menu>
 		</menu>
 
 		<menu action="dummy" name="add-menu">
@@ -83,7 +87,6 @@
 			   <menuitem action="dummy" name="plugins-menu-dummy" />
 			</menu>
 			<separator />
-			<separator />
 			<menuitem action="playlist refresh" />
 			<separator />
 <!--			<menuitem action="playlist delete" /> -->
--- a/src/audacious/ui_manager.c	Fri Aug 10 23:06:35 2007 +0300
+++ b/src/audacious/ui_manager.c	Sat Aug 11 01:49:26 2007 +0300
@@ -699,6 +699,7 @@
 
   /* initialize plugins-menu for playlist-menus */
   ui_manager_create_menus_init_pmenu( "/playlist-menus/playlist-menu/plugins-menu" );
+  ui_manager_create_menus_init_pmenu( "/playlist-menus/playlist-rightclick-menu/plugins-menu" );
 
   gtk_ui_manager_add_ui_from_file( ui_manager , DATA_DIR "/ui/equalizer.ui" , &gerr );
 
@@ -777,31 +778,44 @@
 {
   if ( menu_created )
   {
+    GtkWidget *plugins_menu = NULL;
+    GtkWidget *plugins_menu_item = NULL;
+
     switch (menu_id)
     {
       case AUDACIOUS_MENU_MAIN:
-      {
-        GtkWidget *plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
+        plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
           "/mainwin-menus/main-menu/plugins-menu" );
-        GtkWidget *plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) );
-        gtk_menu_shell_append( GTK_MENU_SHELL(plugins_menu) , item );
-        gtk_widget_show( plugins_menu_item );
-        return 0;
-      }
+        break;
 
       case AUDACIOUS_MENU_PLAYLIST:
-      {
-        GtkWidget *plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
+        plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
           "/playlist-menus/playlist-menu/plugins-menu" );
-        GtkWidget *plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) );
-        gtk_menu_shell_append( GTK_MENU_SHELL(plugins_menu) , item );
-        gtk_widget_show( plugins_menu_item );
-        return 0;
-      }
+        break;
+
+      case AUDACIOUS_MENU_PLAYLIST_RCLICK:
+        plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
+          "/playlist-menus/playlist-rightclick-menu/plugins-menu" );
+        break;
 
       default:
         return -1;
     }
+
+    if ( plugins_menu_item )
+    {
+      plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) );
+      if ( plugins_menu )
+      {
+        gtk_menu_shell_append( GTK_MENU_SHELL(plugins_menu) , item );
+        gtk_widget_show( plugins_menu_item );
+        return 0; /* success */
+      }
+      else
+        return -1;
+    }
+    else
+      return -1;
   }
   else
     return -1;
@@ -820,37 +834,42 @@
     switch (menu_id)
     {
       case AUDACIOUS_MENU_MAIN:
-      {
         plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
           "/mainwin-menus/main-menu/plugins-menu" );
-        plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) );
-        gtk_container_remove( GTK_CONTAINER(plugins_menu) , item );
         break;
-      }
 
       case AUDACIOUS_MENU_PLAYLIST:
-      {
         plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
           "/playlist-menus/playlist-menu/plugins-menu" );
-        plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) );
-        gtk_container_remove( GTK_CONTAINER(plugins_menu) , item );
         break;
-      }
+
+      case AUDACIOUS_MENU_PLAYLIST_RCLICK:
+        plugins_menu_item = gtk_ui_manager_get_widget( ui_manager ,
+          "/playlist-menus/playlist-rightclick-menu/plugins-menu" );
+        break;
 
       default:
         return -1;
     }
 
-    if ( plugins_menu )
+    if ( plugins_menu_item )
     {
-      /* check the current number of items in plugins-menu against its initial count
-         of items; if these are equal, it means that the menu is "empty", so hide it */
-      gint ic = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(plugins_menu),"ic"));
-      plugins_menu_children = gtk_container_get_children( GTK_CONTAINER(plugins_menu) );
-      if ( ic == g_list_length(plugins_menu_children) )
-        gtk_widget_hide( plugins_menu_item );
-      g_list_free( plugins_menu_children );
-      return 0;
+      plugins_menu = gtk_menu_item_get_submenu( GTK_MENU_ITEM(plugins_menu_item) );
+      if ( plugins_menu )
+      {
+        /* remove the plugin-added entry */
+        gtk_container_remove( GTK_CONTAINER(plugins_menu) , item );
+        /* check the current number of items in plugins-menu against its initial count
+           of items; if these are equal, it means that the menu is "empty", so hide it */
+        gint ic = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(plugins_menu),"ic"));
+        plugins_menu_children = gtk_container_get_children( GTK_CONTAINER(plugins_menu) );
+        if ( ic == g_list_length(plugins_menu_children) )
+          gtk_widget_hide( plugins_menu_item );
+        g_list_free( plugins_menu_children );
+        return 0; /* success */
+      }
+      else
+        return -1;
     }
     else
       return -1;
--- a/src/audacious/ui_plugin_menu.h	Fri Aug 10 23:06:35 2007 +0300
+++ b/src/audacious/ui_plugin_menu.h	Sat Aug 11 01:49:26 2007 +0300
@@ -28,8 +28,9 @@
 #include <gtk/gtk.h>
 
 
-#define AUDACIOUS_MENU_MAIN        0
-#define AUDACIOUS_MENU_PLAYLIST    1
+#define AUDACIOUS_MENU_MAIN             0
+#define AUDACIOUS_MENU_PLAYLIST         1
+#define AUDACIOUS_MENU_PLAYLIST_RCLICK  2
 
 gint audacious_menu_plugin_item_add( gint , GtkWidget * );
 gint audacious_menu_plugin_item_remove( gint , GtkWidget * );