[rhythmbox] shell: Fix state of the "Party Mode" toggle item



commit 8f196bb5ba840adf17164ca33f7a562a6708f152
Author: Bastien Nocera <hadess hadess net>
Date:   Fri May 20 15:57:12 2016 +0200

    shell: Fix state of the "Party Mode" toggle item
    
    The "Party Mode" menu item is a toggle menu item. If we only listen to
    the "activate" signal, we'll listen for clicks, but we won't change the
    state. So when the gear menu appears, the old state would be shown.
    
    Listen to the state change instead, and update the action state.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=703910

 shell/rb-shell.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index b69d01a..a9c34f0 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -1742,7 +1742,7 @@ rb_shell_constructed (GObject *object)
                                                         NULL,
                                                         g_variant_new_boolean (FALSE)));
        g_action_map_add_action (G_ACTION_MAP (shell->priv->window), action);
-       g_signal_connect (action, "activate", G_CALLBACK (view_party_mode_changed_cb), shell);
+       g_signal_connect (action, "change-state", G_CALLBACK (view_party_mode_changed_cb), shell);
 
        action = G_ACTION (g_simple_action_new ("library-import", NULL));
        g_signal_connect (action, "activate", G_CALLBACK (add_music_action_cb), shell);
@@ -2415,7 +2415,8 @@ rb_shell_set_window_title (RBShell *shell,
 static void
 view_party_mode_changed_cb (GAction *action, GVariant *parameter, RBShell *shell)
 {
-       shell->priv->party_mode = (shell->priv->party_mode == FALSE);
+       shell->priv->party_mode = g_variant_get_boolean (parameter);
+       g_simple_action_set_state (G_SIMPLE_ACTION (action), parameter);
        rb_shell_sync_party_mode (shell);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]