gnome-packagekit r215 - in trunk: . data po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r215 - in trunk: . data po src
- Date: Fri, 6 Jun 2008 11:35:46 +0000 (UTC)
Author: rhughes
Date: Fri Jun 6 11:35:45 2008
New Revision: 215
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=215&view=rev
Log:
from git
Modified:
trunk/NEWS
trunk/configure.ac
trunk/data/gpk-application.glade
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-depends.h
trunk/src/gpk-client-eula.c
trunk/src/gpk-client-eula.h
trunk/src/gpk-client-requires.c
trunk/src/gpk-client-requires.h
trunk/src/gpk-client-resolve.c
trunk/src/gpk-client-resolve.h
trunk/src/gpk-client.c
trunk/src/gpk-client.h
trunk/src/gpk-common.c
trunk/src/gpk-repo.c
trunk/src/gpk-update-icon.c
trunk/src/gpk-update-viewer.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Fri Jun 6 11:35:45 2008
@@ -1,3 +1,50 @@
+Version 0.2.2
+~~~~~~~~~~~~~~
+Released: 2008-06-05
+
+* Translations
+ - Add Russian translation (Leonid Kanter)
+ - Updated Spanish translation (Daniel Mustieles)
+ - Updated Norwegian bokmÃl translation (Kjartan Maraas)
+ - Update polish translation (Wadim Dziedzic)
+ - Updated Hebrew translation (Yair Hershkovitz)
+ - Updated Finnish translation (Ville-Pekka Vainio)
+ - Updated Brazilian Portuguese translation (Igor Pires Soares)
+
+* New features:
+ - Add three new animated icons (Mike Langlie)
+ - Add installing icons and add into common code for the dialogs to use (Mike Langlie)
+ - Add a Unique GObject that can give single instance capability to the tools (Richard Hughes)
+ - Set the network proxy when we login or whenever the session proxy changes (Richard Hughes)
+ - Don't allow the GTK tools to be run as the root user (Richard Hughes)
+ - Add a simple GtkImage superclass to handle animation from tiles (Richard Hughes)
+ - Show an animated status icon in gpk-client - sometimes things just take too long (Richard Hughes)
+ - Allow users to install and remove multiple packages using gpk-application (Richard Hughes)
+ - Add a check in for malformed descriptions to fix rh#447347 (Richard Hughes)
+ - In GpkNotify use GtkClient rather than PkClient so we get the GPG callback to work (Richard Hughes)
+ - Replace all the usual tags with the bullet symbol in the update viewer (Richard Hughes)
+ - Only show the confirm page when we have succeeded to update packages (Richard Hughes)
+ - Make the update-viewer non-modal and resizable (Richard Hughes)
+ - Give the user a chance to update only the security updates. Fixes rh#448019 (Richard Hughes)
+ - Allow the user to run an application after it has been installed (Richard Hughes)
+
+* Bugfixes:
+ - Stop the animation when we are loading in a new tile to prevent a segfault (Richard Hughes)
+ - Make sure we set a valid error when we return in a failed or cancelled case (Richard Hughes)
+ - Only show the Package() results in if we are not refreshing the cache (Richard Hughes)
+ - Replace duplicate hotkey. Fixes rh#447970 (Richard Hughes)
+ - Don't show a huge maximised confirmation window when we've maximised the chooser (Richard Hughes)
+ - Support the new format ::UpdateDetail() obsoletes and updates (Richard Hughes)
+ - When we remove, we want to get the required packages, not the dependant ones (Richard Hughes)
+ - When GtkClient is waiting, we could potentially re-use the GpkClient object (Richard Hughes)
+ - Don't allow GetUpdates() to be called from two different callbacks (Richard Hughes)
+ - Fix the remove software 'Other software depends on...' window (Richard Hughes)
+ - Ignore cancellation errors in gpk-update-viewer (Richard Hughes)
+ - Don't make GTK sort the gpk-update-viewer list (Richard Hughes)
+ - Make the visited link status only mark the correct link as visited. Fixes rh#446739 (Richard Hughes)
+ - Make the gpk-client window resize (aka, jump around) less (Richard Hughes)
+ - Don't double up notifications. fixed rh#448116 (Richard Hughes)
+
Version 0.2.1
~~~~~~~~~~~~~~
Released: 2008-05-09
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Jun 6 11:35:45 2008
@@ -1,6 +1,6 @@
AC_PREREQ(2.52)
-AC_INIT(gnome-packagekit, 0.2.2)
+AC_INIT(gnome-packagekit, 0.2.3)
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
@@ -45,7 +45,7 @@
dnl ---------------------------------------------------------------------------
dnl - Library dependencies
dnl ---------------------------------------------------------------------------
-PACKAGEKIT_REQUIRED=0.2.0
+PACKAGEKIT_REQUIRED=0.2.2
GLIB_REQUIRED=2.14.0
GTK_REQUIRED=2.12.0
DBUS_REQUIRED=1.1.2
Modified: trunk/data/gpk-application.glade
==============================================================================
--- trunk/data/gpk-application.glade (original)
+++ trunk/data/gpk-application.glade Fri Jun 6 11:35:45 2008
@@ -349,7 +349,7 @@
<property name="stock_id">gtk-add</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
@@ -360,7 +360,7 @@
<property name="stock_id">gtk-clear</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
@@ -371,17 +371,13 @@
<property name="stock_id">gtk-edit</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="toolbutton2">
<property name="visible">True</property>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">False</property>
- </packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_install">
@@ -391,7 +387,7 @@
<property name="stock_id">gtk-floppy</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
@@ -402,17 +398,13 @@
<property name="stock_id">gtk-delete</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="toolbutton1">
<property name="visible">True</property>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">False</property>
- </packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_sources">
@@ -422,7 +414,7 @@
<property name="stock_id">gtk-cdrom</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
@@ -433,7 +425,7 @@
<property name="stock_id">gtk-refresh</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
</widget>
@@ -722,7 +714,7 @@
<child>
<widget class="GtkLabel" id="label_source_text">
<property name="visible">True</property>
- <property name="label" translatable="yes">Software source:</property>
+ <property name="label" translatable="yes">Source:</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -753,7 +745,7 @@
<child>
<widget class="GtkLabel" id="label_filesize_text">
<property name="visible">True</property>
- <property name="label" translatable="yes">Package size:</property>
+ <property name="label">Package size:</property>
</widget>
<packing>
<property name="expand">False</property>
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Fri Jun 6 11:35:45 2008
@@ -48,4 +48,5 @@
src/gpk-client-signature.c
src/gpk-client-untrusted.c
src/gpk-client-chooser.c
+src/gpk-client-run.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Fri Jun 6 11:35:45 2008
@@ -71,6 +71,8 @@
gpk-client-untrusted.h \
gpk-client-chooser.c \
gpk-client-chooser.h \
+ gpk-client-run.c \
+ gpk-client-run.h \
gpk-smart-icon.c \
gpk-smart-icon.h \
gpk-gnome.c \
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Fri Jun 6 11:35:45 2008
@@ -49,6 +49,7 @@
#include "gpk-application.h"
#include "gpk-animated-icon.h"
+#include <gpk-client-run.h>
static void gpk_application_class_init (GpkApplicationClass *klass);
static void gpk_application_init (GpkApplication *application);
@@ -336,12 +337,23 @@
/* if non-zero, set the size */
if (size > 0) {
gchar *value;
- widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
- gtk_widget_show (widget);
+
+ /* change the label */
+ widget = glade_xml_get_widget (application->priv->glade_xml, "label_filesize_text");
+ if (installed) {
+ gtk_label_set_label (GTK_LABEL (widget), _("Installed size:"));
+ } else {
+ gtk_label_set_label (GTK_LABEL (widget), _("Download size:"));
+ }
+
+ /* set the size */
widget = glade_xml_get_widget (application->priv->glade_xml, "label_filesize");
value = gpk_size_to_si_size_text (size);
gtk_label_set_label (GTK_LABEL (widget), value);
g_free (value);
+
+ widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
+ gtk_widget_show (widget);
} else {
widget = glade_xml_get_widget (application->priv->glade_xml, "hbox_filesize");
gtk_widget_hide (widget);
@@ -566,29 +578,36 @@
* gpk_application_package_buffer_to_name_version:
**/
static gchar *
-gpk_application_package_buffer_to_name_version (PkClient *client)
+gpk_application_package_buffer_to_name_version (PkPackageList *list)
{
guint i;
PkPackageItem *item;
gchar *text_pretty;
guint length;
GString *string;
+ gchar *text;
- length = pk_client_package_buffer_get_size (client);
+ /* sort the list */
+ pk_package_list_sort (list);
+
+ length = pk_package_list_get_size (list);
if (length == 0) {
- return g_strdup ("No packages");
+ text = g_strdup ("No packages");
+ goto out;
}
string = g_string_new ("");
for (i=0; i<length; i++) {
- item = pk_client_package_buffer_get_item (client, i);
+ item = pk_package_list_get_item (list, i);
/* just use the name */
text_pretty = gpk_package_id_name_version (item->package_id);
g_string_append_printf (string, "%s\n", text_pretty);
g_free (text_pretty);
}
g_string_set_size (string, string->len - 1);
- return g_string_free (string, FALSE);
+ text = g_string_free (string, FALSE);
+out:
+ return text;
}
/**
@@ -632,6 +651,7 @@
GtkWidget *widget;
PkRoleEnum role;
gchar *text;
+ PkPackageList *list;
g_return_if_fail (PK_IS_APPLICATION (application));
@@ -639,12 +659,16 @@
pk_client_get_role (client, &role, NULL, NULL);
/* do we need to fill in the tab box? */
if (role == PK_ROLE_ENUM_GET_DEPENDS) {
- text = gpk_application_package_buffer_to_name_version (client);
+ list = pk_client_get_package_list (client);
+ text = gpk_application_package_buffer_to_name_version (list);
+ g_object_unref (list);
widget = glade_xml_get_widget (application->priv->glade_xml, "textview_depends");
gpk_application_set_text_buffer (widget, text);
g_free (text);
} else if (role == PK_ROLE_ENUM_GET_REQUIRES) {
- text = gpk_application_package_buffer_to_name_version (client);
+ list = pk_client_get_package_list (client);
+ text = gpk_application_package_buffer_to_name_version (list);
+ g_object_unref (list);
widget = glade_xml_get_widget (application->priv->glade_xml, "textview_requires");
gpk_application_set_text_buffer (widget, text);
g_free (text);
@@ -1212,13 +1236,27 @@
gpk_application_button_install_remove_cb (GtkWidget *widget, GpkApplication *application)
{
gboolean ret = FALSE;
+ GError *error = NULL;
gchar **package_ids = NULL;
+ gchar *exec;
g_return_if_fail (PK_IS_APPLICATION (application));
package_ids = pk_ptr_array_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? */
+ if (ret) {
+ exec = gpk_client_run_show (package_ids);
+ if (exec != NULL) {
+ ret = g_spawn_command_line_async (exec, &error);
+ if (!ret) {
+ pk_warning ("failed to run: %s", error->message);
+ g_error_free (error);
+ }
+ }
+ g_free (exec);
+ }
}
if (application->priv->action == PK_ACTION_REMOVE) {
ret = gpk_client_remove_package_ids (application->priv->gclient, package_ids, NULL);
@@ -1366,10 +1404,6 @@
widget = glade_xml_get_widget (application->priv->glade_xml, "textview_description");
gpk_application_set_text_buffer (widget, NULL);
- /* hide the homepage button until we get data */
- widget = glade_xml_get_widget (application->priv->glade_xml, "button_homepage");
- gtk_widget_hide (widget);
-
/* cancel any previous request */
ret = pk_client_reset (application->priv->client_details, &error);
if (!ret) {
Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c (original)
+++ trunk/src/gpk-check-update.c Fri Jun 6 11:35:45 2008
@@ -73,6 +73,7 @@
GConfClient *gconf_client;
gboolean cache_okay;
gboolean cache_update_in_progress;
+ gboolean get_updates_in_progress;
NotifyNotification *notification_updates_available;
GPtrArray *important_updates_array;
};
@@ -655,7 +656,15 @@
g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), FALSE);
- if (pk_task_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
+ /* are we already called */
+ if (cupdate->priv->get_updates_in_progress) {
+ pk_debug ("GetUpdate already in progress");
+ return FALSE;
+ }
+
+ /* No point if we are already updating */
+ if (pk_task_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_PACKAGES) ||
+ pk_task_list_contains_role (cupdate->priv->tlist, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
pk_debug ("Not checking for updates as already in progress");
return FALSE;
}
@@ -663,7 +672,9 @@
/* get updates */
gpk_client_show_finished (cupdate->priv->gclient, FALSE);
gpk_client_show_progress (cupdate->priv->gclient, FALSE);
+ cupdate->priv->get_updates_in_progress = TRUE;
list = gpk_client_get_updates (cupdate->priv->gclient, &error);
+ cupdate->priv->get_updates_in_progress = FALSE;
if (list == NULL) {
pk_warning ("failed to get updates: %s", error->message);
g_error_free (error);
@@ -758,9 +769,6 @@
if (!ret) {
pk_warning ("Individual updates failed: %s", error->message);
g_error_free (error);
-
- /* we failed, so re-get the update list */
- gpk_check_update_query_updates (cupdate);
}
g_strfreev (package_ids);
goto out;
@@ -796,7 +804,11 @@
/* now try to get newest update list */
pk_debug ("updates changed");
- g_idle_add ((GSourceFunc) gpk_check_update_query_updates, cupdate);
+
+ /* ignore our own updates */
+ if (cupdate->priv->get_updates_in_progress) {
+ g_idle_add ((GSourceFunc) gpk_check_update_query_updates, cupdate);
+ }
}
/**
@@ -890,9 +902,7 @@
{
g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
- /* show the icon at login time
- * hopefully it just needs a quick network access, else we may have to
- * make it a gconf variable */
+ /* show the icon at login time */
gpk_check_update_query_updates (cupdate);
}
@@ -955,6 +965,7 @@
/* refresh the cache, and poll until we get a good refresh */
cupdate->priv->cache_okay = FALSE;
cupdate->priv->cache_update_in_progress = FALSE;
+ cupdate->priv->get_updates_in_progress = FALSE;
}
/**
Modified: trunk/src/gpk-client-chooser.c
==============================================================================
--- trunk/src/gpk-client-chooser.c (original)
+++ trunk/src/gpk-client-chooser.c Fri Jun 6 11:35:45 2008
@@ -166,7 +166,7 @@
* Return value: the package_id of the selected package, or NULL
**/
gchar *
-gpk_client_chooser_show (PkClient *results, PkRoleEnum role, const gchar *title)
+gpk_client_chooser_show (GtkWindow *window, PkPackageList *list, PkRoleEnum role, const gchar *title)
{
GladeXML *glade_xml;
GtkWidget *widget;
@@ -178,7 +178,7 @@
guint len;
guint i;
- g_return_val_if_fail (results != NULL, FALSE);
+ g_return_val_if_fail (list != NULL, FALSE);
g_return_val_if_fail (title != NULL, FALSE);
/* we have to do this before we connect up the glade file */
@@ -205,6 +205,11 @@
gtk_window_set_icon_name (GTK_WINDOW (widget), "system-software-installer");
gtk_window_set_title (GTK_WINDOW (widget), title);
+ /* make modal if window set */
+ if (window != NULL) {
+ gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+ }
+
/* connect up PolicyKit actions */
g_signal_connect (button_action, "activate", G_CALLBACK (gpk_client_chooser_button_action_cb), NULL);
@@ -226,9 +231,9 @@
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
/* see what we've got already */
- len = pk_client_package_buffer_get_size (results);
+ len = pk_package_list_get_size (list);
for (i=0; i<len; i++) {
- item = pk_client_package_buffer_get_item (results, i);
+ item = pk_package_list_get_item (list, i);
pk_debug ("package '%s' got:", item->package_id);
/* put formatted text into treeview */
Modified: trunk/src/gpk-client-chooser.h
==============================================================================
--- trunk/src/gpk-client-chooser.h (original)
+++ trunk/src/gpk-client-chooser.h Fri Jun 6 11:35:45 2008
@@ -28,7 +28,8 @@
G_BEGIN_DECLS
void gpk_client_chooser_self_test (gpointer data);
-gchar *gpk_client_chooser_show (PkClient *results,
+gchar *gpk_client_chooser_show (GtkWindow *window,
+ PkPackageList *list,
PkRoleEnum role,
const gchar *title);
Modified: trunk/src/gpk-client-depends.c
==============================================================================
--- trunk/src/gpk-client-depends.c (original)
+++ trunk/src/gpk-client-depends.c Fri Jun 6 11:35:45 2008
@@ -53,18 +53,16 @@
}
static gboolean
-gpk_client_depends_indervidual (PkPackageList *list, const gchar *package_id)
+gpk_client_depends_indervidual (GtkWindow *window, PkPackageList *list_ret, const gchar *package_id)
{
GError *error = NULL;
- PkPackageItem *item;
+ PkPackageList *list;
gboolean ret;
- guint len;
- guint i;
/* reset */
ret = pk_client_reset (client, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to reset client"), NULL, error->message);
+ gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
g_error_free (error);
return FALSE;
}
@@ -72,25 +70,17 @@
/* find out if this would drag in other packages */
ret = pk_client_get_depends (client, PK_FILTER_ENUM_NOT_INSTALLED, package_id, TRUE, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to get depends"),
- _("Could not work out what packages would be also installed"),
- error->message);
+ gpk_error_dialog_modal (window, _("Failed to get depends"),
+ _("Could not work out what packages would be also installed"),
+ error->message);
g_error_free (error);
return FALSE;
}
- /* no additional packages? */
- len = pk_client_package_buffer_get_size (client);
- if (len == 0) {
- pk_debug ("no additional deps");
- return TRUE;
- }
-
- /* process package list */
- for (i=0; i<len; i++) {
- item = pk_client_package_buffer_get_item (client, i);
- pk_package_list_add (list, item->info, item->package_id, item->summary);
- }
+ /* add additional packages */
+ list = pk_client_get_package_list (client);
+ pk_package_list_add_list (list_ret, list);
+ g_object_unref (list);
return TRUE;
}
@@ -100,7 +90,7 @@
* Return value: if we agreed to remove the deps
**/
gboolean
-gpk_client_depends_show (gchar **package_ids)
+gpk_client_depends_show (GtkWindow *window, gchar **package_ids)
{
GtkWidget *widget;
GtkWidget *dialog;
@@ -130,7 +120,7 @@
length = g_strv_length (package_ids);
for (i=0; i<length; i++) {
- ret = gpk_client_depends_indervidual (list, package_ids[i]);
+ ret = gpk_client_depends_indervidual (window, list, package_ids[i]);
if (!ret) {
ret = FALSE;
goto out;
@@ -158,7 +148,7 @@
text = g_string_free (string, FALSE);
/* show UI */
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ 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 */
Modified: trunk/src/gpk-client-depends.h
==============================================================================
--- trunk/src/gpk-client-depends.h (original)
+++ trunk/src/gpk-client-depends.h Fri Jun 6 11:35:45 2008
@@ -27,7 +27,8 @@
G_BEGIN_DECLS
void gpk_client_depends_self_test (gpointer data);
-gboolean gpk_client_depends_show (gchar **package_ids);
+gboolean gpk_client_depends_show (GtkWindow *window,
+ gchar **package_ids);
G_END_DECLS
Modified: trunk/src/gpk-client-eula.c
==============================================================================
--- trunk/src/gpk-client-eula.c (original)
+++ trunk/src/gpk-client-eula.c Fri Jun 6 11:35:45 2008
@@ -60,7 +60,7 @@
* TODO: Add in gconf checks to see if we've already agreed
**/
gboolean
-gpk_client_eula_show (const gchar *eula_id, const gchar *package_id,
+gpk_client_eula_show (GtkWindow *window, const gchar *eula_id, const gchar *package_id,
const gchar *vendor_name, const gchar *license_agreement)
{
GladeXML *glade_xml;
@@ -108,8 +108,13 @@
/* set minimum size a bit bigger */
gtk_widget_set_size_request (widget, 100, 200);
- /* show window */
+ /* make modal if window set */
widget = glade_xml_get_widget (glade_xml, "window_eula");
+ if (window != NULL) {
+ gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+ }
+
+ /* show window */
gtk_widget_show (widget);
/* wait for button press */
Modified: trunk/src/gpk-client-eula.h
==============================================================================
--- trunk/src/gpk-client-eula.h (original)
+++ trunk/src/gpk-client-eula.h Fri Jun 6 11:35:45 2008
@@ -28,7 +28,8 @@
G_BEGIN_DECLS
void gpk_client_eula_self_test (gpointer data);
-gboolean gpk_client_eula_show (const gchar *eula_id,
+gboolean gpk_client_eula_show (GtkWindow *window,
+ const gchar *eula_id,
const gchar *package_id,
const gchar *vendor_name,
const gchar *license_agreement);
Modified: trunk/src/gpk-client-requires.c
==============================================================================
--- trunk/src/gpk-client-requires.c (original)
+++ trunk/src/gpk-client-requires.c Fri Jun 6 11:35:45 2008
@@ -38,18 +38,16 @@
static PkClient *client = NULL;
static gboolean
-gpk_client_requires_indervidual (PkPackageList *list, const gchar *package_id)
+gpk_client_requires_indervidual (GtkWindow *window, PkPackageList *list_ret, const gchar *package_id)
{
GError *error = NULL;
- PkPackageItem *item;
+ PkPackageList *list;
gboolean ret;
- guint len;
- guint i;
/* reset */
ret = pk_client_reset (client, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to reset client"), NULL, error->message);
+ gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
g_error_free (error);
return FALSE;
}
@@ -57,25 +55,17 @@
/* find out if this would force removal of other packages */
ret = pk_client_get_requires (client, PK_FILTER_ENUM_INSTALLED, package_id, TRUE, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to get requires"),
- _("Could not work out what packages would also be removed"),
- error->message);
+ gpk_error_dialog_modal (window, _("Failed to get requires"),
+ _("Could not work out what packages would also be removed"),
+ error->message);
g_error_free (error);
return FALSE;
}
- /* no additional packages? */
- len = pk_client_package_buffer_get_size (client);
- if (len == 0) {
- pk_debug ("no requires");
- return TRUE;
- }
+ list = pk_client_get_package_list (client);
+ pk_package_list_add_list (list_ret, list);
+ g_object_unref (list);
- /* process package list */
- for (i=0; i<len; i++) {
- item = pk_client_package_buffer_get_item (client, i);
- pk_package_list_add (list, item->info, item->package_id, item->summary);
- }
return TRUE;
}
@@ -85,7 +75,7 @@
* Return value: if we agreed to remove the deps
**/
gboolean
-gpk_client_requires_show (gchar **package_ids)
+gpk_client_requires_show (GtkWindow *window, gchar **package_ids)
{
GtkWidget *dialog;
GtkResponseType button;
@@ -96,6 +86,7 @@
GString *string;
PkPackageItem *item;
gchar *text;
+ gchar *name;
list = pk_package_list_new ();
@@ -105,13 +96,16 @@
length = g_strv_length (package_ids);
for (i=0; i<length; i++) {
- ret = gpk_client_requires_indervidual (list, package_ids[i]);
+ ret = gpk_client_requires_indervidual (window, list, package_ids[i]);
if (!ret) {
ret = FALSE;
goto out;
}
}
+ /* 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");
@@ -129,21 +123,22 @@
/* remove last \n */
g_string_set_size (string, string->len - 1);
- /* display messagebox */
- text = g_string_free (string, FALSE);
-
/* show UI */
if (g_strv_length (package_ids) == 1) {
- text = g_strdup_printf (_("%i other packages depends on %s"), length, package_ids[0]);
+ name = gpk_package_id_name_version (package_ids[0]);
+ text = g_strdup_printf (_("%i other packages depends on %s"), length, name);
+ g_free (name);
} else {
text = g_strdup_printf (_("%i other packages depends on these packages"), length);
}
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ 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);
button = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -171,7 +166,7 @@
{
LibSelfTest *test = (LibSelfTest *) data;
- if (libst_start (test, "GpkClientDepends", CLASS_AUTO) == FALSE) {
+ if (libst_start (test, "GpkClientRequires", CLASS_AUTO) == FALSE) {
return;
}
libst_end (test);
Modified: trunk/src/gpk-client-requires.h
==============================================================================
--- trunk/src/gpk-client-requires.h (original)
+++ trunk/src/gpk-client-requires.h Fri Jun 6 11:35:45 2008
@@ -27,7 +27,8 @@
G_BEGIN_DECLS
void gpk_client_requires_self_test (gpointer data);
-gboolean gpk_client_requires_show (gchar **package_ids);
+gboolean gpk_client_requires_show (GtkWindow *window,
+ gchar **package_ids);
G_END_DECLS
Modified: trunk/src/gpk-client-resolve.c
==============================================================================
--- trunk/src/gpk-client-resolve.c (original)
+++ trunk/src/gpk-client-resolve.c Fri Jun 6 11:35:45 2008
@@ -38,10 +38,11 @@
static PkClient *client = NULL;
static gchar *
-gpk_client_resolve_indervidual (const gchar *package)
+gpk_client_resolve_indervidual (GtkWindow *window, const gchar *package)
{
GError *error = NULL;
PkPackageItem *item;
+ PkPackageList *list;
gchar *package_id = NULL;
gboolean already_installed = FALSE;
gboolean ret;
@@ -52,7 +53,7 @@
/* reset */
ret = pk_client_reset (client, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to reset client"), NULL, error->message);
+ gpk_error_dialog_modal (window, _("Failed to reset client"), NULL, error->message);
g_error_free (error);
goto out;
}
@@ -60,7 +61,7 @@
/* find out if we can find a package */
ret = pk_client_resolve (client, PK_FILTER_ENUM_NONE, package, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to resolve package"),
+ gpk_error_dialog_modal (window, _("Failed to resolve package"),
_("Incorrect response from search"),
error->message);
g_error_free (error);
@@ -68,17 +69,18 @@
}
/* found nothing? */
- len = pk_client_package_buffer_get_size (client);
+ list = pk_client_get_package_list (client);
+ len = pk_package_list_get_size (list);
if (len == 0) {
title = g_strdup_printf (_("Could not find %s"), package);
- gpk_error_dialog (title, _("The package could not be found in any software sources"), NULL);
+ gpk_error_dialog_modal (window, title, _("The package could not be found in any software sources"), NULL);
g_free (title);
goto out;
}
/* see what we've got already */
for (i=0; i<len; i++) {
- item = pk_client_package_buffer_get_item (client, i);
+ item = pk_package_list_get_item (list, i);
if (item->info == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
} else if (item->info == PK_INFO_ENUM_AVAILABLE) {
@@ -91,18 +93,19 @@
package_id = g_strdup (item->package_id);
}
}
+ g_object_unref (list);
/* already installed? */
if (already_installed) {
title = g_strdup_printf (_("Failed to install %s"), package);
- gpk_error_dialog (title, _("The package is already installed"), NULL);
+ gpk_error_dialog_modal (window, title, _("The package is already installed"), NULL);
g_free (title);
goto out;
}
/* got junk? */
if (package_id == NULL) {
- gpk_error_dialog (_("Failed to find package"), _("Incorrect response from search"), NULL);
+ gpk_error_dialog_modal (window, _("Failed to find package"), _("Incorrect response from search"), NULL);
goto out;
}
out:
@@ -115,7 +118,7 @@
* Return value: if we agreed to remove the deps
**/
gchar **
-gpk_client_resolve_show (gchar **packages)
+gpk_client_resolve_show (GtkWindow *window, gchar **packages)
{
guint i;
guint length;
@@ -130,7 +133,7 @@
length = g_strv_length (packages);
for (i=0; i<length; i++) {
- package_id = gpk_client_resolve_indervidual (packages[i]);
+ package_id = gpk_client_resolve_indervidual (window, packages[i]);
if (package_id == NULL) {
goto out;
}
Modified: trunk/src/gpk-client-resolve.h
==============================================================================
--- trunk/src/gpk-client-resolve.h (original)
+++ trunk/src/gpk-client-resolve.h Fri Jun 6 11:35:45 2008
@@ -27,7 +27,8 @@
G_BEGIN_DECLS
void gpk_client_resolve_self_test (gpointer data);
-gchar **gpk_client_resolve_show (gchar **packages);
+gchar **gpk_client_resolve_show (GtkWindow *window,
+ gchar **packages);
G_END_DECLS
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Fri Jun 6 11:35:45 2008
@@ -85,6 +85,8 @@
gboolean show_finished;
gboolean show_progress;
gboolean show_progress_files;
+ gboolean gtk_main_waiting;
+ gchar **files_array;
PkExitEnum exit;
};
@@ -302,6 +304,7 @@
guint i;
guint length;
PkPackageId *ident;
+ PkPackageList *list;
PkPackageItem *item;
GString *message_text;
guint skipped_number = 0;
@@ -310,7 +313,8 @@
g_return_if_fail (GPK_IS_CLIENT (gclient));
/* check we got some packages */
- length = pk_client_package_buffer_get_size (client);
+ list = pk_client_get_package_list (client);
+ length = pk_package_list_get_size (list);
pk_debug ("length=%i", length);
if (length == 0) {
pk_debug ("no updates");
@@ -321,7 +325,7 @@
/* find any we skipped */
for (i=0; i<length; i++) {
- item = pk_client_package_buffer_get_item (client, i);
+ item = pk_package_list_get_item (list, i);
pk_debug ("%s, %s, %s", pk_info_enum_to_text (item->info),
item->package_id, item->summary);
ident = pk_package_id_new_from_string (item->package_id);
@@ -332,6 +336,7 @@
}
pk_package_id_free (ident);
}
+ g_object_unref (list);
/* notify the user if there were skipped entries */
if (skipped_number > 0) {
@@ -522,6 +527,7 @@
const gchar *title;
const gchar *message;
NotifyNotification *notification;
+ GtkWidget *widget;
g_return_if_fail (GPK_IS_CLIENT (gclient));
@@ -556,7 +562,8 @@
title = gpk_error_enum_to_localised_text (code);
message = gpk_error_enum_to_localised_message (code);
if (gclient->priv->show_progress) {
- gpk_error_dialog (title, message, details);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), title, message, details);
return;
}
@@ -596,6 +603,29 @@
}
/**
+ * gpk_client_files_cb:
+ **/
+static void
+gpk_client_files_cb (PkClient *client, const gchar *package_id,
+ const gchar *filelist, GpkClient *gclient)
+{
+ g_return_if_fail (GPK_IS_CLIENT (gclient));
+
+ /* free old array and set new */
+ g_strfreev (gclient->priv->files_array);
+
+ /* no data, eugh */
+ if (pk_strzero (filelist)) {
+ gclient->priv->files_array = NULL;
+ return;
+ }
+
+ /* set new */
+ g_strfreev (gclient->priv->files_array);
+ gclient->priv->files_array = g_strsplit (filelist, ";", 0);
+}
+
+/**
* gpk_client_allow_cancel_cb:
**/
static void
@@ -701,6 +731,12 @@
guint length;
const gchar *title;
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
if (!ret) {
@@ -763,14 +799,21 @@
/* clear status and progress text */
widget = glade_xml_get_widget (gclient->priv->glade_xml, "progress_part_label");
+ gtk_label_set_label (GTK_LABEL (widget), "The Linux kernel (the Linux operating system)");
+ gtk_widget_show (widget);
+
+ /* set the correct width of the label to stop the window jumping around */
+ gtk_widget_size_request (widget, &requisition);
+ gtk_widget_set_size_request (widget, requisition.width * 1.1f, requisition.height);
gtk_label_set_label (GTK_LABEL (widget), "");
+
widget = glade_xml_get_widget (gclient->priv->glade_xml, "label_package");
gtk_label_set_label (GTK_LABEL (widget), "The Linux kernel (the core of the Linux operating system)\n\n\n");
gtk_widget_show (widget);
/* set the correct height of the label to stop the window jumping around */
gtk_widget_size_request (widget, &requisition);
- gtk_widget_set_size_request (widget, requisition.width * 1.1f, requisition.height);
+ gtk_widget_set_size_request (widget, requisition.width, requisition.height);
gtk_label_set_label (GTK_LABEL (widget), "");
return TRUE;
@@ -805,6 +848,24 @@
}
/**
+ * gpk_client_set_progress_files:
+ **/
+static void
+gpk_client_set_progress_files (GpkClient *gclient, gboolean enabled)
+{
+ GtkWidget *widget;
+
+ /* if we're never going to show it, hide the allocation */
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "label_package");
+ if (!enabled) {
+ gtk_widget_hide (widget);
+ } else {
+ gtk_widget_show (widget);
+ }
+ gclient->priv->show_progress_files = enabled;
+}
+
+/**
* gpk_client_install_local_file:
* @gclient: a valid #GpkClient instance
* @file_rel: a file such as <literal>./hal-devel-0.10.0.rpm</literal>
@@ -866,11 +927,13 @@
gpk_client_setup_window (gclient, _("Install local file"));
/* setup the UI */
- gclient->priv->show_progress_files = TRUE;
+ gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* do we need to try again with better auth? */
if (gclient->priv->retry_untrusted_value) {
@@ -879,7 +942,9 @@
goto out;
}
/* wait again */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
}
/* fail the transaction and set the correct error */
@@ -905,10 +970,17 @@
gboolean ret;
GError *error_local = NULL;
gchar *text = NULL;
+ GtkWidget *widget;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
g_return_val_if_fail (package_ids != NULL, FALSE);
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* set title */
gpk_client_setup_window (gclient, _("Remove packages"));
@@ -918,7 +990,8 @@
goto skip_checks;
}
- ret = gpk_client_depends_show (package_ids);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ ret = gpk_client_requires_show (GTK_WINDOW (widget), package_ids);
/* did we click no or exit the window? */
if (!ret) {
gpk_client_error_msg (gclient, _("Failed to remove package"), _("Additional packages were also not removed"), NULL);
@@ -956,11 +1029,13 @@
}
/* setup the UI */
- gclient->priv->show_progress_files = TRUE;
+ gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -985,15 +1060,22 @@
gboolean ret;
GError *error_local = NULL;
gchar *text;
+ GtkWidget *widget;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
g_return_val_if_fail (package_ids != NULL, FALSE);
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* set title */
gpk_client_setup_window (gclient, _("Install packages"));
/* setup the UI */
- gclient->priv->show_progress_files = TRUE;
+ gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* are we dumb and can't check for depends? */
@@ -1002,7 +1084,8 @@
goto skip_checks;
}
- ret = gpk_client_depends_show (package_ids);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ ret = gpk_client_depends_show (GTK_WINDOW (widget), package_ids);
/* did we click no or exit the window? */
if (!ret) {
gpk_client_error_msg (gclient, _("Failed to install package"), _("Additional packages were not downloaded"), NULL);
@@ -1040,7 +1123,9 @@
}
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1067,12 +1152,14 @@
gboolean ret;
GError *error_local = NULL;
gchar **package_ids = NULL;
+ GtkWidget *widget;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
g_return_val_if_fail (packages != NULL, FALSE);
/* resolve a 2D array to package_id's */
- package_ids = gpk_client_resolve_show (packages);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ package_ids = gpk_client_resolve_show (GTK_WINDOW (widget), packages);
if (package_ids == NULL) {
ret = FALSE;
goto out;
@@ -1113,6 +1200,7 @@
guint i;
gboolean already_installed = FALSE;
gchar *package_id = NULL;
+ PkPackageList *list = NULL;
PkPackageItem *item;
PkPackageId *ident;
gchar **package_ids = NULL;
@@ -1132,7 +1220,8 @@
}
/* found nothing? */
- len = pk_client_package_buffer_get_size (gclient->priv->client_resolve);
+ list = pk_client_get_package_list (gclient->priv->client_resolve);
+ len = pk_package_list_get_size (list);
if (len == 0) {
gpk_client_error_msg (gclient, _("Failed to find package"), _("The file could not be found in any packages"), NULL);
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, NULL);
@@ -1142,7 +1231,7 @@
/* see what we've got already */
for (i=0; i<len; i++) {
- item = pk_client_package_buffer_get_item (gclient->priv->client_resolve, i);
+ item = pk_package_list_get_item (list, i);
if (item->info == PK_INFO_ENUM_INSTALLED) {
already_installed = TRUE;
g_free (package_id);
@@ -1178,6 +1267,9 @@
package_ids = g_strsplit (package_id, "|", 1);
ret = gpk_client_install_package_ids (gclient, package_ids, error);
out:
+ if (list != NULL) {
+ g_object_unref (list);
+ }
g_strfreev (package_ids);
g_free (package_id);
return ret;
@@ -1197,10 +1289,12 @@
gpk_client_install_mime_type (GpkClient *gclient, const gchar *mime_type, GError **error)
{
gboolean ret;
+ PkPackageList *list = NULL;
GError *error_local = NULL;
gchar *package_id = NULL;
gchar **package_ids = NULL;
guint len;
+ GtkWidget *widget;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
@@ -1215,7 +1309,8 @@
}
/* found nothing? */
- len = pk_client_package_buffer_get_size (gclient->priv->client_resolve);
+ list = pk_client_get_package_list (gclient->priv->client_resolve);
+ len = pk_package_list_get_size (list);
if (len == 0) {
gpk_client_error_msg (gclient, _("Failed to find software"),
_("No new applications can be found to handle this type of file"), NULL);
@@ -1225,7 +1320,8 @@
}
/* populate a chooser */
- package_id = gpk_client_chooser_show (gclient->priv->client_resolve, 0, _("Applications that can open this type of file"));
+ 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"));
/* selected nothing */
if (package_id == NULL) {
@@ -1239,6 +1335,9 @@
package_ids = g_strsplit (package_id, "|", 1);
ret = gpk_client_install_package_ids (gclient, package_ids, error);
out:
+ if (list != NULL) {
+ g_object_unref (list);
+ }
g_strfreev (package_ids);
g_free (package_id);
return ret;
@@ -1258,6 +1357,12 @@
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
if (!ret) {
@@ -1287,7 +1392,7 @@
}
/* setup the UI */
- gclient->priv->show_progress_files = TRUE;
+ gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* if we are not showing UI, then notify the user what we are doing (just on the active terminal) */
@@ -1311,7 +1416,9 @@
}
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1338,6 +1445,12 @@
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
if (!ret) {
@@ -1367,11 +1480,13 @@
}
/* setup the UI */
- gclient->priv->show_progress_files = FALSE;
+ gpk_client_set_progress_files (gclient, FALSE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1394,12 +1509,15 @@
gboolean ret;
GError *error_local = NULL;
PkPackageList *list = NULL;
- PkPackageItem *item;
- guint length;
- guint i;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
if (!ret) {
@@ -1421,24 +1539,79 @@
}
/* setup the UI */
- gclient->priv->show_progress_files = FALSE;
+ gpk_client_set_progress_files (gclient, FALSE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* copy from client to local */
- list = pk_package_list_new ();
- length = pk_client_package_buffer_get_size (gclient->priv->client_action);
- for (i=0;i<length;i++) {
- item = pk_client_package_buffer_get_item (gclient->priv->client_action, i);
- pk_package_list_add (list, item->info, item->package_id, item->summary);
- }
+ list = pk_client_get_package_list (gclient->priv->client_action);
out:
return list;
}
/**
+ * gpk_client_get_file_list:
+ **/
+gchar **
+gpk_client_get_file_list (GpkClient *gclient, const gchar *package_id, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+
+ g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
+ /* reset */
+ ret = pk_client_reset (gclient->priv->client_action, &error_local);
+ if (!ret) {
+ gpk_client_error_msg (gclient, _("Failed to reset client"), _("Failed to reset get-file-list"), error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ g_error_free (error_local);
+ return FALSE;
+ }
+
+ /* set title */
+ gpk_client_setup_window (gclient, _("Getting file lists"));
+
+ /* wrap get files */
+ ret = pk_client_get_files (gclient->priv->client_action, package_id, &error_local);
+ if (!ret) {
+ gpk_client_error_msg (gclient, _("Getting file list failed"), _("Failed to get file list"), error_local->message);
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, error_local->message);
+ goto out;
+ }
+
+ /* setup the UI */
+ gpk_client_set_progress_files (gclient, FALSE);
+ gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
+
+ /* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
+ gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
+
+ /* fail the transaction and set the correct error */
+ ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
+
+out:
+ if (error_local != NULL) {
+ g_error_free (error_local);
+ }
+
+ /* return the file list */
+ return gclient->priv->files_array;
+}
+
+/**
* gpk_client_update_packages:
**/
gboolean
@@ -1451,6 +1624,12 @@
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
+ /* check if we are already waiting */
+ if (gclient->priv->gtk_main_waiting) {
+ gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Already waiting on this GpkClient");
+ return FALSE;
+ }
+
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
if (!ret) {
@@ -1480,11 +1659,13 @@
}
/* setup the UI */
- gclient->priv->show_progress_files = TRUE;
+ gpk_client_set_progress_files (gclient, TRUE);
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
/* fail the transaction and set the correct error */
ret = gpk_client_set_error_from_exit_enum (gclient->priv->exit, error);
@@ -1509,6 +1690,7 @@
{
gboolean ret;
GError *error = NULL;
+ GtkWidget *widget;
g_return_if_fail (GPK_IS_CLIENT (gclient));
@@ -1523,7 +1705,9 @@
pk_debug ("install signature %s", key_id);
ret = pk_client_reset (gclient->priv->client_secondary, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to install signature"), _("The client could not be reset"), error->message);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to install signature"),
+ _("The client could not be reset"), error->message);
g_error_free (error);
return;
}
@@ -1532,7 +1716,9 @@
key_id, package_id, &error);
gclient->priv->using_secondary_client = ret;
if (!ret) {
- gpk_error_dialog (_("Failed to install signature"), _("The method failed"), error->message);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to install signature"),
+ _("The method failed"), error->message);
g_error_free (error);
}
}
@@ -1546,9 +1732,11 @@
{
gboolean ret;
GError *error = NULL;
+ GtkWidget *widget;
/* do a helper */
- ret = gpk_client_eula_show (eula_id, package_id, vendor_name, license_agreement);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ ret = gpk_client_eula_show (GTK_WINDOW (widget), eula_id, package_id, vendor_name, license_agreement);
/* disagreed with auth */
if (!ret) {
@@ -1559,15 +1747,20 @@
pk_debug ("accept EULA %s", eula_id);
ret = pk_client_reset (gclient->priv->client_secondary, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to accept EULA"), _("The client could not be reset"), error->message);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to accept EULA"),
+ _("The client could not be reset"), error->message);
g_error_free (error);
return;
}
/* this is asynchronous, else we get into livelock */
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
ret = pk_client_accept_eula (gclient->priv->client_secondary, eula_id, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to accept EULA"), _("The method failed"), error->message);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to accept EULA"),
+ _("The method failed"), error->message);
g_error_free (error);
}
gclient->priv->using_secondary_client = ret;
@@ -1581,6 +1774,7 @@
{
gboolean ret;
GError *error = NULL;
+ GtkWidget *widget;
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
@@ -1591,7 +1785,9 @@
pk_debug ("trying to requeue install");
ret = pk_client_requeue (gclient->priv->client_action, &error);
if (!ret) {
- gpk_error_dialog (_("Failed to install"), _("The install task could not be requeued"), error->message);
+ widget = glade_xml_get_widget (gclient->priv->glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to install"),
+ _("The install task could not be requeued"), error->message);
g_error_free (error);
}
@@ -1720,15 +1916,22 @@
}
/* setup the UI */
- if (role == PK_ROLE_ENUM_GET_UPDATES) {
- gclient->priv->show_progress_files = FALSE;
+ if (role == PK_ROLE_ENUM_SEARCH_NAME ||
+ role == PK_ROLE_ENUM_SEARCH_GROUP ||
+ role == PK_ROLE_ENUM_SEARCH_DETAILS ||
+ role == PK_ROLE_ENUM_SEARCH_FILE ||
+ role == PK_ROLE_ENUM_SEARCH_NAME ||
+ role == PK_ROLE_ENUM_GET_UPDATES) {
+ gpk_client_set_progress_files (gclient, FALSE);
} else {
- gclient->priv->show_progress_files = TRUE;
+ gpk_client_set_progress_files (gclient, TRUE);
}
gpk_client_set_page (gclient, GPK_CLIENT_PAGE_PROGRESS);
/* wait for completion */
+ gclient->priv->gtk_main_waiting = TRUE;
gtk_main ();
+ gclient->priv->gtk_main_waiting = FALSE;
return TRUE;
}
@@ -1792,8 +1995,10 @@
gclient->priv = GPK_CLIENT_GET_PRIVATE (gclient);
gclient->priv->glade_xml = NULL;
+ gclient->priv->files_array = NULL;
gclient->priv->pulse_timer_id = 0;
gclient->priv->using_secondary_client = FALSE;
+ gclient->priv->gtk_main_waiting = FALSE;
gclient->priv->exit = PK_EXIT_ENUM_FAILED;
gclient->priv->show_finished = TRUE;
gclient->priv->show_progress = TRUE;
@@ -1832,6 +2037,8 @@
G_CALLBACK (gpk_client_repo_signature_required_cb), gclient);
g_signal_connect (gclient->priv->client_action, "eula-required",
G_CALLBACK (gpk_client_eula_required_cb), gclient);
+ g_signal_connect (gclient->priv->client_action, "files",
+ G_CALLBACK (gpk_client_files_cb), gclient);
gclient->priv->client_resolve = pk_client_new ();
g_signal_connect (gclient->priv->client_resolve, "status-changed",
@@ -1895,6 +2102,7 @@
g_source_remove (gclient->priv->finished_timer_id);
}
+ g_strfreev (gclient->priv->files_array);
g_object_unref (gclient->priv->client_action);
g_object_unref (gclient->priv->client_resolve);
g_object_unref (gclient->priv->client_secondary);
Modified: trunk/src/gpk-client.h
==============================================================================
--- trunk/src/gpk-client.h (original)
+++ trunk/src/gpk-client.h Fri Jun 6 11:35:45 2008
@@ -98,6 +98,9 @@
gboolean enabled);
PkPackageList *gpk_client_get_updates (GpkClient *gclient,
GError **error);
+gchar **gpk_client_get_file_list (GpkClient *gclient,
+ const gchar *package_id,
+ GError **error);
gboolean gpk_client_monitor_tid (GpkClient *gclient,
const gchar *tid);
gboolean gpk_client_set_parent (GpkClient *gclient,
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Fri Jun 6 11:35:45 2008
@@ -87,6 +87,7 @@
{PK_STATUS_ENUM_DOWNLOAD_CHANGELOG, "pk-refresh-cache"},
{PK_STATUS_ENUM_DOWNLOAD_GROUP, "pk-refresh-cache"},
{PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO, "pk-refresh-cache"},
+ {PK_STATUS_ENUM_REPACKAGING, "pk-package-cleanup"},
{0, NULL}
};
@@ -451,6 +452,9 @@
case PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED:
text = _("Package install blocked");
break;
+ case PK_ERROR_ENUM_PACKAGE_CORRUPT:
+ text = _("Package is corrupt");
+ break;
default:
g_warning ("Unknown error");
}
@@ -605,6 +609,9 @@
case PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED:
text = _("Installation of this package prevented by your packaging system's configuration.");
break;
+ case PK_ERROR_ENUM_PACKAGE_CORRUPT:
+ text = _("The package that was downloaded is corrupt and needs to be downloaded again.");
+ break;
default:
g_warning ("Unknown error, please report a bug.\n"
"More information is available in the detailed report.");
@@ -699,10 +706,10 @@
text = _("Unknown state");
break;
case PK_STATUS_ENUM_SETUP:
- text = _("Waiting for PackageKit service");
+ text = _("Waiting for service to start");
break;
case PK_STATUS_ENUM_WAIT:
- text = _("Waiting for other tasks to complete");
+ text = _("Waiting for other tasks");
break;
case PK_STATUS_ENUM_RUNNING:
text = _("Running task");
@@ -776,6 +783,9 @@
case PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO:
text = _("Downloading update information");
break;
+ case PK_STATUS_ENUM_REPACKAGING:
+ text = _("Repackaging files");
+ break;
default:
pk_warning ("status unrecognised: %s", pk_status_enum_to_text (status));
}
@@ -1351,12 +1361,17 @@
status == PK_STATUS_ENUM_DOWNLOAD_FILELIST ||
status == PK_STATUS_ENUM_DOWNLOAD_CHANGELOG ||
status == PK_STATUS_ENUM_DOWNLOAD_GROUP ||
- status == PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO) {
+ status == PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO ||
+ status == PK_STATUS_ENUM_REPACKAGING) {
name = "pk-action-refresh-cache";
delay = 150;
} else if (status == PK_STATUS_ENUM_DOWNLOAD) {
name = "pk-action-download";
delay = 150;
+ } else if (status == PK_STATUS_ENUM_INSTALL ||
+ status == PK_STATUS_ENUM_UPDATE) {
+ name = "pk-action-installing";
+ delay = 150;
} else if (status == PK_STATUS_ENUM_QUERY) {
name = "pk-action-searching";
delay = 150;
Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c (original)
+++ trunk/src/gpk-repo.c Fri Jun 6 11:35:45 2008
@@ -214,7 +214,10 @@
static void
gpk_repo_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, gpointer data)
{
- gpk_error_dialog (_("Failed to change status"), gpk_error_enum_to_localised_text (code), details);
+ GtkWidget *widget;
+ widget = glade_xml_get_widget (glade_xml, "window_repo");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to change status"),
+ gpk_error_enum_to_localised_text (code), details);
}
/**
Modified: trunk/src/gpk-update-icon.c
==============================================================================
--- trunk/src/gpk-update-icon.c (original)
+++ trunk/src/gpk-update-icon.c Fri Jun 6 11:35:45 2008
@@ -30,6 +30,7 @@
#include <dbus/dbus-glib.h>
#include <gtk/gtk.h>
#include <locale.h>
+#include <libnotify/notify.h>
#include <libgbus.h>
@@ -139,6 +140,7 @@
}
dbus_g_thread_init ();
g_type_init ();
+ notify_init ("gpk-update-icon");
g_set_application_name (_("PackageKit Update Applet"));
context = g_option_context_new (NULL);
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Fri Jun 6 11:35:45 2008
@@ -240,7 +240,9 @@
/* we have no checkboxes selected */
if (!selected_any) {
- gpk_error_dialog (_("No updates selected"), _("No updates are selected"), NULL);
+ widget = glade_xml_get_widget (glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("No updates selected"),
+ _("No updates are selected"), NULL);
return;
}
@@ -392,13 +394,16 @@
* pk_update_viewer_history_cb:
**/
static void
-pk_update_viewer_history_cb (GtkWidget *widget, gpointer data)
+pk_update_viewer_history_cb (GtkWidget *widget_button, gpointer data)
{
GError *error = NULL;
+ GtkWidget *widget;
/* FIXME: do this in process */
if (!g_spawn_command_line_async ("gpk-log", &error)) {
- gpk_error_dialog (_("Failed to launch"), _("The file was not found"), error->message);
+ widget = glade_xml_get_widget (glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), _("Failed to launch"),
+ _("The file was not found"), error->message);
g_error_free (error);
}
}
@@ -571,6 +576,10 @@
goto out;
}
+ /* sort by priority, then by package_id (reversed) */
+ pk_package_list_sort (list);
+ pk_package_list_sort_info (list);
+
/* do we have updates? */
length = pk_package_list_get_size (list);
if (length == 0) {
@@ -704,6 +713,44 @@
}
/**
+ * pk_update_viewer_get_pretty_from_composite:
+ *
+ * NOTE: Split using ^, because \t was already taken.
+ **/
+static gchar *
+pk_update_viewer_get_pretty_from_composite (const gchar *package_ids_delimit)
+{
+ guint i;
+ guint length;
+ gchar **package_ids;
+ gchar *pretty = NULL;
+ GString *string;
+
+ /* do we have any data? */
+ if (pk_strzero (package_ids_delimit)) {
+ goto out;
+ }
+
+ string = g_string_new ("");
+ 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]);
+ g_string_append (string, pretty);
+ g_string_append_c (string, '\n');
+ g_free (pretty);
+ }
+
+ /* remove trailing \n */
+ g_string_set_size (string, string->len - 1);
+ pretty = g_string_free (string, FALSE);
+ g_strfreev (package_ids);
+out:
+ return pretty;
+}
+
+
+/**
* pk_update_viewer_update_detail_cb:
**/
static void
@@ -719,8 +766,6 @@
GtkTreeModel *model;
GtkTreeIter treeiter;
gchar *package_pretty;
- gchar *updates_pretty;
- gchar *obsoletes_pretty;
const gchar *info_text;
PkInfoEnum info;
@@ -748,22 +793,24 @@
package_pretty = gpk_package_id_name_version (package_id);
/* translators: this is the package version */
- pk_update_viewer_add_description_item (_("Installed"), package_pretty, NULL);
+ pk_update_viewer_add_description_item (_("New version"), package_pretty, NULL);
g_free (package_pretty);
- if (!pk_strzero (updates)) {
- updates_pretty = gpk_package_id_name_version (updates);
+ /* split and add */
+ package_pretty = pk_update_viewer_get_pretty_from_composite (updates);
+ if (package_pretty != NULL) {
/* translators: this is a list of packages that are updated */
- pk_update_viewer_add_description_item (_("Updates"), updates_pretty, NULL);
- g_free (updates_pretty);
+ pk_update_viewer_add_description_item (_("Updates"), package_pretty, NULL);
}
+ g_free (package_pretty);
- if (!pk_strzero (obsoletes)) {
- obsoletes_pretty = gpk_package_id_name_version (obsoletes);
+ /* split and add */
+ package_pretty = pk_update_viewer_get_pretty_from_composite (obsoletes);
+ if (package_pretty != NULL) {
/* translators: this is a list of packages that are obsoleted */
- pk_update_viewer_add_description_item (_("Obsoletes"), obsoletes_pretty, NULL);
- g_free (obsoletes_pretty);
+ pk_update_viewer_add_description_item (_("Obsoletes"), package_pretty, NULL);
}
+ g_free (package_pretty);
ident = pk_package_id_new_from_string (package_id);
/* translators: this is the repository the package has come from */
@@ -1100,7 +1147,7 @@
* pk_update_viewer_check_blocked_packages:
**/
static void
-pk_update_viewer_check_blocked_packages (PkClient *client)
+pk_update_viewer_check_blocked_packages (PkPackageList *list)
{
guint i;
guint length;
@@ -1114,9 +1161,9 @@
string = g_string_new ("");
/* find any that are blocked */
- length = pk_client_package_buffer_get_size (client);
+ length = pk_package_list_get_size (list);
for (i=0;i<length;i++) {
- item = pk_client_package_buffer_get_item (client, i);
+ item = pk_package_list_get_item (list, i);
if (item->info == PK_INFO_ENUM_BLOCKED) {
text = gpk_package_id_format_oneline (item->package_id, item->summary);
g_string_append_printf (string, "%s\n", text);
@@ -1165,6 +1212,7 @@
GtkWidget *widget;
PkRoleEnum role;
PkRestartEnum restart;
+ PkPackageList *list;
pk_client_get_role (client, &role, NULL, NULL);
@@ -1181,7 +1229,9 @@
if (role == PK_ROLE_ENUM_UPDATE_SYSTEM ||
role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
//TODO: this has to be moved to GpkClient
- pk_update_viewer_check_blocked_packages (client);
+ list = pk_client_get_package_list (client);
+ pk_update_viewer_check_blocked_packages (list);
+ g_object_unref (list);
}
/* hide the cancel */
@@ -1292,8 +1342,18 @@
static void
pk_update_viewer_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, gpointer data)
{
- gpk_error_dialog (gpk_error_enum_to_localised_text (code),
- gpk_error_enum_to_localised_message (code), details);
+ GtkWidget *widget;
+
+ /* ignore some errors */
+ if (code == PK_ERROR_ENUM_PROCESS_KILL ||
+ code == PK_ERROR_ENUM_TRANSACTION_CANCELLED) {
+ pk_debug ("error ignored %s\n%s", pk_error_enum_to_text (code), details);
+ return;
+ }
+
+ widget = glade_xml_get_widget (glade_xml, "window_updates");
+ gpk_error_dialog_modal (GTK_WINDOW (widget), gpk_error_enum_to_localised_text (code),
+ gpk_error_enum_to_localised_message (code), details);
}
/**
@@ -1799,10 +1859,6 @@
list_store_preview = gtk_list_store_new (PREVIEW_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF);
list_store_description = gtk_list_store_new (DESC_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF);
- /* sorted */
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store_details),
- PACKAGES_COLUMN_TEXT, GTK_SORT_ASCENDING);
-
/* create preview tree view */
widget = glade_xml_get_widget (glade_xml, "treeview_preview");
gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]