changeset 3366:ac752b5db631 trunk

introduce change_timer_mode_cb
author Tomasz Mon <desowin@gmail.com>
date Sun, 19 Aug 2007 10:40:43 +0200
parents b4ff4ef0211f
children b47e36a480b3
files src/audacious/ui_main.c src/audacious/ui_main.h src/audacious/ui_playlist.c
diffstat 3 files changed, 21 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Sun Aug 19 10:21:56 2007 +0200
+++ b/src/audacious/ui_main.c	Sun Aug 19 10:40:43 2007 +0200
@@ -436,17 +436,6 @@
 }
 
 gboolean
-mainwin_num_clicked(GtkWidget *widget, GdkEventButton *event)
-{
-    if (event->button == 1) {
-        change_timer_mode();
-    } else if (event->button == 3)
-        return FALSE;
-
-    return TRUE;
-}
-
-gboolean
 mainwin_vis_cb(GtkWidget *widget, GdkEventButton *event)
 {
     if (event->button == 1) {
@@ -2114,6 +2103,17 @@
     cfg.timer_mode = mode;
 }
 
+gboolean
+change_timer_mode_cb(GtkWidget *widget, GdkEventButton *event)
+{
+    if (event->button == 1) {
+        change_timer_mode();
+    } else if (event->button == 3)
+        return FALSE;
+
+    return TRUE;
+}
+
 void change_timer_mode(void) {
     if (cfg.timer_mode == TIMER_ELAPSED)
         set_timer_mode(TIMER_REMAINING);
@@ -2449,19 +2449,19 @@
     mainwin_playstatus = ui_skinned_playstatus_new(SKINNED_WINDOW(mainwin)->fixed, 24, 28);
 
     mainwin_minus_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, 36, 26, SKIN_NUMBERS);
-    g_signal_connect(mainwin_minus_num, "button-press-event", G_CALLBACK(mainwin_num_clicked), NULL);
+    g_signal_connect(mainwin_minus_num, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     mainwin_10min_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, 48, 26, SKIN_NUMBERS);
-    g_signal_connect(mainwin_10min_num, "button-press-event", G_CALLBACK(mainwin_num_clicked), NULL);
+    g_signal_connect(mainwin_10min_num, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     mainwin_min_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, 60, 26, SKIN_NUMBERS);
-    g_signal_connect(mainwin_min_num, "button-press-event", G_CALLBACK(mainwin_num_clicked), NULL);
+    g_signal_connect(mainwin_min_num, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     mainwin_10sec_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, 78, 26, SKIN_NUMBERS);
-    g_signal_connect(mainwin_10sec_num, "button-press-event", G_CALLBACK(mainwin_num_clicked), NULL);
+    g_signal_connect(mainwin_10sec_num, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     mainwin_sec_num = ui_skinned_number_new(SKINNED_WINDOW(mainwin)->fixed, 90, 26, SKIN_NUMBERS);
-    g_signal_connect(mainwin_sec_num, "button-press-event", G_CALLBACK(mainwin_num_clicked), NULL);
+    g_signal_connect(mainwin_sec_num, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     mainwin_about = ui_skinned_button_new();
     ui_skinned_small_button_setup(mainwin_about, SKINNED_WINDOW(mainwin)->fixed, 247, 83, 20, 25);
@@ -2486,10 +2486,10 @@
     g_signal_connect(mainwin_sposition, "release", G_CALLBACK(mainwin_spos_release_cb), NULL);
 
     mainwin_stime_min = ui_skinned_textbox_new(SKINNED_WINDOW(mainwin)->fixed, 130, 4, 15, FALSE, SKIN_TEXT);
-    g_signal_connect(mainwin_stime_min, "clicked", change_timer_mode, NULL);
+    g_signal_connect(mainwin_stime_min, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     mainwin_stime_sec = ui_skinned_textbox_new(SKINNED_WINDOW(mainwin)->fixed, 147, 4, 10, FALSE, SKIN_TEXT);
-    g_signal_connect(mainwin_stime_sec, "clicked", change_timer_mode, NULL);
+    g_signal_connect(mainwin_stime_sec, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     err = gtk_message_dialog_new(GTK_WINDOW(mainwin), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL,
                                  GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error in Audacious."));
--- a/src/audacious/ui_main.h	Sun Aug 19 10:21:56 2007 +0200
+++ b/src/audacious/ui_main.h	Sun Aug 19 10:40:43 2007 +0200
@@ -177,6 +177,7 @@
                                 gpointer user_data);
 
 void mainwin_setup_menus(void);
+gboolean change_timer_mode_cb(GtkWidget *widget, GdkEventButton *event);
 
 void mainwin_jump_to_file(void);
 void mainwin_jump_to_time(void);
@@ -190,5 +191,4 @@
                                 gint * frequency,
                                 gint * numchannels);
 
-
 #endif
--- a/src/audacious/ui_playlist.c	Sun Aug 19 10:21:56 2007 +0200
+++ b/src/audacious/ui_playlist.c	Sun Aug 19 10:40:43 2007 +0200
@@ -1062,12 +1062,6 @@
                    event->button,
                    event->time);
     }
-    else if (event->button == 1 && REGION_R(82, 54, 15, 9)) {
-        if (cfg.timer_mode == TIMER_ELAPSED)
-            cfg.timer_mode = TIMER_REMAINING;
-        else
-            cfg.timer_mode = TIMER_ELAPSED;
-    }
     else if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
              (cfg.easy_move || event->y < 14))
     {
@@ -1414,11 +1408,13 @@
     playlistwin_time_min = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed,
                        playlistwin_get_width() - 82,
                        cfg.playlist_height - 15, 15, FALSE, SKIN_TEXT);
+    g_signal_connect(playlistwin_time_min, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     /* track time (second) */
     playlistwin_time_sec = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed,
                        playlistwin_get_width() - 64,
                        cfg.playlist_height - 15, 10, FALSE, SKIN_TEXT);
+    g_signal_connect(playlistwin_time_sec, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
 
     /* playlist information (current track length / total track length) */
     playlistwin_info = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed,