[nautilus/gnome-2-32: 202/283] Update for GLib 2.25.9 API changes (#621879).
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-2-32: 202/283] Update for GLib 2.25.9 API changes (#621879).
- Date: Thu, 12 Aug 2010 11:21:00 +0000 (UTC)
commit 75f57d3481805a8c426f6fbe3b9b287706ae2f29
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Jun 17 19:00:42 2010 +0200
Update for GLib 2.25.9 API changes (#621879).
configure.in | 2 +-
libnautilus-private/nautilus-mime-actions.c | 70 +++++++++++----------------
src/nautilus-application.c | 55 +++++++++++----------
src/nautilus-application.h | 2 +-
4 files changed, 59 insertions(+), 70 deletions(-)
---
diff --git a/configure.in b/configure.in
index 4862ec7..5b523b2 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 568e28e..75d6446 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 7fa3f7b..3cf2293 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -352,9 +352,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);
@@ -565,23 +565,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),
@@ -594,7 +594,9 @@ session_proxy_appeared (GDBusConnection *connection,
-1,
NULL,
(GAsyncReadyCallback) ck_call_is_active_cb,
- application);
+ application);
+
+ application->proxy = proxy;
}
static void
@@ -619,16 +621,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 d6d681e..36e53b6 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]