changeset 2857:c35703c9dd9e

fix equalizerwin, replace TButtons with UiSkinnedButton, tbutton.c is no longer needed
author Tomasz Mon <desowin@gmail.com>
date Sat, 23 Jun 2007 15:19:19 +0200
parents c4d07471f647
children 174280672291
files src/audacious/ui_equalizer.c src/audacious/widgets/Makefile src/audacious/widgets/widgetcore.h
diffstat 3 files changed, 20 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_equalizer.c	Sat Jun 23 01:15:33 2007 +0300
+++ b/src/audacious/ui_equalizer.c	Sat Jun 23 15:19:19 2007 +0200
@@ -83,7 +83,7 @@
 
 static GList *equalizerwin_wlist = NULL;
 
-static TButton *equalizerwin_on, *equalizerwin_auto;
+static GtkWidget *equalizerwin_on, *equalizerwin_auto;
 
 static GtkWidget *equalizerwin_close, *equalizerwin_presets, *equalizerwin_shade;
 static EqGraph *equalizerwin_graph;
@@ -228,9 +228,9 @@
 }
 
 static void
-equalizerwin_on_pushed(gboolean toggled)
+equalizerwin_on_pushed(void)
 {
-    cfg.equalizer_active = toggled;
+    cfg.equalizer_active = UI_SKINNED_BUTTON(equalizerwin_on)->inside;
     equalizerwin_eq_changed();
 }
 
@@ -245,9 +245,9 @@
 }
 
 static void
-equalizerwin_auto_pushed(gboolean toggled)
+equalizerwin_auto_pushed(void)
 {
-    cfg.equalizer_autoload = toggled;
+    cfg.equalizer_autoload = UI_SKINNED_BUTTON(equalizerwin_auto)->inside;
 }
 
 static void equalizerwin_draw_titlebar() {
@@ -328,8 +328,9 @@
         else
             widget_list_clear_redraw(equalizerwin_wlist);
 
+        gdk_window_clear(equalizerwin->window);
         GList *iter;
-        for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) {
+        for (iter = GTK_FIXED (SKINNED_WINDOW(equalizerwin)->fixed)->children; iter; iter = g_list_next (iter)) {
             GtkFixedChild *child_data = (GtkFixedChild *) iter->data;
             GtkWidget *child = child_data->widget;
             g_signal_emit_by_name(child, "redraw");
@@ -367,9 +368,7 @@
         if (dock_is_moving(GTK_WINDOW(equalizerwin)))
             dock_move_release(GTK_WINDOW(equalizerwin));
     }
-    else if (event->button == 3 &&
-             !(widget_contains(WIDGET(equalizerwin_on), event->x, event->y) ||
-               widget_contains(WIDGET(equalizerwin_auto), event->x, event->y))) {
+    else if (event->button == 3) {
         /*
          * Pop up the main menu a few pixels down to avoid
          * anything to be selected initially.
@@ -653,23 +652,19 @@
 {
     gint i;
 
-    equalizerwin_on =
-        create_tbutton(&equalizerwin_wlist, equalizerwin_bg,
-                       SKINNED_WINDOW(equalizerwin)->gc, 14, 18, 25, 12, 10, 119, 128, 119,
-                       69, 119, 187, 119, equalizerwin_on_pushed,
-                       SKIN_EQMAIN);
-    tbutton_set_toggled(equalizerwin_on, cfg.equalizer_active);
-    ui_skinned_window_widgetlist_associate(equalizerwin, 
-        WIDGET(equalizerwin_on));
+    equalizerwin_on = ui_skinned_button_new();
+    ui_skinned_toggle_button_setup(equalizerwin_on, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg,
+			SKINNED_WINDOW(equalizerwin)->gc, 14, 18, 25, 12, 10, 119, 128, 119,
+                        69, 119, 187, 119, SKIN_EQMAIN);
+    g_signal_connect(equalizerwin_on, "clicked", equalizerwin_on_pushed, NULL);
+    UI_SKINNED_BUTTON(equalizerwin_on)->inside = cfg.equalizer_active;
 
-    equalizerwin_auto =
-        create_tbutton(&equalizerwin_wlist, equalizerwin_bg,
-                       SKINNED_WINDOW(equalizerwin)->gc, 39, 18, 33, 12, 35, 119, 153, 119,
-                       94, 119, 212, 119, equalizerwin_auto_pushed,
-                       SKIN_EQMAIN);
-    tbutton_set_toggled(equalizerwin_auto, cfg.equalizer_autoload);
-    ui_skinned_window_widgetlist_associate(equalizerwin, 
-        WIDGET(equalizerwin_auto));
+    equalizerwin_auto = ui_skinned_button_new();
+    ui_skinned_toggle_button_setup(equalizerwin_auto, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg,
+			SKINNED_WINDOW(equalizerwin)->gc,39, 18, 33, 12, 35, 119, 153, 119,
+                       94, 119, 212, 119, SKIN_EQMAIN);
+    g_signal_connect(equalizerwin_auto, "clicked", equalizerwin_auto_pushed, NULL);
+    UI_SKINNED_BUTTON(equalizerwin_auto)->inside = cfg.equalizer_autoload;
 
     equalizerwin_presets = ui_skinned_button_new();
     ui_skinned_push_button_setup(equalizerwin_presets, SKINNED_WINDOW(equalizerwin)->fixed, equalizerwin_bg,
--- a/src/audacious/widgets/Makefile	Sat Jun 23 01:15:33 2007 +0300
+++ b/src/audacious/widgets/Makefile	Sat Jun 23 15:19:19 2007 +0200
@@ -22,7 +22,6 @@
 	widget.c \
 	sbutton.c \
 	pbutton.c \
-	tbutton.c \
 	textbox.c \
 	hslider.c \
 	menurow.c \
--- a/src/audacious/widgets/widgetcore.h	Sat Jun 23 01:15:33 2007 +0300
+++ b/src/audacious/widgets/widgetcore.h	Sat Jun 23 15:19:19 2007 +0200
@@ -20,7 +20,6 @@
 #ifndef _WIDGETCORE_H_
 #define _WIDGETCORE_H_
 
-#include "tbutton.h"
 #include "eq_graph.h"
 #include "eq_slider.h"
 #include "hslider.h"