[gnome-photos/gnome-3-24] export-notification: Unbreak the "Empty Trash" button on GNOME >= 3.26
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/gnome-3-24] export-notification: Unbreak the "Empty Trash" button on GNOME >= 3.26
- Date: Wed, 21 Mar 2018 17:32:37 +0000 (UTC)
commit 4a7e2c77221b421409ad7c68e4cdccdef324d8b3
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Mar 21 18:22:48 2018 +0100
export-notification: Unbreak the "Empty Trash" button on GNOME >= 3.26
The /org/gnome/SettingsDaemon/Housekeeping D-Bus object got moved to
the org.gnome.SettingsDaemon.Housekeeping bus name when the
gnome-settings-daemon plugins were split into their own processes in
GNOME 3.26.
Support for older GNOME versions have been retained to allow new
Flatpaks to run on older host OSes.
src/photos-export-notification.c | 75 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 74 insertions(+), 1 deletion(-)
---
diff --git a/src/photos-export-notification.c b/src/photos-export-notification.c
index 1604e8f7..5cfefc72 100644
--- a/src/photos-export-notification.c
+++ b/src/photos-export-notification.c
@@ -104,6 +104,79 @@ photos_export_notification_close (PhotosExportNotification *self)
}
+static void
+photos_export_notification_empty_trash_call_empty_trash (GObject *source_object, GAsyncResult *res, gpointer
user_data)
+{
+ GDBusConnection *connection = G_DBUS_CONNECTION (source_object);
+ GError *error = NULL;
+ GVariant *variant = NULL;
+
+ variant = g_dbus_connection_call_finish (connection, res, &error);
+ if (error != NULL)
+ {
+ if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)
+ || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_INTERFACE)
+ || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)
+ || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_OBJECT))
+ {
+ g_warning ("Unable to call org.gnome.SettingsDaemon.Housekeeping:EmptyTrash: "
+ "unknown interface/method/object/service");
+ }
+ else
+ {
+ g_warning ("Unable to call org.gnome.SettingsDaemon.Housekeeping:EmptyTrash: %s", error->message);
+ }
+
+ g_error_free (error);
+ }
+
+ g_clear_pointer (&variant, (GDestroyNotify) g_variant_unref);
+}
+
+
+static void
+photos_export_notification_empty_trash_call_empty_trash_pre_3_26 (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GDBusConnection *connection = G_DBUS_CONNECTION (source_object);
+ GError *error = NULL;
+ GVariant *variant = NULL;
+
+ variant = g_dbus_connection_call_finish (connection, res, &error);
+ if (error != NULL)
+ {
+ if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)
+ || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_INTERFACE)
+ || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)
+ || g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_OBJECT))
+ {
+ g_dbus_connection_call (connection,
+ "org.gnome.SettingsDaemon.Housekeeping",
+ "/org/gnome/SettingsDaemon/Housekeeping",
+ "org.gnome.SettingsDaemon.Housekeeping",
+ "EmptyTrash",
+ NULL,
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ photos_export_notification_empty_trash_call_empty_trash,
+ NULL);
+ }
+ else
+ {
+ g_warning ("Unable to call org.gnome.SettingsDaemon.Housekeeping:EmptyTrash (GNOME < 3.26): %s",
+ error->message);
+ }
+
+ g_error_free (error);
+ }
+
+ g_clear_pointer (&variant, (GDestroyNotify) g_variant_unref);
+}
+
+
static void
photos_export_notification_empty_trash_bus_get (GObject *source_object, GAsyncResult *result, gpointer
user_data)
{
@@ -129,7 +202,7 @@ photos_export_notification_empty_trash_bus_get (GObject *source_object, GAsyncRe
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
- NULL,
+ photos_export_notification_empty_trash_call_empty_trash_pre_3_26,
NULL);
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]