nicklan / pnmixer

Volume mixer for the system tray
GNU General Public License v3.0
152 stars 32 forks source link

Replace mute/unmute menu item with a checkbox #101

Closed hasufell closed 8 years ago

hasufell commented 8 years ago

This also removes get_mute_state() and substitutes it with a bit more atomic and bug-free versions.

Fixes #99

hasufell commented 8 years ago

@elboulangero any objections? Otherwise I'll merge this soon

elboulangero commented 8 years ago

OK for me, except that there's a warning now at startup:

(pnmixer:6993): GLib-GObject-CRITICAL **: g_signal_handler_block: assertion 'handler_id > 0' failed
(pnmixer:6993): GLib-GObject-CRITICAL **: g_signal_handler_block: assertion 'handler_id > 0' failed
(pnmixer:6993): GLib-GObject-CRITICAL **: g_signal_handler_unblock: assertion 'handler_id > 0' failed
(pnmixer:6993): GLib-GObject-CRITICAL **: g_signal_handler_unblock: assertion 'handler_id > 0' failed

It's because the tray icon is updated too early, because of apply_prefs() in main(). Just moving this call later in main solves it. Here's the patch:

diff --git a/src/main.c b/src/main.c
index 4ae4bb2..53a2a27 100644
--- a/src/main.c
+++ b/src/main.c
@@ -847,7 +847,6 @@ main(int argc, char *argv[])
        add_filter();

        tray_icon = create_tray_icon();
-       apply_prefs(0);

        g_signal_connect(G_OBJECT(tray_icon), "popup-menu",
                         G_CALLBACK(popup_callback), popup_menu);
@@ -862,6 +861,8 @@ main(int argc, char *argv[])
                g_signal_connect(G_OBJECT(mute_check_popup_window),
                                "toggled", G_CALLBACK(on_mute_clicked), NULL);

+       apply_prefs(0);
+
        gtk_main();
        uninit_libnotify();
        alsa_close();