[glib/application] bah# On branch application



commit ca059ac507c28ffa4efe4865dd4e1ff6589fc7f0
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Aug 9 19:50:13 2010 -0400

    bah# On branch application

 gio/gapplication.c |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index e9a97d5..2309204 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -1006,14 +1006,14 @@ g_application_class_init (GApplicationClass *klass)
  */
 
 /**
- * g_application_invoke_variant:
+ * g_application_cmdline_with_arguments:
  * @application: a #GApplication
  * @arguments: a bytestring array #GVariant
  * @returns: a status code
  *
  * Invokes the application with the given commandline arguments.
  *
- * This is a bindings-friendly version of g_application_invoke().
+ * This is a bindings-friendly version of g_application_cmdline().
  **/
 int
 g_application_cmdline_with_arguments (GApplication *application,
@@ -1025,24 +1025,16 @@ g_application_cmdline_with_arguments (GApplication *application,
 
   g_variant_ref_sink (arguments);
 
-  if (class->process_cmdline (application, &arguments, &exit_status))
+  if (!class->process_cmdline (application, &arguments, &exit_status))
     {
-      g_variant_unref (arguments);
-      return exit_status;
-    }
-
-  if (!g_application_register (application, NULL, &error))
-    {
-      g_critical ("%s", error->message);
-      g_variant_unref (arguments);
-      g_error_free (error);
-
-      return 1;
-    }
+      if (!g_application_register (application, NULL, &error))
+        {
+          g_critical ("%s", error->message);
+          g_error_free (error);
+          exit_status = 1;
+        }
 
-  if (application->priv->flags & G_APPLICATION_FLAGS_REMOTE_CMDLINE)
-    {
-      if (g_application_is_remote (application))
+      else if (g_application_is_remote (application))
         {
           GVariant *platform_data;
 
@@ -1066,6 +1058,20 @@ g_application_cmdline_with_arguments (GApplication *application,
         }
     }
 
+  g_variant_unref (arguments);
+
+  if (application->priv->use_count)
+    {
+      G_APPLICATION_GET_CLASS (application)->run_mainloop (application);
+      exit_status = 0;
+    }
+
+  g_application_impl_flush (&application->priv->impl);
+
+  return exit_status;
+}
+
+
   else /* not G_APPLICATION_FLAGS_REMOTE_CMDLINE */
     {
       gint n;



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