diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2010-06-17 19:00:42 +0200 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2010-06-17 19:00:42 +0200 |
commit | eae04584d51b9e058c6dcaea488880d8a43409bf (patch) | |
tree | 51573b8d17785d0609e9e2fac8e2c351301d7c92 | |
parent | 5a53ae7e699edb480b76b72df99fdf1dd68eb8f8 (diff) | |
download | nautilus-eae04584d51b9e058c6dcaea488880d8a43409bf.tar.gz |
Update for GLib 2.25.9 API changes (#621879).
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-mime-actions.c | 70 | ||||
-rw-r--r-- | src/nautilus-application.c | 55 | ||||
-rw-r--r-- | src/nautilus-application.h | 2 |
4 files changed, 59 insertions, 70 deletions
diff --git a/configure.in b/configure.in index 6a737fcc9..959b36d6e 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ AC_PREREQ(2.54) dnl =========================================================================== -m4_define(glib_minver, 2.25.7) +m4_define(glib_minver, 2.25.9) m4_define(gnome_desktop_minver, 2.29.91) m4_define(pango_minver, 1.1.2) m4_define(gtk_minver, 2.21.2) diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c index 568e28e88..75d644661 100644 --- a/libnautilus-private/nautilus-mime-actions.c +++ b/libnautilus-private/nautilus-mime-actions.c @@ -1139,7 +1139,6 @@ typedef struct { char *activation_directory; gboolean user_confirmation; char *uri; - guint pk_watch_id; GDBusProxy *proxy; GtkWidget *dialog; } ActivateParametersInstall; @@ -1157,9 +1156,7 @@ activate_parameters_install_free (ActivateParametersInstall *parameters_install) nautilus_file_list_free (parameters_install->files); g_free (parameters_install->activation_directory); g_free (parameters_install->uri); - if (parameters_install->pk_watch_id != 0) { - g_bus_unwatch_proxy (parameters_install->pk_watch_id); - } + g_object_unref (parameters_install->proxy); g_free (parameters_install); } @@ -1408,16 +1405,31 @@ delete_cb (GtkDialog *dialog) } static void -pk_proxy_appeared_cb (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - GDBusProxy *proxy, +pk_proxy_appeared_cb (GObject *source, + GAsyncResult *res, gpointer user_data) { ActivateParametersInstall *parameters_install = user_data; char *mime_type; char *error_message; GtkWidget *dialog; + GDBusProxy *proxy; + GError *error = NULL; + + proxy = g_dbus_proxy_new_for_bus_finish (res, &error); + + if (error != NULL) { + g_warning ("Couldn't call Modify on the PackageKit interface: %s", + error->message); + g_error_free (error); + + /* show an unhelpful dialog */ + show_unhandled_type_error (parameters_install); + /* The callback wasn't started, so we have to free the parameters */ + activate_parameters_install_free (parameters_install); + + return; + } mime_type = nautilus_file_get_mime_type (parameters_install->file); error_message = get_application_no_mime_type_handler_message (parameters_install->file, @@ -1446,26 +1458,6 @@ pk_proxy_appeared_cb (GDBusConnection *connection, } static void -pk_proxy_vanished_cb (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - ActivateParametersInstall *parameters_install = user_data; - - parameters_install->proxy = NULL; - - if (parameters_install->dialog != NULL) { - gtk_widget_destroy (parameters_install->dialog); - parameters_install->dialog = NULL; - } - - /* show an unhelpful dialog */ - show_unhandled_type_error (parameters_install); - /* The callback wasn't started, so we have to free the parameters */ - activate_parameters_install_free (parameters_install); -} - -static void application_unhandled_uri (ActivateParameters *parameters, char *uri) { gboolean show_install_mime; @@ -1510,19 +1502,15 @@ application_unhandled_uri (ActivateParameters *parameters, char *uri) goto out; } - parameters_install->pk_watch_id = - g_bus_watch_proxy (G_BUS_TYPE_SESSION, - "org.freedesktop.PackageKit", - G_BUS_NAME_WATCHER_FLAGS_AUTO_START, - "/org/freedesktop/PackageKit", - "org.freedesktop.PackageKit.Modify", - G_TYPE_DBUS_PROXY, - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | - G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, - pk_proxy_appeared_cb, - pk_proxy_vanished_cb, - parameters_install, - NULL); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.freedesktop.PackageKit", + "/org/freedesktop/PackageKit", + "org.freedesktop.PackageKit.Modify", + NULL, + pk_proxy_appeared_cb, + parameters_install); return; diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 1f048e37d..5a0af02e1 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -353,9 +353,9 @@ nautilus_application_finalize (GObject *object) application->automount_idle_id = 0; } - if (application->ck_watch_id != 0) { - g_bus_unwatch_proxy (application->ck_watch_id); - application->ck_watch_id = 0; + if (application->proxy != NULL) { + g_object_unref (application->proxy); + application->proxy = NULL; } G_OBJECT_CLASS (nautilus_application_parent_class)->finalize (object); @@ -566,23 +566,23 @@ ck_call_is_active_cb (GDBusProxy *proxy, } static void -session_proxy_vanished (GDBusConnection *connection, - const gchar *name, - gpointer user_data) +session_proxy_appeared (GObject *source, + GAsyncResult *res, + gpointer user_data) { NautilusApplication *application = user_data; + GDBusProxy *proxy; + GError *error = NULL; - application->session_is_active = TRUE; -} + proxy = g_dbus_proxy_new_for_bus_finish (res, &error); -static void -session_proxy_appeared (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - GDBusProxy *proxy, - gpointer user_data) -{ - NautilusApplication *application = user_data; + if (error != NULL) { + g_warning ("Failed to get the current CK session: %s", error->message); + g_error_free (error); + + application->session_is_active = TRUE; + return; + } g_signal_connect (proxy, "g-signal", G_CALLBACK (ck_session_proxy_signal_cb), @@ -595,7 +595,9 @@ session_proxy_appeared (GDBusConnection *connection, -1, NULL, (GAsyncReadyCallback) ck_call_is_active_cb, - application); + application); + + application->proxy = proxy; } static void @@ -620,16 +622,15 @@ ck_get_current_session_cb (GDBusConnection *connection, g_variant_get (variant, "(&o)", &session_path); - application->ck_watch_id = g_bus_watch_proxy (G_BUS_TYPE_SYSTEM, - CK_NAME, - 0, session_path, - CK_INTERFACE ".Session", - G_TYPE_DBUS_PROXY, - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, - session_proxy_appeared, - session_proxy_vanished, - application, - NULL); + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + CK_NAME, + session_path, + CK_INTERFACE ".Session", + NULL, + session_proxy_appeared, + application); g_variant_unref (variant); } diff --git a/src/nautilus-application.h b/src/nautilus-application.h index d6d681eed..36e53b6b4 100644 --- a/src/nautilus-application.h +++ b/src/nautilus-application.h @@ -66,7 +66,7 @@ typedef struct { NautilusUndoManager *undo_manager; GVolumeMonitor *volume_monitor; unsigned int automount_idle_id; - guint ck_watch_id; + GDBusProxy *proxy; gboolean session_is_active; } NautilusApplication; |