[gvfs] afc: use the correct choice index for "Cancel"



commit 3fb6e428593ad90904aa07531dd99d9d0cd5e5b2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Aug 23 11:50:35 2012 +0200

    afc: use the correct choice index for "Cancel"
    
    Or pressing the button won't dismiss the dialog.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682496

 daemon/gvfsbackendafc.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 8fa0979..cfee444 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -383,6 +383,12 @@ unpair_client (lockdownd_client_t client,
   return ret;
 }
 
+/* keep in sync with the choices array in g_vfs_backend_afc_mount() */
+enum {
+  CHOICE_TRY_AGAIN = 0,
+  CHOICE_CANCEL
+};
+
 /* Callback for mounting. */
 static void
 g_vfs_backend_afc_mount (GVfsBackend *backend,
@@ -407,7 +413,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
   char **dcim_afcinfo;
   plist_t value;
   lockdownd_error_t lerr;
-  const gchar *choices[] = {_("Try again"), _("Cancel"), NULL};
+  const gchar *choices[] = {_("Try again"), _("Cancel"), NULL}; /* keep in sync with the enum above */
   gboolean aborted = FALSE;
   gchar *message = NULL;
   gint choice;
@@ -623,7 +629,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
                                        2,
                                        &aborted,
                                        &choice);
-    if (!ret || aborted || (choice == 0))
+    if (!ret || aborted || (choice == CHOICE_CANCEL))
       break;
   } while (retries++ < 10);
 



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