[gvfs] gmountsource: Always use NULL-terminated arrays



commit 085c2885ff7f1acaf7a5238f85732d361ad55fc9
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Tue Sep 4 18:43:14 2012 +0200

    gmountsource: Always use NULL-terminated arrays
    
    GDBus calls require NULL-terminated string arrays, let's use them
    internally instead of array + n_elements couple.
    
    Also fix all users of g_mount_source_ask_question() and
    g_mount_source_show_processes().
    
    This is a regression after gdbus port actually, the old code used
    to deal with string arrays differently.
    
    Related commit: 99d06e499f999459f1fc973c870415a004722d54
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683118

 common/gmountsource.c    |    8 --------
 common/gmountsource.h    |    4 ----
 daemon/gvfsbackend.c     |    2 --
 daemon/gvfsbackendafc.c  |    1 -
 daemon/gvfsbackendsftp.c |    3 +--
 5 files changed, 1 insertions(+), 17 deletions(-)
---
diff --git a/common/gmountsource.c b/common/gmountsource.c
index a249237..e7f7d73 100644
--- a/common/gmountsource.c
+++ b/common/gmountsource.c
@@ -563,7 +563,6 @@ gboolean
 g_mount_source_ask_question (GMountSource *source,
 			     const char   *message,
 			     const char  **choices,
-			     gint          n_choices,
 			     gboolean     *aborted_out,
 			     gint         *choice_out)
 {
@@ -579,7 +578,6 @@ g_mount_source_ask_question (GMountSource *source,
   g_mount_source_ask_question_async (source,
                                      message,
 				     choices,
-				     n_choices,
                                      ask_reply_sync,
                                      &data);
   
@@ -609,7 +607,6 @@ void
 g_mount_source_ask_question_async (GMountSource       *source,
 				   const char         *message_string,
 				   const char        **choices,
-				   gint                n_choices,
 				   GAsyncReadyCallback callback,
 				   gpointer            user_data)
 {
@@ -702,7 +699,6 @@ op_ask_question (GMountOperation *op,
   g_mount_source_ask_question_async (mount_source,
 				     message,
 				     choices,
-				     g_strv_length ((gchar **) choices),
 				     op_ask_question_reply,
 				     g_object_ref (op));
   g_signal_stop_emission_by_name (op, "ask_question");
@@ -769,7 +765,6 @@ g_mount_source_show_processes_async (GMountSource        *source,
                                      const char          *message_string,
                                      GArray              *processes,
                                      const char         **choices,
-                                     gint                 n_choices,
                                      GAsyncReadyCallback  callback,
                                      gpointer             user_data)
 {
@@ -833,7 +828,6 @@ g_mount_source_show_processes (GMountSource *source,
                                const char   *message,
                                GArray       *processes,
                                const char  **choices,
-                               gint          n_choices,
                                gboolean     *aborted_out,
                                gint         *choice_out)
 {
@@ -850,7 +844,6 @@ g_mount_source_show_processes (GMountSource *source,
                                        message,
                                        processes,
                                        choices,
-                                       n_choices,
                                        ask_reply_sync,
                                        &data);
 
@@ -920,7 +913,6 @@ op_show_processes (GMountOperation *op,
                                        message,
                                        processes,
                                        choices,
-                                       g_strv_length ((gchar **) choices),
                                        op_show_processes_reply,
                                        g_object_ref (op));
   g_signal_stop_emission_by_name (op, "show_processes");
diff --git a/common/gmountsource.h b/common/gmountsource.h
index 58f7f7f..7febdaa 100644
--- a/common/gmountsource.h
+++ b/common/gmountsource.h
@@ -88,14 +88,12 @@ gboolean     g_mount_source_ask_password_finish       (GMountSource
 gboolean      g_mount_source_ask_question             (GMountSource              *mount_source,
 						       const char                *message,
 						       const char               **choices,
-						       gint                       n_choices,
 						       gboolean                  *aborted,
 						       gint                      *choice_out);
 
 void          g_mount_source_ask_question_async       (GMountSource              *mount_source,
 						       const char                *message,
 						       const char               **choices,
-						       gint                       n_choices,
                                                        GAsyncReadyCallback        callback,
                                                        gpointer                   user_data);
 
@@ -108,7 +106,6 @@ gboolean      g_mount_source_show_processes           (GMountSource
 						       const char                *message,
                                                        GArray                    *processes,
 						       const char               **choices,
-						       gint                       n_choices,
 						       gboolean                  *aborted,
 						       gint                      *choice_out);
 
@@ -116,7 +113,6 @@ void          g_mount_source_show_processes_async     (GMountSource
 						       const char                *message,
                                                        GArray                    *processes,
 						       const char               **choices,
-						       gint                       n_choices,
                                                        GAsyncReadyCallback        callback,
                                                        gpointer                   user_data);
 
diff --git a/daemon/gvfsbackend.c b/daemon/gvfsbackend.c
index b6053a2..0c84c15 100644
--- a/daemon/gvfsbackend.c
+++ b/daemon/gvfsbackend.c
@@ -861,7 +861,6 @@ on_update_processes_timeout (gpointer user_data)
                                            data->message,
                                            processes,
                                            data->choices,
-                                           g_strv_length ((gchar **) data->choices),
                                            NULL,
                                            NULL);
     }
@@ -982,7 +981,6 @@ g_vfs_backend_unmount_with_operation (GVfsBackend        *backend,
                                        data->message,
                                        processes,
                                        data->choices,
-                                       g_strv_length ((gchar **) data->choices),
                                        (GAsyncReadyCallback) on_show_processes_reply,
                                        data);
 
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index ea6f91f..704be77 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -629,7 +629,6 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
     ret = g_mount_source_ask_question (src,
                                        message,
                                        choices,
-                                       2,
                                        &aborted,
                                        &choice);
     if (!ret || aborted || (choice == CHOICE_CANCEL))
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index fe2f4b9..b79b4bc 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -1049,7 +1049,7 @@ handle_login (GVfsBackend *backend,
       else if (g_str_has_prefix (buffer, "The authenticity of host '") ||
                strstr (buffer, "Key fingerprint:") != NULL)
         {
-	  const gchar *choices[] = {_("Log In Anyway"), _("Cancel Login")};
+	  const gchar *choices[] = {_("Log In Anyway"), _("Cancel Login"), NULL};
 	  const gchar *choice_string;
 	  gchar *hostname = NULL;
 	  gchar *fingerprint = NULL;
@@ -1071,7 +1071,6 @@ handle_login (GVfsBackend *backend,
 	  if (!g_mount_source_ask_question (mount_source,
 					    message,
 					    choices,
-					    2,
 					    &aborted,
 					    &choice) || 
 	      aborted)



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