[recipes] Survive without D-Bus



commit 9a01fc3312e87f9cea505b50dfece52890304260
Author: Matthias Clasen <mclasen Matthiass-MBP home>
Date:   Thu Mar 2 06:46:47 2017 -0500

    Survive without D-Bus
    
    Not a situation we want to be in, but it is not hard
    to make it work.

 src/gr-account.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/gr-account.c b/src/gr-account.c
index 207d989..8f4b045 100644
--- a/src/gr-account.c
+++ b/src/gr-account.c
@@ -126,7 +126,13 @@ window_handle_exported (GtkWindow  *window,
         const char *handle;
         GVariantBuilder opt_builder;
 
-        cbdata->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+        cbdata->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+       if (!cbdata->connection) {
+                g_message ("Could not talk to D-Bus: %s", error->message);
+                cbdata->callback (NULL, NULL, NULL, cbdata->data, error);
+                free_callback_data (cbdata);
+                return;
+       }
 
         g_variant_builder_init (&opt_builder, G_VARIANT_TYPE ("a{sv}"));
         g_variant_builder_add (&opt_builder, "{sv}", "reason", g_variant_new_string (_("Allow your personal 
information to be included with recipes you share with your friends.")));
@@ -203,9 +209,10 @@ got_account_info (const char  *id,
 
         if (error) {
                 g_message ("Failed to get account information: %s", error->message);
-                g_free (cbdata);
-                return;
-        }
+               id = g_get_user_name ();
+               name = g_get_real_name ();
+               image_path = NULL;
+       }
 
         chef = gr_chef_new ();
         g_object_set (chef,


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