[gnome-autoar/wip/lantw/autoar-0.2] AutoarExtractor: Rename 'decide-destination' to make it synchronous



commit 3f52199c4bfddf1533b7f80e5841d5131cf7ef7c
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Mon Feb 6 02:31:17 2017 +0800

    AutoarExtractor: Rename 'decide-destination' to make it synchronous
    
    This commit is similar to commit 4ac0fd4, which was a temporary fix made
    for gnome-autoar 0.1 releases. The new name of this synchronous signal
    is 'change-destination', which is clearer because it mentions the
    ability of the signal to change the destination,
    
    The name 'decide-destination' still exists in the source code, which is
    reserved for a new asynchronous signal that can report the destination
    but cannot change it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770437#c9

 gnome-autoar/autoar-extractor.c |   27 ++++++++++++++-------------
 tests/test-extract-unit.c       |    6 +++---
 tools/autoar-extract.c          |    4 ++--
 3 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index 043054f..a027e6d 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -71,7 +71,7 @@
  * destination directory already exists, it will proceed normally. If the
  * destionation directory cannot be created, it will fail with an error.
  * It is possible however to change the destination, when
- * #AutoarExtractor::decide-destination is emitted. The signal provides the decided
+ * #AutoarExtractor::change-destination is emitted. The signal provides the decided
  * destination and the list of files to be extracted. The signal also allows a
  * new output destination to be used instead of the one provided by
  * #AutoarExtractor. This is convenient for solving name conflicts and
@@ -158,6 +158,7 @@ struct _GFileAndInfo
 enum
 {
   SCANNED,
+  CHANGE_DESTINATION,
   DECIDE_DESTINATION,
   PROGRESS,
   CONFLICT,
@@ -416,7 +417,7 @@ autoar_extractor_get_notify_interval (AutoarExtractor *self)
  * determined by analyzing the contents of the archive. If this is not wanted,
  * #AutoarExtractor:output-is-dest can be set to %TRUE, which will make
  * #AutoarExtractor:output the destination for extracted files. In any case, the
- * destination will be notified via #AutoarExtractor::decide-destination, when
+ * destination will be notified via #AutoarExtractor::change-destination, when
  * it is possible to set a new destination.
  *
  * #AutoarExtractor will attempt to create the destination regardless to whether
@@ -722,16 +723,16 @@ autoar_extractor_signal_scanned (AutoarExtractor *self)
 }
 
 static inline void
-autoar_extractor_signal_decide_destination (AutoarExtractor *self,
+autoar_extractor_signal_change_destination (AutoarExtractor *self,
                                             GFile *destination,
                                             GList *files,
                                             GFile **new_destination)
 {
-  autoar_common_g_signal_emit (self, self->in_thread,
-                               autoar_extractor_signals[DECIDE_DESTINATION], 0,
-                               destination,
-                               files,
-                               new_destination);
+  g_signal_emit (self,
+                 autoar_extractor_signals[CHANGE_DESTINATION], 0,
+                 destination,
+                 files,
+                 new_destination);
 }
 
 static inline void
@@ -1359,7 +1360,7 @@ autoar_extractor_class_init (AutoarExtractorClass *klass)
                   G_TYPE_UINT);
 
 /**
- * AutoarExtractor::decide-destination:
+ * AutoarExtractor::change-destination:
  * @self: the #AutoarExtractor
  * @destination: the location where files will be extracted
  * @files: the list of files to be extracted. All have @destination as their
@@ -1372,8 +1373,8 @@ autoar_extractor_class_init (AutoarExtractorClass *klass)
  * useful for solving name conflicts or for setting a new destination, based on
  * the contents of the archive.
  **/
-  autoar_extractor_signals[DECIDE_DESTINATION] =
-    g_signal_new ("decide-destination",
+  autoar_extractor_signals[CHANGE_DESTINATION] =
+    g_signal_new ("change-destination",
                   type,
                   G_SIGNAL_RUN_LAST,
                   0, NULL, NULL,
@@ -1731,14 +1732,14 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
    * needed in order to replace it with the new one
    */
   if (self->prefix != NULL) {
-    autoar_extractor_signal_decide_destination (self,
+    autoar_extractor_signal_change_destination (self,
                                                 self->prefix,
                                                 files,
                                                 &new_destination);
 
     self->new_prefix = new_destination;
   } else {
-    autoar_extractor_signal_decide_destination (self,
+    autoar_extractor_signal_change_destination (self,
                                                 self->destination_dir,
                                                 files,
                                                 &new_destination);
diff --git a/tests/test-extract-unit.c b/tests/test-extract-unit.c
index 94a04c2..1fbccd4 100644
--- a/tests/test-extract-unit.c
+++ b/tests/test-extract-unit.c
@@ -163,7 +163,7 @@ scanned_handler (AutoarExtractor *extractor,
 }
 
 static GFile*
-decide_destination_handler (AutoarExtractor *extractor,
+change_destination_handler (AutoarExtractor *extractor,
                             GFile *dest,
                             GList *files,
                             gpointer user_data)
@@ -266,8 +266,8 @@ extract_test_data_new_for_extract (AutoarExtractor *extractor)
 
   g_signal_connect (extractor, "scanned",
                     G_CALLBACK (scanned_handler), data);
-  g_signal_connect (extractor, "decide-destination",
-                    G_CALLBACK (decide_destination_handler), data);
+  g_signal_connect (extractor, "change-destination",
+                    G_CALLBACK (change_destination_handler), data);
   g_signal_connect (extractor, "progress",
                     G_CALLBACK (progress_handler), data);
   g_signal_connect (extractor, "conflict",
diff --git a/tools/autoar-extract.c b/tools/autoar-extract.c
index 2655922..a564430 100644
--- a/tools/autoar-extract.c
+++ b/tools/autoar-extract.c
@@ -14,7 +14,7 @@ my_handler_scanned (AutoarExtractor *extractor,
 }
 
 static GFile*
-my_handler_decide_destination (AutoarExtractor *extractor,
+my_handler_change_destination (AutoarExtractor *extractor,
                                GFile *dest,
                                GList *files,
                                gpointer data)
@@ -109,7 +109,7 @@ main (int argc,
   autoar_extractor_set_delete_after_extraction (extractor, TRUE);
 
   g_signal_connect (extractor, "scanned", G_CALLBACK (my_handler_scanned), NULL);
-  g_signal_connect (extractor, "decide-destination", G_CALLBACK (my_handler_decide_destination), NULL);
+  g_signal_connect (extractor, "change-destination", G_CALLBACK (my_handler_change_destination), NULL);
   g_signal_connect (extractor, "progress", G_CALLBACK (my_handler_progress), NULL);
   g_signal_connect (extractor, "conflict", G_CALLBACK (my_handler_conflict), NULL);
   g_signal_connect (extractor, "error", G_CALLBACK (my_handler_error), NULL);


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