[gnome-photos] export-notification: Simplify code



commit 62e9ac80aa83aa32d25c8d9298b2fcba981a3f41
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 28 18:04:53 2018 +0200

    export-notification: Simplify code

 src/photos-export-notification.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)
---
diff --git a/src/photos-export-notification.c b/src/photos-export-notification.c
index e956c2c1..1f2f3f96 100644
--- a/src/photos-export-notification.c
+++ b/src/photos-export-notification.c
@@ -177,21 +177,13 @@ photos_export_notification_empty_trash_call_empty_trash_pre_3_24 (GObject *sourc
 
 
 static void
-photos_export_notification_empty_trash_bus_get (GObject *source_object, GAsyncResult *result, gpointer 
user_data)
+photos_export_notification_empty_trash (PhotosExportNotification *self)
 {
-  g_autoptr (PhotosExportNotification) self = PHOTOS_EXPORT_NOTIFICATION (user_data);
-  g_autoptr (GDBusConnection) connection = NULL;
-
-  {
-    g_autoptr (GError) error = NULL;
+  GApplication *app;
+  GDBusConnection *connection;
 
-    connection = g_bus_get_finish (result, &error);
-    if (error != NULL)
-      {
-        g_warning ("Unable to connect to session bus: %s", error->message);
-        goto out;
-      }
-  }
+  app = g_application_get_default ();
+  connection = g_application_get_dbus_connection (app);
 
   g_dbus_connection_call (connection,
                           "org.gnome.SettingsDaemon",
@@ -206,15 +198,6 @@ photos_export_notification_empty_trash_bus_get (GObject *source_object, GAsyncRe
                           photos_export_notification_empty_trash_call_empty_trash_pre_3_24,
                           NULL);
 
- out:
-  return;
-}
-
-
-static void
-photos_export_notification_empty_trash (PhotosExportNotification *self)
-{
-  g_bus_get (G_BUS_TYPE_SESSION, NULL, photos_export_notification_empty_trash_bus_get, g_object_ref (self));
   photos_export_notification_destroy (self);
 }
 


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