summaryrefslogtreecommitdiff
path: root/plugins/gtkui
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-10 20:41:39 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-10 20:41:39 +0200
commit2eb9009a66975657db982287c82494eb704e8e66 (patch)
treecf3792294ba743450a25b4b28aea036e878e1d4e /plugins/gtkui
parentebdd9a4b04ba3a719c713e7c148d049e958e57ee (diff)
fixed volume bounds check in tray mouse wheel signal handler;
added experimental (disabled) code to show volume tooltip over tray icon
Diffstat (limited to 'plugins/gtkui')
-rw-r--r--plugins/gtkui/gtkui.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 4630bc25..6d3092bb 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -217,6 +217,15 @@ update_songinfo (gpointer ctx) {
return FALSE;
}
+void
+set_tray_tooltip (const char *text) {
+#if (GTK_MINOR_VERSION < 16)
+ gtk_status_icon_set_tooltip (trayicon, text);
+#else
+ gtk_status_icon_set_tooltip_text (trayicon, text);
+#endif
+}
+
gboolean
on_trayicon_scroll_event (GtkWidget *widget,
GdkEventScroll *event,
@@ -233,11 +242,23 @@ on_trayicon_scroll_event (GtkWidget *widget,
if (vol > 0) {
vol = 0;
}
- else if (vol < -60) {
- vol = -60;
+ else if (vol < deadbeef->volume_get_min_db ()) {
+ vol = deadbeef->volume_get_min_db ();
}
deadbeef->volume_set_db (vol);
volumebar_redraw ();
+
+#if 0
+ char str[100];
+ if (deadbeef->conf_get_int ("gtkui.show_gain_in_db", 1)) {
+ snprintf (str, sizeof (str), "Gain: %s%d dB", vol == 0 ? "+" : "", (int)vol);
+ }
+ else {
+ snprintf (str, sizeof (str), "Gain: %d%%", (int)(deadbeef->volume_get_amp () * 100));
+ }
+ set_tray_tooltip (str);
+#endif
+
return FALSE;
}
@@ -364,15 +385,6 @@ gtkui_on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) {
return 0;
}
-void
-set_tray_tooltip (const char *text) {
-#if (GTK_MINOR_VERSION < 16)
- gtk_status_icon_set_tooltip (trayicon, text);
-#else
- gtk_status_icon_set_tooltip_text (trayicon, text);
-#endif
-}
-
static void
current_track_changed (DB_playItem_t *it) {
char str[600];
@@ -1010,6 +1022,7 @@ gtkui_load (DB_functions_t *api) {
static const char settings_dlg[] =
"property \"Ask confirmation to delete files from disk\" checkbox gtkui.delete_files_ask 1;\n"
"property \"Status icon volume control sensitivity\" entry gtkui.tray_volume_sensitivity 1;\n"
+// "property \"Show volume in dB (percentage otherwise)\" entry gtkui.show_gain_in_db 1\n"
"property \"Custom status icon\" entry gtkui.custom_tray_icon \"" TRAY_ICON "\" ;\n"
"property \"Run gtk_init with --sync (debug mode)\" checkbox gtkui.sync 0;\n"
;