gnome-packagekit r470 - in trunk: data src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r470 - in trunk: data src
- Date: Wed, 14 Jan 2009 14:36:27 +0000 (UTC)
Author: rhughes
Date: Wed Jan 14 14:36:27 2009
New Revision: 470
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=470&view=rev
Log:
from git
Modified:
trunk/data/gnome-packagekit.schemas.in
trunk/src/gpk-application-main.c
trunk/src/gpk-check-update.c
trunk/src/gpk-client-dialog.c
trunk/src/gpk-client-dialog.h
trunk/src/gpk-client.c
trunk/src/gpk-common.c
trunk/src/gpk-desktop.c
trunk/src/gpk-enum.c
trunk/src/gpk-firmware.c
trunk/src/gpk-watch.c
trunk/src/org.freedesktop.PackageKit.xml
Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in (original)
+++ trunk/data/gnome-packagekit.schemas.in Wed Jan 14 14:36:27 2009
@@ -18,10 +18,10 @@
<applyto>/apps/gnome-packagekit/banned_firmware</applyto>
<owner>gnome-packagekit</owner>
<type>string</type>
- <default></default>
+ <default>*/intel-ucode/*</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 commas</long>
+ <long>Firmware files that should not be searched for, separated by commas. These can include '*' and '?' characters</long>
</locale>
</schema>
Modified: trunk/src/gpk-application-main.c
==============================================================================
--- trunk/src/gpk-application-main.c (original)
+++ trunk/src/gpk-application-main.c Wed Jan 14 14:36:27 2009
@@ -87,9 +87,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 ();
@@ -109,16 +108,14 @@
/* are we running privileged */
ret = gpk_check_privileged_user (_("Package installer"), TRUE);
- if (!ret) {
+ if (!ret)
return 1;
- }
/* are we already activated? */
egg_unique = egg_unique_new ();
ret = egg_unique_assign (egg_unique, "org.freedesktop.PackageKit.Application");
- if (!ret) {
+ if (!ret)
goto unique_out;
- }
/* create a new application object */
application = gpk_application_new ();
Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c (original)
+++ trunk/src/gpk-check-update.c Wed Jan 14 14:36:27 2009
@@ -275,7 +275,7 @@
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
}
-static gboolean gpk_check_update_query_updates (GpkCheckUpdate *cupdate);
+static gboolean gpk_check_update_query_updates (GpkCheckUpdate *cupdate, gboolean policy_action);
/**
* gpk_check_update_get_updates_post_update_cb:
@@ -288,7 +288,7 @@
/* debug so we can catch polling */
egg_debug ("polling check");
- gpk_check_update_query_updates (cupdate);
+ gpk_check_update_query_updates (cupdate, FALSE);
return FALSE;
}
@@ -658,7 +658,7 @@
* gpk_check_update_query_updates:
**/
static gboolean
-gpk_check_update_query_updates (GpkCheckUpdate *cupdate)
+gpk_check_update_query_updates (GpkCheckUpdate *cupdate, gboolean policy_action)
{
const PkPackageObj *obj;
guint length;
@@ -754,13 +754,6 @@
}
}
- /* do we do the automatic updates? */
- update = gpk_check_update_get_update_policy (cupdate);
- if (update == GPK_UPDATE_ENUM_UNKNOWN) {
- egg_warning ("policy unknown");
- goto out;
- }
-
/* work out icon */
icon = gpk_check_update_get_best_update_icon (cupdate, list);
gpk_smart_icon_set_icon_name (cupdate->priv->sicon, icon);
@@ -774,6 +767,20 @@
"There are %d updates pending", length), length);
gtk_status_icon_set_tooltip (GTK_STATUS_ICON (cupdate->priv->sicon), status_tooltip->str);
+ /* if we are just refreshing after a failed update, don't try to do the actions */
+ if (!policy_action) {
+ egg_debug ("skipping actions");
+ ret = TRUE;
+ goto out;
+ }
+
+ /* do we do the automatic updates? */
+ update = gpk_check_update_get_update_policy (cupdate);
+ if (update == GPK_UPDATE_ENUM_UNKNOWN) {
+ egg_warning ("policy unknown");
+ goto out;
+ }
+
/* is policy none? */
if (update == GPK_UPDATE_ENUM_NONE) {
egg_debug ("not updating as policy NONE");
@@ -841,7 +848,7 @@
static gboolean
gpk_check_update_query_updates_idle_cb (GpkCheckUpdate *cupdate)
{
- gpk_check_update_query_updates (cupdate);
+ gpk_check_update_query_updates (cupdate, TRUE);
return FALSE;
}
@@ -934,7 +941,7 @@
/* now try to get updates */
egg_debug ("get updates");
- gpk_check_update_query_updates (cupdate);
+ gpk_check_update_query_updates (cupdate, TRUE);
}
cupdate->priv->cache_update_in_progress = FALSE;
}
Modified: trunk/src/gpk-client-dialog.c
==============================================================================
--- trunk/src/gpk-client-dialog.c (original)
+++ trunk/src/gpk-client-dialog.c Wed Jan 14 14:36:27 2009
@@ -416,6 +416,37 @@
}
/**
+ * gpk_client_dialog_set_remaining:
+ **/
+gboolean
+gpk_client_dialog_set_remaining (GpkClientDialog *dialog, guint remaining)
+{
+ GtkWidget *widget;
+ gchar *timestring = NULL;
+ gchar *text = NULL;
+
+ g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
+
+ egg_debug ("setting remaining: %u", remaining);
+ widget = glade_xml_get_widget (dialog->priv->glade_xml, "progressbar_percent");
+
+ /* unknown */
+ if (remaining == 0) {
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (widget), "");
+ goto out;
+ }
+
+ /* get time text */
+ timestring = gpk_time_to_localised_string (remaining);
+ text = g_strdup_printf (_("Remaining time : %s"), timestring);
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (widget), text);
+out:
+ g_free (timestring);
+ g_free (text);
+ return TRUE;
+}
+
+/**
* gpk_client_dialog_set_image:
**/
gboolean
Modified: trunk/src/gpk-client-dialog.h
==============================================================================
--- trunk/src/gpk-client-dialog.h (original)
+++ trunk/src/gpk-client-dialog.h Wed Jan 14 14:36:27 2009
@@ -107,6 +107,8 @@
const gchar *action);
gboolean gpk_client_dialog_set_percentage (GpkClientDialog *dialog,
guint percentage);
+gboolean gpk_client_dialog_set_remaining (GpkClientDialog *dialog,
+ guint remaining);
gboolean gpk_client_dialog_set_image (GpkClientDialog *dialog,
const gchar *image);
gboolean gpk_client_dialog_set_image_status (GpkClientDialog *dialog,
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Wed Jan 14 14:36:27 2009
@@ -450,6 +450,7 @@
if (!gclient->priv->show_progress)
return;
gpk_client_dialog_set_percentage (gclient->priv->dialog, percentage);
+ gpk_client_dialog_set_remaining (gclient->priv->dialog, remaining);
}
/**
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Wed Jan 14 14:36:27 2009
@@ -110,7 +110,7 @@
/* normal size laptop panel */
egg_debug ("using native mode: %ix%i", width, height);
- gtk_widget_set_size_request (GTK_WIDGET(window), width, height);
+ gtk_window_set_default_size (window, width, height);
return TRUE;
}
Modified: trunk/src/gpk-desktop.c
==============================================================================
--- trunk/src/gpk-desktop.c (original)
+++ trunk/src/gpk-desktop.c Wed Jan 14 14:36:27 2009
@@ -175,6 +175,11 @@
gint weight = 0;
const gchar *locale;
+ /* autostart files usually are not hat we are looking for */
+ value = g_strstr_len (filename, -1, "autostart");
+ if (value != NULL)
+ weight -= 100;
+
locale = setlocale (LC_ALL, NULL);
file = g_key_file_new ();
ret = g_key_file_load_from_file (file, filename, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
@@ -207,7 +212,7 @@
weight -= 100;
g_free (value);
- /* hidden */
+ /* has locale */
value = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, locale, NULL);
if (value != NULL)
weight += 30;
Modified: trunk/src/gpk-enum.c
==============================================================================
--- trunk/src/gpk-enum.c (original)
+++ trunk/src/gpk-enum.c Wed Jan 14 14:36:27 2009
@@ -69,6 +69,7 @@
{PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO, "pk-refresh-cache"},
{PK_STATUS_ENUM_FINISHED, "pk-package-cleanup"}, /* TODO: need better icon */
{PK_STATUS_ENUM_GENERATE_PACKAGE_LIST, "pk-refresh-cache"}, /* TODO: need better icon */
+ {PK_STATUS_ENUM_WAITING_FOR_LOCK, "pk-package-blocked"},
{PK_STATUS_ENUM_INFO, "pk-package-info"},
{PK_STATUS_ENUM_INSTALL, "pk-package-add"},
{PK_STATUS_ENUM_LOADING_CACHE, "pk-refresh-cache"},
@@ -104,6 +105,7 @@
{PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO, "pk-action-refresh-cache"},
{PK_STATUS_ENUM_FINISHED, "pk-package-cleanup"},
{PK_STATUS_ENUM_GENERATE_PACKAGE_LIST, "pk-action-searching"},
+ {PK_STATUS_ENUM_WAITING_FOR_LOCK, "pk-action-waiting"},
{PK_STATUS_ENUM_INFO, "process-working"},
{PK_STATUS_ENUM_INSTALL, "pk-action-installing"},
{PK_STATUS_ENUM_LOADING_CACHE, "pk-action-refresh-cache"},
@@ -860,6 +862,9 @@
case PK_STATUS_ENUM_GENERATE_PACKAGE_LIST:
text = _("Generating package lists");
break;
+ case PK_STATUS_ENUM_WAITING_FOR_LOCK:
+ text = _("Waiting for legacy package manager lock");
+ break;
default:
egg_warning ("status unrecognised: %s", pk_status_enum_to_text (status));
}
Modified: trunk/src/gpk-firmware.c
==============================================================================
--- trunk/src/gpk-firmware.c (original)
+++ trunk/src/gpk-firmware.c Wed Jan 14 14:36:27 2009
@@ -22,6 +22,7 @@
#include "config.h"
#include <stdlib.h>
+#include <string.h>
#include <stdio.h>
#include <time.h>
#include <errno.h>
@@ -40,7 +41,6 @@
#include "egg-debug.h"
#include "egg-string.h"
-#include "egg-string-list.h"
#include "gpk-client.h"
#include "gpk-common.h"
@@ -49,13 +49,14 @@
static void gpk_firmware_finalize (GObject *object);
#define GPK_FIRMWARE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_FIRMWARE, GpkFirmwarePrivate))
-#define GPK_FIRMWARE_STATE_DIR "/var/run/PackageKit/udev"
-#define GPK_FIRMWARE_LOGIN_DELAY 60 /* seconds */
+#define GPK_FIRMWARE_MISSING_DIR "/dev/.udev/firmware-missing"
+#define GPK_FIRMWARE_LOADING_DIR "/lib/firmware"
+#define GPK_FIRMWARE_LOGIN_DELAY 60 /* seconds */
struct GpkFirmwarePrivate
{
- EggStrList *array_found;
- EggStrList *array_requested;
+ GPtrArray *array_found;
+ GPtrArray *array_requested;
GConfClient *gconf_client;
};
@@ -79,7 +80,7 @@
/* try to install each firmware file */
for (i=0; i<array->len; i++) {
- filename = egg_str_list_index (array, i);
+ filename = g_ptr_array_index (array, i);
gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_WARNING_PROGRESS);
ret = gpk_client_install_provide_file (gclient, filename, &error);
if (!ret) {
@@ -157,10 +158,11 @@
static gboolean
gpk_firmware_timeout_cb (gpointer data)
{
- guint i;
+ guint i, j;
gboolean ret;
const gchar *filename;
const gchar *message;
+ gchar *duplicate;
GpkFirmware *firmware = GPK_FIRMWARE (data);
NotifyNotification *notification;
GPtrArray *array;
@@ -172,11 +174,11 @@
/* try to find each firmware file in an available package */
array = firmware->priv->array_requested;
for (i=0; i<array->len; i++) {
- filename = egg_str_list_index (array, i);
+ filename = g_ptr_array_index (array, i);
/* save to new array if we found one package for this file */
ret = gpk_firmware_check_available (firmware, filename);
if (ret)
- egg_str_list_add (firmware->priv->array_found, filename);
+ g_ptr_array_add (firmware->priv->array_found, g_strdup (filename));
}
/* nothing to do */
@@ -187,11 +189,22 @@
}
/* check we don't want the same package more than once */
- egg_str_list_remove_duplicate (array);
+ for (i=0; i<array->len; i++) {
+ for (j=0; j<array->len; j++) {
+ duplicate = g_ptr_array_index (array, j);
+ if (i != j && egg_strequal (g_ptr_array_index (array, i), duplicate)) {
+ g_free (duplicate);
+ g_ptr_array_remove_index_fast (array, j);
+ }
+ }
+ }
/* debugging */
egg_debug ("need to install:");
- egg_str_list_print (array);
+ for (i=0; i<array->len; i++) {
+ filename = g_ptr_array_index (array, i);
+ egg_debug ("%s", filename);
+ }
/* TRANSLATORS: we need another package to keep udev quiet */
message = _("Additional firmware is required to make hardware in this computer function correctly.");
@@ -224,7 +237,9 @@
{
gchar *banned_str;
gchar **banned = NULL;
- EggStrList *banned_list = NULL;
+ gchar *filename;
+ guint i, j;
+ gboolean ret;
/* get from gconf */
banned_str = gconf_client_get_string (firmware->priv->gconf_client, GPK_CONF_BANNED_FIRMWARE, NULL);
@@ -242,17 +257,48 @@
/* split using "," */
banned = g_strsplit (banned_str, ",", 0);
- /* add to string list */
- banned_list = egg_str_list_new ();
- egg_str_list_add_strv (banned_list, banned);
-
- /* remove all entries in banned list from main list */
- egg_str_list_remove_list (array, banned_list);
+ /* remove any banned pattern matches */
+ for (i=0; i<array->len; i++) {
+ filename = g_ptr_array_index (array, i);
+ for (j=0; banned[j] != NULL; j++) {
+ ret = g_pattern_match_simple (banned[j], filename);
+ if (ret) {
+ egg_debug ("match %s for %s, removing", banned[j], filename);
+ g_free (filename);
+ g_ptr_array_remove_index_fast (array, i);
+ }
+ }
+ }
out:
g_free (banned_str);
g_strfreev (banned);
- if (banned_list != NULL)
- g_object_unref (banned_list);
+}
+
+/**
+ * gpk_firmware_udev_text_decode:
+ **/
+static gchar *
+gpk_firmware_udev_text_decode (const gchar *data)
+{
+ guint i;
+ guint j;
+ gchar *decode;
+
+ decode = g_strdup (data);
+ for (i = 0, j = 0; data[i] != '\0'; j++) {
+ if (memcmp (&data[i], "\\x2f", 4) == 0) {
+ decode[j] = '/';
+ i += 4;
+ }else if (memcmp (&data[i], "\\x5c", 4) == 0) {
+ decode[j] = '\\';
+ i += 4;
+ } else {
+ decode[j] = data[i];
+ i++;
+ }
+ }
+ decode[j] = '\0';
+ return decode;
}
/**
@@ -275,19 +321,17 @@
gpk_firmware_init (GpkFirmware *firmware)
{
gboolean ret;
- gchar *contents;
GError *error = NULL;
GDir *dir;
const gchar *filename;
+ gchar *filename_decoded;
gchar *filename_path;
- gchar **firmware_files;
guint i;
- guint length;
GPtrArray *array;
firmware->priv = GPK_FIRMWARE_GET_PRIVATE (firmware);
- firmware->priv->array_found = egg_str_list_new ();
- firmware->priv->array_requested = egg_str_list_new ();
+ firmware->priv->array_found = g_ptr_array_new ();
+ firmware->priv->array_requested = g_ptr_array_new ();
firmware->priv->gconf_client = gconf_client_get_default ();
/* should we check and show the user */
@@ -298,7 +342,7 @@
}
/* open the directory of requests */
- dir = g_dir_open (GPK_FIRMWARE_STATE_DIR, 0, &error);
+ dir = g_dir_open (GPK_FIRMWARE_MISSING_DIR, 0, &error);
if (dir == NULL) {
egg_warning ("failed to open directory: %s", error->message);
g_error_free (error);
@@ -310,43 +354,26 @@
array = firmware->priv->array_requested;
while (filename != NULL) {
- /* can we get the contents */
- filename_path = g_build_filename (GPK_FIRMWARE_STATE_DIR, filename, NULL);
- egg_debug ("opening %s", filename_path);
- ret = g_file_get_contents (filename_path, &contents, NULL, &error);
- if (!ret) {
- egg_warning ("can't open file %s, %s", filename, error->message);
- g_error_free (error);
- error = NULL;
- goto skip_file;
- }
+ /* decode udev text */
+ filename_decoded = gpk_firmware_udev_text_decode (filename);
+ filename_path = g_build_filename (GPK_FIRMWARE_LOADING_DIR, filename_decoded, NULL);
+ egg_debug ("filename=%s -> %s", filename, filename_path);
+
+ /* file already exists */
+ ret = g_file_test (filename_path, G_FILE_TEST_EXISTS);
+ if (!ret)
+ g_ptr_array_add (array, g_strdup (filename_path));
- /* split, as we can use multiple requests in one file */
- firmware_files = g_strsplit (contents, "\n", 0);
- length = g_strv_length (firmware_files);
- for (i=0; i<length; i++) {
- if (!egg_strzero (firmware_files[i])) {
- /* file still doesn't exist */
- ret = g_file_test (firmware_files[i], G_FILE_TEST_EXISTS);
- if (!ret)
- egg_str_list_add (array, firmware_files[i]);
- }
- }
- g_free (contents);
- g_strfreev (firmware_files);
-skip_file:
+ g_free (filename_decoded);
g_free (filename_path);
/* next file */
filename = g_dir_read_name (dir);
}
g_dir_close (dir);
- /* don't request duplicates */
- egg_str_list_remove_duplicate (array);
-
/* debugging */
for (i=0; i<array->len; i++) {
- filename = egg_str_list_index (array, i);
+ filename = g_ptr_array_index (array, i);
egg_debug ("requested: %s", filename);
}
@@ -355,7 +382,7 @@
/* debugging */
for (i=0; i<array->len; i++) {
- filename = egg_str_list_index (array, i);
+ filename = g_ptr_array_index (array, i);
egg_debug ("searching for: %s", filename);
}
@@ -378,8 +405,10 @@
firmware = GPK_FIRMWARE (object);
g_return_if_fail (firmware->priv != NULL);
- egg_str_list_free (firmware->priv->array_found);
- egg_str_list_free (firmware->priv->array_requested);
+ g_ptr_array_foreach (firmware->priv->array_found, (GFunc) g_free, NULL);
+ g_ptr_array_free (firmware->priv->array_found, TRUE);
+ g_ptr_array_foreach (firmware->priv->array_requested, (GFunc) g_free, NULL);
+ g_ptr_array_free (firmware->priv->array_requested, TRUE);
g_object_unref (firmware->priv->gconf_client);
G_OBJECT_CLASS (gpk_firmware_parent_class)->finalize (object);
Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c (original)
+++ trunk/src/gpk-watch.c Wed Jan 14 14:36:27 2009
@@ -233,6 +233,7 @@
PK_STATUS_ENUM_CLEANUP,
PK_STATUS_ENUM_REPACKAGING,
PK_STATUS_ENUM_WAIT,
+ PK_STATUS_ENUM_WAITING_FOR_LOCK,
PK_STATUS_ENUM_FINISHED, -1);
/* only set if in the list and not unknown */
Modified: trunk/src/org.freedesktop.PackageKit.xml
==============================================================================
--- trunk/src/org.freedesktop.PackageKit.xml (original)
+++ trunk/src/org.freedesktop.PackageKit.xml Wed Jan 14 14:36:27 2009
@@ -390,12 +390,6 @@
<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"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]