[patch] use new PackageKit session interface
- From: Richard Hughes <hughsient gmail com>
- To: nautilus-list <nautilus-list gnome org>
- Subject: [patch] use new PackageKit session interface
- Date: Tue, 13 Jan 2009 14:55:26 +0000
We've been working with the KDE devs, and we've come up with a slightly
changed specification that can be adopted by KPackageKit and also have
room for expansion in the future. There's only a couple of things
already using the old interface, nautilus being one of them.
I've attached a trivial patch to nautilus to convert from the old
interface to the new interface. The new interface does not have the
double confirm problem, and now respects the users session policy on
interaction. It'll also be working on KDE soon too.
Please review,
Richard.
Index: libnautilus-private/nautilus-mime-actions.c
===================================================================
--- libnautilus-private/nautilus-mime-actions.c (revision 14855)
+++ libnautilus-private/nautilus-mime-actions.c (working copy)
@@ -1054,6 +1054,7 @@
{
gboolean ret;
GError *error = NULL;
+ char *message;
const char *remote = NULL;
ret = dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
@@ -1062,10 +1063,13 @@
remote = dbus_g_error_get_name (error);
}
/* we already show an error in the installer if not found, just catch generic failure */
- if (remote == NULL || strcmp (remote, "org.freedesktop.PackageKit.Failed") == 0) {
- eel_show_error_dialog (_("Unable to search for application"),
- _("There was an internal error trying to search for applications"),
+ if (remote == NULL || strcmp (remote, "org.freedesktop.PackageKit.Modify.Failed") == 0) {
+ message = g_strdup_printf ("%s\n%s",
+ _("There was an internal error trying to search for applications:"),
+ error->message);
+ eel_show_error_dialog (_("Unable to search for application"), message,
parameters_install->parent_window);
+ g_free (message);
}
g_error_free (error);
return;
@@ -1094,6 +1098,7 @@
DBusGProxyCall *call = NULL;
GtkWidget *dialog;
GdkWindow *window;
+ char **mime_types;
/* get bus */
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
@@ -1107,7 +1112,7 @@
proxy = dbus_g_proxy_new_for_name (connection,
"org.freedesktop.PackageKit",
"/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit");
+ "org.freedesktop.PackageKit.Modify");
if (proxy == NULL) {
g_warning ("Could not connect to PackageKit session service\n");
goto out;
@@ -1123,14 +1128,16 @@
dbus_g_proxy_set_default_timeout (proxy, INT_MAX);
/* invoke the method */
- call = dbus_g_proxy_begin_call (proxy, "InstallMimeType",
+ mime_types = g_strsplit (mime_type, "|", 1);
+ call = dbus_g_proxy_begin_call (proxy, "InstallMimeTypes",
(DBusGProxyCallNotify) search_for_application_dbus_call_notify_cb,
parameters_install,
(GDestroyNotify) activate_parameters_install_free,
G_TYPE_UINT, xid,
- G_TYPE_UINT, 0,
- G_TYPE_STRING, mime_type,
+ G_TYPE_STRV, mime_types,
+ G_TYPE_STRING, "hide-confirm-search",
G_TYPE_INVALID);
+ g_strfreev (mime_types);
if (call == NULL) {
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]