[gnome-control-center] sharing: don't allow empty passwords in screen sharing



commit 995ba2c2d72311f8dd3c01ae0926d664222a198a
Author: Jonh Wendell <jonh wendell intel com>
Date:   Mon Jul 29 12:34:25 2013 -0300

    sharing: don't allow empty passwords in screen sharing
    
    if the user chooses to use a password but doesn't provide one,
    then revert the option to not use a password at all.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703512

 panels/sharing/cc-sharing-panel.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 2462823..4aa24f6 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -857,6 +857,22 @@ screen_sharing_show_cb (GtkWidget *widget, CcSharingPanel *self)
                                 FALSE);
 }
 
+static void
+screen_sharing_hide_cb (GtkWidget *widget, CcSharingPanel *self)
+{
+  GtkSwitch   *pw_switch;
+  GtkEntry    *pw_entry;
+  const gchar *password;
+  CcSharingPanelPrivate *priv = self->priv;
+
+  pw_switch = GTK_SWITCH (WID ("remote-control-require-password-switch"));
+  pw_entry = GTK_ENTRY (WID ("remote-control-password-entry"));
+  password = gtk_entry_get_text (pw_entry);
+
+  if (password == NULL || *password == '\0')
+    gtk_switch_set_active (pw_switch, FALSE);
+}
+
 #define MAX_PASSWORD_SIZE 8
 static void
 screen_sharing_password_insert_text_cb (GtkEditable *editable,
@@ -944,6 +960,9 @@ cc_sharing_panel_setup_screen_sharing_dialog (CcSharingPanel *self)
   g_signal_connect (priv->screen_sharing_dialog, "show",
                     G_CALLBACK (screen_sharing_show_cb), self);
 
+  g_signal_connect (priv->screen_sharing_dialog, "hide",
+                    G_CALLBACK (screen_sharing_hide_cb), self);
+
   /* accept at most 8 bytes in password entry */
   g_signal_connect (WID ("remote-control-password-entry"), "insert-text",
                     G_CALLBACK (screen_sharing_password_insert_text_cb), self);


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