gnome-packagekit r412 - in trunk: . data src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r412 - in trunk: . data src
- Date: Mon, 3 Nov 2008 11:28:45 +0000 (UTC)
Author: rhughes
Date: Mon Nov 3 11:28:45 2008
New Revision: 412
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=412&view=rev
Log:
more translation updates
Modified:
trunk/configure.ac
trunk/data/gnome-packagekit.schemas.in
trunk/data/gpk-application.desktop.in
trunk/data/gpk-application.glade
trunk/src/gpk-application.c
trunk/src/gpk-check-update.c
trunk/src/gpk-client.c
trunk/src/gpk-dbus.c
trunk/src/gpk-dbus.h
trunk/src/gpk-install-package-name.c
trunk/src/gpk-install-provide-file.c
trunk/src/gpk-interface.xml
trunk/src/gpk-prefs.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Nov 3 11:28:45 2008
@@ -89,6 +89,14 @@
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
+PKG_CHECK_MODULES(GIO, gio-2.0)
+AC_SUBST(GIO_CFLAGS)
+AC_SUBST(GIO_LIBS)
+
+CPPFLAGS=$GIO_CFLAGS
+LIBS=$GIO_LIBS
+AC_CHECK_FUNCS(g_file_make_directory_with_parents)
+
PKG_CHECK_MODULES(DBUS, \
dbus-glib-1 >= $DBUS_GLIB_REQUIRED \
dbus-1 >= $DBUS_REQUIRED \
Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in (original)
+++ trunk/data/gnome-packagekit.schemas.in Mon Nov 3 11:28:45 2008
@@ -20,8 +20,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Skip the confirm dialog if there are no dependencies</short>
- <long>Skip the confirm dialog when installing and removing packages if there are no dependencies</long>
+ <short>Skip the confirmation dialog if there are no additional dependencies</short>
+ <long>Skip the confirmation dialog when installing and removing packages if there are no additional dependencies to be installed</long>
</locale>
</schema>
@@ -33,7 +33,7 @@
<default></default>
<locale name="C">
<short>Firmware files that should not be searched for</short>
- <long>Firmware files that should not be searched for, separated by comma</long>
+ <long>Firmware files that should not be searched for, separated by commas</long>
</locale>
</schema>
@@ -68,8 +68,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Notify the user for failed updates</short>
- <long>Notify the user for failed updates</long>
+ <short>Notify the user when an update has failed</short>
+ <long>Notify the user when an update has failed</long>
</locale>
</schema>
@@ -104,8 +104,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Notify the user when the update was not started an auto-update on battery</short>
- <long>Notify the user when the update was not started an auto-update on battery</long>
+ <short>Notify the user when the automatic update was not started on battery power</short>
+ <long>Notify the user when the update was not automatically started while running on battery power</long>
</locale>
</schema>
@@ -128,8 +128,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Notify the user for messages</short>
- <long>Notify the user for messages</long>
+ <short>Notify the user when there are messages</short>
+ <long>Notify the user when there are messages</long>
</locale>
</schema>
@@ -140,8 +140,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Notify the user for errors</short>
- <long>Notify the user for errors</long>
+ <short>Notify the user when there are errors</short>
+ <long>Notify the user when there are errors</long>
</locale>
</schema>
@@ -152,8 +152,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Notify the user when the task is complete</short>
- <long>Notify the user when the task is complete</long>
+ <short>Notify the user when a task is complete</short>
+ <long>Notify the user when a task is complete</long>
</locale>
</schema>
@@ -200,8 +200,8 @@
<type>bool</type>
<default>false</default>
<locale name="C">
- <short>If autocompletion should be used when searching</short>
- <long>If autocompletion should be used when searching</long>
+ <short>If search terms should be completed automatically</short>
+ <long>If search terms should be completed automatically</long>
</locale>
</schema>
@@ -275,8 +275,8 @@
<type>string</type>
<default>none</default>
<locale name="C">
- <short>Auto update these types of updates</short>
- <long>Auto update these types of updates. Options are "all", "security", or "none"</long>
+ <short>Automatically update these types of updates</short>
+ <long>Automatically update these types of updates. Options are "all", "security", or "none"</long>
</locale>
</schema>
@@ -287,8 +287,8 @@
<type>bool</type>
<default>false</default>
<locale name="C">
- <short>Install updates automatically when on battery power</short>
- <long>Install updates automatically when on battery power</long>
+ <short>Install updates automatically when running on battery power</short>
+ <long>Install updates automatically when running on battery power</long>
</locale>
</schema>
@@ -311,8 +311,8 @@
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>Filter using newest in gpk-application</short>
- <long>Filter package lists using newest in gpk-application</long>
+ <short>Only show the newest packages in the file lists</short>
+ <long>Only show the newest packages in the file lists</long>
</locale>
</schema>
Modified: trunk/data/gpk-application.desktop.in
==============================================================================
--- trunk/data/gpk-application.desktop.in (original)
+++ trunk/data/gpk-application.desktop.in Mon Nov 3 11:28:45 2008
@@ -2,7 +2,7 @@
Encoding=UTF-8
_Name=Add/Remove Software
_GenericName=Add/Remove Software
-_Comment=Change the software installed on the system
+_Comment=Add or remove software installed on the system
Icon=system-software-install
Exec=gpk-application
Terminal=false
Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade (original)
+++ trunk/data/gpk-application.glade Mon Nov 3 11:28:45 2008
@@ -55,34 +55,6 @@
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="menuitem_view">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_View</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="menu10">
- <property name="visible">True</property>
- <child>
- <widget class="GtkCheckMenuItem" id="menuitem_group_type">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Use the complicated group selector</property>
- <property name="label" translatable="yes">Use category group list</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkCheckMenuItem" id="menuitem_autocomplete">
- <property name="visible">True</property>
- <property name="tooltip" translatable="yes">Use the system package list to autocomplete package selections</property>
- <property name="label" translatable="yes">Use auto-completion</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
<widget class="GtkMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Mon Nov 3 11:28:45 2008
@@ -2533,40 +2533,6 @@
}
/**
- * gpk_application_menu_group_type_cb:
- * @widget: The GtkWidget object
- **/
-static void
-gpk_application_menu_group_type_cb (GtkWidget *widget, GpkApplication *application)
-{
- gboolean enabled;
-
- g_return_if_fail (PK_IS_APPLICATION (application));
-
- /* save users preference to gconf */
- enabled = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
- gconf_client_set_bool (application->priv->gconf_client,
- GPK_CONF_APPLICATION_CATEGORY_GROUPS, enabled, NULL);
-}
-
-/**
- * gpk_application_menu_autocompletion_cb:
- * @widget: The GtkWidget object
- **/
-static void
-gpk_application_menu_autocompletion_cb (GtkWidget *widget, GpkApplication *application)
-{
- gboolean enabled;
-
- g_return_if_fail (PK_IS_APPLICATION (application));
-
- /* save users preference to gconf */
- enabled = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
- gconf_client_set_bool (application->priv->gconf_client,
- GPK_CONF_AUTOCOMPLETE, enabled, NULL);
-}
-
-/**
* gpk_application_status_changed_cb:
**/
static void
@@ -3276,16 +3242,6 @@
g_signal_connect (widget, "toggled",
G_CALLBACK (gpk_application_menu_filter_newest_cb), application);
- /* category menu / simple menu */
- widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_group_type");
- g_signal_connect (widget, "toggled",
- G_CALLBACK (gpk_application_menu_group_type_cb), application);
-
- /* autocompletion */
- widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_autocomplete");
- g_signal_connect (widget, "toggled",
- G_CALLBACK (gpk_application_menu_autocompletion_cb), application);
-
/* Remove description/file list if needed. */
if (pk_bitfield_contain (application->priv->roles, PK_ROLE_ENUM_GET_DETAILS) == FALSE) {
widget = glade_xml_get_widget (application->priv->glade_xml, "scrolledwindow2");
Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c (original)
+++ trunk/src/gpk-check-update.c Mon Nov 3 11:28:45 2008
@@ -615,9 +615,9 @@
}
/* TRANSLATORS: policy says update, but we are on battery and so prompt */
- message = _("Automatic updates are not being installed as the computer is on battery power");
+ message = _("Automatic updates are not being installed as the computer is running on battery power");
/* TRANSLATORS: informs user will not install by default */
- notification = notify_notification_new (_("Will not install updates"), message, "help-browser", NULL);
+ notification = notify_notification_new (_("Updates not installed"), message, "help-browser", NULL);
notify_notification_set_timeout (notification, 15000);
notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
notify_notification_add_action (notification, "do-not-show-update-not-battery",
@@ -625,7 +625,7 @@
_("Do not show this warning again"), gpk_check_update_libnotify_cb, cupdate, NULL);
notify_notification_add_action (notification, "update-all-packages",
/* TRANSLATORS: to hell with my battery life, just do it */
- _("Do the updates anyway"), gpk_check_update_libnotify_cb, cupdate, NULL);
+ _("Install the updates anyway"), gpk_check_update_libnotify_cb, cupdate, NULL);
ret = notify_notification_show (notification, &error);
if (!ret) {
egg_warning ("error: %s", error->message);
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Mon Nov 3 11:28:45 2008
@@ -33,6 +33,7 @@
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
@@ -756,14 +757,14 @@
}
/**
- * _g_ptr_array_to_bullets:
+ * gpk_client_ptr_array_to_bullets:
*
* splits the strings up nicely
*
* Return value: a newly allocated string
**/
static gchar *
-_g_ptr_array_to_bullets (GPtrArray *array, const gchar *prefix)
+gpk_client_ptr_array_to_bullets (GPtrArray *array, const gchar *prefix)
{
GString *string;
guint i;
@@ -771,7 +772,7 @@
string = g_string_new (prefix);
if (prefix != NULL)
- g_string_append_c (string, '\n');
+ g_string_append (string, "\n\n");
/* prefix with bullet and suffix with newline */
for (i=0; i<array->len; i++) {
@@ -787,94 +788,145 @@
}
/**
- * _g_ptr_array_copy_deep:
+ * gpk_client_install_local_files_get_user_temp:
*
- * Deep copy a GPtrArray of strings
+ * Return (and create if does not exist) a temporary directory
+ * that is writable only by the user, and readable by root.
*
- * Return value: A new GPtrArray
+ * Return value: the temp directory, or %NULL for create error
**/
-static GPtrArray *
-_g_ptr_array_copy_deep (GPtrArray *array)
+static gchar *
+gpk_client_install_local_files_get_user_temp (GpkClient *gclient, const gchar *subfolder, GError **error)
{
- guint i;
- const gchar *data;
- GPtrArray *array_new;
+ GFile *file;
+ gboolean ret;
+ gchar *path = NULL;
- array_new = g_ptr_array_new ();
- for (i=0; i<array->len; i++) {
- data = (const gchar *) g_ptr_array_index (array, i);
- g_ptr_array_add (array_new, g_strdup (data));
+ /* build path in home folder */
+ path = g_build_filename (g_get_home_dir (), ".PackageKit", subfolder, NULL);
+
+ /* find if exists */
+ file = g_file_new_for_path (path);
+ ret = g_file_query_exists (file, NULL);
+ if (ret)
+ goto out;
+
+ /* create as does not exist */
+#ifdef HAVE_G_GILE_MAKE_DIRECTORY_WITH_PARENTS
+ ret = g_file_make_directory_with_parents (file, NULL, error);
+ g_object_unref (file);
+ if (!ret) {
+ /* return nothing.. */
+ g_free (path);
+ path = NULL;
+ }
+#else
+ g_mkdir_with_parents(path, 0755);
+ g_object_unref (file);
+ if (ret == -1) {
+ /* return nothing.. */
+ g_free (path);
+ path = NULL;
}
- return array_new;
+#endif
+out:
+ return path;
}
/**
- * gpk_check_permissions:
- * @filename: a filename to check
- * @euid: the effective user ID to check for, or the output of geteuid()
- * @egid: the effective group ID to check for, or the output of getegid()
- * @mode: bitfield of R_OK, W_OK, XOK
+ * gpk_client_install_local_files_copy_non_native:
*
- * Like, access but a bit more accurate - access will let root do anything.
- * Does not get read-only or no-exec filesystems right.
+ * Copy the new file into a new file that can be read by packagekitd, and
+ * that can't be written into by other users.
*
- * Return value: %TRUE if the file has access perms
+ * Return value: the new file path, or %NULL for copy error
**/
-static gboolean
-gpk_check_permissions (const gchar *filename, guint euid, guint egid, guint mode)
+static gchar *
+gpk_client_install_local_files_copy_non_native (GpkClient *gclient, const gchar *filename, GError **error)
{
- struct stat statbuf;
+ GFile *file = NULL;
+ GFile *dest = NULL;
+ gchar *basename = NULL;
+ gchar *dest_path = NULL;
+ gchar *new_path = NULL;
+ gchar *cache_path = NULL;
+ gboolean ret;
+ GError *error_local = NULL;
- if (stat (filename, &statbuf) == 0) {
- if ((mode & R_OK) &&
- !((statbuf.st_mode & S_IROTH) ||
- ((statbuf.st_mode & S_IRUSR) && euid == statbuf.st_uid) ||
- ((statbuf.st_mode & S_IRGRP) && egid == statbuf.st_gid)))
- return FALSE;
- if ((mode & W_OK) &&
- !((statbuf.st_mode & S_IWOTH) ||
- ((statbuf.st_mode & S_IWUSR) && euid == statbuf.st_uid) ||
- ((statbuf.st_mode & S_IWGRP) && egid == statbuf.st_gid)))
- return FALSE;
- if ((mode & X_OK) &&
- !((statbuf.st_mode & S_IXOTH) ||
- ((statbuf.st_mode & S_IXUSR) && euid == statbuf.st_uid) ||
- ((statbuf.st_mode & S_IXGRP) && egid == statbuf.st_gid)))
- return FALSE;
- return TRUE;
+ /* create the non FUSE temp directory */
+ cache_path = gpk_client_install_local_files_get_user_temp (gclient, "native-cache", &error_local);
+ if (cache_path == NULL) {
+ *error = g_error_new (1, 0, "failed to create temp directory: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
}
- return FALSE;
+
+ /* get the final location */
+ file = g_file_new_for_path (filename);
+ basename = g_file_get_basename (file);
+ dest_path = g_build_filename (cache_path, basename, NULL);
+
+ /* copy the file */
+ dest = g_file_new_for_path (dest_path);
+ ret = g_file_copy (file, dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error_local);
+ if (!ret) {
+ *error = g_error_new (1, 0, "failed to copy file '%s' to '%s': %s", filename, cache_path, error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* return the modified file item */
+ new_path = g_strdup (dest_path);
+
+out:
+ if (file != NULL)
+ g_object_unref (file);
+ if (dest != NULL)
+ g_object_unref (dest);
+ g_free (basename);
+ g_free (cache_path);
+ g_free (dest_path);
+ return new_path;
}
/**
- * gpk_client_install_local_files_copy_private:
+ * gpk_client_install_local_files_native_check:
*
- * Allow the user to confirm the package copy to /tmp
+ * Allow the user to confirm the package copy to ~/.PackageKit/native-cache
+ * as we cannot access FUSE mounts as the root user.
*
* Return value: %TRUE if the method succeeded
**/
static gboolean
-gpk_client_install_local_files_copy_private (GpkClient *gclient, GPtrArray *array, GError **error)
+gpk_client_install_local_files_native_check (GpkClient *gclient, GPtrArray *array, GError **error)
{
guint i;
- gchar *data;
+ const gchar *data;
+ gchar *cache_path = NULL;
+ gchar *filename;
gboolean ret;
- GPtrArray *array_new;
+ gboolean native;
GPtrArray *array_missing;
const gchar *message_part;
const gchar *title;
gchar *message;
GtkResponseType button;
+ GError *error_local = NULL;
+ GFile *file;
- /* see if root has access to this file, in case we have to copy it
- * somewhere where it does.
- * See https://bugzilla.redhat.com/show_bug.cgi?id=456094 */
+ /* check if any files are non-native and need to be copied */
array_missing = g_ptr_array_new ();
for (i=0; i<array->len; i++) {
- data = (gchar *) g_ptr_array_index (array, i);
- ret = gpk_check_permissions (data, 0, 0, R_OK);
- if (!ret)
+ data = (const gchar *) g_ptr_array_index (array, i);
+ /* if file is non-native, it's on a FUSE mount (probably created by GVFS).
+ * See https://bugzilla.redhat.com/show_bug.cgi?id=456094 */
+ file = g_file_new_for_path (data);
+ native = g_file_is_native (file);
+ g_object_unref (file);
+ if (!native) {
+ egg_debug ("%s is non-native", data);
g_ptr_array_add (array_missing, g_strdup (data));
+ }
}
/* optional */
@@ -883,17 +935,17 @@
title = ngettext ("Do you want to copy this file?",
"Do you want to copy these files?", array_missing->len);
/* TRANSLATORS: message: explain to the user what we are doing */
- message_part = ngettext ("One package file has to be copied to a non-private location so it can be installed:",
- "Some package files have to be copied to a non-private location so they can be installed:",
+ message_part = ngettext ("This package file has to be copied from a private directory so it can be installed:",
+ "Several package files have to be copied from a private directory so they can be installed:",
array_missing->len);
- message = _g_ptr_array_to_bullets (array_missing, message_part);
+ message = gpk_client_ptr_array_to_bullets (array_missing, message_part);
/* show UI */
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-warning");
/* TRANSLATORS: button: copy file from one directory to another */
- gpk_client_dialog_set_action (gclient->priv->dialog, _("Copy file"));
+ gpk_client_dialog_set_action (gclient->priv->dialog, ngettext ("Copy file", "Copy files", array_missing->len));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-installing-private-files");
g_free (message);
@@ -907,54 +959,28 @@
}
}
- /* copy, and re-allocate so we can pass back the same array */
- array_new = _g_ptr_array_copy_deep (array);
- g_ptr_array_remove_range (array, 0, array->len);
-
/* now we have the okay to copy the files, do so */
ret = TRUE;
- for (i=0; i<array_new->len; i++) {
- gchar *command;
- gchar *dest;
- gchar *dest_path;
- gint retval;
- GError *error = NULL;
-
- data = (gchar *) g_ptr_array_index (array_new, i);
- ret = gpk_check_permissions (data, 0, 0, R_OK);
- if (ret) {
- /* just copy over the name */
- g_ptr_array_add (array, g_strdup (data));
- } else {
- /* get the final location */
- dest = g_path_get_basename (data);
- dest_path = g_strdup_printf ("/tmp/%s", dest);
-
- command = g_strdup_printf ("cp \"%s\" \"%s\"", data, dest_path);
- egg_debug ("command=%s", command);
- ret = g_spawn_command_line_sync (command, NULL, NULL, NULL, &error);
-
- /* we failed */
- if (!ret) {
- egg_warning ("failed to copy %s: %s", data, error->message);
- g_error_free (error);
- break;
- }
+ for (i=0; i<array->len; i++) {
+ data = (const gchar *) g_ptr_array_index (array, i);
- /* make this readable by root */
- retval = g_chmod (dest_path, 0644);
- if (retval < 0) {
+ /* check we are not on FUSE */
+ file = g_file_new_for_path (data);
+ native = g_file_is_native (file);
+ g_object_unref (file);
+ if (!native) {
+ /* copy the file */
+ filename = gpk_client_install_local_files_copy_non_native (gclient, data, &error_local);
+ if (filename == NULL) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "failed to copy file %s: %s", data, error_local->message);
ret = FALSE;
- egg_warning ("failed to chmod %s", dest_path);
break;
}
- /* add the modified file item */
- g_ptr_array_add (array, g_strdup (dest_path));
-
- g_free (dest);
- g_free (dest_path);
- g_free (command);
+ /* swap data in array */
+ g_free (array->pdata[i]);
+ array->pdata[i] = g_strdup (filename);
+ g_free (filename);
}
}
@@ -966,15 +992,17 @@
/* show UI */
gpk_client_dialog_set_title (gclient->priv->dialog, title);
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
+ gpk_client_dialog_set_message (gclient->priv->dialog, error_local->message);
gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "files not copied");
ret = FALSE;
+ g_error_free (error_local);
goto out;
}
out:
+ g_free (cache_path);
g_ptr_array_foreach (array_missing, (GFunc) g_free, NULL);
g_ptr_array_free (array_missing, TRUE);
return ret;
@@ -998,7 +1026,7 @@
/* TRANSLATORS: title: confirm the user want's to install a local file */
title = ngettext ("Do you want to install this file?",
"Do you want to install these files?", array->len);
- message = _g_ptr_array_to_bullets (array, NULL);
+ message = gpk_client_ptr_array_to_bullets (array, NULL);
/* show UI */
gpk_client_dialog_set_title (gclient->priv->dialog, title);
@@ -1039,7 +1067,7 @@
gpk_client_install_local_files_check_exists (GpkClient *gclient, GPtrArray *array, GError **error)
{
guint i;
- gchar *data;
+ const gchar *data;
gboolean ret;
GPtrArray *array_missing;
const gchar *message_part;
@@ -1050,7 +1078,7 @@
/* find missing */
for (i=0; i<array->len; i++) {
- data = (gchar *) g_ptr_array_index (array, i);
+ data = (const gchar *) g_ptr_array_index (array, i);
ret = g_file_test (data, G_FILE_TEST_EXISTS);
if (!ret)
g_ptr_array_add (array_missing, g_strdup (data));
@@ -1066,7 +1094,7 @@
/* TRANSLATORS: message: explain what went wrong */
message_part = ngettext ("The following file was not found:",
"The following files were not found:", array_missing->len);
- message = _g_ptr_array_to_bullets (array_missing, message_part);
+ message = gpk_client_ptr_array_to_bullets (array_missing, message_part);
/* show UI */
gpk_client_dialog_set_title (gclient->priv->dialog, title);
@@ -1146,6 +1174,7 @@
gboolean ret;
gchar **files = NULL;
GPtrArray *array;
+ const gchar *title;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
g_return_val_if_fail (files_rel != NULL, FALSE);
@@ -1165,15 +1194,15 @@
goto out;
/* check all files exist and are readable by the local user */
- ret = gpk_client_install_local_files_copy_private (gclient, array, error);
+ ret = gpk_client_install_local_files_native_check (gclient, array, error);
if (!ret)
goto out;
/* TRANSLATORS: title: installing a local file */
- gpk_client_dialog_set_title (gclient->priv->dialog, _("Install local file"));
+ gpk_client_dialog_set_title (gclient->priv->dialog, ngettext ("Install local file", "Install local files", array->len));
gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, gclient->priv->timestamp);
files = pk_ptr_array_to_strv (array);
gclient->priv->retry_untrusted_value = FALSE;
@@ -1186,6 +1215,10 @@
/* do we need to try again with better auth? */
if (gclient->priv->retry_untrusted_value) {
+ /* TRANSLATORS: title: installing a local file that is not trusted */
+ gpk_client_dialog_set_title (gclient->priv->dialog, ngettext ("Install untrusted local file", "Install untrusted local files", array->len));
+ if (gclient->priv->show_progress)
+ gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, gclient->priv->timestamp);
ret = gpk_client_install_local_files_internal (gclient, FALSE, files, error);
if (!ret)
goto out;
@@ -1196,6 +1229,18 @@
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
+ /* optional, and only when successfull */
+ if (ret && gclient->priv->show_confirm) {
+ /* TRANSLATORS: title: we have installed the local file OK */
+ title = ngettext ("File was installed successfully",
+ "Files were installed successfully", array->len);
+ gpk_client_dialog_set_title (gclient->priv->dialog, title);
+ gpk_client_dialog_set_message (gclient->priv->dialog, "");
+ gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-info");
+ gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_FINISHED, 0, gclient->priv->timestamp);
+ gpk_client_dialog_run (gclient->priv->dialog);
+ }
+
out:
g_strfreev (files);
g_ptr_array_foreach (array, (GFunc) g_free, NULL);
Modified: trunk/src/gpk-dbus.c
==============================================================================
--- trunk/src/gpk-dbus.c (original)
+++ trunk/src/gpk-dbus.c Mon Nov 3 11:28:45 2008
@@ -57,6 +57,7 @@
struct GpkDbusPrivate
{
GpkClient *gclient;
+ PkClient *client;
};
G_DEFINE_TYPE (GpkDbus, gpk_dbus, G_TYPE_OBJECT)
@@ -295,6 +296,44 @@
}
/**
+ * gpk_dbus_install_package_names:
+ **/
+void
+gpk_dbus_install_package_names (GpkDbus *dbus, guint32 xid, guint32 timestamp, gchar **package_names, 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", package_names[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_package_names (dbus->priv->gclient, package_names, &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_mime_type:
**/
void
@@ -442,6 +481,91 @@
}
/**
+ * gpk_dbus_install_catalog:
+ **/
+void
+gpk_dbus_install_catalog (GpkDbus *dbus, guint32 xid, guint32 timestamp, const gchar *catalog_file, DBusGMethodInvocation *context)
+{
+ gboolean ret;
+ GError *error;
+ GError *error_local = NULL;
+ gchar *sender;
+ gchar **catalog_files;
+ gchar *exec;
+
+ g_return_if_fail (PK_IS_DBUS (dbus));
+
+ egg_debug ("InstallCatalog method called: %s", catalog_file);
+
+ /* check sender */
+ sender = dbus_g_method_get_sender (context);
+
+ /* just convert from char* to char** */
+ catalog_files = g_strsplit (catalog_file, "|", 1);
+ gpk_dbus_set_parent_window (dbus, xid, timestamp);
+
+ /* get the program name and set */
+ 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_catalogs (dbus->priv->gclient, catalog_files, &error_local);
+ g_strfreev (catalog_files);
+
+ 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_is_package_installed:
+ **/
+gboolean
+gpk_dbus_is_package_installed (GpkDbus *dbus, const gchar *package_name, gboolean *installed, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+ PkPackageList *list = NULL;
+ gchar **package_names = NULL;
+
+ g_return_val_if_fail (PK_IS_DBUS (dbus), FALSE);
+
+ /* reset */
+ ret = pk_client_reset (dbus->priv->client, &error_local);
+ if (!ret) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED, "failed to get installed status: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* get the package list for the installed packages */
+ package_names = g_strsplit (package_name, "|", 1);
+ ret = pk_client_resolve (dbus->priv->client, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), package_names, &error_local);
+ if (!ret) {
+ *error = g_error_new (GPK_DBUS_ERROR, GPK_DBUS_ERROR_DENIED, "failed to get installed status: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* more than one entry? */
+ list = pk_client_get_package_list (dbus->priv->client);
+ *installed = (PK_OBJ_LIST(list)->len > 0);
+out:
+ if (list != NULL)
+ g_object_unref (list);
+ g_strfreev (package_names);
+ return ret;
+}
+
+/**
* gpk_dbus_class_init:
* @klass: The GpkDbusClass
**/
@@ -461,6 +585,9 @@
gpk_dbus_init (GpkDbus *dbus)
{
dbus->priv = GPK_DBUS_GET_PRIVATE (dbus);
+ dbus->priv->client = pk_client_new ();
+ pk_client_set_use_buffer (dbus->priv->client, TRUE, NULL);
+ pk_client_set_synchronous (dbus->priv->client, TRUE, NULL);
dbus->priv->gclient = gpk_client_new ();
gpk_client_set_interaction (dbus->priv->gclient, GPK_CLIENT_INTERACT_WARNING_CONFIRM_PROGRESS);
}
@@ -477,6 +604,7 @@
dbus = GPK_DBUS (object);
g_return_if_fail (dbus->priv != NULL);
+ g_object_unref (dbus->priv->client);
g_object_unref (dbus->priv->gclient);
G_OBJECT_CLASS (gpk_dbus_parent_class)->finalize (object);
Modified: trunk/src/gpk-dbus.h
==============================================================================
--- trunk/src/gpk-dbus.h (original)
+++ trunk/src/gpk-dbus.h Mon Nov 3 11:28:45 2008
@@ -75,6 +75,11 @@
guint32 timestamp,
const gchar *package_name,
DBusGMethodInvocation *context);
+void gpk_dbus_install_package_names (GpkDbus *dbus,
+ guint32 xid,
+ guint32 timestamp,
+ gchar **package_names,
+ DBusGMethodInvocation *context);
void gpk_dbus_install_mime_type (GpkDbus *dbus,
guint32 xid,
guint32 timestamp,
@@ -90,6 +95,15 @@
guint32 timestamp,
const gchar *font_desc,
DBusGMethodInvocation *context);
+void gpk_dbus_install_catalog (GpkDbus *dbus,
+ guint32 xid,
+ guint32 timestamp,
+ const gchar *catalog_file,
+ DBusGMethodInvocation *context);
+gboolean gpk_dbus_is_package_installed (GpkDbus *dbus,
+ const gchar *package_name,
+ gboolean *installed,
+ GError **error);
G_END_DECLS
Modified: trunk/src/gpk-install-package-name.c
==============================================================================
--- trunk/src/gpk-install-package-name.c (original)
+++ trunk/src/gpk-install-package-name.c Mon Nov 3 11:28:45 2008
@@ -74,8 +74,8 @@
egg_debug_init (verbose);
gtk_init (&argc, &argv);
- /* TRANSLATORS: title to pass to to the user if there are not enough privs */
- ret = gpk_check_privileged_user (_("Package name installer"));
+ /* TRANSLATORS: application name to pass to to the user if there are not enough privs */
+ ret = gpk_check_privileged_user (_("Package Name Installer"));
if (!ret)
return 1;
Modified: trunk/src/gpk-install-provide-file.c
==============================================================================
--- trunk/src/gpk-install-provide-file.c (original)
+++ trunk/src/gpk-install-provide-file.c Mon Nov 3 11:28:45 2008
@@ -71,8 +71,8 @@
egg_debug_init (verbose);
gtk_init (&argc, &argv);
- /* TRANSLATORS: title to pass to to the user if there are not enough privs */
- ret = gpk_check_privileged_user (_("Provide file installer"));
+ /* TRANSLATORS: application name to pass to to the user if there are not enough privs */
+ ret = gpk_check_privileged_user (_("Provide File Installer"));
if (!ret)
return 1;
Modified: trunk/src/gpk-interface.xml
==============================================================================
--- trunk/src/gpk-interface.xml (original)
+++ trunk/src/gpk-interface.xml Mon Nov 3 11:28:45 2008
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/">
<interface name="org.freedesktop.PackageKit">
+ <method name="IsPackageInstalled">
+ <arg type="s" name="package_name" direction="in"/>
+ <arg type="b" name="installed" direction="out"/>
+ </method>
<method name="InstallLocalFile">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg type="u" name="xid" direction="in"/>
@@ -19,6 +23,12 @@
<arg type="u" name="timestamp" direction="in"/>
<arg type="s" name="package_name" direction="in"/>
</method>
+ <method name="InstallPackageNames">
+ <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="package_names" direction="in"/>
+ </method>
<method name="InstallMimeType">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg type="u" name="xid" direction="in"/>
@@ -37,6 +47,12 @@
<arg type="u" name="timestamp" direction="in"/>
<arg type="s" name="font_desc" direction="in"/>
</method>
+ <method name="InstallCatalog">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg type="u" name="xid" direction="in"/>
+ <arg type="u" name="timestamp" direction="in"/>
+ <arg type="s" name="catalog_file" direction="in"/>
+ </method>
</interface>
</node>
Modified: trunk/src/gpk-prefs.c
==============================================================================
--- trunk/src/gpk-prefs.c (original)
+++ trunk/src/gpk-prefs.c Mon Nov 3 11:28:45 2008
@@ -27,6 +27,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
#include <math.h>
#include <string.h>
#include <dbus/dbus-glib.h>
@@ -100,17 +101,16 @@
client = gconf_client_get_default ();
value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
- if (strcmp (value, PK_FREQ_HOURLY_TEXT) == 0) {
+ if (strcmp (value, PK_FREQ_HOURLY_TEXT) == 0)
freq = GPK_FREQ_ENUM_HOURLY;
- } else if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0) {
+ else if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0)
freq = GPK_FREQ_ENUM_DAILY;
- } else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0) {
+ else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0)
freq = GPK_FREQ_ENUM_WEEKLY;
- } else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0) {
+ else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0)
freq = GPK_FREQ_ENUM_NEVER;
- } else {
+ else
g_assert (FALSE);
- }
action = gpk_freq_enum_to_text (freq);
egg_debug ("Changing %s to %s", GPK_CONF_FREQUENCY_GET_UPDATES, action);
@@ -132,15 +132,14 @@
client = gconf_client_get_default ();
value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
- if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0) {
+ if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0)
freq = GPK_FREQ_ENUM_DAILY;
- } else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0) {
+ else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0)
freq = GPK_FREQ_ENUM_WEEKLY;
- } else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0) {
+ else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0)
freq = GPK_FREQ_ENUM_NEVER;
- } else {
+ else
g_assert (FALSE);
- }
action = gpk_freq_enum_to_text (freq);
egg_debug ("Changing %s to %s", GPK_CONF_FREQUENCY_GET_UPGRADES, action);
@@ -337,6 +336,21 @@
}
/**
+ * gpk_prefs_key_event_cb
+ **/
+static gboolean
+gpk_prefs_key_event_cb (GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+ if (event->keyval == GDK_Escape) {
+ /* user pressed escape key, close the window */
+ gtk_main_quit ();
+ return TRUE;
+ }
+ /* returns FALSE to propagate event further */
+ return FALSE;
+}
+
+/**
* main:
**/
int
@@ -366,9 +380,8 @@
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- if (! g_thread_supported ()) {
+ if (! g_thread_supported ())
g_thread_init (NULL);
- }
dbus_g_thread_init ();
g_type_init ();
@@ -390,9 +403,8 @@
/* are we already activated? */
egg_unique = egg_unique_new ();
ret = egg_unique_assign (egg_unique, "org.freedesktop.PackageKit.Prefs");
- if (!ret) {
+ if (!ret)
goto unique_out;
- }
g_signal_connect (egg_unique, "activated",
G_CALLBACK (gpk_prefs_activated_cb), NULL);
@@ -403,6 +415,8 @@
glade_xml = glade_xml_new (GPK_DATA "/gpk-prefs.glade", NULL, NULL);
main_window = glade_xml_get_widget (glade_xml, "window_prefs");
+ g_signal_connect (main_window, "key_press_event",
+ G_CALLBACK (gpk_prefs_key_event_cb), NULL);
/* Hide window first so that the dialogue resizes itself without redrawing */
gtk_widget_hide (main_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]