[gnome-control-center] sharing: Don't add the folder if the dialog isn't explicity accepted



commit 38180662cddb3fe0305bba1f9e8b6a60efa9be0a
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Feb 9 11:28:24 2015 +0100

    sharing: Don't add the folder if the dialog isn't explicity accepted
    
    E.g. selecting a folder and then dismissing the dialog via the cancel
    button or by pressing escape would still add the folder to the shared
    folders list.

 panels/sharing/cc-sharing-panel.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 5cebb9c..bfc07b1 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -478,7 +478,7 @@ cc_sharing_panel_add_folder (GtkListBox     *box,
 {
   CcSharingPanelPrivate *priv = self->priv;
   GtkWidget *dialog;
-  gchar *folder;
+  gchar *folder = NULL;
   gboolean matching = FALSE;
   GList *rows, *l;
 
@@ -492,7 +492,8 @@ cc_sharing_panel_add_folder (GtkListBox     *box,
                                         _("_Open"), GTK_RESPONSE_ACCEPT,
                                         NULL);
   gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
-  gtk_dialog_run (GTK_DIALOG (dialog));
+  if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
+    goto bail;
 
   gtk_widget_hide (dialog);
 


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