changeset 3110:a522493de76e

Set up a hook_call for showing the main menu, since it's implemented in a plugin now (fixes #38).
author John Lindgren <john.lindgren@tds.net>
date Sat, 02 May 2009 11:16:23 -0400
parents 5a11abf0075c
children 7c27b8612b7e
files src/skins/ui_main.c src/skins/ui_main.h src/statusicon/si_ui.c
diffstat 3 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/skins/ui_main.c	Fri May 01 12:28:48 2009 -0500
+++ b/src/skins/ui_main.c	Sat May 02 11:16:23 2009 -0400
@@ -329,9 +329,16 @@
     return TRUE;
 }
 
+static void show_main_menu (GdkEventButton * event, void * unused)
+{
+    ui_manager_popup_menu_show ((GtkMenu *) mainwin_general_menu, event->x_root,
+     event->y_root, event->button, event->time);
+}
+
 static void
 mainwin_destroy(GtkWidget * widget, gpointer data)
 {
+    aud_hook_dissociate ("show main menu", (HookFunction) show_main_menu);
     mainwin_quit_cb();
 }
 
@@ -2367,6 +2374,7 @@
     gtk_window_add_accel_group( GTK_WINDOW(mainwin) , ui_manager_get_accel_group() );
 
     mainwin_create_widgets();
+    aud_hook_associate ("show main menu", (HookFunction) show_main_menu, 0);
 }
 
 gboolean
@@ -2795,12 +2803,3 @@
 {
     mainwin_quit_cb();
 }
-
-void
-util_menu_main_show( gint x , gint y , guint button , guint time )
-{
-    /* convenience function that shows the main popup menu wherever requested */
-    ui_manager_popup_menu_show( GTK_MENU(mainwin_general_menu),
-                                x , y , button , time );
-    return;
-}
--- a/src/skins/ui_main.h	Fri May 01 12:28:48 2009 -0500
+++ b/src/skins/ui_main.h	Sat May 02 11:16:23 2009 -0400
@@ -51,7 +51,7 @@
 
 enum {
     MAINWIN_GENERAL_ABOUT,
-    
+
     MAINWIN_GENERAL_PLAYFILE,
     MAINWIN_GENERAL_PLAYLOCATION,
 
@@ -188,6 +188,4 @@
 
 void ui_main_check_theme_engine(void);
 
-void util_menu_main_show( gint x , gint y , guint button , guint time );
-
 #endif /* AUDACIOUS_UI_MAIN_H */
--- a/src/statusicon/si_ui.c	Fri May 01 12:28:48 2009 -0500
+++ b/src/statusicon/si_ui.c	Sat May 02 11:16:23 2009 -0400
@@ -102,8 +102,7 @@
           break;
         case SI_CFG_RCLICK_MENU_AUD:
         default:
-          if(audacious_menu_main_show != NULL)
-              audacious_menu_main_show ( event->x_root , event->y_root , 3 , event->time );
+          aud_hook_call ("show main menu", event);
           break;
       }
       break;
@@ -133,7 +132,7 @@
       }
       break;
     }
-    
+
     case GDK_SCROLL_DOWN:
     {
       switch ( si_cfg.scroll_action )
@@ -340,7 +339,7 @@
   GdkPixbuf *si_pixbuf, *si_scaled_pixbuf;
   gint size = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(image) , "size" ));
   static gchar *wmname = NULL;
-  
+
   AUDDBG("WM reported proposed icon size: %d\n", size);
 
   /* sometimes, KDE won't give the correct size-allocation; workaround this */
@@ -360,7 +359,7 @@
 	const gchar *path;
 	gboolean scalable = FALSE;
 	gboolean catch = FALSE;
-	
+
 	theme = gtk_icon_theme_get_default ();
 	array = gtk_icon_theme_get_icon_sizes (theme, "audacious");
 	if (array[0] != 0) {
@@ -380,7 +379,7 @@
 		info = gtk_icon_theme_lookup_icon (theme, "audacious", -1, GTK_ICON_LOOKUP_FORCE_SVG);
 		path = gtk_icon_info_get_filename (info);
 		si_pixbuf = gdk_pixbuf_new_from_file (path, NULL);
-		
+
 	} else {
 		si_pixbuf = gdk_pixbuf_new_from_file (DATA_DIR "/images/audacious_player.xpm", NULL);
 	}
@@ -405,7 +404,7 @@
     size = allocation->height;
   else
     size = allocation->width;*/
-  
+
   size = MAX(allocation->height, allocation->width); /* some WMs doesn't report orientation correctly --asphyx */
 
   if ( prev_size != size )