changeset 2964:7926d46872c8 trunk

right click on mainwin_about brings menu
author Tomasz Mon <desowin@gmail.com>
date Mon, 02 Jul 2007 10:28:05 +0200
parents 74a2471f8eb7
children f84d09bada0f
files src/audacious/ui_main.c src/audacious/ui_skinned_button.c src/audacious/ui_skinned_button.h
diffstat 3 files changed, 52 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Mon Jul 02 10:11:37 2007 +0200
+++ b/src/audacious/ui_main.c	Mon Jul 02 10:28:05 2007 +0200
@@ -403,6 +403,17 @@
                             1, GDK_CURRENT_TIME);
 }
 
+static void
+mainwin_about_cb(void)
+{
+    gint x, y;
+    gdk_window_get_pointer(NULL, &x, &y, NULL);
+    ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu),
+                            x + 6 * (1 + cfg.doublesize),
+                            y + MAINWIN_SHADED_HEIGHT * (1 + cfg.doublesize),
+                            1, GDK_CURRENT_TIME);
+}
+
 void
 mainwin_minimize_cb(void)
 {
@@ -2796,33 +2807,33 @@
 
     mainwin_shuffle = ui_skinned_button_new();
     ui_skinned_toggle_button_setup(mainwin_shuffle, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
-			SKINNED_WINDOW(mainwin)->gc, 164, 89, 46,
-                       15, 28, 0, 28, 15, 28, 30, 28, 45, SKIN_SHUFREP);
+                                   SKINNED_WINDOW(mainwin)->gc, 164, 89, 46,
+                                   15, 28, 0, 28, 15, 28, 30, 28, 45, SKIN_SHUFREP);
     g_signal_connect(mainwin_shuffle, "clicked", mainwin_shuffle_pushed_cb, NULL);
 
     mainwin_repeat = ui_skinned_button_new();
     ui_skinned_toggle_button_setup(mainwin_repeat, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
-			SKINNED_WINDOW(mainwin)->gc, 210, 89, 28,
-                       15, 0, 0, 0, 15, 0, 30, 0, 45, SKIN_SHUFREP);
+                                   SKINNED_WINDOW(mainwin)->gc, 210, 89, 28,
+                                   15, 0, 0, 0, 15, 0, 30, 0, 45, SKIN_SHUFREP);
     g_signal_connect(mainwin_repeat, "clicked", mainwin_repeat_pushed_cb, NULL);
 
     mainwin_eq = ui_skinned_button_new();
     ui_skinned_toggle_button_setup(mainwin_eq, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
-			SKINNED_WINDOW(mainwin)->gc, 219, 58, 23,
-                       12, 0, 61, 46, 61, 0, 73, 46, 73, SKIN_SHUFREP);
+                                   SKINNED_WINDOW(mainwin)->gc, 219, 58, 23,
+                                   12, 0, 61, 46, 61, 0, 73, 46, 73, SKIN_SHUFREP);
     g_signal_connect(mainwin_eq, "clicked", mainwin_equalizer_pushed_cb, NULL);
     UI_SKINNED_BUTTON(mainwin_eq)->inside = cfg.equalizer_visible;
 
     mainwin_pl = ui_skinned_button_new();
     ui_skinned_toggle_button_setup(mainwin_pl, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
-			SKINNED_WINDOW(mainwin)->gc, 242, 58, 23,
-                       12, 23, 61, 69, 61, 23, 73, 69, 73, SKIN_SHUFREP);
+                                   SKINNED_WINDOW(mainwin)->gc, 242, 58, 23,
+                                   12, 23, 61, 69, 61, 23, 73, 69, 73, SKIN_SHUFREP);
     g_signal_connect(mainwin_pl, "clicked", mainwin_playlist_pushed_cb, NULL);
     UI_SKINNED_BUTTON(mainwin_pl)->inside = cfg.playlist_visible;
 
     mainwin_info = ui_skinned_textbox_new();
     ui_skinned_textbox_setup(mainwin_info, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 112, 27,
-                      153, 1, SKIN_TEXT);
+                             153, 1, SKIN_TEXT);
     ui_skinned_textbox_set_scroll(mainwin_info, cfg.autoscroll);
     ui_skinned_textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font);
     g_signal_connect(mainwin_info, "double-clicked", mainwin_info_double_clicked_cb, NULL);
@@ -2830,15 +2841,15 @@
 
     mainwin_othertext = ui_skinned_textbox_new();
     ui_skinned_textbox_setup(mainwin_othertext, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 112, 43,
-                      153, 1, SKIN_TEXT);
+                             153, 1, SKIN_TEXT);
 
     mainwin_rate_text = ui_skinned_textbox_new();
     ui_skinned_textbox_setup(mainwin_rate_text, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 111, 43, 15,
-                       0, SKIN_TEXT);
+                             0, SKIN_TEXT);
 
     mainwin_freq_text = ui_skinned_textbox_new();
     ui_skinned_textbox_setup(mainwin_freq_text, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 156, 43, 10,
-                       0, SKIN_TEXT);
+                            0, SKIN_TEXT);
 
     mainwin_menurow =
         create_menurow(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 10, 22, 304,
@@ -2889,10 +2900,11 @@
                       SKIN_NUMBERS);
     widget_hide(WIDGET(mainwin_sec_num));
 
-	mainwin_about = ui_skinned_button_new();
-	ui_skinned_small_button_setup(mainwin_about, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
-			SKINNED_WINDOW(mainwin)->gc, 247, 83, 20, 25);
-	g_signal_connect(mainwin_about, "clicked", show_about_window, NULL);
+    mainwin_about = ui_skinned_button_new();
+    ui_skinned_small_button_setup(mainwin_about, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg,
+                                  SKINNED_WINDOW(mainwin)->gc, 247, 83, 20, 25);
+    g_signal_connect(mainwin_about, "clicked", show_about_window, NULL);
+    g_signal_connect(mainwin_about, "right-clicked", mainwin_about_cb, NULL );
 
     mainwin_vis =
         create_vis(&mainwin_wlist, mainwin_bg, mainwin->window, SKINNED_WINDOW(mainwin)->gc,
--- a/src/audacious/ui_skinned_button.c	Mon Jul 02 10:11:37 2007 +0200
+++ b/src/audacious/ui_skinned_button.c	Mon Jul 02 10:28:05 2007 +0200
@@ -27,6 +27,16 @@
 #define UI_SKINNED_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_SKINNED_BUTTON, UiSkinnedButtonPrivate))
 typedef struct _UiSkinnedButtonPrivate UiSkinnedButtonPrivate;
 
+enum {
+	PRESSED,
+	RELEASED,
+	CLICKED,
+	RIGHT_CLICKED,
+	DOUBLED,
+	REDRAW,
+	LAST_SIGNAL
+};
+
 struct _UiSkinnedButtonPrivate {
         //Skinned part
         GtkWidget        *image;
@@ -124,6 +134,7 @@
         klass->pressed = button_pressed;
         klass->released = button_released;
         klass->clicked = NULL;
+        klass->right_clicked = NULL;
         klass->doubled = ui_skinned_button_toggle_doublesize;
         klass->redraw = ui_skinned_button_redraw;
 
@@ -142,6 +153,11 @@
                                   G_STRUCT_OFFSET (UiSkinnedButtonClass, clicked), NULL, NULL,
                                   gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
 
+        button_signals[RIGHT_CLICKED] = 
+                    g_signal_new ("right-clicked", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                                  G_STRUCT_OFFSET (UiSkinnedButtonClass, right_clicked), NULL, NULL,
+                                  gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
         button_signals[DOUBLED] = 
                     g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
                                   G_STRUCT_OFFSET (UiSkinnedButtonClass, doubled), NULL, NULL,
@@ -375,6 +391,8 @@
                 button = UI_SKINNED_BUTTON(widget);
                 button->redraw = TRUE;
                 ui_skinned_button_released(button);
+        } else if (event->button == 3) {
+                g_signal_emit(widget, button_signals[RIGHT_CLICKED], 0);
         }
 
         return TRUE;
--- a/src/audacious/ui_skinned_button.h	Mon Jul 02 10:11:37 2007 +0200
+++ b/src/audacious/ui_skinned_button.h	Mon Jul 02 10:28:05 2007 +0200
@@ -35,15 +35,6 @@
 typedef struct _UiSkinnedButtonClass	UiSkinnedButtonClass;
 
 enum {
-	PRESSED,
-	RELEASED,
-	CLICKED,
-	DOUBLED,
-	REDRAW,
-	LAST_SIGNAL
-};
-
-enum {
 	TYPE_NOT_SET,
 	TYPE_PUSH,
 	TYPE_TOGGLE,
@@ -71,11 +62,12 @@
 
 struct _UiSkinnedButtonClass {
 	GtkBinClass parent_class;
-	void (* pressed)  (UiSkinnedButton *button);
-	void (* released) (UiSkinnedButton *button);
-	void (* clicked)  (UiSkinnedButton *button);
-	void (* doubled)  (UiSkinnedButton *button);
-	void (* redraw)   (UiSkinnedButton *button);
+	void (* pressed)       (UiSkinnedButton *button);
+	void (* released)      (UiSkinnedButton *button);
+	void (* clicked)       (UiSkinnedButton *button);
+	void (* right_clicked) (UiSkinnedButton *button);
+	void (* doubled)       (UiSkinnedButton *button);
+	void (* redraw)        (UiSkinnedButton *button);
 };
 
 GType ui_skinned_button_get_type(void) G_GNUC_CONST;