gnome-packagekit r256 - trunk/src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r256 - trunk/src
- Date: Sun, 27 Jul 2008 09:29:19 +0000 (UTC)
Author: rhughes
Date: Sun Jul 27 09:29:19 2008
New Revision: 256
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=256&view=rev
Log:
from git
Modified:
trunk/src/gpk-animated-icon.c
trunk/src/gpk-application.c
trunk/src/gpk-cell-renderer-uri.c
trunk/src/gpk-client-untrusted.c
trunk/src/gpk-client.c
trunk/src/gpk-common.c
trunk/src/gpk-log.c
trunk/src/gpk-update-viewer.c
trunk/src/gpk-watch.c
Modified: trunk/src/gpk-animated-icon.c
==============================================================================
--- trunk/src/gpk-animated-icon.c (original)
+++ trunk/src/gpk-animated-icon.c Sun Jul 27 09:29:19 2008
@@ -208,6 +208,7 @@
g_source_remove (icon->animation_id);
}
g_free (icon->filename);
+ icon->filename = NULL;
gpk_animated_icon_free_pixbufs (icon);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Sun Jul 27 09:29:19 2008
@@ -1925,6 +1925,8 @@
1, gtk_get_current_event_time());
}
+#define PK_PACKAGE_LIST_LOCATION "/var/lib/PackageKit/package-list.txt"
+
/**
* gpk_application_create_completion_model:
*
@@ -1933,22 +1935,42 @@
static GtkTreeModel *
gpk_application_create_completion_model (void)
{
+ PkPackageList *list;
+ guint i;
+ guint length;
+ gboolean ret;
+ const PkPackageObj *obj;
+ GHashTable *hash;
+ gpointer data;
GtkListStore *store;
GtkTreeIter iter;
store = gtk_list_store_new (1, G_TYPE_STRING);
+ hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ list = pk_package_list_new ();
+ ret = pk_package_list_add_file (list, PK_PACKAGE_LIST_LOCATION);
+ if (!ret) {
+ pk_warning ("no package list, try running pk-generate-package-list as root");
+ return NULL;
+ }
- /* append one word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "gnome-power-manager", -1);
-
- /* append another word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "gnome-screensaver", -1);
-
- /* and another word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "hal", -1);
+ length = pk_package_list_get_size (list);
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (list, i);
+ if (obj == NULL || obj->id == NULL || obj->id->name == NULL) {
+ pk_warning ("obj invalid!");
+ break;
+ }
+ data = g_hash_table_lookup (hash, (gpointer) obj->id->name);
+ if (data == NULL) {
+ /* append just the name */
+ g_hash_table_insert (hash, g_strdup (obj->id->name), GINT_TO_POINTER (1));
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, obj->id->name, -1);
+ }
+ }
+ g_hash_table_unref (hash);
+ g_object_unref (list);
return GTK_TREE_MODEL (store);
}
@@ -2887,12 +2909,14 @@
/* create a tree model and use it as the completion model */
completion_model = gpk_application_create_completion_model ();
- gtk_entry_completion_set_model (completion, completion_model);
- g_object_unref (completion_model);
-
- /* use model column 0 as the text column */
- gtk_entry_completion_set_text_column (completion, 0);
- gtk_entry_completion_set_inline_completion (completion, TRUE);
+ if (completion_model != NULL) {
+ gtk_entry_completion_set_model (completion, completion_model);
+ g_object_unref (completion_model);
+
+ /* use model column 0 as the text column */
+ gtk_entry_completion_set_text_column (completion, 0);
+ gtk_entry_completion_set_inline_completion (completion, TRUE);
+ }
}
/* set focus on entry text */
Modified: trunk/src/gpk-cell-renderer-uri.c
==============================================================================
--- trunk/src/gpk-cell-renderer-uri.c (original)
+++ trunk/src/gpk-cell-renderer-uri.c Sun Jul 27 09:29:19 2008
@@ -73,7 +73,7 @@
GdkRectangle *background_area,
GdkRectangle *cell_area, GtkCellRendererState flags)
{
- GpkCellRendererUri *cru = GPK_CELL_RENDERER_URI (g_object_get_data (G_OBJECT (cell), "cru"));
+ GpkCellRendererUri *cru = GPK_CELL_RENDERER_URI (cell);
/* nothing to do */
if (cru->uri == NULL) {
@@ -170,9 +170,6 @@
/* we can click */
g_object_set (G_OBJECT (cru), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
- /* save this */
- g_object_set_data (G_OBJECT (cell), "cru", cru);
-
GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, window, widget, background_area, cell_area, expose_area, flags);
}
Modified: trunk/src/gpk-client-untrusted.c
==============================================================================
--- trunk/src/gpk-client-untrusted.c (original)
+++ trunk/src/gpk-client-untrusted.c Sun Jul 27 09:29:19 2008
@@ -99,8 +99,8 @@
/* add the extra button and connect up to a Policykit action */
pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.localinstall-untrusted");
- update_system_action = polkit_gnome_action_new_default ("localinstall-untrusted", pk_action,
+ polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.package-install-untrusted");
+ update_system_action = polkit_gnome_action_new_default ("package-install-untrusted", pk_action,
_("_Force install"),
_("Force installing package"));
g_object_set (update_system_action,
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Sun Jul 27 09:29:19 2008
@@ -2169,15 +2169,14 @@
pk_common_get_role_text (PkClient *client)
{
const gchar *role_text;
- gchar *package_id;
gchar *text;
- gchar *package;
+ gchar *message;
PkRoleEnum role;
GError *error = NULL;
gboolean ret;
/* get role and text */
- ret = pk_client_get_role (client, &role, &package_id, &error);
+ ret = pk_client_get_role (client, &role, &text, &error);
if (!ret) {
pk_warning ("failed to get role: %s", error->message);
g_error_free (error);
@@ -2187,16 +2186,14 @@
/* backup */
role_text = gpk_role_enum_to_localised_present (role);
- if (!pk_strzero (package_id) && role != PK_ROLE_ENUM_UPDATE_PACKAGES) {
- package = gpk_package_get_name (package_id);
- text = g_strdup_printf ("%s: %s", role_text, package);
- g_free (package);
+ if (!pk_strzero (text) && role != PK_ROLE_ENUM_UPDATE_PACKAGES) {
+ message = g_strdup_printf ("%s: %s", role_text, text);
} else {
- text = g_strdup_printf ("%s", role_text);
+ message = g_strdup_printf ("%s", role_text);
}
- g_free (package_id);
+ g_free (text);
- return text;
+ return message;
}
/**
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Sun Jul 27 09:29:19 2008
@@ -217,6 +217,8 @@
gchar *text;
GString *string;
+ g_return_val_if_fail (id != NULL, NULL);
+
/* optional */
if (pk_strzero (summary)) {
string = g_string_new (id->name);
@@ -288,6 +290,10 @@
gchar *package = NULL;
PkPackageId *id;
+ /* pk_package_id_new_from_string can't accept NULL */
+ if (package_id == NULL) {
+ return NULL;
+ }
id = pk_package_id_new_from_string (package_id);
if (id == NULL) {
package = g_strdup (package_id);
@@ -424,7 +430,7 @@
text = _("Package is corrupt");
break;
default:
- g_warning ("Unknown error");
+ pk_warning ("Unknown error");
}
return text;
}
@@ -581,8 +587,8 @@
text = _("The package that was downloaded is corrupt and needs to be downloaded again.");
break;
default:
- g_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
- "More information is available in the detailed report.");
+ pk_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
+ "More information is available in the detailed report.");
}
return text;
}
@@ -989,6 +995,9 @@
case PK_ROLE_ENUM_ACCEPT_EULA:
text = _("Accepting EULA");
break;
+ case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
+ text = _("Downloading packages");
+ break;
default:
pk_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
}
@@ -1089,6 +1098,9 @@
case PK_ROLE_ENUM_ACCEPT_EULA:
text = _("Accepted EULA");
break;
+ case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
+ text = _("Downloaded packages");
+ break;
default:
pk_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
}
@@ -1667,15 +1679,6 @@
/************************************************************
**************** package name text **************
************************************************************/
- libst_title (test, "package id pretty null");
- text = gpk_package_id_format_twoline (NULL, NULL);
- if (text == NULL) {
- libst_success (test, NULL);
- } else {
- libst_failed (test, "failed, got %s", text);
- }
-
- /************************************************************/
libst_title (test, "package id pretty valid package id, no summary");
id = pk_package_id_new_from_string ("simon;0.0.1;i386;data");
text = gpk_package_id_format_twoline (id, NULL);
Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c (original)
+++ trunk/src/gpk-log.c Sun Jul 27 09:29:19 2008
@@ -300,7 +300,7 @@
{
PolKitAction *pk_action;
pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.rollback");
+ polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.system-rollback");
button_action = polkit_gnome_action_new_default ("rollback", pk_action, _("_Rollback"), NULL);
g_object_set (button_action,
"no-icon-name", "gtk-go-back-ltr",
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Sun Jul 27 09:29:19 2008
@@ -1658,7 +1658,7 @@
/* refresh */
pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.refresh-cache");
+ polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.system-sources-refresh");
refresh_action = polkit_gnome_action_new_default ("refresh", pk_action,
_("Refresh"),
_("Refreshing is not normally required but will retrieve the latest application and update lists"));
@@ -1682,7 +1682,7 @@
/* update-package */
pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.update-package");
+ polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.system-update");
update_packages_action = polkit_gnome_action_new_default ("update-package", pk_action,
_("_Apply Updates"),
_("Apply the selected updates"));
@@ -1696,7 +1696,7 @@
/* update-system */
pk_action = polkit_action_new ();
- polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.update-system");
+ polkit_action_set_action_id (pk_action, "org.freedesktop.packagekit.system-update");
update_system_action = polkit_gnome_action_new_default ("update-system", pk_action,
_("_Update System"),
_("Apply all updates"));
Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c (original)
+++ trunk/src/gpk-watch.c Sun Jul 27 09:29:19 2008
@@ -50,6 +50,7 @@
#include <pk-package-id.h>
#include "gpk-common.h"
+#include "gpk-error.h"
#include "gpk-watch.h"
#include "gpk-client.h"
#include "gpk-inhibit.h"
@@ -79,6 +80,7 @@
gboolean show_refresh_in_menu;
PolKitGnomeAction *restart_action;
guint set_proxy_timeout;
+ gchar *error_details;
};
G_DEFINE_TYPE (GpkWatch, gpk_watch, G_TYPE_OBJECT)
@@ -105,7 +107,6 @@
PkTaskListItem *item;
guint length;
GString *status;
- gchar *text;
const gchar *localised_status;
g_return_val_if_fail (GPK_IS_WATCH (watch), FALSE);
@@ -127,13 +128,11 @@
/* should we display the text */
if (item->role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
- pk_strzero (item->package_id)) {
+ pk_strzero (item->text)) {
g_string_append_printf (status, "%s\n", localised_status);
} else {
/* display the package name, not the package_id */
- text = gpk_package_get_name (item->package_id);
- g_string_append_printf (status, "%s: %s\n", localised_status, text);
- g_free (text);
+ g_string_append_printf (status, "%s: %s\n", localised_status, item->text);
}
/* don't fill the screen with a giant tooltip */
if (i > GPK_WATCH_MAXIMUM_TOOLTIP_LINES) {
@@ -268,6 +267,10 @@
if (pk_strequal (action, "do-not-show-notify-complete")) {
pk_debug ("set %s to FALSE", GPK_CONF_PROMPT_FIRMWARE);
gconf_client_set_bool (watch->priv->gconf_client, GPK_CONF_NOTIFY_COMPLETED, FALSE, NULL);
+
+ } else if (pk_strequal (action, "show-error-details")) {
+ gpk_error_dialog (_("Error details"), NULL, watch->priv->error_details);
+
} else {
pk_warning ("unknown action id: %s", action);
}
@@ -284,9 +287,8 @@
PkRoleEnum role;
PkRestartEnum restart;
GError *error = NULL;
- gchar *package_id = NULL;
+ gchar *text = NULL;
gchar *message = NULL;
- gchar *package;
const gchar *restart_message;
const gchar *icon_name;
NotifyNotification *notification;
@@ -294,12 +296,12 @@
g_return_if_fail (GPK_IS_WATCH (watch));
/* get the role */
- ret = pk_client_get_role (client, &role, &package_id, NULL);
+ ret = pk_client_get_role (client, &role, &text, NULL);
if (!ret) {
pk_warning ("cannot get role");
goto out;
}
- pk_debug ("role=%s, package=%s", pk_role_enum_to_text (role), package_id);
+ pk_debug ("role=%s, text=%s", pk_role_enum_to_text (role), text);
/* show an icon if the user needs to reboot */
if (role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
@@ -347,13 +349,9 @@
}
if (role == PK_ROLE_ENUM_REMOVE_PACKAGES) {
- package = gpk_package_get_name (package_id);
- message = g_strdup_printf (_("Package '%s' has been removed"), package);
- g_free (package);
+ message = g_strdup_printf (_("Package '%s' has been removed"), text);
} else if (role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
- package = gpk_package_get_name (package_id);
- message = g_strdup_printf (_("Package '%s' has been installed"), package);
- g_free (package);
+ message = g_strdup_printf (_("Package '%s' has been installed"), text);
} else if (role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
message = g_strdup ("System has been updated");
}
@@ -377,7 +375,7 @@
out:
g_free (message);
- g_free (package_id);
+ g_free (text);
}
/**
@@ -388,8 +386,8 @@
{
gboolean ret;
GError *error = NULL;
- gchar *escaped_details;
const gchar *title;
+ const gchar *message;
gboolean is_active;
gboolean value;
NotifyNotification *notification;
@@ -424,19 +422,24 @@
}
/* we need to format this */
- escaped_details = g_markup_escape_text (details, -1);
+ message = gpk_error_enum_to_localised_message (error_code);
+
+ /* save this globally */
+ g_free (watch->priv->error_details);
+ watch->priv->error_details = g_markup_escape_text (details, -1);
/* do the bubble */
- notification = notify_notification_new (title, escaped_details, "help-browser", NULL);
+ notification = notify_notification_new (title, message, "help-browser", NULL);
notify_notification_set_timeout (notification, 15000);
notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
+ notify_notification_add_action (notification, "show-error-details",
+ _("Show details"), gpk_watch_libnotify_cb, watch, NULL);
+
ret = notify_notification_show (notification, &error);
if (!ret) {
pk_warning ("error: %s", error->message);
g_error_free (error);
}
-
- g_free (escaped_details);
}
/**
@@ -491,7 +494,6 @@
gboolean ret;
char *cmdline;
GdkScreen *gscreen;
- GtkWidget *error_dialog;
gchar *url;
gchar *protocol = (gchar*) data;
@@ -517,9 +519,7 @@
g_free (cmdline);
if (!ret) {
- error_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Failed to show url %s", error->message);
- gtk_dialog_run (GTK_DIALOG (error_dialog));
- gtk_widget_destroy (error_dialog);
+ gpk_error_dialog (_("Internal error"), _("Failed to show url"), error->message);
g_error_free (error);
}
@@ -699,7 +699,6 @@
const gchar *localised_status;
const gchar *localised_role;
const gchar *icon_name;
- gchar *package;
gchar *text;
guint length;
@@ -721,11 +720,9 @@
localised_status = gpk_status_enum_to_localised_text (item->status);
icon_name = gpk_status_enum_to_icon_name (item->status);
- if (!pk_strzero (item->package_id) &&
+ if (!pk_strzero (item->text) &&
item->role != PK_ROLE_ENUM_UPDATE_PACKAGES) {
- package = gpk_package_get_name (item->package_id);
- text = g_strdup_printf ("%s %s (%s)", localised_role, package, localised_status);
- g_free (package);
+ text = g_strdup_printf ("%s %s (%s)", localised_role, item->text, localised_status);
} else {
text = g_strdup_printf ("%s (%s)", localised_role, localised_status);
}
@@ -1064,6 +1061,7 @@
PolKitGnomeAction *restart_action;
watch->priv = GPK_WATCH_GET_PRIVATE (watch);
+ watch->priv->error_details = NULL;
watch->priv->show_refresh_in_menu = TRUE;
watch->priv->gconf_client = gconf_client_get_default ();
@@ -1166,6 +1164,7 @@
g_source_remove (watch->priv->set_proxy_timeout);
}
+ g_free (watch->priv->error_details);
g_object_unref (watch->priv->sicon);
g_object_unref (watch->priv->inhibit);
g_object_unref (watch->priv->tlist);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]