gnome-packagekit r445 - trunk/src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r445 - trunk/src
- Date: Mon, 1 Dec 2008 12:13:01 +0000 (UTC)
Author: rhughes
Date: Mon Dec 1 12:13:01 2008
New Revision: 445
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=445&view=rev
Log:
from git
Added:
trunk/src/gpk-language.c
trunk/src/gpk-language.h
Modified:
trunk/src/Makefile.am
trunk/src/gdb.sh
trunk/src/gpk-client-dialog.c
trunk/src/gpk-client-dialog.h
trunk/src/gpk-client-untrusted.c
trunk/src/gpk-client.c
trunk/src/gpk-common.c
trunk/src/gpk-install-provide-file.c
trunk/src/gpk-log.c
trunk/src/gpk-repo.c
trunk/src/gpk-self-test.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Dec 1 12:13:01 2008
@@ -74,6 +74,8 @@
gpk-dialog.h \
gpk-vendor.c \
gpk-vendor.h \
+ gpk-language.c \
+ gpk-language.h \
gpk-client.c \
gpk-client.h \
gpk-client-dialog.c \
Modified: trunk/src/gdb.sh
==============================================================================
--- trunk/src/gdb.sh (original)
+++ trunk/src/gdb.sh Mon Dec 1 12:13:01 2008
@@ -1 +1 @@
-sudo gdb --args $1 --verbose
+gdb --args $1 --verbose
Modified: trunk/src/gpk-client-dialog.c
==============================================================================
--- trunk/src/gpk-client-dialog.c (original)
+++ trunk/src/gpk-client-dialog.c Mon Dec 1 12:13:01 2008
@@ -64,6 +64,9 @@
GtkListStore *store;
gchar *help_id;
gchar *title;
+ gboolean set_image;
+ GpkClientDialogPage page;
+ PkBitfield options;
};
enum {
@@ -100,10 +103,31 @@
}
/**
- * gpk_client_dialog_show_page:
+ * gpk_client_dialog_setup:
**/
gboolean
-gpk_client_dialog_show_page (GpkClientDialog *dialog, GpkClientDialogPage page, PkBitfield options, guint32 timestamp)
+gpk_client_dialog_setup (GpkClientDialog *dialog, GpkClientDialogPage page, PkBitfield options)
+{
+ GtkWidget *widget;
+ g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
+
+ /* reset state */
+ g_free (dialog->priv->help_id);
+ dialog->priv->help_id = NULL;
+ dialog->priv->set_image = FALSE;
+ dialog->priv->page = page;
+ dialog->priv->options = options;
+ widget = glade_xml_get_widget (dialog->priv->glade_xml, "label_message");
+ gtk_label_set_label (GTK_LABEL (widget), "");
+ gpk_client_dialog_set_action (dialog, NULL);
+ return TRUE;
+}
+
+/**
+ * gpk_client_dialog_present_with_time:
+ **/
+gboolean
+gpk_client_dialog_present_with_time (GpkClientDialog *dialog, guint32 timestamp)
{
GtkWidget *widget;
PkBitfield bitfield = 0;
@@ -114,34 +138,38 @@
gtk_widget_show (widget);
widget = glade_xml_get_widget (dialog->priv->glade_xml, "image_status");
gtk_widget_show (widget);
-
/* helper */
- if (page == GPK_CLIENT_DIALOG_PAGE_CONFIRM) {
- gpk_client_dialog_set_image (dialog, "dialog-question");
+ if (dialog->priv->page == GPK_CLIENT_DIALOG_PAGE_CONFIRM) {
+ if (!dialog->priv->set_image)
+ gpk_client_dialog_set_image (dialog, "dialog-question");
bitfield = pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_BUTTON_CLOSE,
GPK_CLIENT_DIALOG_WIDGET_BUTTON_ACTION,
GPK_CLIENT_DIALOG_WIDGET_BUTTON_HELP,
GPK_CLIENT_DIALOG_WIDGET_MESSAGE,
-1);
- } else if (page == GPK_CLIENT_DIALOG_PAGE_FINISHED) {
- gpk_client_dialog_set_image (dialog, "dialog-information");
+ } else if (dialog->priv->page == GPK_CLIENT_DIALOG_PAGE_FINISHED) {
+ if (!dialog->priv->set_image)
+ gpk_client_dialog_set_image (dialog, "dialog-information");
bitfield = pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_BUTTON_CLOSE,
GPK_CLIENT_DIALOG_WIDGET_MESSAGE,
-1);
- } else if (page == GPK_CLIENT_DIALOG_PAGE_CONFIRM) {
- gpk_client_dialog_set_image (dialog, "dialog-question");
+ } else if (dialog->priv->page == GPK_CLIENT_DIALOG_PAGE_CONFIRM) {
+ if (!dialog->priv->set_image)
+ gpk_client_dialog_set_image (dialog, "dialog-question");
bitfield = pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_BUTTON_CLOSE,
GPK_CLIENT_DIALOG_WIDGET_BUTTON_ACTION,
GPK_CLIENT_DIALOG_WIDGET_BUTTON_HELP,
GPK_CLIENT_DIALOG_WIDGET_MESSAGE,
-1);
- } else if (page == GPK_CLIENT_DIALOG_PAGE_WARNING) {
- gpk_client_dialog_set_image (dialog, "dialog-warning");
+ } else if (dialog->priv->page == GPK_CLIENT_DIALOG_PAGE_WARNING) {
+ if (!dialog->priv->set_image)
+ gpk_client_dialog_set_image (dialog, "dialog-warning");
bitfield = pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_BUTTON_CLOSE,
GPK_CLIENT_DIALOG_WIDGET_MESSAGE,
-1);
- } else if (page == GPK_CLIENT_DIALOG_PAGE_PROGRESS) {
- gpk_client_dialog_set_image (dialog, "dialog-warning");
+ } else if (dialog->priv->page == GPK_CLIENT_DIALOG_PAGE_PROGRESS) {
+ if (!dialog->priv->set_image)
+ gpk_client_dialog_set_image (dialog, "dialog-warning");
bitfield = pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_BUTTON_CLOSE,
GPK_CLIENT_DIALOG_WIDGET_BUTTON_CANCEL,
GPK_CLIENT_DIALOG_WIDGET_BUTTON_HELP,
@@ -150,7 +178,7 @@
}
/* we can specify extras */
- bitfield += options;
+ bitfield += dialog->priv->options;
gpk_client_dialog_show_widget (dialog, "button_help", pk_bitfield_contain (bitfield, GPK_CLIENT_DIALOG_WIDGET_BUTTON_HELP));
gpk_client_dialog_show_widget (dialog, "button_cancel", pk_bitfield_contain (bitfield, GPK_CLIENT_DIALOG_WIDGET_BUTTON_CANCEL));
@@ -169,10 +197,20 @@
gtk_widget_realize (widget);
gtk_window_present_with_time (GTK_WINDOW (widget), timestamp);
+
return TRUE;
}
/**
+ * gpk_client_dialog_present:
+ **/
+gboolean
+gpk_client_dialog_present (GpkClientDialog *dialog)
+{
+ return gpk_client_dialog_present_with_time (dialog, 0);
+}
+
+/**
* gpk_client_dialog_set_parent:
**/
gboolean
@@ -305,11 +343,13 @@
GtkWidget *widget;
g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
- g_return_val_if_fail (action != NULL, FALSE);
egg_debug ("setting action: %s", action);
widget = glade_xml_get_widget (dialog->priv->glade_xml, "button_action");
- gtk_button_set_label (GTK_BUTTON (widget), action);
+ if (action != NULL)
+ gtk_button_set_label (GTK_BUTTON (widget), action);
+ else
+ gtk_widget_hide (widget);
return TRUE;
}
@@ -388,6 +428,9 @@
g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
g_return_val_if_fail (image != NULL, FALSE);
+ /* set state */
+ dialog->priv->set_image = TRUE;
+
egg_debug ("setting image: %s", image);
widget = glade_xml_get_widget (dialog->priv->glade_xml, "image_status");
gpk_animated_icon_enable_animation (GPK_ANIMATED_ICON (widget), FALSE);
@@ -405,6 +448,9 @@
g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
+ /* set state */
+ dialog->priv->set_image = TRUE;
+
widget = glade_xml_get_widget (dialog->priv->glade_xml, "image_status");
gpk_set_animated_icon_from_status (GPK_ANIMATED_ICON (widget), status, GTK_ICON_SIZE_DIALOG);
return TRUE;
@@ -450,6 +496,7 @@
dialog->priv->response = GTK_RESPONSE_NONE;
g_main_loop_run (dialog->priv->loop);
+
return dialog->priv->response;
}
@@ -522,7 +569,7 @@
gpk_client_dialog_set_help_id (GpkClientDialog *dialog, const gchar *help_id)
{
g_return_val_if_fail (GPK_IS_CLIENT_DIALOG (dialog), FALSE);
- g_free (dialog->priv->help_id);
+ g_return_val_if_fail (dialog->priv->help_id == NULL, FALSE);
dialog->priv->help_id = g_strdup (help_id);
return TRUE;
}
@@ -740,6 +787,9 @@
dialog->priv->pulse_timer_id = 0;
dialog->priv->show_progress_files = TRUE;
dialog->priv->has_parent = FALSE;
+ dialog->priv->set_image = FALSE;
+ dialog->priv->page = GPK_CLIENT_DIALOG_PAGE_UNKNOWN;
+ dialog->priv->options = 0;
dialog->priv->help_id = NULL;
dialog->priv->title = NULL;
@@ -860,11 +910,12 @@
/************************************************************/
egg_test_title (test, "help button");
+ gpk_client_dialog_setup (dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_window_title (dialog, "PackageKit self test");
gpk_client_dialog_set_title (dialog, "Button press test");
gpk_client_dialog_set_message (dialog, "Please press close");
gpk_client_dialog_set_image (dialog, "dialog-warning");
- gpk_client_dialog_show_page (dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (dialog);
button = gpk_client_dialog_run (dialog);
if (button == GTK_RESPONSE_CLOSE)
egg_test_success (test, NULL);
@@ -873,11 +924,12 @@
/************************************************************/
egg_test_title (test, "confirm button");
+ gpk_client_dialog_setup (dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0);
gpk_client_dialog_set_title (dialog, "Button press test with a really really long title");
gpk_client_dialog_set_message (dialog, "Please press Uninstall\n\nThis is a really really, really,\nreally long title <i>with formatting</i>");
gpk_client_dialog_set_image (dialog, "dialog-information");
gpk_client_dialog_set_action (dialog, "Uninstall");
- gpk_client_dialog_show_page (dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0, 0);
+ gpk_client_dialog_present (dialog);
button = gpk_client_dialog_run (dialog);
if (button == GTK_RESPONSE_OK)
egg_test_success (test, NULL);
@@ -886,20 +938,22 @@
/************************************************************/
egg_test_title (test, "no message");
+ gpk_client_dialog_setup (dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
gpk_client_dialog_set_title (dialog, "Refresh cache");
gpk_client_dialog_set_image_status (dialog, PK_STATUS_ENUM_REFRESH_CACHE);
gpk_client_dialog_set_percentage (dialog, 101);
- gpk_client_dialog_show_page (dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (dialog);
gpk_client_dialog_run (dialog);
egg_test_success (test, NULL);
/************************************************************/
egg_test_title (test, "progress");
+ gpk_client_dialog_setup (dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
gpk_client_dialog_set_title (dialog, "Button press test");
gpk_client_dialog_set_message (dialog, "Please press cancel");
gpk_client_dialog_set_image_status (dialog, PK_STATUS_ENUM_RUNNING);
gpk_client_dialog_set_percentage (dialog, 50);
- gpk_client_dialog_show_page (dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (dialog);
button = gpk_client_dialog_run (dialog);
if (button == GTK_RESPONSE_CANCEL)
egg_test_success (test, NULL);
@@ -908,11 +962,12 @@
/************************************************************/
egg_test_title (test, "progress");
+ gpk_client_dialog_setup (dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_MESSAGE, -1));
gpk_client_dialog_set_title (dialog, "Button press test");
gpk_client_dialog_set_message (dialog, "Please press close");
gpk_client_dialog_set_image_status (dialog, PK_STATUS_ENUM_INSTALL);
gpk_client_dialog_set_percentage (dialog, 101);
- gpk_client_dialog_show_page (dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, pk_bitfield_from_enums (GPK_CLIENT_DIALOG_WIDGET_MESSAGE, -1), 0);
+ gpk_client_dialog_present (dialog);
button = gpk_client_dialog_run (dialog);
if (button == GTK_RESPONSE_CLOSE)
egg_test_success (test, NULL);
@@ -921,11 +976,12 @@
/************************************************************/
egg_test_title (test, "confirm install button");
+ gpk_client_dialog_setup (dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST);
gpk_client_dialog_set_title (dialog, "Button press test");
gpk_client_dialog_set_message (dialog, "Please press Install if you can see the package list");
gpk_client_dialog_set_image (dialog, "dialog-information");
gpk_client_dialog_set_action (dialog, "Install");
- gpk_client_dialog_show_page (dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST, 0);
+ gpk_client_dialog_present (dialog);
button = gpk_client_dialog_run (dialog);
if (button == GTK_RESPONSE_OK)
egg_test_success (test, NULL);
Modified: trunk/src/gpk-client-dialog.h
==============================================================================
--- trunk/src/gpk-client-dialog.h (original)
+++ trunk/src/gpk-client-dialog.h Mon Dec 1 12:13:01 2008
@@ -90,9 +90,8 @@
GType gpk_client_dialog_get_type (void) G_GNUC_CONST;
GpkClientDialog *gpk_client_dialog_new (void);
-gboolean gpk_client_dialog_show_page (GpkClientDialog *dialog,
- GpkClientDialogPage page,
- PkBitfield options,
+gboolean gpk_client_dialog_present (GpkClientDialog *dialog);
+gboolean gpk_client_dialog_present_with_time (GpkClientDialog *dialog,
guint32 timestamp);
gboolean gpk_client_dialog_set_package_list (GpkClientDialog *dialog,
const PkPackageList *list);
@@ -119,6 +118,9 @@
GtkWindow *gpk_client_dialog_get_window (GpkClientDialog *dialog);
GtkResponseType gpk_client_dialog_run (GpkClientDialog *dialog);
gboolean gpk_client_dialog_close (GpkClientDialog *dialog);
+gboolean gpk_client_dialog_setup (GpkClientDialog *dialog,
+ GpkClientDialogPage page,
+ PkBitfield options);
G_END_DECLS
Modified: trunk/src/gpk-client-untrusted.c
==============================================================================
--- trunk/src/gpk-client-untrusted.c (original)
+++ trunk/src/gpk-client-untrusted.c Mon Dec 1 12:13:01 2008
@@ -70,9 +70,6 @@
/* connect up actions */
widget = glade_xml_get_widget (glade_xml, "dialog_error");
g_signal_connect_swapped (widget, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
-
- /* set icon name */
- widget = glade_xml_get_widget (glade_xml, "dialog_error");
gtk_window_set_icon_name (GTK_WINDOW (widget), GPK_ICON_SOFTWARE_INSTALLER);
/* close button */
@@ -122,7 +119,11 @@
g_signal_connect (update_system_action, "activate",
G_CALLBACK (gpk_client_untrusted_button_cb), NULL);
button = polkit_gnome_action_create_button (update_system_action);
- widget = glade_xml_get_widget (glade_xml, "hbuttonbox2");
+ gtk_widget_show (button);
+
+ /* add to box */
+ widget = glade_xml_get_widget (glade_xml, "dialog_error");
+ widget = gtk_dialog_get_action_area (GTK_DIALOG(widget));
gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0);
/* show window */
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Mon Dec 1 12:13:01 2008
@@ -52,6 +52,7 @@
#include "gpk-common.h"
#include "gpk-gnome.h"
#include "gpk-error.h"
+#include "gpk-language.h"
#include "gpk-consolekit.h"
#include "gpk-animated-icon.h"
#include "gpk-client-dialog.h"
@@ -77,6 +78,7 @@
PkClient *client_action;
PkClient *client_resolve;
PkClient *client_secondary;
+ GpkLanguage *language;
GConfClient *gconf_client;
GpkClientDialog *dialog;
GpkVendor *vendor;
@@ -351,10 +353,10 @@
if (exit == PK_EXIT_ENUM_SUCCESS && gclient->priv->show_finished) {
list = pk_client_get_package_list (client);
/* TRANSLATORS: list the packages we just installed */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_FINISHED, GPK_CLIENT_DIALOG_PACKAGE_LIST);
gpk_client_dialog_set_message (gclient->priv->dialog, _("The following packages were installed:"));
gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_FINISHED, GPK_CLIENT_DIALOG_PACKAGE_LIST, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
g_object_unref (list);
gclient->priv->finished_timer_id = g_timeout_add_seconds (GPK_CLIENT_FINISHED_AUTOCLOSE_DELAY,
gpk_install_finished_timeout, gclient);
@@ -388,8 +390,9 @@
status == PK_STATUS_ENUM_DOWNLOAD_GROUP ||
status == PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO ||
status == PK_STATUS_ENUM_REFRESH_CACHE) {
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-progress");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, 0);
}
}
@@ -616,6 +619,9 @@
if (!gclient->priv->show_warning)
return;
+ /* setup UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
+
/* print a proper error if we have it */
if (error != NULL) {
if (error->code == PK_CLIENT_ERROR_FAILED_AUTH ||
@@ -631,15 +637,12 @@
/* TRANSLATORS: the user tried to query for something invalid */
message = _("The query is not valid.");
details = error->message;
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
} else if (error->code == PK_CLIENT_ERROR_INVALID_FILE) {
/* TRANSLATORS: the user tried to install a file that was not compatable or broken */
message = _("The file is not valid.");
details = error->message;
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
} else {
details = error->message;
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
}
}
@@ -647,7 +650,7 @@
if (details == NULL) {
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
return;
}
@@ -980,6 +983,7 @@
message = gpk_client_ptr_array_to_bullets (array_missing, message_part);
/* show UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-warning");
@@ -988,7 +992,7 @@
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-installing-private-files");
g_free (message);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
/* did we click no or exit the window? */
if (button != GTK_RESPONSE_OK) {
@@ -1003,9 +1007,10 @@
/* TRANSLATORS: title: we are about to copy files, which may take a few seconds */
title = ngettext ("Copying file",
"Copying files", array_missing->len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-installing-private-files");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
}
/* now we have the okay to copy the files, do so */
@@ -1043,10 +1048,10 @@
"The files could not be copied", array_missing->len);
/* show UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, error_local->message);
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "files not copied");
ret = FALSE;
@@ -1081,12 +1086,13 @@
message = gpk_client_ptr_array_to_bullets (array, NULL);
/* show UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
/* TRANSLATORS: title: installing local files */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-install-files");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
g_free (message);
@@ -1095,10 +1101,9 @@
/* TRANSLATORS: title: the user cancelled the action */
title = ngettext ("The file was not installed",
"The files were not installed", array->len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "Aborted");
ret = FALSE;
@@ -1149,10 +1154,10 @@
message = gpk_client_ptr_array_to_bullets (array_missing, message_part);
/* show UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
g_free (message);
@@ -1173,7 +1178,7 @@
* @gclient: a valid #GpkClient instance
**/
static gboolean
-gpk_client_confirm_action (GpkClient *gclient, const gchar *title, const gchar *message)
+gpk_client_confirm_action (GpkClient *gclient, const gchar *title, const gchar *message, const gchar *action)
{
GtkResponseType button;
gchar *title_name;
@@ -1186,6 +1191,10 @@
title_name = g_strdup_printf (_("A program %s"), title);
}
+ /* setup UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0);
+ gpk_client_dialog_set_action (gclient->priv->dialog, action);
+
/* set icon */
if (gclient->priv->parent_icon_name != NULL)
gpk_client_dialog_set_image (gclient->priv->dialog, gclient->priv->parent_icon_name);
@@ -1195,7 +1204,7 @@
gpk_client_dialog_set_title (gclient->priv->dialog, title_name);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-application-confirm");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
g_free (title_name);
button = gpk_client_dialog_run (gclient->priv->dialog);
@@ -1250,11 +1259,11 @@
if (!ret)
goto out;
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: installing a local file */
gpk_client_dialog_set_title (gclient->priv->dialog, ngettext ("Install local file", "Install local files", array->len));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
files = pk_ptr_array_to_strv (array);
gclient->priv->retry_untrusted_value = FALSE;
@@ -1268,9 +1277,11 @@
/* do we need to try again with better auth? */
if (gclient->priv->retry_untrusted_value) {
/* TRANSLATORS: title: installing a local file that is not trusted */
- gpk_client_dialog_set_title (gclient->priv->dialog, ngettext ("Install untrusted local file", "Install untrusted local files", array->len));
+ title = ngettext ("Install untrusted local file", "Install untrusted local files", array->len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
+ gpk_client_dialog_set_title (gclient->priv->dialog, title);
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
ret = gpk_client_install_local_files_internal (gclient, FALSE, files, error);
if (!ret)
goto out;
@@ -1286,10 +1297,9 @@
/* TRANSLATORS: title: we have installed the local file OK */
title = ngettext ("File was installed successfully",
"Files were installed successfully", array->len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_FINISHED, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
- gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-info");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_FINISHED, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
}
@@ -1335,13 +1345,14 @@
goto skip_checks;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: getting a list of other packages that depend on this one */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Finding packages we require"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-finding-requires");
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* reset */
ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
@@ -1389,13 +1400,14 @@
g_free (name);
/* show UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST);
gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
/* TRANSLATORS: title: removing packages */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Remove"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-remove-other-packages");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
g_free (title);
g_free (message);
button = gpk_client_dialog_run (gclient->priv->dialog);
@@ -1409,14 +1421,11 @@
}
skip_checks:
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: title removing packages */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Remove packages"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
-
- /* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
@@ -1490,14 +1499,14 @@
goto skip_checks;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: finding a list of packages that we would also need to download */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Finding other packages we require"));
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-finding-depends");
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* reset */
ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
@@ -1538,13 +1547,14 @@
length), name);
g_free (name);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST);
gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
/* TRANSLATORS: title: installing package */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-install-other-packages");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
/* did we click no or exit the window? */
@@ -1556,12 +1566,11 @@
}
skip_checks:
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: title: installing packages */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Installing packages"));
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* reset */
ret = pk_client_reset (gclient->priv->client_action, &error_local);
@@ -1650,12 +1659,8 @@
text,
/* TRANSLATORS: ask the user if it's okay to search */
_("Do you want to search for this file now?"));
- /* TRANSLATORS: title: */
- gpk_client_dialog_set_title (gclient->priv->dialog, _("Package installer"));
- /* TRANSLATORS: title: we want to install a package */
- gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
/* TRANSLATORS: generic confirm, use the application name if we can */
- ret = gpk_client_confirm_action (gclient, _("wants to install packages"), message);
+ ret = gpk_client_confirm_action (gclient, _("wants to install packages"), message, _("Install"));
g_free (text);
g_free (message);
if (!ret) {
@@ -1665,12 +1670,13 @@
}
skip_checks:
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title, searching */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Searching for packages"));
gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_WAIT);
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-finding-packages");
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* reset */
ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
@@ -1702,18 +1708,18 @@
/* TRANSLATORS: couldn't resolve name to package */
title = g_strdup_printf (_("Could not find %s"), text);
info_url = gpk_vendor_get_not_found_url (gclient->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
+ /* only show the "more info" button if there is a valid link */
+ if (info_url != NULL)
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION);
+ else
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
/* TRANSLATORS: message: could not find */
gpk_client_dialog_set_message (gclient->priv->dialog, _("The packages could not be found in any software source"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: a link to the help file */
gpk_client_dialog_set_action (gclient->priv->dialog, _("More information"));
-
- /* only show the "more info" button if there is a valid link */
- if (info_url != NULL)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION, 0);
- else
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
button = gpk_client_dialog_run (gclient->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
@@ -1745,11 +1751,11 @@
text = pk_package_ids_to_text (packages);
/* TRANSLATORS: title: package is already installed */
title = g_strdup_printf (_("Failed to install %s"), text);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
/* TRANSLATORS: message: package is already installed */
gpk_client_dialog_set_message (gclient->priv->dialog, _("The package is already installed"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
gpk_client_dialog_run (gclient->priv->dialog);
g_free (text);
g_free (title);
@@ -1762,12 +1768,12 @@
/* got junk? */
if (id == NULL) {
if (gclient->priv->show_warning) {
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: failed to install, shouldn't be shown */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to install package"));
/* TRANSLATORS: the search gave us the wrong result. internal error. barf. */
gpk_client_dialog_set_message (gclient->priv->dialog, _("Incorrect response from search"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
gpk_client_dialog_run (gclient->priv->dialog);
}
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "package already found");
@@ -1837,12 +1843,8 @@
full_path,
/* TRANSLATORS: confirm with the user */
_("Do you want to search for this now?"));
- /* TRANSLATORS: title */
- gpk_client_dialog_set_title (gclient->priv->dialog, _("File installer"));
- /* TRANSLATORS: button: install package that provides a file */
- gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
/* TRANSLATORS: generic confirm, use the application name if we can */
- ret = gpk_client_confirm_action (gclient, _("wants to install a file"), message);
+ ret = gpk_client_confirm_action (gclient, _("wants to install a file"), message, _("Install"));
g_free (message);
if (!ret) {
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
@@ -1881,6 +1883,11 @@
if (len == 0) {
if (gclient->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (gclient->priv->vendor, GPK_VENDOR_URL_TYPE_DEFAULT);
+ /* only show the "more info" button if there is a valid link */
+ if (info_url != NULL)
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION);
+ else
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: failed to fild the package for thefile */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to find package"));
/* TRANSLATORS: nothing found */
@@ -1888,11 +1895,7 @@
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: show the user a button to get more help finding stuff */
gpk_client_dialog_set_action (gclient->priv->dialog, _("More information"));
- /* only show the "more info" button if there is a valid link */
- if (info_url != NULL)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION, 0);
- else
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
button = gpk_client_dialog_run (gclient->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
@@ -1920,11 +1923,11 @@
if (gclient->priv->show_warning) {
/* TRANSLATORS: we've already got a package that provides this file */
text = g_strdup_printf (_("The %s package already provides the file %s"), id->name, full_path);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: title */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to install file"));
gpk_client_dialog_set_message (gclient->priv->dialog, text);
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
gpk_client_dialog_run (gclient->priv->dialog);
g_free (text);
}
@@ -2046,12 +2049,8 @@
/* display messagebox */
text = g_string_free (string, FALSE);
- /* TRANSLATORS: title: codec installer */
- gpk_client_dialog_set_title (gclient->priv->dialog, _("Plugin installer"));
- /* TRANSLATORS: button: search for a codec */
- gpk_client_dialog_set_action (gclient->priv->dialog, _("Search"));
/* TRANSLATORS: generic confirm, use the application name if we can */
- ret = gpk_client_confirm_action (gclient, _("requires additional plugins"), text);
+ ret = gpk_client_confirm_action (gclient, _("requires additional plugins"), text, _("Search"));
g_free (text);
return ret;
@@ -2106,15 +2105,15 @@
}
skip_checks:
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: search for codec */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Searching for plugins"));
gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_WAIT);
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-finding-packages");
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* save the objects to download in a list */
list = pk_package_list_new ();
@@ -2130,16 +2129,17 @@
if (obj_new == NULL) {
if (gclient->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (gclient->priv->vendor, GPK_VENDOR_URL_TYPE_CODEC);
+ /* only show the "more info" button if there is a valid link */
+ if (info_url != NULL)
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION);
+ else
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: failed to search for codec */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to search for plugin"));
/* TRANSLATORS: no software sources have the wanted codec */
gpk_client_dialog_set_message (gclient->priv->dialog, _("Could not find plugin in any configured software source"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-package-not-found");
- /* only show the "more info" button if there is a valid link */
- if (info_url != NULL)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION, 0);
- else
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
button = gpk_client_dialog_run (gclient->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
@@ -2172,14 +2172,14 @@
title = ngettext ("Install the following plugin", "Install the following plugins", len);
message = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST);
gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-information");
/* TRANSLATORS: button: install codecs */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
/* close, we're going to fail the method */
@@ -2252,12 +2252,9 @@
mime_type,
/* TRANSLATORS: message: confirm with the user */
_("Do you want to search for a program to open this file type now?"));
- /* TRANSLATORS: title */
- gpk_client_dialog_set_title (gclient->priv->dialog, _("File type installer"));
- /* TRANSLATORS: button: search for mime installer */
- gpk_client_dialog_set_action (gclient->priv->dialog, _("Search"));
+
/* TRANSLATORS: generic confirm, use the application name if we can */
- ret = gpk_client_confirm_action (gclient, _("requires a new mime type"), message);
+ ret = gpk_client_confirm_action (gclient, _("requires a new mime type"), message, _("Search"));
g_free (message);
if (!ret) {
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
@@ -2266,6 +2263,7 @@
}
skip_checks:
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: searching for mime type handlers */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Searching for file handlers"));
gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_WAIT);
@@ -2273,7 +2271,7 @@
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* reset */
ret = pk_client_reset (gclient->priv->client_resolve, &error_local);
@@ -2302,6 +2300,11 @@
if (len == 0) {
if (gclient->priv->show_warning) {
info_url = gpk_vendor_get_not_found_url (gclient->priv->vendor, GPK_VENDOR_URL_TYPE_MIME);
+ /* only show the "more info" button if there is a valid link */
+ if (info_url != NULL)
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION);
+ else
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: title */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to find software"));
/* TRANSLATORS: nothing found in the software sources that helps */
@@ -2309,11 +2312,7 @@
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: show the user a button to get more help finding stuff */
gpk_client_dialog_set_action (gclient->priv->dialog, _("More information"));
- /* only show the "more info" button if there is a valid link */
- if (info_url != NULL)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION, 0);
- else
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
button = gpk_client_dialog_run (gclient->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
@@ -2332,12 +2331,12 @@
/* selected nothing */
if (package_id == NULL) {
if (gclient->priv->show_warning) {
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
/* TRANSLATORS: we failed to install */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Failed to install software"));
/* TRANSLATORS: we didn't select any applications that were returned */
gpk_client_dialog_set_message (gclient->priv->dialog, _("No applications were chosen to be installed"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
gpk_client_dialog_run (gclient->priv->dialog);
}
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "user chose nothing");
@@ -2363,10 +2362,29 @@
gpk_client_font_tag_to_localised_name (GpkClient *gclient, const gchar *tag)
{
guint len;
+ gchar *language = NULL;
+ gchar *name;
+
len = strlen (tag);
- if (len < 7)
- return g_strdup_printf ("unknown: %s", tag);
- return g_strdup (&tag[6]);
+ if (len < 7) {
+ /* TRANSLATORS: the user specified an invalid ISO639 code */
+ name = g_strdup_printf ("%s: %s", _("Invalid language code"), tag);
+ goto out;
+ }
+ language = gpk_language_iso639_to_language (gclient->priv->language, &tag[6]);
+ if (language == NULL) {
+ /* TRANSLATORS: we could not find a valid ISO639 code */
+ name = g_strdup_printf ("%s: %s", _("Language code not matched"), tag);
+ goto out;
+ }
+
+ /* get translation, or return untranslated string */
+ name = g_strdup (dgettext("iso_639", language));
+ if (name == NULL)
+ name = g_strdup (language);
+out:
+ g_free (language);
+ return name;
}
/**
@@ -2445,12 +2463,11 @@
/* check user wanted operation */
message = g_strdup_printf ("%s\n\n%s\n%s", title, text, title_part);
- /* TRANSLATORS: title: font installer */
- gpk_client_dialog_set_title (gclient->priv->dialog, _("Font installer"));
- /* TRANSLATORS: buttton: search for font */
- gpk_client_dialog_set_action (gclient->priv->dialog, _("Search"));
- /* TRANSLATORS: generic confirm, use the application name if we can */
- ret = gpk_client_confirm_action (gclient, _("wants to install a font"), message);
+ /* TRANSLATORS: generic confirm, the application name is used as a prefix */
+ title = ngettext ("wants to install a font", "wants to install fonts", len);
+
+ /* TRANSLATORS: button: confirm to install fonts */
+ ret = gpk_client_confirm_action (gclient, title, message, _("Search"));
g_free (message);
if (!ret) {
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "did not agree to search");
@@ -2461,13 +2478,14 @@
skip_checks:
/* TRANSLATORS: title to show when searching for font files */
title = ngettext ("Searching for font", "Searching for fonts", len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_WAIT);
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-finding-packages");
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* do each one */
list = pk_package_list_new ();
@@ -2507,17 +2525,18 @@
info_url = gpk_vendor_get_not_found_url (gclient->priv->vendor, GPK_VENDOR_URL_TYPE_FONT);
/* TRANSLATORS: title: cannot find in sources */
title = ngettext ("Failed to find font", "Failed to find fonts", len);
+ /* only show the "more info" button if there is a valid link */
+ if (info_url != NULL)
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION);
+ else
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
/* TRANSLATORS: message: tell the user we suck */
gpk_client_dialog_set_message (gclient->priv->dialog, _("No new fonts can be found for this document"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-package-not-found");
/* TRANSLATORS: button: show the user a button to get more help finding stuff */
gpk_client_dialog_set_action (gclient->priv->dialog, _("More information"));
- /* only show the "more info" button if there is a valid link */
- if (info_url != NULL)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, GPK_CLIENT_DIALOG_BUTTON_ACTION, 0);
- else
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
button = gpk_client_dialog_run (gclient->priv->dialog);
if (button == GTK_RESPONSE_OK)
gpk_gnome_open (info_url);
@@ -2535,19 +2554,15 @@
}
/* TRANSLATORS: title: show a list of fonts */
- title = ngettext ("Install the following font", "Install the following fonts", len);
+ title = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", len);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST);
gpk_client_dialog_set_package_list (gclient->priv->dialog, list);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
-
- /* TRANSLATORS: confirm */
- title = ngettext ("Do you want to install this package now?", "Do you want to install these packages now?", len);
-
gpk_client_dialog_set_message (gclient->priv->dialog, title);
gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-information");
/* TRANSLATORS: button: install a font */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, GPK_CLIENT_DIALOG_PACKAGE_LIST, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
/* close, we're going to fail the method */
@@ -2630,12 +2645,13 @@
message = g_strjoinv ("\n", filenames);
/* show UI */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, title);
gpk_client_dialog_set_message (gclient->priv->dialog, message);
/* TRANSLATORS: button: install catalog */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-install-catalogs");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
g_free (message);
@@ -2644,13 +2660,14 @@
return FALSE;
skip_checks:
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: install package catalogs, that is, instructions for installing */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Install catalogs"));
gpk_client_set_status (gclient, PK_STATUS_ENUM_WAIT);
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* get files to be installed */
catalog = pk_catalog_new ();
@@ -2664,10 +2681,10 @@
/* show UI */
if (gclient->priv->show_warning) {
/* TRANSLATORS: title: we've already got all these packages installed */
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0);
gpk_client_dialog_set_title (gclient->priv->dialog, _("No packages need to be installed"));
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-catalog-none-required");
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_WARNING, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
gpk_client_dialog_run (gclient->priv->dialog);
}
gpk_client_error_set (error, GPK_CLIENT_ERROR_FAILED, "No packages need to be installed");
@@ -2698,14 +2715,14 @@
/* display messagebox */
text = g_string_free (string, FALSE);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0);
/* TRANSLATORS: title: allow user to confirm */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Install packages in catalog?"));
gpk_client_dialog_set_message (gclient->priv->dialog, text);
gpk_client_dialog_set_image (gclient->priv->dialog, "dialog-question");
/* TRANSLATORS: button: install packages in catalog */
gpk_client_dialog_set_action (gclient->priv->dialog, _("Install"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CONFIRM, 0, gclient->priv->timestamp);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, gclient->priv->timestamp);
button = gpk_client_dialog_run (gclient->priv->dialog);
g_free (text);
@@ -2753,9 +2770,9 @@
goto out;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: title: update all pending updates */
gpk_client_dialog_set_title (gclient->priv->dialog, _("System update"));
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-update-system");
/* wrap update, but handle all the GPG and EULA stuff */
@@ -2770,7 +2787,7 @@
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* if we are not showing UI, then notify the user what we are doing (just on the active terminal) */
ret = gconf_client_get_bool (gclient->priv->gconf_client, GPK_CONF_NOTIFY_CRITICAL, NULL);
@@ -2831,6 +2848,7 @@
goto out;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: refresh the lists of packages */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Refresh package lists"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-refresh");
@@ -2847,7 +2865,7 @@
/* setup the UI */
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* wait for an answer */
g_main_loop_run (gclient->priv->loop);
@@ -2895,10 +2913,10 @@
/* ignore this if it's uninteresting */
if (gclient->priv->show_progress) {
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: getting the list of updates */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Getting list of updates"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
}
/* wait for an answer */
@@ -2953,11 +2971,12 @@
goto out;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: get if we can go from one distro release to another */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Getting distribution upgrade information"));
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-get-upgrades");
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* wait for an answer */
g_main_loop_run (gclient->priv->loop);
@@ -2999,11 +3018,11 @@
return NULL;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
/* TRANSLATORS: title: getting the files that are contained in a package */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Getting file lists"));
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* wait for an answer */
g_main_loop_run (gclient->priv->loop);
@@ -3054,12 +3073,12 @@
goto out;
}
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
/* TRANSLATORS: title: update specific packages */
gpk_client_dialog_set_title (gclient->priv->dialog, _("Update packages"));
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
gpk_client_dialog_set_help_id (gclient->priv->dialog, "dialog-update-packages");
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* wait for an answer */
g_main_loop_run (gclient->priv->loop);
@@ -3086,13 +3105,12 @@
g_return_if_fail (GPK_IS_CLIENT (gclient));
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CUSTOM, pk_bitfield_value (GPK_CLIENT_DIALOG_WIDGET_PROGRESS_BAR));
gpk_client_dialog_set_title (gclient->priv->dialog, _("Signature required"));
gpk_client_dialog_set_image_status (gclient->priv->dialog, PK_STATUS_ENUM_SIG_CHECK);
- gpk_client_dialog_set_message (gclient->priv->dialog, "");
gpk_client_dialog_set_percentage (gclient->priv->dialog, 101);
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
if (gclient->priv->show_progress)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_CUSTOM, pk_bitfield_value (GPK_CLIENT_DIALOG_WIDGET_PROGRESS_BAR), 0);
+ gpk_client_dialog_present (gclient->priv->dialog);
widget = GTK_WIDGET (gpk_client_dialog_get_window (gclient->priv->dialog));
ret = gpk_client_signature_show (GTK_WINDOW (widget), package_id, repository_name, key_url, key_userid,
@@ -3187,8 +3205,8 @@
g_return_val_if_fail (GPK_IS_CLIENT (gclient), FALSE);
/* go back to the UI */
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
+ gpk_client_dialog_present_with_time (gclient->priv->dialog, 0);
gclient->priv->using_secondary_client = FALSE;
egg_debug ("trying to requeue install");
@@ -3281,7 +3299,6 @@
text = pk_common_get_role_text (gclient->priv->client_action);
gpk_client_dialog_set_title (gclient->priv->dialog, text);
g_free (text);
- gpk_client_dialog_set_help_id (gclient->priv->dialog, NULL);
/* coldplug */
ret = pk_client_get_status (gclient->priv->client_action, &status, NULL);
@@ -3338,9 +3355,10 @@
role == PK_ROLE_ENUM_SEARCH_FILE ||
role == PK_ROLE_ENUM_SEARCH_NAME ||
role == PK_ROLE_ENUM_GET_UPDATES)
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0, 0);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, 0);
else
- gpk_client_dialog_show_page (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING, 0);
+ gpk_client_dialog_setup (gclient->priv->dialog, GPK_CLIENT_DIALOG_PAGE_PROGRESS, GPK_CLIENT_DIALOG_PACKAGE_PADDING);
+ gpk_client_dialog_present (gclient->priv->dialog);
/* wait for an answer */
g_main_loop_run (gclient->priv->loop);
@@ -3587,6 +3605,10 @@
g_signal_connect (gclient->priv->dialog, "close",
G_CALLBACK (pk_client_button_close_cb), gclient);
+ /* map ISO639 to language names */
+ gclient->priv->language = gpk_language_new ();
+ gpk_language_populate (gclient->priv->language, NULL);
+
/* use gconf for session settings */
gclient->priv->gconf_client = gconf_client_get_default ();
@@ -3670,6 +3692,7 @@
g_object_unref (gclient->priv->gconf_client);
g_object_unref (gclient->priv->dialog);
g_object_unref (gclient->priv->vendor);
+ g_object_unref (gclient->priv->language);
g_main_loop_unref (gclient->priv->loop);
G_OBJECT_CLASS (gpk_client_parent_class)->finalize (object);
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Mon Dec 1 12:13:01 2008
@@ -56,7 +56,7 @@
screen_w = gdk_screen_get_width (screen);
screen_h = gdk_screen_get_height (screen);
if (screen_w < width || screen_h < height) {
- egg_error ("using small form factor mode as %ix%i and requested %ix%i",
+ egg_debug ("using small form factor mode as %ix%i and requested %ix%i",
screen_w, screen_h, width, height);
gtk_window_maximize (window);
return FALSE;
Modified: trunk/src/gpk-install-provide-file.c
==============================================================================
--- trunk/src/gpk-install-provide-file.c (original)
+++ trunk/src/gpk-install-provide-file.c Mon Dec 1 12:13:01 2008
@@ -60,10 +60,10 @@
g_thread_init (NULL);
g_type_init ();
- /* TRANSLATORS: program name, an application to install files that are provided by packages */
- g_set_application_name (_("File Provide Installer"));
- context = g_option_context_new ("gpk-install-filename");
- g_option_context_set_summary (context, _("File Provide Installer"));
+ /* TRANSLATORS: program name, an application to install a file that is needed by an application and is provided by packages */
+ g_set_application_name (_("Single File Installer"));
+ context = g_option_context_new ("gpk-install-provide-file");
+ g_option_context_set_summary (context, _("Single File Installer"));
g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
@@ -72,7 +72,7 @@
gtk_init (&argc, &argv);
/* TRANSLATORS: application name to pass to to the user if there are not enough privs */
- ret = gpk_check_privileged_user (_("Provide File Installer"), TRUE);
+ ret = gpk_check_privileged_user (_("Single File Installer"), TRUE);
if (!ret)
return 1;
Added: trunk/src/gpk-language.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-language.c Mon Dec 1 12:13:01 2008
@@ -0,0 +1,261 @@
+/* -*- 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 <string.h>
+#include <glib.h>
+
+#include "egg-debug.h"
+
+#include "gpk-language.h"
+
+static void gpk_language_class_init (GpkLanguageClass *klass);
+static void gpk_language_init (GpkLanguage *language);
+static void gpk_language_finalize (GObject *object);
+
+#define GPK_LANGUAGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_LANGUAGE, GpkLanguagePrivate))
+
+struct GpkLanguagePrivate
+{
+ GHashTable *hash;
+};
+
+G_DEFINE_TYPE (GpkLanguage, gpk_language, G_TYPE_OBJECT)
+
+/**
+ * gpk_language_parser_start_element:
+ **/
+static void
+gpk_language_parser_start_element (GMarkupParseContext *context, const gchar *element_name,
+ const gchar **attribute_names, const gchar **attribute_values,
+ gpointer user_data, GError **error)
+{
+ guint i, len;
+ const gchar *code1 = NULL;
+ const gchar *code2b = NULL;
+ const gchar *name = NULL;
+ GpkLanguage *language = user_data;
+
+ if (strcmp (element_name, "iso_639_entry") != 0)
+ return;
+
+ /* find data */
+ len = g_strv_length ((gchar**)attribute_names);
+ for (i=0; i<len; i++) {
+ if (strcmp (attribute_names[i], "iso_639_1_code") == 0)
+ code1 = attribute_values[i];
+ if (strcmp (attribute_names[i], "iso_639_2B_code") == 0)
+ code2b = attribute_values[i];
+ if (strcmp (attribute_names[i], "name") == 0)
+ name = attribute_values[i];
+ }
+
+ /* not valid entry */
+ if (name == NULL)
+ return;
+
+ /* add both to hash */
+ if (code1 != NULL)
+ g_hash_table_insert (language->priv->hash, g_strdup (code1), g_strdup (name));
+ if (code2b != NULL)
+ g_hash_table_insert (language->priv->hash, g_strdup (code2b), g_strdup (name));
+}
+
+/* trivial parser */
+static const GMarkupParser gpk_language_markup_parser =
+{
+ gpk_language_parser_start_element,
+ NULL, /* end_element */
+ NULL, /* characters */
+ NULL, /* passthrough */
+ NULL /* error */
+};
+
+/**
+ * gpk_language_populate:
+ *
+ * <iso_639_entry iso_639_2B_code="hun" iso_639_2T_code="hun" iso_639_1_code="hu" name="Hungarian" />
+ **/
+gboolean
+gpk_language_populate (GpkLanguage *language, GError **error)
+{
+ gboolean ret = FALSE;
+ gchar *contents = NULL;
+ gchar *filename;
+ gsize size;
+ GMarkupParseContext *context = NULL;
+
+ /* find filename */
+ filename = g_build_filename (DATADIR, "xml", "iso-codes", "iso_639.xml", NULL);
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ g_free (filename);
+ filename = g_build_filename ("/usr", "share", "xml", "iso-codes", "iso_639.xml", NULL);
+ }
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ if (error != NULL)
+ *error = g_error_new (1, 0, "cannot find source file : '%s'", filename);
+ goto out;
+ }
+
+ /* get contents */
+ ret = g_file_get_contents (filename, &contents, &size, error);
+ if (!ret)
+ goto out;
+
+ /* create parser */
+ context = g_markup_parse_context_new (&gpk_language_markup_parser, G_MARKUP_PREFIX_ERROR_POSITION, language, NULL);
+
+ /* parse data */
+ ret = g_markup_parse_context_parse (context, contents, (gssize) size, error);
+ if (!ret)
+ goto out;
+out:
+ if (context != NULL)
+ g_markup_parse_context_free (context);
+ g_free (filename);
+ g_free (contents);
+ return ret;
+}
+
+/**
+ * gpk_language_iso639_to_language:
+ **/
+gchar *
+gpk_language_iso639_to_language (GpkLanguage *language, const gchar *iso639)
+{
+ return g_strdup (g_hash_table_lookup (language->priv->hash, iso639));
+}
+
+/**
+ * gpk_language_finalize:
+ * @object: The object to finalize
+ **/
+static void
+gpk_language_finalize (GObject *object)
+{
+ GpkLanguage *language;
+
+ g_return_if_fail (GPK_IS_LANGUAGE (object));
+
+ language = GPK_LANGUAGE (object);
+
+ g_return_if_fail (language->priv != NULL);
+ g_hash_table_unref (language->priv->hash);
+
+ G_OBJECT_CLASS (gpk_language_parent_class)->finalize (object);
+}
+
+/**
+ * gpk_language_init:
+ * @language: This class instance
+ **/
+static void
+gpk_language_init (GpkLanguage *language)
+{
+ language->priv = GPK_LANGUAGE_GET_PRIVATE (language);
+ language->priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free);
+}
+
+/**
+ * gpk_language_class_init:
+ * @klass: The GpkLanguageClass
+ **/
+static void
+gpk_language_class_init (GpkLanguageClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = gpk_language_finalize;
+ g_type_class_add_private (klass, sizeof (GpkLanguagePrivate));
+}
+
+/**
+ * gpk_language_new:
+ *
+ * Return value: a new GpkLanguage object.
+ **/
+GpkLanguage *
+gpk_language_new (void)
+{
+ GpkLanguage *language;
+ language = g_object_new (GPK_TYPE_LANGUAGE, NULL);
+ return GPK_LANGUAGE (language);
+}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef EGG_TEST
+#include "egg-test.h"
+
+void
+gpk_language_test (EggTest *test)
+{
+ gboolean ret;
+ gchar *lang;
+ GError *error = NULL;
+ GpkLanguage *language = NULL;
+
+ if (!egg_test_start (test, "GpkLanguage"))
+ return;
+
+ /************************************************************/
+ egg_test_title (test, "get GpkLanguage object");
+ language = gpk_language_new ();
+ if (language != NULL)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "populate");
+ ret = gpk_language_populate (language, &error);
+ if (ret) {
+ egg_test_success (test, NULL);
+ } else {
+ egg_test_failed (test, "failed to load XML: %s", error->message);
+ g_error_free (error);
+ }
+
+ /************************************************************/
+ egg_test_title (test, "get data (present)");
+ lang = gpk_language_iso639_to_language (language, "en");
+ if (lang != NULL && strcmp (lang, "English") == 0)
+ egg_test_success (test, "got %s", lang);
+ else
+ egg_test_failed (test, NULL);
+ g_free (lang);
+
+ /************************************************************/
+ egg_test_title (test, "get data (missing)");
+ lang = gpk_language_iso639_to_language (language, "XxX");
+ if (lang == NULL)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "got %s", lang);
+ g_free (lang);
+
+ g_object_unref (language);
+
+ egg_test_end (test);
+}
+#endif
+
Added: trunk/src/gpk-language.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-language.h Mon Dec 1 12:13:01 2008
@@ -0,0 +1,60 @@
+/* -*- 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_LANGUAGE_H
+#define __GPK_LANGUAGE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GPK_TYPE_LANGUAGE (gpk_language_get_type ())
+#define GPK_LANGUAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPK_TYPE_LANGUAGE, GpkLanguage))
+#define GPK_LANGUAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPK_TYPE_LANGUAGE, GpkLanguageClass))
+#define GPK_IS_LANGUAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPK_TYPE_LANGUAGE))
+#define GPK_IS_LANGUAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPK_TYPE_LANGUAGE))
+#define GPK_LANGUAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPK_TYPE_LANGUAGE, GpkLanguageClass))
+#define GPK_LANGUAGE_ERROR (gpk_language_error_quark ())
+#define GPK_LANGUAGE_TYPE_ERROR (gpk_language_error_get_type ())
+
+typedef struct GpkLanguagePrivate GpkLanguagePrivate;
+
+typedef struct
+{
+ GObject parent;
+ GpkLanguagePrivate *priv;
+} GpkLanguage;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} GpkLanguageClass;
+
+GType gpk_language_get_type (void) G_GNUC_CONST;
+GpkLanguage *gpk_language_new (void);
+gboolean gpk_language_populate (GpkLanguage *language,
+ GError **error);
+gchar *gpk_language_iso639_to_language (GpkLanguage *language,
+ const gchar *iso639);
+
+G_END_DECLS
+
+#endif /* __GPK_LANGUAGE_H */
Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c (original)
+++ trunk/src/gpk-log.c Mon Dec 1 12:13:01 2008
@@ -52,7 +52,7 @@
static gchar *filter = NULL;
static PolKitGnomeAction *button_action = NULL;
static PkObjList *transactions = NULL;
-static PkObjList *tid_list = NULL;
+static GtkTreePath *path_global = NULL;
enum
{
@@ -64,10 +64,93 @@
GPK_LOG_COLUMN_ID,
GPK_LOG_COLUMN_USER,
GPK_LOG_COLUMN_TOOL,
+ GPK_LOG_COLUMN_ACTIVE,
GPK_LOG_COLUMN_LAST
};
/**
+ * gpk_log_find_iter_model_cb:
+ **/
+static gboolean
+gpk_log_find_iter_model_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, const gchar *id)
+{
+ gchar *id_tmp = NULL;
+ gtk_tree_model_get (model, iter, GPK_LOG_COLUMN_ID, &id_tmp, -1);
+ if (strcmp (id_tmp, id) == 0) {
+ path_global = gtk_tree_path_copy (path);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * gpk_log_mark_nonactive_cb:
+ **/
+static gboolean
+gpk_log_mark_nonactive_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+{
+ gtk_list_store_set (GTK_LIST_STORE(model), iter, GPK_LOG_COLUMN_ACTIVE, FALSE, -1);
+ return FALSE;
+}
+
+/**
+ * gpk_log_mark_nonactive:
+ **/
+static void
+gpk_log_mark_nonactive (GtkTreeModel *model)
+{
+ gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) gpk_log_mark_nonactive_cb, NULL);
+}
+
+/**
+ * gpk_log_remove_nonactive_cb:
+ **/
+static gboolean
+gpk_log_remove_nonactive_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gboolean *ret)
+{
+ gboolean active;
+ gtk_tree_model_get (model, iter, GPK_LOG_COLUMN_ACTIVE, &active, -1);
+ if (!active) {
+ *ret = TRUE;
+ gtk_list_store_remove (GTK_LIST_STORE(model), iter);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * gpk_log_remove_nonactive:
+ **/
+static void
+gpk_log_remove_nonactive (GtkTreeModel *model)
+{
+ gboolean ret;
+ /* do this again and again as removing in gtk_tree_model_foreach causes errors */
+ do {
+ ret = FALSE;
+ gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) gpk_log_remove_nonactive_cb, &ret);
+ } while (ret);
+}
+
+/**
+ * gpk_log_model_get_iter:
+ **/
+static gboolean
+gpk_log_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter, const gchar *id)
+{
+ gboolean ret = TRUE;
+ path_global = NULL;
+ gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) gpk_log_find_iter_model_cb, (gpointer) id);
+ if (path_global == NULL) {
+ gtk_list_store_append (GTK_LIST_STORE(model), iter);
+ } else {
+ ret = gtk_tree_model_get_iter (model, iter, path_global);
+ gtk_tree_path_free (path_global);
+ }
+ return ret;
+}
+
+/**
* gpk_log_button_help_cb:
**/
static void
@@ -414,6 +497,8 @@
const gchar *tool;
static guint count;
struct passwd *pw;
+ GtkTreeView *treeview = GTK_TREE_VIEW (glade_xml_get_widget (glade_xml, "treeview_simple"));
+ GtkTreeModel *model = gtk_tree_view_get_model (treeview);
/* put formatted text into treeview */
details = gpk_log_get_details_localised (obj->timespec, obj->data);
@@ -448,7 +533,7 @@
else
tool = obj->cmdline;
- gtk_list_store_append (list_store, &iter);
+ gpk_log_model_get_iter (model, &iter, obj->tid);
gtk_list_store_set (list_store, &iter,
GPK_LOG_COLUMN_ICON, icon_name,
GPK_LOG_COLUMN_TIMESPEC, obj->timespec,
@@ -457,10 +542,8 @@
GPK_LOG_COLUMN_DETAILS, details,
GPK_LOG_COLUMN_ID, obj->tid,
GPK_LOG_COLUMN_USER, username,
- GPK_LOG_COLUMN_TOOL, tool, -1);
-
- /* add to db */
- pk_obj_list_add (tid_list, obj->tid);
+ GPK_LOG_COLUMN_TOOL, tool,
+ GPK_LOG_COLUMN_ACTIVE, TRUE, -1);
/* spin the gui */
if (count++ % 10 == 0)
@@ -473,33 +556,6 @@
}
/**
- * gpk_log_remove_obj
- **/
-static void
-gpk_log_remove_obj (const PkTransactionObj *obj)
-{
- gchar *id;
- GtkTreeIter iter;
- gboolean ret;
-
- /* remove from db */
- pk_obj_list_remove (tid_list, obj->tid);
-
- /* find the tid in the existing list */
- ret = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter);
- while (ret) {
- gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter, GPK_LOG_COLUMN_ID, &id, -1);
- if (g_strcmp0 (id, obj->tid) == 0) {
- gtk_list_store_remove (list_store, &iter);
- g_free (id);
- break;
- }
- g_free (id);
- ret = gtk_tree_model_iter_next (GTK_TREE_MODEL (list_store), &iter);
- }
-}
-
-/**
* gpk_log_refilter
**/
static void
@@ -507,10 +563,11 @@
{
guint i;
gboolean ret;
- gboolean in_list;
const PkTransactionObj *obj;
GtkWidget *widget;
const gchar *package;
+ GtkTreeView *treeview;
+ GtkTreeModel *model;
/* set the new filter */
g_free (filter);
@@ -523,18 +580,21 @@
egg_debug ("len=%i", transactions->len);
+ /* mark the items as not used */
+ treeview = GTK_TREE_VIEW (glade_xml_get_widget (glade_xml, "treeview_simple"));
+ model = gtk_tree_view_get_model (treeview);
+ gpk_log_mark_nonactive (model);
+
/* go through the list, adding and removing the items as required */
for (i=0; i<transactions->len; i++) {
obj = pk_obj_list_index (transactions, i);
-
ret = gpk_log_filter (obj);
- in_list = pk_obj_list_exists (tid_list, obj->tid);
- if (ret && !in_list)
+ if (ret)
gpk_log_add_obj (obj);
- if (!ret && in_list)
- gpk_log_remove_obj (obj);
}
+ /* remove the items that are not used */
+ gpk_log_remove_nonactive (model);
}
/**
@@ -546,10 +606,6 @@
gboolean ret;
GError *error = NULL;
- /* clear old list */
- gtk_list_store_clear (list_store);
- pk_obj_list_clear (tid_list);
-
ret = pk_client_reset (client, &error);
if (!ret) {
egg_warning ("failed to reset client: %s", error->message);
@@ -644,12 +700,6 @@
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
- /* keep a list of added tid_list */
- tid_list = pk_obj_list_new ();
- pk_obj_list_set_compare (tid_list, (PkObjListCompareFunc) g_strcmp0);
- pk_obj_list_set_copy (tid_list, (PkObjListCopyFunc) g_strdup);
- pk_obj_list_set_free (tid_list, (PkObjListFreeFunc) g_free);
-
egg_debug_init (verbose);
gtk_init (&argc, &argv);
@@ -744,7 +794,7 @@
/* create list stores */
list_store = gtk_list_store_new (GPK_LOG_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
/* create transaction_id tree view */
widget = glade_xml_get_widget (glade_xml, "treeview_simple");
@@ -777,8 +827,6 @@
g_free (filter);
if (transactions != NULL)
g_object_unref (transactions);
- if (tid_list != NULL)
- g_object_unref (tid_list);
unique_out:
g_object_unref (egg_unique);
return 0;
Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c (original)
+++ trunk/src/gpk-repo.c Mon Dec 1 12:13:01 2008
@@ -49,16 +49,100 @@
static PkBitfield roles;
static GConfClient *gconf_client;
static gboolean show_details;
+static GtkTreePath *path_global = NULL;
enum
{
REPO_COLUMN_ENABLED,
REPO_COLUMN_TEXT,
REPO_COLUMN_ID,
+ REPO_COLUMN_ACTIVE,
REPO_COLUMN_LAST
};
/**
+ * gpk_repo_find_iter_model_cb:
+ **/
+static gboolean
+gpk_repo_find_iter_model_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, const gchar *repo_id)
+{
+ gchar *repo_id_tmp = NULL;
+ gtk_tree_model_get (model, iter, REPO_COLUMN_ID, &repo_id_tmp, -1);
+ if (strcmp (repo_id_tmp, repo_id) == 0) {
+ path_global = gtk_tree_path_copy (path);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * gpk_repo_mark_nonactive_cb:
+ **/
+static gboolean
+gpk_repo_mark_nonactive_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+{
+ gtk_list_store_set (GTK_LIST_STORE(model), iter, REPO_COLUMN_ACTIVE, FALSE, -1);
+ return FALSE;
+}
+
+/**
+ * gpk_repo_mark_nonactive:
+ **/
+static void
+gpk_repo_mark_nonactive (GtkTreeModel *model)
+{
+ gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) gpk_repo_mark_nonactive_cb, NULL);
+}
+
+/**
+ * gpk_repo_model_get_iter:
+ **/
+static gboolean
+gpk_repo_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter, const gchar *id)
+{
+ gboolean ret = TRUE;
+ path_global = NULL;
+ gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) gpk_repo_find_iter_model_cb, (gpointer) id);
+ if (path_global == NULL) {
+ gtk_list_store_append (GTK_LIST_STORE(model), iter);
+ } else {
+ ret = gtk_tree_model_get_iter (model, iter, path_global);
+ gtk_tree_path_free (path_global);
+ }
+ return ret;
+}
+
+/**
+ * gpk_repo_remove_nonactive_cb:
+ **/
+static gboolean
+gpk_repo_remove_nonactive_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gboolean *ret)
+{
+ gboolean active;
+ gtk_tree_model_get (model, iter, REPO_COLUMN_ACTIVE, &active, -1);
+ if (!active) {
+ *ret = TRUE;
+ gtk_list_store_remove (GTK_LIST_STORE(model), iter);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * gpk_repo_remove_nonactive:
+ **/
+static void
+gpk_repo_remove_nonactive (GtkTreeModel *model)
+{
+ gboolean ret;
+ /* do this again and again as removing in gtk_tree_model_foreach causes errors */
+ do {
+ ret = FALSE;
+ gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) gpk_repo_remove_nonactive_cb, &ret);
+ } while (ret);
+}
+
+/**
* pk_button_help_cb:
**/
static void
@@ -70,6 +154,7 @@
static void
pk_misc_installed_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
{
+ GtkWidget *widget;
GtkTreeModel *model = (GtkTreeModel *)data;
GtkTreeIter iter;
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
@@ -84,6 +169,10 @@
return;
}
+ /* set insensitive until we've done this */
+ widget = glade_xml_get_widget (glade_xml, "treeview_repo");
+ gtk_widget_set_sensitive (widget, FALSE);
+
/* get toggled iter */
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
@@ -109,7 +198,7 @@
}
/* set new value */
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, REPO_COLUMN_ENABLED, installed, -1);
+ gtk_list_store_set (GTK_LIST_STORE(model), &iter, REPO_COLUMN_ENABLED, installed, -1);
out:
/* clean up */
@@ -125,15 +214,19 @@
const gchar *description, gboolean enabled, gpointer data)
{
GtkTreeIter iter;
+ GtkTreeView *treeview = GTK_TREE_VIEW (glade_xml_get_widget (glade_xml, "treeview_repo"));
+ GtkTreeModel *model = gtk_tree_view_get_model (treeview);
egg_debug ("repo = %s:%s:%i", repo_id, description, enabled);
- gtk_list_store_append (list_store, &iter);
+ gpk_repo_model_get_iter (model, &iter, repo_id);
gtk_list_store_set (list_store, &iter,
REPO_COLUMN_ENABLED, enabled,
REPO_COLUMN_TEXT, description,
REPO_COLUMN_ID, repo_id,
+ REPO_COLUMN_ACTIVE, TRUE,
-1);
+
/* sort after each entry, which is okay as there shouldn't be many */
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(list_store), REPO_COLUMN_TEXT, GTK_SORT_ASCENDING);
}
@@ -157,7 +250,6 @@
"active", REPO_COLUMN_ENABLED, NULL);
gtk_tree_view_append_column (treeview, column);
-
/* column for text */
renderer = gtk_cell_renderer_text_new ();
/* TRANSLATORS: column for the source description */
@@ -179,8 +271,7 @@
/* This will only work in single or browse selection mode! */
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- gtk_tree_model_get (model, &iter,
- REPO_COLUMN_ID, &repo_id, -1);
+ gtk_tree_model_get (model, &iter, REPO_COLUMN_ID, &repo_id, -1);
egg_debug ("selected row is: %s", repo_id);
g_free (repo_id);
} else {
@@ -194,7 +285,18 @@
static void
gpk_repo_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpointer data)
{
- /* nothing? */
+ GtkTreeView *treeview;
+ GtkTreeModel *model;
+ GtkWidget *widget;
+
+ /* set sensitive now we've done this */
+ widget = glade_xml_get_widget (glade_xml, "treeview_repo");
+ gtk_widget_set_sensitive (widget, TRUE);
+
+ /* remove the items that are not used */
+ treeview = GTK_TREE_VIEW (glade_xml_get_widget (glade_xml, "treeview_repo"));
+ model = gtk_tree_view_get_model (treeview);
+ gpk_repo_remove_nonactive (model);
}
/**
@@ -248,21 +350,25 @@
gboolean ret;
GError *error = NULL;
PkBitfield filters;
+ GtkTreeView *treeview;
+ GtkTreeModel *model;
+
+ /* mark the items as not used */
+ treeview = GTK_TREE_VIEW (glade_xml_get_widget (glade_xml, "treeview_repo"));
+ model = gtk_tree_view_get_model (treeview);
+ gpk_repo_mark_nonactive (model);
egg_debug ("refreshing list");
- gtk_list_store_clear (list_store);
ret = pk_client_reset (client, &error);
if (!ret) {
egg_warning ("failed to reset client: %s", error->message);
g_error_free (error);
return;
}
-
- if (!show_details) {
+ if (!show_details)
filters = pk_bitfield_value (PK_FILTER_ENUM_NOT_DEVELOPMENT);
- } else {
+ else
filters = pk_bitfield_value (PK_FILTER_ENUM_NONE);
- }
ret = pk_client_get_repo_list (client, filters, &error);
if (!ret) {
egg_warning ("failed to get repo list: %s", error->message);
@@ -310,9 +416,8 @@
gchar *string1, gchar *string2,
gint int1, gint int2, gpointer user_data)
{
- if (egg_strequal (name, "image_animation")) {
+ if (egg_strequal (name, "image_animation"))
return gpk_animated_icon_new ();
- }
egg_warning ("name unknown='%s'", name);
return NULL;
}
@@ -344,9 +449,8 @@
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- if (! g_thread_supported ()) {
+ if (! g_thread_supported ())
g_thread_init (NULL);
- }
dbus_g_thread_init ();
g_type_init ();
@@ -361,16 +465,14 @@
/* TRANSLATORS: title to pass to to the user if there are not enough privs */
ret = gpk_check_privileged_user (_("Software source viewer"), TRUE);
- if (!ret) {
+ if (!ret)
return 1;
- }
/* are we already activated? */
egg_unique = egg_unique_new ();
ret = egg_unique_assign (egg_unique, "org.freedesktop.PackageKit.Repo");
- if (!ret) {
+ if (!ret)
goto unique_out;
- }
g_signal_connect (egg_unique, "activated",
G_CALLBACK (gpk_repo_activated_cb), NULL);
@@ -418,7 +520,7 @@
/* create list stores */
list_store = gtk_list_store_new (REPO_COLUMN_LAST, G_TYPE_BOOLEAN,
- G_TYPE_STRING, G_TYPE_STRING);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
/* create repo tree view */
widget = glade_xml_get_widget (glade_xml, "treeview_repo");
Modified: trunk/src/gpk-self-test.c
==============================================================================
--- trunk/src/gpk-self-test.c (original)
+++ trunk/src/gpk-self-test.c Mon Dec 1 12:13:01 2008
@@ -29,6 +29,7 @@
void egg_string_test (EggTest *test);
void egg_string_list_test (EggTest *test);
void gpk_dbus_test (EggTest *test);
+void gpk_language_test (EggTest *test);
void gpk_client_dialog_test (EggTest *test);
int
@@ -49,6 +50,7 @@
gpk_enum_test (test);
gpk_common_test (test);
// gpk_dbus_test (test);
+ gpk_language_test (test);
gpk_client_dialog_test (test);
return egg_test_finish (test);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]