gnome-packagekit r441 - in trunk: . src



Author: rhughes
Date: Thu Nov 27 09:51:50 2008
New Revision: 441
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=441&view=rev

Log:
rebase to trunk, new translations

Modified:
   trunk/NEWS
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/gpk-application.c
   trunk/src/gpk-client-chooser.c
   trunk/src/gpk-client-dialog.c
   trunk/src/gpk-client-run.c
   trunk/src/gpk-client.c
   trunk/src/gpk-client.h
   trunk/src/gpk-dbus.c
   trunk/src/gpk-dbus.h
   trunk/src/gpk-desktop.c
   trunk/src/gpk-desktop.h
   trunk/src/gpk-dialog.c
   trunk/src/gpk-enum.c
   trunk/src/org.freedesktop.PackageKit.xml

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Thu Nov 27 09:51:50 2008
@@ -1,3 +1,47 @@
+Version 0.3.11
+~~~~~~~~~~~~~~
+Released: 2008-11-24
+
+* Translations
+ - Added Danish translation (Jan Madsen)
+ - Updated Spanish help translation (Daniel Mustieles)
+ - Updated Hungarian translation (Gabor Kelemen)
+ - Updated Italian translation (Gianvito Cavasoli)
+ - Updated Spanish translation (Jorge Gonzalez)
+ - Updated Czech translation (Marek Lisy)
+ - Updated Hebrew translation (Mark Krapivner)
+ - Updated Polish translation (Tomasz Dominikowski)
+ - Updated Polish help translation (Tomasz Dominikowski)
+ - Updated Finnish translation (Ville-Pekka Vainio)
+
+* New Features:
+ - Show the user and executable used for a transaction in gpk-log (Richard Hughes)
+ - Use PkDesktop rather than PkExtra so we can do cleverer things with the
+   desktop file results (Richard Hughes)
+
+* Bugfix:
+ - Prefix the libnotify widget title with a 'Package Manager' prefix so the
+   user has some idea what service it's coming from (Richard Hughes)
+ - Initialise the libnotify subsystem before it's attempted to create
+   notifications in GpkClient (Richard Hughes)
+ - Ensure we set the GpkClientDialog properly when doing a repo signature (Richard Hughes)
+ - Fix a crash if the user installs two bits of software in gpk-application and
+   runs neither of them (Richard Hughes)
+ - Don't show GPG in the client dialogs. Also make the unsigned packages UI less scary. (Richard Hughes)
+ - Make the root windows of the glade files be GtkDialog type, not GtkWindow (Richard Hughes)
+ - Don't overwrite CPPFLAGS in the configure check for g_file_make_directory_with_parents (Richard Hughes)
+ - Fix compile problem on x86_64 - missing header (Scott Reeves)
+ - Remove unused code (Scott Reeves)
+ - Adapt example to latest api (Sebastian Heinlein)
+ - Python widgets: Adapt latest API changes and introduce an error class (Sebastian Heinlein)
+ - Python widgets: Add a PackageKitPackageDialog and a high level PackageKitInstaller (Sebastian Heinlein)
+ - Python client: Do not make the window parent insensitive. This should be done
+   by the application (Sebastian Heinlein)
+ - Python widgets: Set the progress bar to 100% when the transaction is complete (Sebastian Heinlein)
+ - Python client: Add (install|remove)_by_name methods to the installer (Sebastian Heinlein)
+ - Python client: The progress dialog's run method returns the exit state of the transaction (Sebastian Heinlein)
+ - Python client: Handle return values correctly (Sebastian Heinlein)
+
 Version 0.3.10
 ~~~~~~~~~~~~~~
 Released: 2008-11-10

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Nov 27 09:51:50 2008
@@ -1,6 +1,6 @@
 AC_PREREQ(2.52)
 
-AC_INIT(gnome-packagekit, 0.3.11)
+AC_INIT(gnome-packagekit, 0.4.0)
 AC_CONFIG_SRCDIR(src)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)
@@ -52,7 +52,7 @@
 dnl ---------------------------------------------------------------------------
 dnl - Library dependencies
 dnl ---------------------------------------------------------------------------
-PACKAGEKIT_REQUIRED=0.3.8
+PACKAGEKIT_REQUIRED=0.3.11
 GLIB_REQUIRED=2.14.0
 GTK_REQUIRED=2.12.0
 DBUS_REQUIRED=1.1.2
@@ -63,6 +63,7 @@
 LIBSEXY_REQUIRED=0.1.10
 POLKIT_GNOME_REQUIRED=0.8
 UNIQUE_REQUIRED=0.9.4
+GNOME_MENUS_REQUIRED=2.24.1
 
 dnl ---------------------------------------------------------------------------
 dnl - Make above strings available for packaging files (e.g. rpm spec files)
@@ -77,6 +78,7 @@
 AC_SUBST(LIBSEXY_REQUIRED)
 AC_SUBST(POLKIT_GNOME_REQUIRED)
 AC_SUBST(UNIQUE_REQUIRED)
+AC_SUBST(GNOME_MENUS_REQUIRED)
 
 dnl ---------------------------------------------------------------------------
 dnl - Check library dependencies
@@ -97,9 +99,11 @@
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
+OLDCPPFLAGS=$CPPFLAGS
 CPPFLAGS=$GIO_CFLAGS
 LIBS=$GIO_LIBS
 AC_CHECK_FUNCS(g_file_make_directory_with_parents)
+CPPFLAGS=$OLDCPPFLAGS
 
 PKG_CHECK_MODULES(DBUS, \
  dbus-glib-1 >= $DBUS_GLIB_REQUIRED \
@@ -109,7 +113,7 @@
 AC_SUBST(DBUS_LIBS)
 
 PKG_CHECK_MODULES(GTK, \
- gtk+-2.0 >= $GTK_REQUIRED, gdk-2.0)
+ gtk+-2.0 >= $GTK_REQUIRED gdk-2.0)
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
@@ -133,6 +137,11 @@
 AC_SUBST(LIBNOTIFY_CFLAGS)
 AC_SUBST(LIBNOTIFY_LIBS)
 
+PKG_CHECK_MODULES(GNOME_MENUS, \
+ libgnome-menu >= $GNOME_MENUS_REQUIRED)
+AC_SUBST(GNOME_MENUS_CFLAGS)
+AC_SUBST(GNOME_MENUS_LIBS)
+
 AC_PATH_PROG(GCONFTOOL, gconftool-2)
 AM_GCONF_SOURCE_2
 
@@ -276,6 +285,7 @@
         datadir:                   ${datadir}
         compiler:                  ${CC}
         cflags:                    ${CFLAGS}
-	gconf-schema dir:          $GCONF_SCHEMA_FILE_DIR
+        cppflags:                  ${CPPFLAGS}
+        gconf-schema dir:          $GCONF_SCHEMA_FILE_DIR
 "
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Nov 27 09:51:50 2008
@@ -14,6 +14,7 @@
 	$(UNIQUE_CFLAGS)				\
 	$(POLKIT_GNOME_CFLAGS)				\
 	$(GTK_CFLAGS)					\
+	$(GNOME_MENUS_CFLAGS)				\
 	-DBINDIR=\"$(bindir)\"			 	\
 	-DDATADIR=\"$(datadir)\"			\
 	-DPREFIX=\""$(prefix)"\" 			\
@@ -107,6 +108,7 @@
 	$(PACKAGEKIT_LIBS)				\
 	$(UNIQUE_LIBS)					\
 	$(POLKIT_GNOME_LIBS)				\
+	$(GNOME_MENUS_LIBS)				\
 	$(NULL)
 
 gpk_install_provide_file_SOURCES =			\

Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c	(original)
+++ trunk/src/gpk-application.c	Thu Nov 27 09:51:50 2008
@@ -1013,6 +1013,18 @@
 		gpk_application_add_detail_item (application, _("License"), details->license, NULL);
 	}
 
+	/* menu path */
+	value = gpk_desktop_guess_best_file (application->priv->desktop, details->id->name);
+	if (value != NULL) {
+		text = gpk_desktop_get_menu_path (value);
+		if (text != NULL) {
+			/* TRANSLATORS: the path in the menu, e.g. Applications -> Games */
+			gpk_application_add_detail_item (application, _("Menu"), text, NULL);
+		}
+		g_free (text);
+	}
+	g_free (value);
+
 	/* set the description */
 	text = gpk_application_text_format_display (details->description);
 	widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description");

Modified: trunk/src/gpk-client-chooser.c
==============================================================================
--- trunk/src/gpk-client-chooser.c	(original)
+++ trunk/src/gpk-client-chooser.c	Thu Nov 27 09:51:50 2008
@@ -177,7 +177,6 @@
 	const PkPackageObj *obj;
 	GtkTreeIter iter;
 	PkDesktop *desktop;
-	gboolean ret;
 	const gchar *icon_name;
 	gchar *text;
 	guint len;

Modified: trunk/src/gpk-client-dialog.c
==============================================================================
--- trunk/src/gpk-client-dialog.c	(original)
+++ trunk/src/gpk-client-dialog.c	Thu Nov 27 09:51:50 2008
@@ -592,7 +592,6 @@
 	gchar *text;
 	guint length;
 	guint i;
-	gboolean valid;
 	GtkWidget *widget;
 
 	gtk_list_store_clear (dialog->priv->store);

Modified: trunk/src/gpk-client-run.c
==============================================================================
--- trunk/src/gpk-client-run.c	(original)
+++ trunk/src/gpk-client-run.c	Thu Nov 27 09:51:50 2008
@@ -35,6 +35,7 @@
 #include "gpk-client.h"
 #include "gpk-common.h"
 #include "gpk-enum.h"
+#include "gpk-desktop.h"
 
 static GtkListStore *list_store = NULL;
 static gchar *full_path = NULL;
@@ -173,10 +174,12 @@
 	gboolean ret;
 	gchar *icon = NULL;
 	gchar *text = NULL;
+	gchar *fulltext = NULL;
 	gchar *name = NULL;
 	gchar *exec = NULL;
 	gchar *summary = NULL;
 	gchar *joint = NULL;
+	gchar *menu_path;
 	GtkTreeIter iter;
 	GKeyFile *file;
 	PkPackageId *id;
@@ -220,6 +223,13 @@
 	joint = g_strdup_printf ("%s - %s", name, summary);
 	id = pk_package_id_new_from_string (package_id);
 	text = gpk_package_id_format_twoline (id, joint);
+	menu_path = gpk_desktop_get_menu_path (filename);
+	if (menu_path) {
+		/* TRANSLATORS: the path in the menu, e.g. Applications -> Games -> Dave */
+		fulltext = g_strdup_printf("%s\n\n<i>%s %s</i>", text, _("Menu:"), menu_path);
+		g_free (text);
+		text = fulltext;
+	}
 	pk_package_id_free (id);
 
 	/* might not be valid */
@@ -230,7 +240,7 @@
 	if (icon == NULL)
 		icon = g_strdup (gpk_info_enum_to_icon_name (PK_INFO_ENUM_AVAILABLE));
 	gtk_list_store_set (list_store, &iter,
-			    GPK_CHOOSER_COLUMN_TEXT, text,
+			    GPK_CHOOSER_COLUMN_TEXT, fulltext,
 			    GPK_CHOOSER_COLUMN_FULL_PATH, exec,
 			    GPK_CHOOSER_COLUMN_ICON, icon, -1);
 out:
@@ -240,6 +250,7 @@
 	g_free (icon);
 	g_free (name);
 	g_free (text);
+	g_free (menu_path);
 	g_free (joint);
 	g_free (summary);
 

Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c	(original)
+++ trunk/src/gpk-client.c	Thu Nov 27 09:51:50 2008
@@ -774,7 +774,7 @@
 	/* don't use a bullet for one item */
 	if (array->len == 1) {
 		if (prefix != NULL)
-			return g_strdup_printf ("%s\n\n%s", prefix, g_ptr_array_index (array, 0));
+			return g_strdup_printf ("%s\n\n%s", prefix, (const gchar *) g_ptr_array_index (array, 0));
 		else
 			return g_strdup (g_ptr_array_index (array, 0));
 	}
@@ -891,8 +891,6 @@
 	gchar *dest_path = NULL;
 	gchar *new_path = NULL;
 	gchar *cache_path = NULL;
-	gboolean ret;
-	GAsyncResult *res;
 	GError *error_local = NULL;
 
 	/* create the non FUSE temp directory */
@@ -2359,9 +2357,22 @@
 }
 
 /**
- * gpk_client_install_font:
+ * gpk_client_font_tag_to_localised_name:
+ **/
+static gchar *
+gpk_client_font_tag_to_localised_name (GpkClient *gclient, const gchar *tag)
+{
+	guint len;
+	len = strlen (tag);
+	if (len < 7)
+		return g_strdup_printf ("unknown: %s", tag);
+	return g_strdup (&tag[6]);
+}
+
+/**
+ * gpk_client_install_fonts:
  * @gclient: a valid #GpkClient instance
- * @font_desc: a font description such as <literal>lang:en_GB</literal>
+ * @fonts: font description such as <literal>lang:fr</literal>
  * @error: a %GError to put the error code and message in, or %NULL
  *
  * Install a application to handle a mime type
@@ -2369,19 +2380,28 @@
  * Return value: %TRUE if the method succeeded
  **/
 gboolean
-gpk_client_install_font (GpkClient *gclient, const gchar *font_desc, GError **error)
+gpk_client_install_fonts (GpkClient *gclient, gchar **fonts, GError **error)
 {
 	gboolean ret;
 	PkPackageList *list = NULL;
+	PkPackageList *list_tmp = NULL;
 	GtkResponseType button;
 	gchar *info_url;
 	GError *error_local = NULL;
 	gchar **package_ids = NULL;
+	guint i;
 	guint len;
+	gchar *text;
 	gchar *message;
+	const gchar *title;
+	const gchar *title_part;
+	GString *string;
 
 	g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
-	g_return_val_if_fail (font_desc != NULL, FALSE);
+	g_return_val_if_fail (fonts != NULL, FALSE);
+
+	/* get number of fonts to install */
+	len = g_strv_length (fonts);
 
 	/* check it's not session wide banned in gconf */
 	ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_ENABLE_FONT_HELPER, NULL);
@@ -2397,12 +2417,34 @@
 		goto skip_checks;
 	}
 
+	string = g_string_new ("");
+
+	/* don't use a bullet for one item */
+	if (len == 1) {
+		text = gpk_client_font_tag_to_localised_name (gclient, fonts[0]);
+		g_string_append_printf (string, "%s\n", text);
+		g_free (text);
+	} else {
+		for (i=0; i<len; i++) {
+			text = gpk_client_font_tag_to_localised_name (gclient, fonts[i]);
+			g_string_append_printf (string, "â %s\n", text);
+			g_free (text);
+		}
+	}
+	/* display messagebox  */
+	text = g_string_free (string, FALSE);
+
+	/* TRANSLATORS: we need to download a new font package to display a document */
+	title = ngettext ("An additional font is required to view this document correctly.",
+			  "Additional fonts are required to view this document correctly.", len);
+
+	/* TRANSLATORS: we need to download a new font package to display a document */
+	title_part = ngettext ("Do you want to search for a suitable package now?",
+			       "Do you want to search for suitable packages now?", len);
+
 	/* check user wanted operation */
-	message = g_strdup_printf ("%s\n\n%s",
-				   /* TRANSLATORS: we need to download a new font package to display a document */
-				   _("An additional font is required to view this file correctly"),
-				   /* TRANSLATORS: confirm with user */
-				   _("Do you want to search for a suitable font now?"));
+	message = g_strdup_printf ("%s\n\n%s\n%s", title, text, title_part);
+
 	/* TRANSLATORS: title: font installer */
 	gpk_client_dialog_set_title (gclient->priv->dialog, _("Font installer"));
 	/* TRANSLATORS: buttton: search for font */
@@ -2417,8 +2459,9 @@
 	}
 
 skip_checks:
-	/* TRANSLATORS: title: we are now searching */
-	gpk_client_dialog_set_title (gclient->priv->dialog, _("Searching for fonts"));
+	/* TRANSLATORS: title to show when searching for font files */
+	title = ngettext ("Searching for font", "Searching for fonts", len);
+	gpk_client_dialog_set_title (gclient->priv->dialog, title);
 	gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_WAIT);
 	gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-finding-packages");
 
@@ -2426,35 +2469,45 @@
 	if (gclient->priv->show_progress)
 		gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
 
-	/* reset */
-	ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
-	if (!ret) {
-		/* TRANSLATORS: this is an internal error, and should not be seen */
-		gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
-		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
-		g_error_free (error_local);
-		goto out;
-	}
+	/* do each one */
+	list = pk_package_list_new ();
+	for (i=0; i<len; i++) {
 
-	/* action */
-	ret = pk_client_what_provides (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
-				       PK_PROVIDES_ENUM_FONT, font_desc, &error_local);
-	if (!ret) {
-		/* TRANSLATORS: we failed to find the package, this shouldn't happen */
-		gpk_client_error_msg (gclient, _("Failed to search for provides"), error_local);
-		gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
-		g_error_free (error_local);
-		goto out;
+		/* reset */
+		ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
+		if (!ret) {
+			/* TRANSLATORS: this is an internal error, and should not be seen */
+			gpk_client_error_msg (gclient, _("Failed to reset client used for searching"), error_local);
+			gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+			g_error_free (error_local);
+			goto out;
+		}
+
+		/* action */
+		ret = pk_client_what_provides (gclient->priv->client_resolve, pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED),
+					       PK_PROVIDES_ENUM_FONT, fonts[i], &error_local);
+		if (!ret) {
+			/* TRANSLATORS: we failed to find the package, this shouldn't happen */
+			gpk_client_error_msg (gclient, _("Failed to search for provides"), error_local);
+			gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+			g_error_free (error_local);
+			goto out;
+		}
+
+		/* add to main list */
+		list_tmp = pk_client_get_package_list (gclient->priv->client_resolve);
+		pk_obj_list_add_list (PK_OBJ_LIST (list), PK_OBJ_LIST (list_tmp));
+		g_object_unref (list_tmp);
 	}
 
 	/* found nothing? */
-	list = pk_client_get_package_list (gclient->priv->client_resolve);
 	len = pk_package_list_get_size (list);
 	if (len == 0) {
 		if (gclient->priv->show_warning) {
 			info_url = gpk_vendor_get_not_found_url (gclient->priv->vendor, GPK_VENDOR_URL_TYPE_FONT);
 			/* TRANSLATORS: title: cannot find in sources */
-			gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to find font"));
+			title = ngettext ("Failed to find font", "Failed to find fonts", len);
+			gpk_client_dialog_set_title (gclient->priv->dialog, title);
 			/* TRANSLATORS: message: tell the user we suck */
 			gpk_client_dialog_set_message (gclient->priv->dialog, _("No new fonts can be found for this document"));
 			gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-package-not-found");
@@ -2481,11 +2534,15 @@
 		goto skip_checks2;
 	}
 
-	gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
 	/* TRANSLATORS: title: show a list of fonts */
-	gpk_client_dialog_set_title (gclient->priv->dialog, _("Install the following fonts"));
+	title = ngettext ("Install the following font", "Install the following fonts", len);
+	gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
+	gpk_client_dialog_set_title (gclient->priv->dialog, title);
+
 	/* TRANSLATORS: confirm */
-	gpk_client_dialog_set_message (gclient->priv->dialog, _("Do you want to install these packages now?"));
+	title = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", len);
+
+	gpk_client_dialog_set_message (gclient->priv->dialog, title);
 	gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-information");
 	/* TRANSLATORS: button: install a font */
 	gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
@@ -2567,6 +2624,7 @@
 		goto skip_checks;
 	}
 
+	/* TRANSLATORS: title to install package catalogs */
 	title = ngettext ("Do you want to install this catalog?",
 			  "Do you want to install these catalogs?", len);
 	message = g_strjoinv ("\n", filenames);

Modified: trunk/src/gpk-client.h
==============================================================================
--- trunk/src/gpk-client.h	(original)
+++ trunk/src/gpk-client.h	Thu Nov 27 09:51:50 2008
@@ -97,8 +97,8 @@
 gboolean	 gpk_client_install_gstreamer_codecs	(GpkClient	*gclient,
 							 gchar		**codec_name_strings,
 							 GError		**error);
-gboolean	 gpk_client_install_font		(GpkClient	*gclient,
-							 const gchar	*font_desc,
+gboolean	 gpk_client_install_fonts		(GpkClient	*gclient,
+							 gchar		**fonts,
 							 GError		**error);
 gboolean	 gpk_client_install_package_names	(GpkClient	*gclient,
 							 gchar		**packages,

Modified: trunk/src/gpk-dbus.c
==============================================================================
--- trunk/src/gpk-dbus.c	(original)
+++ trunk/src/gpk-dbus.c	Thu Nov 27 09:51:50 2008
@@ -442,20 +442,59 @@
 }
 
 /**
+ * gpk_dbus_install_fonts:
+ **/
+void
+gpk_dbus_install_fonts (GpkDbus *dbus, guint32 xid, guint32 timestamp, gchar **fonts, DBusGMethodInvocation *context)
+{
+	gboolean ret;
+	GError *error;
+	GError *error_local = NULL;
+	gchar *sender;
+	gchar *exec;
+
+	g_return_if_fail (PK_IS_DBUS (dbus));
+
+	egg_debug ("InstallPackageNames method called: %s", fonts[0]);
+
+	gpk_dbus_set_parent_window (dbus, xid, timestamp);
+
+	/* get the program name and set */
+	sender = dbus_g_method_get_sender (context);
+	exec = gpk_dbus_get_exec_for_sender (sender);
+	gpk_client_set_parent_exec (dbus->priv->gclient, exec);
+	g_free (sender);
+	g_free (exec);
+
+	/* do the action */
+	ret = gpk_client_install_fonts (dbus->priv->gclient, fonts, &error_local);
+	if (!ret) {
+		error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
+				     "Method failed: %s", error_local->message);
+		g_error_free (error_local);
+		dbus_g_method_return_error (context, error);
+		return;
+	}
+
+	dbus_g_method_return (context);
+}
+
+/**
  * gpk_dbus_install_font:
  **/
 void
-gpk_dbus_install_font (GpkDbus *dbus, guint32 xid, guint32 timestamp, const gchar *font_desc, DBusGMethodInvocation *context)
+gpk_dbus_install_font (GpkDbus *dbus, guint32 xid, guint32 timestamp, const gchar *font, DBusGMethodInvocation *context)
 {
 	gboolean ret;
 	GError *error;
 	GError *error_local = NULL;
 	gchar *sender;
 	gchar *exec;
+	gchar **fonts;
 
 	g_return_if_fail (PK_IS_DBUS (dbus));
 
-	egg_debug ("InstallFont method called: %s", font_desc);
+	egg_debug ("InstallFont method called: %s", font);
 
 	/* set modality */
 	gpk_dbus_set_parent_window (dbus, xid, timestamp);
@@ -468,7 +507,9 @@
 	g_free (exec);
 
 	/* do the action */
-	ret = gpk_client_install_font (dbus->priv->gclient, font_desc, &error_local);
+	fonts = g_strsplit (font, "|", 1);
+	ret = gpk_client_install_fonts (dbus->priv->gclient, fonts, &error_local);
+	g_strfreev (fonts);
 	if (!ret) {
 		error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED,
 				     "Method failed: %s", error_local->message);

Modified: trunk/src/gpk-dbus.h
==============================================================================
--- trunk/src/gpk-dbus.h	(original)
+++ trunk/src/gpk-dbus.h	Thu Nov 27 09:51:50 2008
@@ -95,6 +95,11 @@
 							 guint32	 timestamp,
 							 const gchar	*font_desc,
 							 DBusGMethodInvocation *context);
+void		 gpk_dbus_install_fonts			(GpkDbus	*dbus,
+							 guint32	 xid,
+							 guint32	 timestamp,
+							 gchar		**font_descs,
+							 DBusGMethodInvocation *context);
 void		 gpk_dbus_install_catalog		(GpkDbus	*dbus,
 							 guint32	 xid,
 							 guint32	 timestamp,

Modified: trunk/src/gpk-desktop.c
==============================================================================
--- trunk/src/gpk-desktop.c	(original)
+++ trunk/src/gpk-desktop.c	Thu Nov 27 09:51:50 2008
@@ -22,14 +22,116 @@
 #include "config.h"
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <packagekit-glib/packagekit.h>
 #include <locale.h>
+#include <string.h>
+
+#define GMENU_I_KNOW_THIS_IS_UNSTABLE
+#include <gnome-menus/gmenu-tree.h>
 
 #include "egg-debug.h"
+#include "egg-string.h"
 
 #include "gpk-desktop.h"
 
+/*
+ * gpk_desktop_directory_get_menu_path:
+ **/
+static gchar *
+gpk_desktop_directory_get_menu_path (GMenuTreeDirectory *directory, const gchar *path)
+{
+	gchar *menu_path;
+	GMenuTreeItem *item;
+	gchar *data;
+	const gchar *desktop_file_path;
+	GSList *list;
+
+	/* recurse */
+	list = gmenu_tree_directory_get_contents (directory);
+	while (list != NULL) {
+		item = list->data;
+		if (gmenu_tree_item_get_type (item) == GMENU_TREE_ITEM_DIRECTORY) {
+			menu_path = gpk_desktop_directory_get_menu_path (GMENU_TREE_DIRECTORY (item), path);
+			if (menu_path != NULL) {
+				data = g_strdup_printf("%s \342\236\231 %s", gmenu_tree_directory_get_name (GMENU_TREE_DIRECTORY (item)), menu_path);
+				g_free (menu_path);
+				return data;
+			}
+			list = list->next;
+			continue;
+		}
+
+		if (gmenu_tree_item_get_type (item) == GMENU_TREE_ITEM_ENTRY) {
+			desktop_file_path = gmenu_tree_entry_get_desktop_file_path (GMENU_TREE_ENTRY (item));
+			if (strcmp (path, desktop_file_path) == 0)
+				return g_strdup (gmenu_tree_entry_get_name (GMENU_TREE_ENTRY (item)));
+		}
+		list = list->next;
+	}
+	return NULL;
+}
+
+/**
+ * gpk_desktop_get_menu_path_submenu
+ **/
+static gchar *
+gpk_desktop_get_menu_path_submenu (const gchar *filename, const gchar *menu_file, const gchar *label)
+{
+	gchar *text;
+	gchar *path = NULL;
+	GMenuTree *tree;
+	GMenuTreeDirectory *directory;
+
+	tree = gmenu_tree_lookup (menu_file, GMENU_TREE_FLAGS_INCLUDE_EXCLUDED);
+	if (tree == NULL) {
+		egg_warning ("no tree for %s", menu_file);
+		goto out;
+	}
+	directory = gmenu_tree_get_root_directory (tree);
+	text = gpk_desktop_directory_get_menu_path (directory, filename);
+	if (text == NULL) {
+		egg_debug ("no path for %s", filename);
+		goto out;
+	}
+	path = g_strdup_printf ("%s \342\236\231 %s", label, text);
+	g_free (text);
+out:
+	return path;
+}
+
+/**
+ * gpk_desktop_get_menu_path
+ **/
+gchar *
+gpk_desktop_get_menu_path (const gchar *filename)
+{
+	gchar *path = NULL;
+	gchar *text;
+
+	/* TRANSLATORS: the menu item, Applications, Places, System etc */
+	path = gpk_desktop_get_menu_path_submenu (filename, "applications.menu", _("Applications"));
+	if (path != NULL)
+		goto out;
+
+	/* TRANSLATORS: the path in the menu, e.g. Applications -> Games */
+	text = g_strdup_printf ("%s \342\236\231 %s",  _("System"), _("Preferences"));
+	path = gpk_desktop_get_menu_path_submenu (filename, "preferences.menu", text);
+	g_free (text);
+	if (path != NULL)
+		goto out;
+
+	/* TRANSLATORS: the path in the menu, e.g. Applications -> Games */
+	text = g_strdup_printf ("%s \342\236\231 %s",  _("System"), _("Administration"));
+	path = gpk_desktop_get_menu_path_submenu (filename, "system-settings.menu", text);
+	g_free (text);
+	if (path != NULL)
+		goto out;
+out:
+	return path;
+}
+
 /**
  * gpk_desktop_check_icon_valid:
  *

Modified: trunk/src/gpk-desktop.h
==============================================================================
--- trunk/src/gpk-desktop.h	(original)
+++ trunk/src/gpk-desktop.h	Thu Nov 27 09:51:50 2008
@@ -34,6 +34,7 @@
 gchar		*gpk_desktop_guess_localised_name	(PkDesktop	*desktop,
 							 const gchar	*package);
 gint		 gpk_desktop_get_file_weight		(const gchar	*filename);
+gchar		*gpk_desktop_get_menu_path		(const gchar	*filename);
 gboolean	 gpk_desktop_check_icon_valid		(const gchar	*icon);
 
 G_END_DECLS

Modified: trunk/src/gpk-dialog.c
==============================================================================
--- trunk/src/gpk-dialog.c	(original)
+++ trunk/src/gpk-dialog.c	Thu Nov 27 09:51:50 2008
@@ -33,6 +33,7 @@
 #include "gpk-common.h"
 #include "gpk-dialog.h"
 #include "gpk-enum.h"
+#include "gpk-desktop.h"
 
 enum {
 	GPK_DIALOG_STORE_IMAGE,
@@ -90,7 +91,6 @@
 	gchar *text;
 	guint length;
 	guint i;
-	gboolean valid;
 
 	desktop = pk_desktop_new ();
 	store = gtk_list_store_new (GPK_DIALOG_STORE_LAST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

Modified: trunk/src/gpk-enum.c
==============================================================================
--- trunk/src/gpk-enum.c	(original)
+++ trunk/src/gpk-enum.c	Thu Nov 27 09:51:50 2008
@@ -134,6 +134,7 @@
 	{PK_ROLE_ENUM_GET_DETAILS,		"pk-package-info"},
 	{PK_ROLE_ENUM_GET_DISTRO_UPGRADES,	"pk-package-info"},
 	{PK_ROLE_ENUM_GET_FILES,		"pk-package-search"},
+	{PK_ROLE_ENUM_GET_OLD_TRANSACTIONS,	"pk-package-info"},
 	{PK_ROLE_ENUM_GET_PACKAGES,		"pk-package-search"},
 	{PK_ROLE_ENUM_GET_REPO_LIST,		"pk-package-sources"},
 	{PK_ROLE_ENUM_GET_REQUIRES,		"pk-package-info"},

Modified: trunk/src/org.freedesktop.PackageKit.xml
==============================================================================
--- trunk/src/org.freedesktop.PackageKit.xml	(original)
+++ trunk/src/org.freedesktop.PackageKit.xml	Thu Nov 27 09:51:50 2008
@@ -47,6 +47,12 @@
       <arg type="u" name="timestamp" direction="in"/>
       <arg type="s" name="font_desc" direction="in"/>
     </method>
+    <method name="InstallFonts">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg type="u" name="xid" direction="in"/>
+      <arg type="u" name="timestamp" direction="in"/>
+      <arg type="as" name="font_descs" direction="in"/>
+    </method>
     <method name="InstallCatalog">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <arg type="u" name="xid" direction="in"/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]