gnome-packagekit r240 - in trunk: help/C po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r240 - in trunk: help/C po src
- Date: Fri, 4 Jul 2008 16:30:10 +0000 (UTC)
Author: rhughes
Date: Fri Jul 4 16:30:10 2008
New Revision: 240
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=240&view=rev
Log:
from git
Added:
trunk/src/gpk-dialog.c
trunk/src/gpk-dialog.h
Modified:
trunk/help/C/gnome-packagekit.xml
trunk/po/POTFILES.in
trunk/src/Makefile.am
trunk/src/gpk-application.c
trunk/src/gpk-check-update.c
trunk/src/gpk-client-chooser.c
trunk/src/gpk-client-chooser.h
trunk/src/gpk-client-depends.c
trunk/src/gpk-client-eula.c
trunk/src/gpk-client-requires.c
trunk/src/gpk-client-resolve.c
trunk/src/gpk-client-run.c
trunk/src/gpk-client-signature.c
trunk/src/gpk-client-untrusted.c
trunk/src/gpk-client.c
trunk/src/gpk-common.c
trunk/src/gpk-common.h
trunk/src/gpk-log.c
trunk/src/gpk-update-viewer.c
trunk/src/gpk-watch.c
Modified: trunk/help/C/gnome-packagekit.xml
==============================================================================
--- trunk/help/C/gnome-packagekit.xml (original)
+++ trunk/help/C/gnome-packagekit.xml Fri Jul 4 16:30:10 2008
@@ -463,6 +463,55 @@
</para>
</section>
+<section id="eula">
+ <title>Agreeing to EULAs</title>
+ <para>
+ A license agreement is a contract between a producer and a user of software
+ which grants the user a software license.
+ A software license agreement defines the legal terms under which a user
+ may use the software.
+ This is called an end-user license agreement or EULA for short.
+ </para>
+ <para>
+ Many EULAs assert extensive liability limitations for the software.
+ Typically a EULA will hold the software producer immune in the event that
+ the software causes damage to the computer hardware or data.
+ Some software also includes limitations if the user can be held liable for
+ damage that arises through improper use of the software.
+ </para>
+ <para>
+ Be sure to carefully read and accept the EULA text before continuing with
+ the install or update.
+ </para>
+</section>
+
+<section id="gpg-signature">
+ <title>Accepting a security signature</title>
+ <para>
+ Packages from a software source are typically signed by the project managing
+ the repository or packages.
+ This allows users to be sure a package signed with a security key is
+ actually from the software source it claims to be.
+ </para>
+ <para>
+ For a package management infrastructure to operate effectively, it has to
+ trust repositories so that updates can be downloaded and installed
+ automatically.
+ The other benefit is that signed packages can be installed without using the
+ administrator password, assuming your admin has enabled this option.
+ </para>
+ <para>
+ To trust a repository, you should very the details of the signing key.
+ Normally the best way to do this is to go to the web page of the software
+ source, and try to find details about the key used to sign the packages.
+ This is normally called a <literal>GPG key</literal>.
+ </para>
+ <para>
+ You should only proceed with this dialog if you are happy to trust packages
+ from this software source.
+ </para>
+</section>
+
<section id="about">
<title>About</title>
<para>
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Fri Jul 4 16:30:10 2008
@@ -35,6 +35,7 @@
src/gpk-client-untrusted.c
src/gpk-common.c
src/gpk-consolekit.c
+src/gpk-dialog.c
src/gpk-error.c
src/gpk-firmware.c
src/gpk-inhibit.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Fri Jul 4 16:30:10 2008
@@ -56,6 +56,8 @@
gpk-animated-icon.h \
gpk-consolekit.c \
gpk-consolekit.h \
+ gpk-dialog.c \
+ gpk-dialog.h \
gpk-client.c \
gpk-client.h \
gpk-client-private.h \
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Fri Jul 4 16:30:10 2008
@@ -53,6 +53,7 @@
#include "gpk-application.h"
#include "gpk-application-state.h"
#include "gpk-animated-icon.h"
+#include "gpk-dialog.h"
#include "gpk-client-run.h"
#include "gpk-client-chooser.h"
#include "gpk-cell-renderer-uri.h"
@@ -112,7 +113,7 @@
PkSearchType search_type;
PkSearchMode search_mode;
PkActionMode action;
- GPtrArray *package_list;
+ PkPackageList *package_list;
};
enum {
@@ -120,8 +121,7 @@
LAST_SIGNAL
};
-enum
-{
+enum {
PACKAGES_COLUMN_IMAGE,
PACKAGES_COLUMN_STATE, /* state of the */
PACKAGES_COLUMN_CHECKBOX, /* what we show in the checkbox */
@@ -131,8 +131,7 @@
PACKAGES_COLUMN_LAST
};
-enum
-{
+enum {
GROUPS_COLUMN_ICON,
GROUPS_COLUMN_NAME,
GROUPS_COLUMN_ID,
@@ -372,11 +371,13 @@
GtkTreeModel *model;
GpkPackageState state;
gboolean enabled;
+ guint length;
g_return_if_fail (PK_IS_APPLICATION (application));
/* okay to apply? */
- if (application->priv->package_list->len == 0) {
+ length = pk_package_list_get_size (application->priv->package_list);
+ if (length == 0) {
widget = glade_xml_get_widget (application->priv->glade_xml, "button_apply");
gtk_widget_set_sensitive (widget, FALSE);
widget = glade_xml_get_widget (application->priv->glade_xml, "button_clear");
@@ -411,7 +412,7 @@
gpk_application_install (GpkApplication *application)
{
gboolean ret;
- guint index;
+ PkPackageId *id;
g_return_val_if_fail (PK_IS_APPLICATION (application), FALSE);
@@ -423,7 +424,7 @@
/* changed mind, or wrong mode */
if (application->priv->action == PK_ACTION_REMOVE) {
- ret = pk_ptr_array_remove_string (application->priv->package_list, application->priv->package);
+ ret = pk_package_list_remove (application->priv->package_list, application->priv->package);
if (ret) {
pk_debug ("removed %s from package list", application->priv->package);
@@ -439,14 +440,16 @@
}
/* already added */
- index = pk_ptr_array_find_string (application->priv->package_list, application->priv->package);
- if (index != -1) {
+ ret = pk_package_list_contains (application->priv->package_list, application->priv->package);
+ if (ret) {
pk_warning ("already added");
return FALSE;
}
application->priv->action = PK_ACTION_INSTALL;
- g_ptr_array_add (application->priv->package_list, g_strdup (application->priv->package));
+ id = pk_package_id_new_from_string (application->priv->package);
+ pk_package_list_add (application->priv->package_list, 0, id, NULL);
+ pk_package_id_free (id);
/* correct buttons */
gpk_application_allow_install (application, FALSE);
@@ -537,7 +540,7 @@
gpk_application_remove (GpkApplication *application)
{
gboolean ret;
- guint index;
+ PkPackageId *id;
g_return_val_if_fail (PK_IS_APPLICATION (application), FALSE);
@@ -549,7 +552,7 @@
/* changed mind, or wrong mode */
if (application->priv->action == PK_ACTION_INSTALL) {
- ret = pk_ptr_array_remove_string (application->priv->package_list, application->priv->package);
+ ret = pk_package_list_remove (application->priv->package_list, application->priv->package);
if (ret) {
pk_debug ("removed %s from package list", application->priv->package);
@@ -565,14 +568,16 @@
}
/* already added */
- index = pk_ptr_array_find_string (application->priv->package_list, application->priv->package);
- if (index != -1) {
+ ret = pk_package_list_contains (application->priv->package_list, application->priv->package);
+ if (ret) {
pk_warning ("already added");
return FALSE;
}
application->priv->action = PK_ACTION_REMOVE;
- g_ptr_array_add (application->priv->package_list, g_strdup (application->priv->package));
+ id = pk_package_id_new_from_string (application->priv->package);
+ pk_package_list_add (application->priv->package_list, 0, id, NULL);
+ pk_package_id_free (id);
/* correct buttons */
gpk_application_allow_install (application, TRUE);
@@ -676,7 +681,6 @@
package_ids = pk_package_ids_from_id (application->priv->package);
ret = pk_client_get_requires (application->priv->client_files, PK_FILTER_ENUM_NONE,
package_ids, TRUE, &error);
- g_strfreev (package_ids);
pk_client_set_synchronous (application->priv->client_files, FALSE, NULL);
if (!ret) {
@@ -691,9 +695,36 @@
gpk_error_dialog_modal (GTK_WINDOW (widget), _("No packages"),
_("This package does not require any others"), NULL);
} else {
- gpk_client_chooser_show (GTK_WINDOW (widget), list, PK_ROLE_ENUM_GET_REQUIRES, _("Required by"));
+ gchar *name;
+ gchar *title;
+ gchar *message;
+ guint length;
+ GtkWidget *dialog;
+
+ length = pk_package_list_get_size (list);
+ name = gpk_dialog_package_id_name_join_locale (package_ids);
+ title = g_strdup_printf (ngettext ("%i other package requires %s",
+ "%i other packages require %s",
+ length), length, name);
+
+ message = g_strdup_printf (ngettext ("Packages listed below require %s to function correctly.",
+ "Packages listed below require %s to function correctly.",
+ length), name);
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (widget), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", title);
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
+ gpk_dialog_embed_package_list_widget (GTK_DIALOG (dialog), list);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ g_free (name);
+ g_free (title);
+ g_free (message);
}
+ g_strfreev (package_ids);
g_object_unref (list);
}
@@ -722,7 +753,6 @@
package_ids = pk_package_ids_from_id (application->priv->package);
ret = pk_client_get_depends (application->priv->client_files, PK_FILTER_ENUM_NONE,
package_ids, TRUE, &error);
- g_strfreev (package_ids);
pk_client_set_synchronous (application->priv->client_files, FALSE, NULL);
if (!ret) {
@@ -737,9 +767,36 @@
gpk_error_dialog_modal (GTK_WINDOW (widget), _("No packages"),
_("This package does not depends on any others"), NULL);
} else {
- gpk_client_chooser_show (GTK_WINDOW (widget), list, PK_ROLE_ENUM_GET_DEPENDS, _("Depends on"));
+ gchar *name;
+ gchar *title;
+ gchar *message;
+ guint length;
+ GtkWidget *dialog;
+
+ length = pk_package_list_get_size (list);
+ name = gpk_dialog_package_id_name_join_locale (package_ids);
+ title = g_strdup_printf (ngettext ("%i other package depends on %s",
+ "%i other packages depends on %s",
+ length), length, name);
+
+ message = g_strdup_printf (ngettext ("Packages listed below are required for %s to function correctly.",
+ "Packages listed below are required for %s to function correctly.",
+ length), name);
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (widget), GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", title);
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
+ gpk_dialog_embed_package_list_widget (GTK_DIALOG (dialog), list);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ g_free (name);
+ g_free (title);
+ g_free (message);
}
+ g_strfreev (package_ids);
g_object_unref (list);
}
@@ -842,7 +899,6 @@
GtkWidget *widget;
gchar *text;
gchar *value;
- PkPackageId *ident;
const gchar *repo_name;
const gchar *icon;
const gchar *group;
@@ -852,15 +908,10 @@
g_return_if_fail (PK_IS_APPLICATION (application));
- ident = pk_package_id_new_from_string (details->package_id);
- if (ident == NULL) {
- pk_warning ("failed to get PkPackageId for %s", details->package_id);
- return;
- }
- installed = pk_strequal (ident->data, "installed");
+ installed = pk_strequal (details->id->data, "installed");
/* get the icon */
- icon = pk_extra_get_icon_name (application->priv->extra, ident->name);
+ icon = pk_extra_get_icon_name (application->priv->extra, details->id->name);
/* check icon actually exists and is valid in this theme */
valid = gpk_check_icon_valid (icon);
@@ -934,25 +985,22 @@
/* set the repo text, or hide if installed */
if (!installed) {
/* see if we can get the full name of the repo from the repo_id */
- repo_name = gpk_application_get_full_repo_name (application, ident->data);
+ repo_name = gpk_application_get_full_repo_name (application, details->id->data);
gpk_application_add_detail_item (application, _("Source"), repo_name, NULL);
}
- pk_package_id_free (ident);
}
/**
* gpk_application_package_cb:
**/
static void
-gpk_application_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_id,
- const gchar *summary, GpkApplication *application)
+gpk_application_package_cb (PkClient *client, const PkPackageObj *obj, GpkApplication *application)
{
GtkTreeIter iter;
- PkPackageId *ident;
const gchar *summary_new;
const gchar *icon = NULL;
gchar *text;
- gint index;
+ gchar *package_id;
gboolean in_queue;
gboolean installed;
gboolean checkbox;
@@ -961,32 +1009,25 @@
g_return_if_fail (PK_IS_APPLICATION (application));
- pk_debug ("package = %s:%s:%s", pk_info_enum_to_text (info), package_id, summary);
+ pk_debug ("package = %s:%s:%s", pk_info_enum_to_text (obj->info), obj->id->name, obj->summary);
/* ignore progress */
- if (info != PK_INFO_ENUM_INSTALLED && info != PK_INFO_ENUM_AVAILABLE) {
+ if (obj->info != PK_INFO_ENUM_INSTALLED && obj->info != PK_INFO_ENUM_AVAILABLE) {
return;
}
- /* find localised summary */
- ident = pk_package_id_new_from_string (package_id);
- if (ident == NULL) {
- pk_warning ("failed to get PkPackageId for %s", package_id);
- return;
- }
- summary_new = pk_extra_get_summary (application->priv->extra, ident->name);
+ summary_new = pk_extra_get_summary (application->priv->extra, obj->id->name);
if (summary_new == NULL) {
/* use the non-localised one */
- summary_new = summary;
+ summary_new = obj->summary;
}
/* mark as got so we don't warn */
application->priv->has_package = TRUE;
/* are we in the package list? */
- index = pk_ptr_array_find_string (application->priv->package_list, package_id);
- in_queue = (index != -1);
- installed = (info == PK_INFO_ENUM_INSTALLED);
+ in_queue = pk_package_list_contains_obj (application->priv->package_list, obj);
+ installed = (obj->info == PK_INFO_ENUM_INSTALLED);
if (installed && in_queue) {
state = GPK_STATE_INSTALLED_TO_BE_REMOVED;
@@ -1002,11 +1043,12 @@
checkbox = gpk_application_state_get_checkbox (state);
/* use two lines */
- text = gpk_package_id_format_twoline (package_id, summary);
+ text = gpk_package_id_format_twoline (obj->id, summary_new);
/* can we modify this? */
enabled = gpk_application_get_checkbox_enable (application, state);
+ package_id = pk_package_id_to_string (obj->id);
gtk_list_store_append (application->priv->packages_store, &iter);
gtk_list_store_set (application->priv->packages_store, &iter,
PACKAGES_COLUMN_STATE, state,
@@ -1017,7 +1059,7 @@
PACKAGES_COLUMN_IMAGE, icon,
-1);
- pk_package_id_free (ident);
+ g_free (package_id);
g_free (text);
while (gtk_events_pending ()) {
@@ -1504,7 +1546,7 @@
valid = gtk_tree_model_iter_next (model, &iter);
}
- g_ptr_array_remove_range (application->priv->package_list, 0, application->priv->package_list->len);
+ pk_package_list_clear (application->priv->package_list);
/* force a button refresh */
widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_packages");
@@ -1527,7 +1569,7 @@
g_return_if_fail (PK_IS_APPLICATION (application));
- package_ids = pk_ptr_array_to_argv (application->priv->package_list);
+ package_ids = pk_package_list_to_argv (application->priv->package_list);
if (application->priv->action == PK_ACTION_INSTALL) {
ret = gpk_client_install_package_ids (application->priv->gclient, package_ids, NULL);
/* can we show the user the new application? */
@@ -1551,7 +1593,7 @@
/* refresh the search as the items may have changed and the filter has not changed */
if (ret) {
/* clear if success */
- g_ptr_array_remove_range (application->priv->package_list, 0, application->priv->package_list->len);
+ pk_package_list_clear (application->priv->package_list);
application->priv->action = PK_ACTION_NONE;
gpk_application_set_buttons_apply_clear (application);
gpk_application_refresh_search_results (application);
@@ -1670,6 +1712,7 @@
gboolean show_remove = TRUE;
GpkPackageState state;
gchar **package_ids;
+ gchar *image;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -1692,6 +1735,15 @@
return;
}
+ /* check we aren't a help line */
+ gtk_tree_model_get (model, &iter, PACKAGES_COLUMN_IMAGE, &image, -1);
+ ret = pk_strequal (image, "search");
+ g_free (image);
+ if (ret) {
+ pk_debug ("ignoring help click");
+ return;
+ }
+
/* show the menu item */
widget = glade_xml_get_widget (application->priv->glade_xml, "menuitem_selection");
gtk_widget_show (widget);
@@ -2568,7 +2620,7 @@
application->priv->group = NULL;
application->priv->url = NULL;
application->priv->has_package = FALSE;
- application->priv->package_list = g_ptr_array_new ();
+ application->priv->package_list = pk_package_list_new ();
application->priv->gconf_client = gconf_client_get_default ();
application->priv->repos = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -3010,6 +3062,15 @@
GROUPS_COLUMN_ICON, icon_name, -1);
}
+ /* set up the groups checkbox */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
+ gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
+ GTK_TREE_MODEL (application->priv->groups_store));
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (gpk_application_groups_treeview_clicked_cb), application);
+
/* only if we can do both */
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_GET_PACKAGES) &&
pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_GROUP)) {
@@ -3021,20 +3082,13 @@
GROUPS_COLUMN_ID, "separator", -1);
/* use the seporator */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget),
gpk_application_group_row_separator_func, NULL, NULL);
}
/* create group tree view if we can search by group */
if (pk_enums_contain (application->priv->roles, PK_ROLE_ENUM_SEARCH_GROUP)) {
- widget = glade_xml_get_widget (application->priv->glade_xml, "treeview_groups");
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
- GTK_TREE_MODEL (application->priv->groups_store));
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
- g_signal_connect (selection, "changed",
- G_CALLBACK (gpk_application_groups_treeview_clicked_cb), application);
-
/* add columns to the tree view */
gpk_application_groups_add_columns (GTK_TREE_VIEW (widget));
@@ -3092,12 +3146,12 @@
g_object_unref (application->priv->extra);
g_object_unref (application->priv->gconf_client);
g_object_unref (application->priv->gclient);
+ g_object_unref (application->priv->package_list);
g_free (application->priv->url);
g_free (application->priv->group);
g_free (application->priv->package);
g_hash_table_destroy (application->priv->repos);
- g_ptr_array_free (application->priv->package_list, TRUE);
G_OBJECT_CLASS (gpk_application_parent_class)->finalize (object);
}
Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c (original)
+++ trunk/src/gpk-check-update.c Fri Jul 4 16:30:10 2008
@@ -174,7 +174,6 @@
static void
gpk_check_update_show_about_cb (GtkMenuItem *item, gpointer data)
{
- static gboolean been_here = FALSE;
const char *authors[] = {
"Richard Hughes <richard hughsie com>",
NULL};
@@ -207,12 +206,8 @@
license_trans = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n",
_(license[2]), "\n\n", _(license[3]), "\n", NULL);
- /* FIXME: unnecessary with libgnomeui >= 2.16.0 */
- if (!been_here) {
- been_here = TRUE;
- gtk_about_dialog_set_url_hook (gpk_check_update_about_dialog_url_cb, NULL, NULL);
- gtk_about_dialog_set_email_hook (gpk_check_update_about_dialog_url_cb, "mailto:", NULL);
- }
+ gtk_about_dialog_set_url_hook (gpk_check_update_about_dialog_url_cb, NULL, NULL);
+ gtk_about_dialog_set_email_hook (gpk_check_update_about_dialog_url_cb, "mailto:", NULL);
gtk_window_set_default_icon_name ("system-software-installer");
gtk_show_about_dialog (NULL,
@@ -475,12 +470,13 @@
/* do the bubble */
notification = notify_notification_new (title, message, "help-browser", NULL);
if (notification == NULL) {
- pk_error ("moo");
+ pk_warning ("failed to get bubble");
+ return;
}
notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL);
notify_notification_add_action (notification, "update-just-security",
- _("Install these updates"), gpk_check_update_libnotify_cb, cupdate, NULL);
+ _("Install security updates"), gpk_check_update_libnotify_cb, cupdate, NULL);
notify_notification_add_action (notification, "update-all-packages",
_("Install all updates"), gpk_check_update_libnotify_cb, cupdate, NULL);
notify_notification_add_action (notification, "do-not-show-notify-critical",
@@ -522,7 +518,7 @@
pk_warning ("not found obj %i", i);
break;
}
- pk_debug ("%s %s", obj->package_id, pk_info_enum_to_text (obj->info));
+ pk_debug ("%s %s", obj->id->name, pk_info_enum_to_text (obj->info));
pk_enums_add (infos, obj->info);
}
return infos;
@@ -641,13 +637,14 @@
const PkPackageObj *obj;
guint length;
guint i;
+ guint more;
gboolean ret = FALSE;
GString *status_security;
GString *status_tooltip;
PkUpdateEnum update;
- PkPackageId *ident;
GPtrArray *security_array;
const gchar *icon;
+ gchar *package_id;
gchar **package_ids;
PkPackageList *list;
GError *error = NULL;
@@ -697,16 +694,22 @@
/* find the security updates */
for (i=0; i<length; i++) {
obj = pk_package_list_get_obj (list, i);
- pk_debug ("%s, %s, %s", pk_info_enum_to_text (obj->info),
- obj->package_id, obj->summary);
- ident = pk_package_id_new_from_string (obj->package_id);
if (obj->info == PK_INFO_ENUM_SECURITY) {
/* add to array */
- g_ptr_array_add (security_array, g_strdup (obj->package_id));
+ package_id = pk_package_id_to_string (obj->id);
+ g_ptr_array_add (security_array, package_id);
g_string_append_printf (status_security, "<b>%s</b> - %s\n",
- ident->name, obj->summary);
+ obj->id->name, obj->summary);
+ }
+
+ /* don't have a huge notification that won't fit on the screen */
+ if (security_array->len > 10) {
+ more = length - security_array->len;
+ g_string_append_printf (status_security, ngettext ("and %d other security update",
+ "and %d other security updates", more), more);
+ g_string_append (status_security, "...\n");
+ break;
}
- pk_package_id_free (ident);
}
/* do we do the automatic updates? */
@@ -785,11 +788,20 @@
g_string_free (status_security, TRUE);
g_string_free (status_tooltip, TRUE);
g_ptr_array_free (security_array, TRUE);
-
return ret;
}
/**
+ * gpk_check_update_query_updates_idle_cb:
+ **/
+static gboolean
+gpk_check_update_query_updates_idle_cb (GpkCheckUpdate *cupdate)
+{
+ gpk_check_update_query_updates (cupdate);
+ return FALSE;
+}
+
+/**
* gpk_check_update_updates_changed_cb:
**/
static void
@@ -802,7 +814,7 @@
/* ignore our own updates */
if (!cupdate->priv->get_updates_in_progress) {
- g_idle_add ((GSourceFunc) gpk_check_update_query_updates, cupdate);
+ g_idle_add ((GSourceFunc) gpk_check_update_query_updates_idle_cb, cupdate);
}
}
@@ -897,7 +909,7 @@
g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
/* show the icon at login time */
- gpk_check_update_query_updates (cupdate);
+ g_idle_add ((GSourceFunc) gpk_check_update_query_updates_idle_cb, cupdate);
}
/**
Modified: trunk/src/gpk-client-chooser.c
==============================================================================
--- trunk/src/gpk-client-chooser.c (original)
+++ trunk/src/gpk-client-chooser.c Fri Jul 4 16:30:10 2008
@@ -167,13 +167,12 @@
* Return value: the package_id of the selected package, or NULL
**/
gchar *
-gpk_client_chooser_show (GtkWindow *window, PkPackageList *list, PkRoleEnum role, const gchar *title)
+gpk_client_chooser_show (GtkWindow *window, PkPackageList *list, const gchar *title)
{
GladeXML *glade_xml;
GtkWidget *widget;
GtkTreeSelection *selection;
const PkPackageObj *obj;
- PkPackageId *ident;
GtkTreeIter iter;
PkExtra *extra;
gboolean ret;
@@ -217,13 +216,6 @@
/* connect up PolicyKit actions */
g_signal_connect (button_action, "activate", G_CALLBACK (gpk_client_chooser_button_action_cb), NULL);
- /* no point showing install button */
- if (role == PK_ROLE_ENUM_GET_DEPENDS ||
- role == PK_ROLE_ENUM_GET_REQUIRES) {
- widget = glade_xml_get_widget (glade_xml, "button_action");
- gtk_widget_hide (widget);
- }
-
/* create list stores */
list_store = gtk_list_store_new (GPK_CHOOSER_COLUMN_LAST, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -248,16 +240,14 @@
len = pk_package_list_get_size (list);
for (i=0; i<len; i++) {
obj = pk_package_list_get_obj (list, i);
- pk_debug ("package '%s' got:", obj->package_id);
+ pk_debug ("package '%s' got:", obj->id->name);
/* put formatted text into treeview */
gtk_list_store_append (list_store, &iter);
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_twoline (obj->id, obj->summary);
/* get the icon */
- ident = pk_package_id_new_from_string (obj->package_id);
- icon_name = pk_extra_get_icon_name (extra, ident->name);
- pk_package_id_free (ident);
+ icon_name = pk_extra_get_icon_name (extra, obj->id->name);
/* check icon actually exists and is valid in this theme */
ret = gpk_check_icon_valid (icon_name);
@@ -265,9 +255,11 @@
icon_name = gpk_info_enum_to_icon_name (obj->info);
}
+ package_id = pk_package_id_to_string (obj->id);
gtk_list_store_set (list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, text,
- GPK_CHOOSER_COLUMN_ID, obj->package_id, -1);
+ GPK_CHOOSER_COLUMN_ID, package_id, -1);
+ g_free (package_id);
gtk_list_store_set (list_store, &iter, GPK_CHOOSER_COLUMN_ICON, icon_name, -1);
g_free (text);
}
Modified: trunk/src/gpk-client-chooser.h
==============================================================================
--- trunk/src/gpk-client-chooser.h (original)
+++ trunk/src/gpk-client-chooser.h Fri Jul 4 16:30:10 2008
@@ -30,7 +30,6 @@
void gpk_client_chooser_self_test (gpointer data);
gchar *gpk_client_chooser_show (GtkWindow *window,
PkPackageList *list,
- PkRoleEnum role,
const gchar *title);
G_END_DECLS
Modified: trunk/src/gpk-client-depends.c
==============================================================================
--- trunk/src/gpk-client-depends.c (original)
+++ trunk/src/gpk-client-depends.c Fri Jul 4 16:30:10 2008
@@ -35,25 +35,13 @@
#include "gpk-gnome.h"
#include "gpk-error.h"
#include "gpk-common.h"
+#include "gpk-dialog.h"
#include "gpk-client-private.h"
static PkClient *client = NULL;
static GConfClient *gconf_client = NULL;
/**
- * gpk_client_checkbutton_show_depends_cb:
- **/
-static void
-gpk_client_checkbutton_show_depends_cb (GtkWidget *widget, gpointer data)
-{
- gboolean checked;
- /* set the policy */
- checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- pk_debug ("Changing %s to %i", GPK_CONF_SHOW_DEPENDS, checked);
- gconf_client_set_bool (gconf_client, GPK_CONF_SHOW_DEPENDS, checked, NULL);
-}
-
-/**
* gpk_client_status_changed_cb:
**/
static void
@@ -70,17 +58,16 @@
gboolean
gpk_client_depends_show (GpkClient *gclient, gchar **package_ids)
{
- GtkWidget *widget;
GtkWidget *dialog;
GtkWindow *window;
GtkResponseType button;
PkPackageList *list;
gboolean ret;
guint length;
- guint i;
- GString *string;
- const PkPackageObj *obj;
- gchar *text;
+ gchar *name;
+ gchar *title;
+ gchar *message;
+ gchar *button_text;
GError *error = NULL;
list = pk_package_list_new ();
@@ -127,45 +114,39 @@
/* these are the new packages */
list = pk_client_get_package_list (client);
-
- /* process package list */
- string = g_string_new (_("The following packages also have to be downloaded:"));
- g_string_append (string, "\n\n");
length = pk_package_list_get_size (list);
- /* shortcut */
- if (length == 0) {
- goto out;
- }
- for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
- text = gpk_package_id_format_oneline (obj->package_id, obj->summary);
- g_string_append_printf (string, "%s\n", text);
- g_free (text);
- }
- /* remove last \n */
- g_string_set_size (string, string->len - 1);
- /* display messagebox */
- text = g_string_free (string, FALSE);
+ /* title */
+ title = g_strdup_printf (ngettext ("%i other package also have to be installed",
+ "%i other packages also have to be installed",
+ length), length);
+
+ /* button */
+ button_text = g_strdup_printf (ngettext ("Install package",
+ "Install packages", length));
+
+ /* message */
+ name = gpk_dialog_package_id_name_join_locale (package_ids);
+ message = g_strdup_printf (ngettext ("To install %s, an additional package also has to be downloaded.",
+ "To install %s, additional packages also have to be downloaded.",
+ length), name);
+ g_free (name);
/* show UI */
window = gpk_client_get_window (gclient);
dialog = gtk_message_dialog_new (window, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
- "%s", _("Install additional packages?"));
- /* add a specialist button */
- gtk_dialog_add_button (GTK_DIALOG (dialog), _("Install"), GTK_RESPONSE_OK);
-
- /* add a checkbutton for deps screen */
- widget = gtk_check_button_new_with_label (_("Do not show me this again"));
- g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_checkbutton_show_depends_cb), NULL);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
- gtk_widget_show (widget);
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, "%s", title);
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, GTK_RESPONSE_OK);
+ gpk_dialog_embed_package_list_widget (GTK_DIALOG (dialog), list);
+ gpk_dialog_embed_do_not_show_widget (GTK_DIALOG (dialog), GPK_CONF_SHOW_DEPENDS);
+
+ g_free (button_text);
+ g_free (title);
+ g_free (message);
- gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", text);
button = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
- g_free (text);
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
Modified: trunk/src/gpk-client-eula.c
==============================================================================
--- trunk/src/gpk-client-eula.c (original)
+++ trunk/src/gpk-client-eula.c Fri Jul 4 16:30:10 2008
@@ -49,8 +49,8 @@
static void
gpk_client_eula_button_help_cb (GtkWidget *widget, gpointer data)
{
- /* FIXME: need a whole section on this! */
- gpk_gnome_help (NULL);
+ /* show the help */
+ gpk_gnome_help ("eula");
}
/**
Modified: trunk/src/gpk-client-requires.c
==============================================================================
--- trunk/src/gpk-client-requires.c (original)
+++ trunk/src/gpk-client-requires.c Fri Jul 4 16:30:10 2008
@@ -28,47 +28,19 @@
#include <glade/glade.h>
#include <pk-debug.h>
+#include <pk-common.h>
#include <pk-client.h>
+#include <pk-extra.h>
#include <pk-package-id.h>
#include <pk-package-list.h>
#include "gpk-gnome.h"
#include "gpk-error.h"
#include "gpk-common.h"
+#include "gpk-dialog.h"
static PkClient *client = NULL;
/**
- * gpk_client_requires_get_package_ids_name:
- **/
-gchar *
-gpk_client_requires_get_package_ids_name (gchar **package_ids)
-{
- guint i;
- guint length;
- gchar *text;
- GString *string;
- PkPackageId *ident;
-
- string = g_string_new ("");
- length = g_strv_length (package_ids);
-
- /* for each name */
- for (i=0; i<length; i++) {
- ident = pk_package_id_new_from_string (package_ids[i]);
- g_string_append_printf (string, "%s, ", ident->name);
- pk_package_id_free (ident);
- }
-
- /* remove last ', ' */
- if (string->len > 2) {
- g_string_set_size (string, string->len - 2);
- }
-
- text = g_string_free (string, FALSE);
- return text;
-}
-
-/**
* gpk_client_requires_show:
*
* Return value: if we agreed to remove the deps
@@ -81,10 +53,9 @@
PkPackageList *list;
gboolean ret;
guint length;
- guint i;
- GString *string;
- const PkPackageObj *obj;
- gchar *text;
+ gchar *title;
+ gchar *message;
+ gchar *button_text;
gchar *name;
GError *error = NULL;
@@ -117,43 +88,44 @@
/* these are the new packages */
list = pk_client_get_package_list (client);
- /* sort by package_id */
- pk_package_list_sort (list);
-
- /* process package list */
- string = g_string_new (_("The following packages have to be removed:"));
- g_string_append (string, "\n\n");
+ /* no deps */
length = pk_package_list_get_size (list);
- /* shortcut */
if (length == 0) {
goto out;
}
- for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
- text = gpk_package_id_format_oneline (obj->package_id, obj->summary);
- g_string_append_printf (string, "%s\n", text);
- g_free (text);
- }
- /* remove last \n */
- g_string_set_size (string, string->len - 1);
- name = gpk_client_requires_get_package_ids_name (package_ids);
- text = g_strdup_printf (ngettext ("%i other package depends on %s", "%i other packages depend on %s", length), length, name);
+ /* sort by package_id */
+ pk_package_list_sort (list);
+
+ /* title */
+ title = g_strdup_printf (ngettext ("%i other package also has to be removed",
+ "%i other packages also have to be removed",
+ length), length);
+
+ /* button */
+ button_text = g_strdup_printf (ngettext ("Remove package", "Remove packages", length));
+
+ /* message */
+ name = gpk_dialog_package_id_name_join_locale (package_ids);
+ length = g_strv_length (package_ids);
+ message = g_strdup_printf (ngettext ("To remove %s other packages that depend on it must also be removed.",
+ "To remove %s other packages that depend on them must also be removed.",
+ length), name);
g_free (name);
/* show UI */
dialog = gtk_message_dialog_new (window, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, "%s", text);
- g_free (text);
- /* add a specialist button */
- gtk_dialog_add_button (GTK_DIALOG (dialog), _("Remove all packages"), GTK_RESPONSE_OK);
-
- /* display messagebox */
- text = g_string_free (string, FALSE);
- gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", text);
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, "%s", title);
+ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, GTK_RESPONSE_OK);
+ gpk_dialog_embed_package_list_widget (GTK_DIALOG (dialog), list);
+
+ g_free (button_text);
+ g_free (title);
+ g_free (message);
+
button = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
- g_free (text);
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
Modified: trunk/src/gpk-client-resolve.c
==============================================================================
--- trunk/src/gpk-client-resolve.c (original)
+++ trunk/src/gpk-client-resolve.c Fri Jul 4 16:30:10 2008
@@ -49,7 +49,7 @@
GError *error = NULL;
const PkPackageObj *obj;
PkPackageList *list;
- gchar *package_id = NULL;
+ PkPackageId *id = NULL;
gchar **package_ids = NULL;
gchar *text;
gboolean already_installed = FALSE;
@@ -97,13 +97,9 @@
if (obj->info == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
} else if (obj->info == PK_INFO_ENUM_AVAILABLE) {
- pk_debug ("package '%s' resolved", obj->package_id);
+ pk_debug ("package '%s' resolved", obj->id->name);
+ id = obj->id;
//TODO: we need to list these in a gpk-client-chooser
- if (package_id != NULL) {
- pk_warning ("throwing away %s", package_id);
- g_free (package_id);
- }
- package_id = g_strdup (obj->package_id);
}
}
@@ -118,7 +114,7 @@
}
/* got junk? */
- if (package_id == NULL) {
+ if (id == NULL) {
gpk_error_dialog_modal (window, _("Failed to find package"), _("Incorrect response from search"), NULL);
goto out;
}
Modified: trunk/src/gpk-client-run.c
==============================================================================
--- trunk/src/gpk-client-run.c (original)
+++ trunk/src/gpk-client-run.c Fri Jul 4 16:30:10 2008
@@ -154,6 +154,7 @@
gchar *joint = NULL;
GtkTreeIter iter;
GKeyFile *file;
+ PkPackageId *id;
/* get some data from the desktop file */
file = g_key_file_new ();
@@ -194,7 +195,9 @@
/* put formatted text into treeview */
gtk_list_store_append (list_store, &iter);
joint = g_strdup_printf ("%s - %s", name, summary);
- text = gpk_package_id_format_twoline (package_id, joint);
+ id = pk_package_id_new_from_string (package_id);
+ text = gpk_package_id_format_twoline (id, joint);
+ pk_package_id_free (id);
/* might not be valid */
if (!gpk_check_icon_valid (icon)) {
Modified: trunk/src/gpk-client-signature.c
==============================================================================
--- trunk/src/gpk-client-signature.c (original)
+++ trunk/src/gpk-client-signature.c Fri Jul 4 16:30:10 2008
@@ -49,8 +49,8 @@
static void
gpk_client_signature_button_help_cb (GtkWidget *widget, gpointer data)
{
- /* FIXME: need a whole section on this! */
- gpk_gnome_help (NULL);
+ /* show the help */
+ gpk_gnome_help ("gpg-signature");
}
/**
Modified: trunk/src/gpk-client-untrusted.c
==============================================================================
--- trunk/src/gpk-client-untrusted.c (original)
+++ trunk/src/gpk-client-untrusted.c Fri Jul 4 16:30:10 2008
@@ -51,7 +51,6 @@
* gpk_client_untrusted_show:
*
* Return value: if we agreed
- * TODO: Add in gconf checks to see if we've already agreed
**/
gboolean
gpk_client_untrusted_show (PkErrorCodeEnum code)
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Fri Jul 4 16:30:10 2008
@@ -350,7 +350,6 @@
PkRestartEnum restart;
guint i;
guint length;
- PkPackageId *ident;
PkPackageList *list;
const PkPackageObj *obj;
GString *message_text;
@@ -374,14 +373,12 @@
for (i=0; i<length; i++) {
obj = pk_package_list_get_obj (list, i);
pk_debug ("%s, %s, %s", pk_info_enum_to_text (obj->info),
- obj->package_id, obj->summary);
- ident = pk_package_id_new_from_string (obj->package_id);
+ obj->id->name, obj->summary);
if (obj->info == PK_INFO_ENUM_BLOCKED) {
skipped_number++;
g_string_append_printf (message_text, "<b>%s</b> - %s\n",
- ident->name, obj->summary);
+ obj->id->name, obj->summary);
}
- pk_package_id_free (ident);
}
g_object_unref (list);
@@ -711,8 +708,7 @@
* gpk_client_package_cb:
**/
static void
-gpk_client_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_id,
- const gchar *summary, GpkClient *gclient)
+gpk_client_package_cb (PkClient *client, const PkPackageObj *obj, GpkClient *gclient)
{
gchar *text;
g_return_if_fail (GPK_IS_CLIENT (gclient));
@@ -722,7 +718,7 @@
return;
}
- text = gpk_package_id_format_twoline (package_id, summary);
+ text = gpk_package_id_format_twoline (obj->id, obj->summary);
gpk_client_set_package_label (gclient, text);
g_free (text);
}
@@ -1334,7 +1330,7 @@
gchar *package_id = NULL;
PkPackageList *list = NULL;
const PkPackageObj *obj;
- PkPackageId *ident;
+ PkPackageId *id = NULL;
gchar **package_ids = NULL;
gchar *text;
@@ -1366,29 +1362,25 @@
obj = pk_package_list_get_obj (list, i);
if (obj->info == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
- g_free (package_id);
- package_id = g_strdup (obj->package_id);
- break;
+ id = obj->id;
} else if (obj->info == PK_INFO_ENUM_AVAILABLE) {
- pk_debug ("package '%s' resolved to:", obj->package_id);
- package_id = g_strdup (obj->package_id);
+ pk_debug ("package '%s' resolved to:", obj->id->name);
+ id = obj->id;
}
}
/* already installed? */
if (already_installed) {
- ident = pk_package_id_new_from_string (package_id);
- text = g_strdup_printf (_("The %s package already provides the file %s"), ident->name, full_path);
+ text = g_strdup_printf (_("The %s package already provides the file %s"), id->name, full_path);
gpk_client_error_msg (gclient, _("Failed to install file"), text, NULL);
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
g_free (text);
- pk_package_id_free (ident);
ret = FALSE;
goto out;
}
/* got junk? */
- if (package_id == NULL) {
+ if (id == NULL) {
gpk_client_error_msg (gclient, _("Failed to install file"), _("Incorrect response from file search"), NULL);
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
ret = FALSE;
@@ -1396,7 +1388,8 @@
}
/* install this specific package */
- package_ids = g_strsplit (package_id, "|", 1);
+ package_id = pk_package_id_to_string (id);
+ package_ids = pk_package_ids_from_id (package_id);
ret = gpk_client_install_package_ids (gclient, package_ids, error);
out:
if (list != NULL) {
@@ -1453,7 +1446,7 @@
/* populate a chooser */
widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
- package_id = gpk_client_chooser_show (GTK_WINDOW (widget), list, 0, _("Applications that can open this type of file"));
+ package_id = gpk_client_chooser_show (GTK_WINDOW (widget), list, _("Applications that can open this type of file"));
/* selected nothing */
if (package_id == NULL) {
@@ -1521,7 +1514,7 @@
/* populate a chooser */
widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
- package_id = gpk_client_chooser_show (GTK_WINDOW (widget), list, 0, _("Available fonts for this document"));
+ package_id = gpk_client_chooser_show (GTK_WINDOW (widget), list, _("Available fonts for this document"));
/* selected nothing */
if (package_id == NULL) {
@@ -1581,7 +1574,6 @@
gboolean ret;
const PkPackageObj *obj;
PkPackageList *list;
- GPtrArray *array;
PkCatalog *catalog;
GString *string;
gchar *text;
@@ -1654,7 +1646,7 @@
g_string_append (string, "\n\n");
for (i=0; i<len; i++) {
obj = pk_package_list_get_obj (list, i);
- text = gpk_package_id_format_oneline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_oneline (obj->id, obj->summary);
g_string_append_printf (string, "%s\n", text);
g_free (text);
}
@@ -1694,14 +1686,7 @@
}
/* convert to list of package id's */
- array = g_ptr_array_new ();
- for (i=0; i<len; i++) {
- obj = pk_package_list_get_obj (list, i);
- g_ptr_array_add (array, g_strdup (obj->package_id));
- }
-
- /* install packages */
- package_ids = pk_ptr_array_to_argv (array);
+ package_ids = pk_package_list_to_argv (list);
ret = gpk_client_install_package_ids (gclient, package_ids, error);
out:
@@ -2259,9 +2244,17 @@
/* do the best we can */
ret = pk_client_get_package (gclient->priv->client_action, &text, NULL);
+
+ PkPackageId *id;
+ PkPackageObj *obj;
+
+ id = pk_package_id_new_from_string (text);
+ obj = pk_package_obj_new (PK_INFO_ENUM_UNKNOWN, id, NULL);
+ pk_package_id_free (id);
if (ret) {
- gpk_client_package_cb (gclient->priv->client_action, 0, text, NULL, gclient);
+ gpk_client_package_cb (gclient->priv->client_action, obj, gclient);
}
+ pk_package_obj_free (obj);
/* get the role */
ret = pk_client_get_role (gclient->priv->client_action, &role, NULL, &error);
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Fri Jul 4 16:30:10 2008
@@ -211,40 +211,31 @@
* Return value: "<b>GTK Toolkit</b>\ngtk2-2.12.2 (i386)"
**/
gchar *
-gpk_package_id_format_twoline (const gchar *package_id, const gchar *summary)
+gpk_package_id_format_twoline (const PkPackageId *id, const gchar *summary)
{
- PkPackageId *ident;
gchar *summary_safe;
gchar *text;
GString *string;
- /* split by delimeter */
- ident = pk_package_id_new_from_string (package_id);
- if (ident == NULL) {
- pk_warning ("invalid package_id %s", package_id);
- return NULL;
- }
-
/* optional */
if (pk_strzero (summary)) {
- string = g_string_new (ident->name);
+ string = g_string_new (id->name);
} else {
string = g_string_new ("");
summary_safe = g_markup_escape_text (summary, -1);
- g_string_append_printf (string, "<b>%s</b>\n%s", summary_safe, ident->name);
+ g_string_append_printf (string, "<b>%s</b>\n%s", summary_safe, id->name);
g_free (summary_safe);
}
/* some backends don't provide this */
- if (ident->version != NULL) {
- g_string_append_printf (string, "-%s", ident->version);
+ if (id->version != NULL) {
+ g_string_append_printf (string, "-%s", id->version);
}
- if (ident->arch != NULL) {
- g_string_append_printf (string, " (%s)", ident->arch);
+ if (id->arch != NULL) {
+ g_string_append_printf (string, " (%s)", id->arch);
}
text = g_string_free (string, FALSE);
- pk_package_id_free (ident);
return text;
}
@@ -254,29 +245,19 @@
* Return value: "<b>GTK Toolkit</b> (gtk2)"
**/
gchar *
-gpk_package_id_format_oneline (const gchar *package_id, const gchar *summary)
+gpk_package_id_format_oneline (const PkPackageId *id, const gchar *summary)
{
- PkPackageId *ident;
gchar *summary_safe;
gchar *text;
- /* split by delimeter */
- ident = pk_package_id_new_from_string (package_id);
- if (ident == NULL) {
- pk_warning ("invalid package_id %s", package_id);
- return NULL;
- }
-
if (pk_strzero (summary)) {
/* just have name */
- text = g_strdup (ident->name);
+ text = g_strdup (id->name);
} else {
summary_safe = g_markup_escape_text (summary, -1);
- text = g_strdup_printf ("<b>%s</b> (%s)", summary_safe, ident->name);
+ text = g_strdup_printf ("<b>%s</b> (%s)", summary_safe, id->name);
g_free (summary_safe);
}
-
- pk_package_id_free (ident);
return text;
}
@@ -284,30 +265,17 @@
* gpk_package_id_name_version:
**/
gchar *
-gpk_package_id_name_version (const gchar *package_id)
+gpk_package_id_name_version (const PkPackageId *id)
{
- PkPackageId *ident;
gchar *text;
GString *string;
- if (pk_strzero (package_id)) {
- return g_strdup (_("Package identifier not valid"));
- }
-
- /* split by delimeter */
- ident = pk_package_id_new_from_string (package_id);
- if (ident == NULL) {
- pk_warning ("invalid package_id %s", package_id);
- return NULL;
- }
-
- string = g_string_new (ident->name);
- if (ident->version != NULL) {
- g_string_append_printf (string, "-%s", ident->version);
+ string = g_string_new (id->name);
+ if (id->version != NULL) {
+ g_string_append_printf (string, "-%s", id->version);
}
text = g_string_free (string, FALSE);
- pk_package_id_free (ident);
return text;
}
@@ -318,15 +286,15 @@
gpk_package_get_name (const gchar *package_id)
{
gchar *package = NULL;
- PkPackageId *ident;
+ PkPackageId *id;
- ident = pk_package_id_new_from_string (package_id);
- if (ident == NULL) {
+ id = pk_package_id_new_from_string (package_id);
+ if (id == NULL) {
package = g_strdup (package_id);
} else {
- package = g_strdup (ident->name);
+ package = g_strdup (id->name);
}
- pk_package_id_free (ident);
+ pk_package_id_free (id);
return package;
}
@@ -1494,6 +1462,44 @@
return array;
}
+/**
+ * gpk_strv_join_locale:
+ *
+ * Return value: "dave" or "dave and john" or "dave, john and alice",
+ * or %NULL for no match
+ **/
+gchar *
+gpk_strv_join_locale (gchar **array)
+{
+ guint length;
+
+ /* trivial case */
+ length = g_strv_length (array);
+ if (length == 0) {
+ return g_strdup ("none");
+ }
+
+ /* try and get a print format */
+ if (length == 1) {
+ return g_strdup (array[0]);
+ } else if (length == 2) {
+ return g_strdup_printf (_("%s and %s"),
+ array[0], array[1]);
+ } else if (length == 3) {
+ return g_strdup_printf (_("%s, %s and %s"),
+ array[0], array[1], array[2]);
+ } else if (length == 4) {
+ return g_strdup_printf (_("%s, %s, %s and %s"),
+ array[0], array[1],
+ array[2], array[3]);
+ } else if (length == 5) {
+ return g_strdup_printf (_("%s, %s, %s, %s and %s"),
+ array[0], array[1], array[2],
+ array[3], array[4]);
+ }
+ return NULL;
+}
+
/***************************************************************************
*** MAKE CHECK TESTS ***
***************************************************************************/
@@ -1506,6 +1512,7 @@
gchar *text;
guint i;
const gchar *string;
+ PkPackageId *id;
LibSelfTest *test = (LibSelfTest *) data;
if (libst_start (test, "GpkCommon", CLASS_AUTO) == FALSE) {
@@ -1670,7 +1677,9 @@
/************************************************************/
libst_title (test, "package id pretty valid package id, no summary");
- text = gpk_package_id_format_twoline ("simon;0.0.1;i386;data", NULL);
+ id = pk_package_id_new_from_string ("simon;0.0.1;i386;data");
+ text = gpk_package_id_format_twoline (id, NULL);
+ pk_package_id_free (id);
if (text != NULL && strcmp (text, "simon-0.0.1 (i386)") == 0) {
libst_success (test, NULL);
} else {
@@ -1680,7 +1689,9 @@
/************************************************************/
libst_title (test, "package id pretty valid package id, no summary 2");
- text = gpk_package_id_format_twoline ("simon;0.0.1;;data", NULL);
+ id = pk_package_id_new_from_string ("simon;0.0.1;;data");
+ text = gpk_package_id_format_twoline (id, NULL);
+ pk_package_id_free (id);
if (text != NULL && strcmp (text, "simon-0.0.1") == 0) {
libst_success (test, NULL);
} else {
@@ -1690,7 +1701,9 @@
/************************************************************/
libst_title (test, "package id pretty valid package id, no summary 3");
- text = gpk_package_id_format_twoline ("simon;;;data", NULL);
+ id = pk_package_id_new_from_string ("simon;;;data");
+ text = gpk_package_id_format_twoline (id, NULL);
+ pk_package_id_free (id);
if (text != NULL && strcmp (text, "simon") == 0) {
libst_success (test, NULL);
} else {
@@ -1700,7 +1713,9 @@
/************************************************************/
libst_title (test, "package id pretty valid package id, no summary 4");
- text = gpk_package_id_format_twoline ("simon;0.0.1;;data", "dude");
+ id = pk_package_id_new_from_string ("simon;0.0.1;;data");
+ text = gpk_package_id_format_twoline (id, "dude");
+ pk_package_id_free (id);
if (text != NULL && strcmp (text, "<b>dude</b>\nsimon-0.0.1") == 0) {
libst_success (test, NULL);
} else {
Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h (original)
+++ trunk/src/gpk-common.h Fri Jul 4 16:30:10 2008
@@ -24,6 +24,7 @@
#include <glib-object.h>
#include <pk-enum.h>
+#include <pk-package-id.h>
#include "gpk-animated-icon.h"
G_BEGIN_DECLS
@@ -55,11 +56,11 @@
void gpk_common_self_test (gpointer data);
gchar *gpk_package_get_name (const gchar *package_id);
-gchar *gpk_package_id_format_twoline (const gchar *package_id,
+gchar *gpk_package_id_format_twoline (const PkPackageId *id,
const gchar *summary);
-gchar *gpk_package_id_format_oneline (const gchar *package_id,
+gchar *gpk_package_id_format_oneline (const PkPackageId *id,
const gchar *summary);
-gchar *gpk_package_id_name_version (const gchar *package_id);
+gchar *gpk_package_id_name_version (const PkPackageId *id);
const gchar *gpk_role_enum_to_localised_past (PkRoleEnum role)
G_GNUC_CONST;
@@ -101,6 +102,7 @@
gboolean gpk_set_animated_icon_from_status (GpkAnimatedIcon *icon,
PkStatusEnum status,
GtkIconSize size);
+gchar *gpk_strv_join_locale (gchar **array);
G_END_DECLS
Added: trunk/src/gpk-dialog.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-dialog.c Fri Jul 4 16:30:10 2008
@@ -0,0 +1,243 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include <pk-debug.h>
+#include <pk-common.h>
+#include <pk-enum.h>
+#include <pk-extra.h>
+#include <pk-package-id.h>
+#include <gconf/gconf-client.h>
+
+#include "gpk-common.h"
+#include "gpk-dialog.h"
+
+enum {
+ GPK_DIALOG_STORE_IMAGE,
+ GPK_DIALOG_STORE_ID,
+ GPK_DIALOG_STORE_TEXT,
+ GPK_DIALOG_STORE_LAST
+};
+
+/**
+ * gpk_dialog_package_id_name_join_locale:
+ **/
+gchar *
+gpk_dialog_package_id_name_join_locale (gchar **package_ids)
+{
+ guint i;
+ guint length;
+ gchar *text;
+ PkPackageId *ident;
+ GPtrArray *array;
+ gchar **array_strv;
+
+ length = g_strv_length (package_ids);
+ array = g_ptr_array_new ();
+ for (i=0; i<length; i++) {
+ ident = pk_package_id_new_from_string (package_ids[i]);
+ if (ident == NULL) {
+ pk_warning ("failed to split %s", package_ids[i]);
+ continue;
+ }
+ g_ptr_array_add (array, g_strdup (ident->name));
+ pk_package_id_free (ident);
+ }
+ array_strv = pk_ptr_array_to_argv (array);
+ text = gpk_strv_join_locale (array_strv);
+ g_strfreev (array_strv);
+ if (text == NULL) {
+ text = g_strdup (_("many packages"));
+ }
+ g_ptr_array_free (array, TRUE);
+ return text;
+}
+
+/**
+ * gpk_dialog_package_list_to_list_store:
+ **/
+static GtkListStore *
+gpk_dialog_package_list_to_list_store (PkPackageList *list)
+{
+ GtkListStore *store;
+ GtkTreeIter iter;
+ const PkPackageObj *obj;
+ PkExtra *extra;
+ const gchar *icon;
+ gchar *package_id;
+ gchar *text;
+ guint length;
+ guint i;
+ gboolean valid;
+
+ extra = pk_extra_new ();
+ store = gtk_list_store_new (GPK_DIALOG_STORE_LAST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ length = pk_package_list_get_size (list);
+
+ /* add each well */
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (list, i);
+ text = gpk_package_id_format_twoline (obj->id, obj->summary);
+ package_id = pk_package_id_to_string (obj->id);
+
+ /* get the icon */
+ icon = pk_extra_get_icon_name (extra, obj->id->name);
+ valid = gpk_check_icon_valid (icon);
+ if (!valid) {
+ icon = gpk_info_enum_to_icon_name (PK_INFO_ENUM_INSTALLED);
+ }
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ GPK_DIALOG_STORE_IMAGE, icon,
+ GPK_DIALOG_STORE_ID, package_id,
+ GPK_DIALOG_STORE_TEXT, text,
+ -1);
+ g_free (text);
+ g_free (package_id);
+ }
+
+ g_object_unref (extra);
+ return store;
+}
+
+/**
+ * gpk_dialog_treeview_for_package_list:
+ **/
+static gboolean
+gpk_dialog_treeview_for_package_list (GtkTreeView *treeview)
+{
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+
+ /* column for images */
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DND, NULL);
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_column_add_attribute (column, renderer, "icon-name", GPK_DIALOG_STORE_IMAGE);
+ gtk_tree_view_append_column (treeview, column);
+
+ /* column for name */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer,
+ "markup", GPK_DIALOG_STORE_TEXT, NULL);
+ gtk_tree_view_column_set_sort_column_id (column, GPK_DIALOG_STORE_TEXT);
+ gtk_tree_view_append_column (treeview, column);
+
+ /* set some common options */
+ gtk_tree_view_set_headers_visible (treeview, FALSE);
+ selection = gtk_tree_view_get_selection (treeview);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
+ gtk_tree_selection_unselect_all (selection);
+
+ return TRUE;
+}
+
+/**
+ * gpk_dialog_widget_unrealize_unref_cb:
+ **/
+static void
+gpk_dialog_widget_unrealize_unref_cb (GtkWidget *widget, GObject *obj)
+{
+ g_object_unref (obj);
+}
+
+/**
+ * gpk_dialog_embed_package_list_widget:
+ **/
+gboolean
+gpk_dialog_embed_package_list_widget (GtkDialog *dialog, PkPackageList *list)
+{
+ GtkWidget *scroll;
+ GtkListStore *store;
+ GtkWidget *widget;
+ guint length;
+
+ /* convert to a store */
+ store = gpk_dialog_package_list_to_list_store (list);
+
+ /* create a treeview to hold the store */
+ widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ gpk_dialog_treeview_for_package_list (GTK_TREE_VIEW (widget));
+ gtk_widget_show (widget);
+
+ /* scroll the treeview */
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll), widget);
+ gtk_widget_show (scroll);
+
+ length = pk_package_list_get_size (list);
+ if (length > 5) {
+ gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 300);
+ } else if (length > 1) {
+ gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 150);
+ }
+
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), scroll);
+
+ /* free the store */
+ g_signal_connect (G_OBJECT (dialog), "unrealize",
+ G_CALLBACK (gpk_dialog_widget_unrealize_unref_cb), store);
+
+ return TRUE;
+}
+
+/**
+ * gpk_client_checkbutton_show_depends_cb:
+ **/
+static void
+gpk_client_checkbutton_show_depends_cb (GtkWidget *widget, const gchar *key)
+{
+ gboolean checked;
+ GConfClient *gconf_client;
+
+ /* set the policy */
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ pk_debug ("Changing %s to %i", key, checked);
+ gconf_client = gconf_client_get_default ();
+ gconf_client_set_bool (gconf_client, key, checked, NULL);
+ g_object_unref (gconf_client);
+}
+
+/**
+ * gpk_dialog_embed_do_not_show_widget:
+ **/
+gboolean
+gpk_dialog_embed_do_not_show_widget (GtkDialog *dialog, const gchar *key)
+{
+ GtkWidget *widget;
+
+ /* add a checkbutton for deps screen */
+ widget = gtk_check_button_new_with_label (_("Do not show this again"));
+ g_signal_connect (widget, "clicked", G_CALLBACK (gpk_client_checkbutton_show_depends_cb), (gpointer) key);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), widget);
+ gtk_widget_show (widget);
+ return TRUE;
+}
+
Added: trunk/src/gpk-dialog.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-dialog.h Fri Jul 4 16:30:10 2008
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GPK_DIALOG_H
+#define __GPK_DIALOG_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <pk-package-list.h>
+
+G_BEGIN_DECLS
+
+gboolean gpk_dialog_embed_package_list_widget (GtkDialog *dialog,
+ PkPackageList *list);
+gboolean gpk_dialog_embed_do_not_show_widget (GtkDialog *dialog,
+ const gchar *key);
+gchar *gpk_dialog_package_id_name_join_locale (gchar **package_ids);
+
+G_END_DECLS
+
+#endif /* __GPK_DIALOG_H */
Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c (original)
+++ trunk/src/gpk-log.c Fri Jul 4 16:30:10 2008
@@ -121,6 +121,7 @@
gchar *text;
gchar *whole;
gchar **sections;
+ PkPackageId *id;
string = g_string_new ("");
size = g_strv_length (array);
@@ -128,9 +129,11 @@
sections = g_strsplit (array[i], "\t", 0);
info_local = pk_info_enum_from_text (sections[0]);
if (info_local == info) {
- text = gpk_package_id_format_oneline (sections[1], NULL);
+ id = pk_package_id_new_from_string (sections[1]);
+ text = gpk_package_id_format_oneline (id, NULL);
g_string_append_printf (string, "%s, ", text);
g_free (text);
+ pk_package_id_free (id);
}
g_strfreev (sections);
}
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Fri Jul 4 16:30:10 2008
@@ -150,6 +150,12 @@
}
gtk_widget_show (widget);
+ /* clear */
+ if (page == PAGE_DETAILS) {
+ widget = glade_xml_get_widget (glade_xml, "scrolledwindow_description");
+ gtk_widget_hide (widget);
+ }
+
widget = glade_xml_get_widget (glade_xml, "hbox_hidden");
list = gtk_container_get_children (GTK_CONTAINER (widget));
for (l=list, i=0; l; l=l->next, i++) {
@@ -445,6 +451,16 @@
{
GtkWidget *widget;
guint length;
+ const PkPackageObj *obj;
+ guint i;
+ guint num_low = 0;
+ guint num_normal = 0;
+ guint num_important = 0;
+ guint num_security = 0;
+ guint num_bugfix = 0;
+ guint num_enhancement = 0;
+ const gchar *icon;
+ gchar *text;
length = pk_package_list_get_size (list);
if (length == 0) {
@@ -452,16 +468,6 @@
widget = glade_xml_get_widget (glade_xml, "button_close3");
gtk_widget_grab_default (widget);
} else {
- const PkPackageObj *obj;
- guint i;
- guint num_low = 0;
- guint num_normal = 0;
- guint num_important = 0;
- guint num_security = 0;
- guint num_bugfix = 0;
- guint num_enhancement = 0;
- const gchar *icon;
- gchar *text;
for (i=0;i<length;i++) {
obj = pk_package_list_get_obj (list, i);
@@ -542,11 +548,15 @@
guint length;
guint i;
gchar *text;
+ gchar *package_id;
const gchar *icon_name;
gchar **package_ids;
GtkTreeIter iter;
gboolean ret;
+ /* spin */
+ gpk_update_viewer_description_animation_start ();
+
/* clear existing list */
gtk_list_store_clear (list_store_details);
@@ -572,16 +582,18 @@
for (i=0; i<length; i++) {
obj = pk_package_list_get_obj (list, i);
- text = gpk_package_id_format_twoline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_twoline (obj->id, obj->summary);
icon_name = gpk_info_enum_to_icon_name (obj->info);
gtk_list_store_append (list_store_details, &iter);
+ package_id = pk_package_id_to_string (obj->id);
gtk_list_store_set (list_store_details, &iter,
PACKAGES_COLUMN_TEXT, text,
- PACKAGES_COLUMN_ID, obj->package_id,
+ PACKAGES_COLUMN_ID, package_id,
PACKAGES_COLUMN_ICON, icon_name,
PACKAGES_COLUMN_INFO, obj->info,
PACKAGES_COLUMN_SELECT, TRUE,
-1);
+ g_free (package_id);
g_free (text);
}
@@ -612,6 +624,9 @@
goto out;
}
+ /* don't spin */
+ gpk_update_viewer_description_animation_stop ();
+
out:
g_object_unref (list);
}
@@ -633,14 +648,13 @@
* gpk_update_viewer_package_cb:
**/
static void
-gpk_update_viewer_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_id,
- const gchar *summary, gpointer data)
+gpk_update_viewer_package_cb (PkClient *client, const PkPackageObj *obj, gpointer data)
{
PkRoleEnum role;
pk_client_get_role (client, &role, NULL, NULL);
pk_debug ("role = %s, package = %s:%s:%s", pk_role_enum_to_text (role),
- pk_info_enum_to_text (info), package_id, summary);
+ pk_info_enum_to_text (obj->info), obj->id->name, obj->summary);
}
/**
@@ -726,6 +740,7 @@
gchar **package_ids;
gchar *pretty = NULL;
GString *string;
+ PkPackageId *id;
/* do we have any data? */
if (pk_strzero (package_ids_delimit)) {
@@ -736,7 +751,9 @@
package_ids = g_strsplit (package_ids_delimit, "^", 0);
length = g_strv_length (package_ids);
for (i=0; i<length; i++) {
- pretty = gpk_package_id_name_version (package_ids[i]);
+ id = pk_package_id_new_from_string (package_ids[i]);
+ pretty = gpk_package_id_name_version (id);
+ pk_package_id_free (id);
g_string_append (string, pretty);
g_string_append_c (string, '\n');
g_free (pretty);
@@ -755,10 +772,9 @@
* gpk_update_viewer_update_detail_cb:
**/
static void
-gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetailObj *detail, gpointer data)
+gpk_update_viewer_update_detail_cb (PkClient *client, const PkUpdateDetailObj *obj, gpointer data)
{
GtkWidget *widget;
- PkPackageId *ident;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter treeiter;
@@ -788,13 +804,13 @@
/* translators: this is the update type, e.g. security */
gpk_update_viewer_add_description_item (_("Type"), info_text, NULL);
- package_pretty = gpk_package_id_name_version (detail->package_id);
+ package_pretty = gpk_package_id_name_version (obj->id);
/* translators: this is the package version */
gpk_update_viewer_add_description_item (_("New version"), package_pretty, NULL);
g_free (package_pretty);
/* split and add */
- package_pretty = gpk_update_viewer_get_pretty_from_composite (detail->updates);
+ package_pretty = gpk_update_viewer_get_pretty_from_composite (obj->updates);
if (package_pretty != NULL) {
/* translators: this is a list of packages that are updated */
gpk_update_viewer_add_description_item (_("Updates"), package_pretty, NULL);
@@ -802,22 +818,20 @@
g_free (package_pretty);
/* split and add */
- package_pretty = gpk_update_viewer_get_pretty_from_composite (detail->obsoletes);
+ package_pretty = gpk_update_viewer_get_pretty_from_composite (obj->obsoletes);
if (package_pretty != NULL) {
/* translators: this is a list of packages that are obsoleted */
gpk_update_viewer_add_description_item (_("Obsoletes"), package_pretty, NULL);
}
g_free (package_pretty);
- ident = pk_package_id_new_from_string (detail->package_id);
/* translators: this is the repository the package has come from */
- gpk_update_viewer_add_description_item (_("Repository"), ident->data, NULL);
- pk_package_id_free (ident);
+ gpk_update_viewer_add_description_item (_("Repository"), obj->id->data, NULL);
- if (!pk_strzero (detail->update_text)) {
+ if (!pk_strzero (obj->update_text)) {
gchar *first;
gchar *second;
- first = pk_strreplace (detail->update_text, "\n- ", "\nâ ");
+ first = pk_strreplace (obj->update_text, "\n- ", "\nâ ");
second = pk_strreplace (first, "\n* ", "\nâ ");
/* translators: this is the package description */
gpk_update_viewer_add_description_item (_("Description"), second, NULL);
@@ -826,23 +840,23 @@
}
/* add all the links */
- if (!pk_strzero (detail->vendor_url)) {
+ if (!pk_strzero (obj->vendor_url)) {
/* translators: this is a list of vendor URLs */
- gpk_update_viewer_add_description_link_item (_("Vendor"), detail->vendor_url);
+ gpk_update_viewer_add_description_link_item (_("Vendor"), obj->vendor_url);
}
- if (!pk_strzero (detail->bugzilla_url)) {
+ if (!pk_strzero (obj->bugzilla_url)) {
/* translators: this is a list of bugzilla URLs */
- gpk_update_viewer_add_description_link_item (_("Bugzilla"), detail->bugzilla_url);
+ gpk_update_viewer_add_description_link_item (_("Bugzilla"), obj->bugzilla_url);
}
- if (!pk_strzero (detail->cve_url)) {
+ if (!pk_strzero (obj->cve_url)) {
/* translators: this is a list of CVE (security) URLs */
- gpk_update_viewer_add_description_link_item (_("CVE"), detail->cve_url);
+ gpk_update_viewer_add_description_link_item (_("CVE"), obj->cve_url);
}
/* reboot */
- if (detail->restart == PK_RESTART_ENUM_SESSION ||
- detail->restart == PK_RESTART_ENUM_SYSTEM) {
- info_text = gpk_restart_enum_to_localised_text (detail->restart);
+ if (obj->restart == PK_RESTART_ENUM_SESSION ||
+ obj->restart == PK_RESTART_ENUM_SYSTEM) {
+ info_text = gpk_restart_enum_to_localised_text (obj->restart);
/* translators: this is a notice a restart might be required */
gpk_update_viewer_add_description_item (_("Notice"), info_text, NULL);
}
@@ -1166,7 +1180,7 @@
for (i=0;i<length;i++) {
obj = pk_package_list_get_obj (list, i);
if (obj->info == PK_INFO_ENUM_BLOCKED) {
- text = gpk_package_id_format_oneline (obj->package_id, obj->summary);
+ text = gpk_package_id_format_oneline (obj->id, obj->summary);
g_string_append_printf (string, "%s\n", text);
g_free (text);
exists = TRUE;
@@ -1270,7 +1284,6 @@
{
/* set correct view */
gpk_update_viewer_set_page (PAGE_DETAILS);
-
gpk_update_viewer_get_new_update_list ();
}
Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c (original)
+++ trunk/src/gpk-watch.c Fri Jul 4 16:30:10 2008
@@ -532,7 +532,6 @@
static void
gpk_watch_show_about_cb (GtkMenuItem *item, gpointer data)
{
- static gboolean been_here = FALSE;
const char *authors[] = {
"Richard Hughes <richard hughsie com>",
NULL};
@@ -565,12 +564,8 @@
license_trans = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n",
_(license[2]), "\n\n", _(license[3]), "\n", NULL);
- /* FIXME: unnecessary with libgnomeui >= 2.16.0 */
- if (!been_here) {
- been_here = TRUE;
- gtk_about_dialog_set_url_hook (gpk_watch_about_dialog_url_cb, NULL, NULL);
- gtk_about_dialog_set_email_hook (gpk_watch_about_dialog_url_cb, "mailto:", NULL);
- }
+ gtk_about_dialog_set_url_hook (gpk_watch_about_dialog_url_cb, NULL, NULL);
+ gtk_about_dialog_set_email_hook (gpk_watch_about_dialog_url_cb, "mailto:", NULL);
gtk_window_set_default_icon_name ("system-software-installer");
gtk_show_about_dialog (NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]