Commit 8ad2cbdd authored by Debarshi Ray's avatar Debarshi Ray

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.
parent 9007599c
......@@ -105,6 +105,77 @@ 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);
g_autoptr (GVariant) variant = NULL;
{
g_autoptr (GError) error = 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);
}
}
}
}
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);
g_autoptr (GVariant) variant = NULL;
{
g_autoptr (GError) error = 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);
}
}
}
}
static void
photos_export_notification_empty_trash_bus_get (GObject *source_object, GAsyncResult *result, gpointer user_data)
{
......@@ -132,7 +203,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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment