[gnome-control-center/fix-sharing-master-switch] sharing: Fix master switch



commit 574916496cf5dd7389db6099f317e59819434d3f
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Sat Oct 20 09:40:09 2018 +0200

    sharing: Fix master switch
    
    Since the switches for media, personal file, and screen sharing are in the header bar of the
    respective dialogs, they are not visible when we click on the master switch. This caused the
    check in OFF_IF_VISIBLE to always fail.
    
    Fix it by checking if the corresponding button in the main list box is visible, instead.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/240

 panels/sharing/cc-sharing-panel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 058271695..099ca5887 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -109,7 +109,7 @@ struct _CcSharingPanel
 
 CC_PANEL_REGISTER (CcSharingPanel, cc_sharing_panel)
 
-#define OFF_IF_VISIBLE(x) { if (gtk_widget_is_visible(x) && gtk_widget_is_sensitive(x)) 
gtk_switch_set_active (GTK_SWITCH(x), FALSE); }
+#define OFF_IF_VISIBLE(x, y) { if (gtk_widget_is_visible(x) && gtk_widget_is_sensitive(y)) 
gtk_switch_set_active (GTK_SWITCH(y), FALSE); }
 
 static void
 cc_sharing_panel_master_switch_notify (GtkSwitch      *gtkswitch,
@@ -123,9 +123,9 @@ cc_sharing_panel_master_switch_notify (GtkSwitch      *gtkswitch,
   if (!active)
     {
       /* disable all services if the master switch is not active */
-      OFF_IF_VISIBLE(self->media_sharing_switch);
-      OFF_IF_VISIBLE(self->personal_file_sharing_switch);
-      OFF_IF_VISIBLE(self->screen_sharing_switch);
+      OFF_IF_VISIBLE(self->media_sharing_button, self->media_sharing_switch);
+      OFF_IF_VISIBLE(self->personal_file_sharing_button, self->personal_file_sharing_switch);
+      OFF_IF_VISIBLE(self->screen_sharing_button, self->screen_sharing_switch);
 
       gtk_switch_set_active (GTK_SWITCH (self->remote_login_switch), FALSE);
     }


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