gnome-packagekit r296 - in trunk: po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r296 - in trunk: po src
- Date: Fri, 19 Sep 2008 11:51:00 +0000 (UTC)
Author: rhughes
Date: Fri Sep 19 11:51:00 2008
New Revision: 296
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=296&view=rev
Log:
from git
Added:
trunk/src/gpk-enum.c
trunk/src/gpk-enum.h
Modified:
trunk/po/POTFILES.in
trunk/src/Makefile.am
trunk/src/gpk-application.c
trunk/src/gpk-auto-refresh.c
trunk/src/gpk-check-update.c
trunk/src/gpk-client-chooser.c
trunk/src/gpk-client-dialog.c
trunk/src/gpk-client-run.c
trunk/src/gpk-client-untrusted.c
trunk/src/gpk-client.c
trunk/src/gpk-common.c
trunk/src/gpk-common.h
trunk/src/gpk-dialog.c
trunk/src/gpk-interface.h
trunk/src/gpk-log.c
trunk/src/gpk-prefs.c
trunk/src/gpk-repo.c
trunk/src/gpk-self-test.c
trunk/src/gpk-update-viewer.c
trunk/src/gpk-watch.c
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Fri Sep 19 11:51:00 2008
@@ -31,6 +31,7 @@
src/gpk-client-run.c
src/gpk-client-signature.c
src/gpk-client-untrusted.c
+src/gpk-enum.c
src/gpk-common.c
src/gpk-consolekit.c
src/gpk-dialog.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Fri Sep 19 11:51:00 2008
@@ -51,6 +51,8 @@
egg-unique.h \
egg-dbus-monitor.c \
egg-dbus-monitor.h \
+ gpk-enum.c \
+ gpk-enum.h \
gpk-marshal.c \
gpk-marshal.h \
gpk-animated-icon.c \
@@ -183,6 +185,8 @@
gpk-prefs.c \
gpk-gnome.c \
gpk-gnome.h \
+ gpk-enum.c \
+ gpk-enum.h \
$(NULL)
gpk_prefs_LDADD = \
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Fri Sep 19 11:51:00 2008
@@ -32,9 +32,6 @@
#include <string.h>
#include <polkit-gnome/polkit-gnome.h>
-#include "egg-debug.h"
-#include "egg-string.h"
-
#include <pk-enum.h>
#include <pk-client.h>
#include <pk-control.h>
@@ -46,11 +43,14 @@
#include <pk-extra.h>
#include <pk-details-obj.h>
-#include <gpk-client.h>
-#include <gpk-common.h>
-#include <gpk-gnome.h>
-#include <gpk-error.h>
+#include "egg-debug.h"
+#include "egg-string.h"
+#include "gpk-client.h"
+#include "gpk-common.h"
+#include "gpk-gnome.h"
+#include "gpk-error.h"
+#include "gpk-enum.h"
#include "gpk-application.h"
#include "gpk-animated-icon.h"
#include "gpk-dialog.h"
Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c (original)
+++ trunk/src/gpk-auto-refresh.c Fri Sep 19 11:51:00 2008
@@ -42,6 +42,7 @@
#include "gpk-common.h"
#include "gpk-auto-refresh.h"
+#include "gpk-enum.h"
static void gpk_auto_refresh_class_init (GpkAutoRefreshClass *klass);
static void gpk_auto_refresh_init (GpkAutoRefresh *arefresh);
@@ -167,19 +168,19 @@
* or zero for never or no schema
**/
static guint
-gpk_auto_refresh_convert_frequency (PkFreqEnum freq)
+gpk_auto_refresh_convert_frequency (GpkFreqEnum freq)
{
- if (freq == PK_FREQ_ENUM_UNKNOWN) {
+ if (freq == GPK_FREQ_ENUM_UNKNOWN) {
egg_warning ("no schema");
return 0;
}
- if (freq == PK_FREQ_ENUM_NEVER)
+ if (freq == GPK_FREQ_ENUM_NEVER)
return 0;
- if (freq == PK_FREQ_ENUM_HOURLY)
+ if (freq == GPK_FREQ_ENUM_HOURLY)
return 60*60;
- if (freq == PK_FREQ_ENUM_DAILY)
+ if (freq == GPK_FREQ_ENUM_DAILY)
return 60*60*24;
- if (freq == PK_FREQ_ENUM_WEEKLY)
+ if (freq == GPK_FREQ_ENUM_WEEKLY)
return 60*60*24*7;
egg_warning ("unknown frequency enum");
return 0;
@@ -192,7 +193,7 @@
gpk_auto_refresh_convert_frequency_text (GpkAutoRefresh *arefresh, const gchar *key)
{
gchar *freq_text;
- PkFreqEnum freq;
+ GpkFreqEnum freq;
g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), 0);
@@ -204,7 +205,7 @@
}
/* convert to enum and get seconds */
- freq = pk_freq_enum_from_text (freq_text);
+ freq = gpk_freq_enum_from_text (freq_text);
g_free (freq_text);
return gpk_auto_refresh_convert_frequency (freq);
}
@@ -235,7 +236,7 @@
}
/* only do the refresh cache when the user is idle */
- if (arefresh->priv->session_idle == FALSE) {
+ if (!arefresh->priv->session_idle) {
egg_debug ("not when session active");
return FALSE;
}
@@ -250,7 +251,7 @@
/* get the time since the last refresh */
ret = pk_control_get_time_since_action (arefresh->priv->control,
PK_ROLE_ENUM_REFRESH_CACHE, &time, NULL);
- if (ret == FALSE) {
+ if (!ret) {
egg_warning ("failed to get last time");
return FALSE;
}
@@ -287,7 +288,7 @@
/* get the time since the last refresh */
ret = pk_control_get_time_since_action (arefresh->priv->control,
PK_ROLE_ENUM_GET_UPDATES, &time, NULL);
- if (ret == FALSE) {
+ if (!ret) {
egg_warning ("failed to get last time");
return FALSE;
}
@@ -324,7 +325,7 @@
/* get the time since the last refresh */
ret = pk_control_get_time_since_action (arefresh->priv->control,
PK_ROLE_ENUM_GET_DISTRO_UPGRADES, &time, NULL);
- if (ret == FALSE) {
+ if (!ret) {
egg_debug ("failed to get last time");
return FALSE;
}
@@ -348,19 +349,19 @@
g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
/* we shouldn't do this early in the session startup */
- if (arefresh->priv->session_delay == FALSE) {
+ if (!arefresh->priv->session_delay) {
egg_debug ("not when this early in the session");
return FALSE;
}
/* no point continuing if we have no network */
- if (arefresh->priv->network_active == FALSE) {
+ if (!arefresh->priv->network_active) {
egg_debug ("not when no network");
return FALSE;
}
/* we do this to get an icon at startup */
- if (arefresh->priv->sent_get_updates == FALSE) {
+ if (!arefresh->priv->sent_get_updates) {
gpk_auto_refresh_signal_get_updates (arefresh);
gpk_auto_refresh_maybe_get_upgrades (arefresh);
arefresh->priv->sent_get_updates = TRUE;
@@ -458,7 +459,7 @@
egg_debug ("polling check");
/* we have waited enough */
- if (arefresh->priv->session_delay == FALSE) {
+ if (!arefresh->priv->session_delay) {
egg_debug ("setting session delay TRUE");
arefresh->priv->session_delay = TRUE;
}
@@ -485,7 +486,7 @@
egg_debug ("gnome-power-manager connection-changed: %i", connected);
/* is this valid? */
- if (connected == FALSE) {
+ if (!connected) {
if (arefresh->priv->proxy_gpm != NULL) {
g_object_unref (arefresh->priv->proxy_gpm);
arefresh->priv->proxy_gpm = NULL;
@@ -536,7 +537,7 @@
egg_debug ("gnome-screensaver connection-changed: %i", connected);
/* is this valid? */
- if (connected == FALSE) {
+ if (!connected) {
if (arefresh->priv->proxy_gs != NULL) {
g_object_unref (arefresh->priv->proxy_gs);
arefresh->priv->proxy_gs = NULL;
@@ -641,12 +642,10 @@
g_object_unref (arefresh->priv->gconf_client);
/* only unref the proxies if they were ever set */
- if (arefresh->priv->proxy_gs != NULL) {
+ if (arefresh->priv->proxy_gs != NULL)
g_object_unref (arefresh->priv->proxy_gs);
- }
- if (arefresh->priv->proxy_gpm != NULL) {
+ if (arefresh->priv->proxy_gpm != NULL)
g_object_unref (arefresh->priv->proxy_gpm);
- }
G_OBJECT_CLASS (gpk_auto_refresh_parent_class)->finalize (object);
}
Modified: trunk/src/gpk-check-update.c
==============================================================================
--- trunk/src/gpk-check-update.c (original)
+++ trunk/src/gpk-check-update.c Fri Sep 19 11:51:00 2008
@@ -57,6 +57,7 @@
#include "gpk-auto-refresh.h"
#include "gpk-client.h"
#include "gpk-check-update.h"
+#include "gpk-enum.h"
static void gpk_check_update_class_init (GpkCheckUpdateClass *klass);
static void gpk_check_update_init (GpkCheckUpdate *cupdate);
@@ -116,9 +117,8 @@
gpk_check_update_show_preferences_cb (GtkMenuItem *item, GpkCheckUpdate *cupdate)
{
const gchar *command = "gpk-prefs";
- if (g_spawn_command_line_async (command, NULL) == FALSE) {
+ if (!g_spawn_command_line_async (command, NULL))
egg_warning ("Couldn't execute command: %s", command);
- }
}
/**
@@ -200,13 +200,12 @@
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n"
"02110-1301, USA.")
};
- const char *translators = _("translator-credits");
+ const char *translators = _("translator-credits");
char *license_trans;
/* Translators comment: put your own name here to appear in the about dialog. */
- if (!strcmp (translators, "translator-credits")) {
+ if (!strcmp (translators, "translator-credits"))
translators = NULL;
- }
license_trans = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n",
_(license[2]), "\n\n", _(license[3]), "\n", NULL);
@@ -277,9 +276,8 @@
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
gtk_status_icon_position_menu, status_icon,
button, timestamp);
- if (button == 0) {
+ if (button == 0)
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
- }
}
static gboolean gpk_check_update_query_updates (GpkCheckUpdate *cupdate);
@@ -336,9 +334,8 @@
gpk_check_update_menuitem_show_updates_cb (GtkMenuItem *item, gpointer data)
{
const gchar *command = "gpk-update-viewer";
- if (g_spawn_command_line_async (command, NULL) == FALSE) {
+ if (!g_spawn_command_line_async (command, NULL))
egg_warning ("Couldn't execute command: %s", command);
- }
}
/**
@@ -517,9 +514,8 @@
/* shortcut */
length = pk_package_list_get_size (list);
- if (length == 0) {
+ if (length == 0)
return PK_INFO_ENUM_UNKNOWN;
- }
/* add each status to a list */
for (i=0; i<length; i++) {
@@ -620,10 +616,10 @@
/**
* gpk_check_update_get_update_policy:
**/
-static PkUpdateEnum
+static GpkUpdateEnum
gpk_check_update_get_update_policy (GpkCheckUpdate *cupdate)
{
- PkUpdateEnum update;
+ GpkUpdateEnum update;
gchar *updates;
g_return_val_if_fail (GPK_IS_CHECK_UPDATE (cupdate), FALSE);
@@ -631,9 +627,9 @@
updates = gconf_client_get_string (cupdate->priv->gconf_client, GPK_CONF_AUTO_UPDATE, NULL);
if (updates == NULL) {
egg_warning ("'%s' gconf key is null!", GPK_CONF_AUTO_UPDATE);
- return PK_UPDATE_ENUM_UNKNOWN;
+ return GPK_UPDATE_ENUM_UNKNOWN;
}
- update = pk_update_enum_from_text (updates);
+ update = gpk_update_enum_from_text (updates);
g_free (updates);
return update;
}
@@ -651,7 +647,7 @@
gboolean ret = FALSE;
GString *status_security;
GString *status_tooltip;
- PkUpdateEnum update;
+ GpkUpdateEnum update;
GPtrArray *security_array;
const gchar *icon;
gchar *package_id;
@@ -724,7 +720,7 @@
/* do we do the automatic updates? */
update = gpk_check_update_get_update_policy (cupdate);
- if (update == PK_UPDATE_ENUM_UNKNOWN) {
+ if (update == GPK_UPDATE_ENUM_UNKNOWN) {
egg_warning ("policy unknown");
goto out;
}
@@ -743,13 +739,12 @@
gtk_status_icon_set_tooltip (GTK_STATUS_ICON (cupdate->priv->sicon), status_tooltip->str);
/* is policy none? */
- if (update == PK_UPDATE_ENUM_NONE) {
+ if (update == GPK_UPDATE_ENUM_NONE) {
egg_debug ("not updating as policy NONE");
/* do we warn the user? */
- if (security_array->len > 0) {
+ if (security_array->len > 0)
gpk_check_update_critical_updates_warning (cupdate, status_security->str, security_array);
- }
goto out;
}
@@ -758,14 +753,13 @@
if (!ret) {
egg_debug ("on battery so not doing update");
/* do we warn the user? */
- if (security_array->len > 0) {
+ if (security_array->len > 0)
gpk_check_update_critical_updates_warning (cupdate, status_security->str, security_array);
- }
goto out;
}
/* just do security updates */
- if (update == PK_UPDATE_ENUM_SECURITY) {
+ if (update == GPK_UPDATE_ENUM_SECURITY) {
if (security_array->len == 0) {
egg_debug ("policy security, but none available");
goto out;
@@ -784,7 +778,7 @@
}
/* just do everything */
- if (update == PK_UPDATE_ENUM_ALL) {
+ if (update == GPK_UPDATE_ENUM_ALL) {
egg_debug ("we should do the update automatically!");
gpk_client_set_interaction (cupdate->priv->gclient_update_system, GPK_CLIENT_INTERACT_NEVER);
g_idle_add ((GSourceFunc) gpk_check_update_update_system, cupdate);
@@ -824,9 +818,8 @@
egg_debug ("updates changed");
/* ignore our own updates */
- if (!cupdate->priv->get_updates_in_progress) {
+ if (!cupdate->priv->get_updates_in_progress)
g_idle_add ((GSourceFunc) gpk_check_update_query_updates_idle_cb, cupdate);
- }
}
/**
@@ -877,14 +870,12 @@
g_return_if_fail (GPK_IS_CHECK_UPDATE (cupdate));
/* got a cache, no need to poll */
- if (cupdate->priv->cache_okay) {
+ if (cupdate->priv->cache_okay)
return;
- }
/* already in progress, but not yet certified okay */
- if (cupdate->priv->cache_update_in_progress) {
+ if (cupdate->priv->cache_update_in_progress)
return;
- }
cupdate->priv->cache_update_in_progress = TRUE;
cupdate->priv->cache_okay = TRUE;
@@ -965,9 +956,8 @@
obj = (PkDistroUpgradeObj *) g_ptr_array_index (array, i);
g_string_append_printf (string, "%s (%s)\n", obj->name, pk_distro_upgrade_enum_to_text (obj->state));
}
- if (string->len != 0) {
+ if (string->len != 0)
g_string_set_size (string, string->len-1);
- }
/* do the bubble */
title = _("Distribution upgrades available");
Modified: trunk/src/gpk-client-chooser.c
==============================================================================
--- trunk/src/gpk-client-chooser.c (original)
+++ trunk/src/gpk-client-chooser.c Fri Sep 19 11:51:00 2008
@@ -39,6 +39,7 @@
#include "gpk-gnome.h"
#include "gpk-common.h"
+#include "gpk-enum.h"
static GtkListStore *list_store = NULL;
static gchar *package_id = NULL;
Modified: trunk/src/gpk-client-dialog.c
==============================================================================
--- trunk/src/gpk-client-dialog.c (original)
+++ trunk/src/gpk-client-dialog.c Fri Sep 19 11:51:00 2008
@@ -49,6 +49,7 @@
#include "gpk-client-dialog.h"
#include "gpk-common.h"
#include "gpk-gnome.h"
+#include "gpk-enum.h"
static void gpk_client_dialog_class_init (GpkClientDialogClass *klass);
static void gpk_client_dialog_init (GpkClientDialog *dialog);
Modified: trunk/src/gpk-client-run.c
==============================================================================
--- trunk/src/gpk-client-run.c (original)
+++ trunk/src/gpk-client-run.c Fri Sep 19 11:51:00 2008
@@ -38,6 +38,7 @@
#include "gpk-gnome.h"
#include "gpk-client.h"
#include "gpk-common.h"
+#include "gpk-enum.h"
static GtkListStore *list_store = NULL;
static gchar *full_path = NULL;
Modified: trunk/src/gpk-client-untrusted.c
==============================================================================
--- trunk/src/gpk-client-untrusted.c (original)
+++ trunk/src/gpk-client-untrusted.c Fri Sep 19 11:51:00 2008
@@ -28,11 +28,14 @@
#include <glade/glade.h>
#include <polkit-gnome/polkit-gnome.h>
-#include "egg-debug.h"
#include <pk-enum.h>
#include <pk-package-id.h>
+
+#include "egg-debug.h"
+
#include "gpk-gnome.h"
#include "gpk-common.h"
+#include "gpk-enum.h"
static gboolean retry_untrusted = FALSE;
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Fri Sep 19 11:51:00 2008
@@ -51,18 +51,19 @@
#include "egg-debug.h"
#include "egg-string.h"
-#include <gpk-client.h>
-#include <gpk-client-eula.h>
-#include <gpk-client-signature.h>
-#include <gpk-client-untrusted.h>
-#include <gpk-client-chooser.h>
-#include <gpk-common.h>
-#include <gpk-gnome.h>
-#include <gpk-error.h>
+#include "gpk-client.h"
+#include "gpk-client-eula.h"
+#include "gpk-client-signature.h"
+#include "gpk-client-untrusted.h"
+#include "gpk-client-chooser.h"
+#include "gpk-common.h"
+#include "gpk-gnome.h"
+#include "gpk-error.h"
#include "gpk-consolekit.h"
#include "gpk-animated-icon.h"
#include "gpk-client-dialog.h"
#include "gpk-dialog.h"
+#include "gpk-enum.h"
static void gpk_client_class_init (GpkClientClass *klass);
static void gpk_client_init (GpkClient *gclient);
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Fri Sep 19 11:51:00 2008
@@ -39,155 +39,10 @@
#include "egg-debug.h"
#include "egg-string.h"
+#include "gpk-enum.h"
#include "gpk-common.h"
#include "gpk-error.h"
-/* icon names */
-static PkEnumMatch enum_info_icon_name[] = {
- {PK_INFO_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
- {PK_INFO_ENUM_INSTALLED, "pk-package-installed"},
- {PK_INFO_ENUM_AVAILABLE, "pk-package-available"},
- {PK_INFO_ENUM_LOW, "pk-update-low"},
- {PK_INFO_ENUM_NORMAL, "pk-update-normal"},
- {PK_INFO_ENUM_IMPORTANT, "pk-update-high"},
- {PK_INFO_ENUM_SECURITY, "pk-update-security"},
- {PK_INFO_ENUM_BUGFIX, "pk-update-bugfix"},
- {PK_INFO_ENUM_ENHANCEMENT, "pk-update-enhancement"},
- {PK_INFO_ENUM_BLOCKED, "pk-package-blocked"},
- {PK_INFO_ENUM_DOWNLOADING, "pk-package-download"},
- {PK_INFO_ENUM_UPDATING, "pk-package-update"},
- {PK_INFO_ENUM_INSTALLING, "pk-package-add"},
- {PK_INFO_ENUM_REMOVING, "pk-package-delete"},
- {PK_INFO_ENUM_OBSOLETING, "pk-package-cleanup"},
- {PK_INFO_ENUM_CLEANUP, "pk-package-cleanup"},
- {PK_INFO_ENUM_COLLECTION_INSTALLED, "pk-collection-installed"},
- {PK_INFO_ENUM_COLLECTION_AVAILABLE, "pk-collection-available"},
- {0, NULL}
-};
-
-static PkEnumMatch enum_status_icon_name[] = {
- {PK_STATUS_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
- {PK_STATUS_ENUM_WAIT, "pk-wait"},
- {PK_STATUS_ENUM_SETUP, "pk-setup"},
- {PK_STATUS_ENUM_RUNNING, "pk-setup"},
- {PK_STATUS_ENUM_QUERY, "pk-package-search"},
- {PK_STATUS_ENUM_INFO, "pk-package-info"},
- {PK_STATUS_ENUM_REFRESH_CACHE, "pk-refresh-cache"},
- {PK_STATUS_ENUM_REMOVE, "pk-package-delete"},
- {PK_STATUS_ENUM_DOWNLOAD, "pk-package-download"},
- {PK_STATUS_ENUM_INSTALL, "pk-package-add"},
- {PK_STATUS_ENUM_UPDATE, "pk-package-update"},
- {PK_STATUS_ENUM_CLEANUP, "pk-package-cleanup"},
- {PK_STATUS_ENUM_OBSOLETE, "pk-package-cleanup"},
- {PK_STATUS_ENUM_DEP_RESOLVE, "pk-package-info"}, /* TODO: need better icon */
- {PK_STATUS_ENUM_ROLLBACK, "pk-package-info"}, /* TODO: need better icon */
- {PK_STATUS_ENUM_COMMIT, "pk-setup"}, /* TODO: need better icon */
- {PK_STATUS_ENUM_REQUEST, "pk-package-search"},
- {PK_STATUS_ENUM_FINISHED, "pk-package-cleanup"}, /* TODO: need better icon */
- {PK_STATUS_ENUM_CANCEL, "pk-package-cleanup"}, /* TODO: need better icon */
- {PK_STATUS_ENUM_DOWNLOAD_REPOSITORY, "pk-refresh-cache"},
- {PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST, "pk-refresh-cache"},
- {PK_STATUS_ENUM_DOWNLOAD_FILELIST, "pk-refresh-cache"},
- {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"},
- {PK_STATUS_ENUM_LOADING_CACHE, "pk-refresh-cache"},
- {0, NULL}
-};
-
-static PkEnumMatch enum_role_icon_name[] = {
- {PK_ROLE_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
- {PK_ROLE_ENUM_CANCEL, "process-stop.svg"},
- {PK_ROLE_ENUM_RESOLVE, "pk-package-search"},
- {PK_ROLE_ENUM_ROLLBACK, "pk-rollback"},
- {PK_ROLE_ENUM_GET_DEPENDS, "pk-package-info"},
- {PK_ROLE_ENUM_GET_UPDATE_DETAIL, "pk-package-info"},
- {PK_ROLE_ENUM_GET_DETAILS, "pk-package-info"},
- {PK_ROLE_ENUM_GET_REQUIRES, "pk-package-info"},
- {PK_ROLE_ENUM_GET_UPDATES, "pk-package-info"},
- {PK_ROLE_ENUM_SEARCH_DETAILS, "pk-package-search"},
- {PK_ROLE_ENUM_SEARCH_FILE, "pk-package-search"},
- {PK_ROLE_ENUM_SEARCH_GROUP, "pk-package-search"},
- {PK_ROLE_ENUM_SEARCH_NAME, "pk-package-search"},
- {PK_ROLE_ENUM_REFRESH_CACHE, "pk-refresh-cache"},
- {PK_ROLE_ENUM_REMOVE_PACKAGES, "pk-package-delete"},
- {PK_ROLE_ENUM_INSTALL_PACKAGES, "pk-package-add"},
- {PK_ROLE_ENUM_INSTALL_FILES, "pk-package-add"},
- {PK_ROLE_ENUM_UPDATE_PACKAGES, "pk-package-update"},
- {PK_ROLE_ENUM_SERVICE_PACK, "pk-package-update"},
- {PK_ROLE_ENUM_UPDATE_SYSTEM, "system-software-update"},
- {PK_ROLE_ENUM_GET_REPO_LIST, "pk-package-sources"},
- {PK_ROLE_ENUM_REPO_ENABLE, "pk-package-sources"},
- {PK_ROLE_ENUM_REPO_SET_DATA, "pk-package-sources"},
- {PK_ROLE_ENUM_INSTALL_SIGNATURE, "emblem-system"},
- {PK_ROLE_ENUM_GET_PACKAGES, "pk-package-search"},
- {0, NULL}
-};
-
-static PkEnumMatch enum_group_icon_name[] = {
- {PK_GROUP_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
- {PK_GROUP_ENUM_ACCESSIBILITY, "preferences-desktop-accessibility"},
- {PK_GROUP_ENUM_ACCESSORIES, "applications-accessories"},
- {PK_GROUP_ENUM_EDUCATION, "utilities-system-monitor"},
- {PK_GROUP_ENUM_GAMES, "applications-games"},
- {PK_GROUP_ENUM_GRAPHICS, "applications-graphics"},
- {PK_GROUP_ENUM_INTERNET, "applications-internet"},
- {PK_GROUP_ENUM_OFFICE, "applications-office"},
- {PK_GROUP_ENUM_OTHER, "applications-other"},
- {PK_GROUP_ENUM_PROGRAMMING, "applications-development"},
- {PK_GROUP_ENUM_MULTIMEDIA, "applications-multimedia"},
- {PK_GROUP_ENUM_SYSTEM, "applications-system"},
- {PK_GROUP_ENUM_DESKTOP_GNOME, "pk-desktop-gnome"},
- {PK_GROUP_ENUM_DESKTOP_KDE, "pk-desktop-kde"},
- {PK_GROUP_ENUM_DESKTOP_XFCE, "pk-desktop-xfce"},
- {PK_GROUP_ENUM_DESKTOP_OTHER, "user-desktop"},
- {PK_GROUP_ENUM_PUBLISHING, "accessories-dictionary"},
- {PK_GROUP_ENUM_SERVERS, "network-server"},
- {PK_GROUP_ENUM_FONTS, "preferences-desktop-font"},
- {PK_GROUP_ENUM_ADMIN_TOOLS, "system-lock-screen"},
- {PK_GROUP_ENUM_LEGACY, "media-floppy"},
- {PK_GROUP_ENUM_LOCALIZATION, "preferences-desktop-locale"},
- {PK_GROUP_ENUM_VIRTUALIZATION, "computer"},
- {PK_GROUP_ENUM_SECURITY, "network-wireless-encrypted"},
- {PK_GROUP_ENUM_POWER_MANAGEMENT, "battery"},
- {PK_GROUP_ENUM_COMMUNICATION, "folder-remote"},
- {PK_GROUP_ENUM_NETWORK, "network-wired"},
- {PK_GROUP_ENUM_MAPS, "applications-multimedia"},
- {PK_GROUP_ENUM_REPOS, "system-file-manager"},
- {PK_GROUP_ENUM_SCIENCE, "application-certificate"},
- {PK_GROUP_ENUM_DOCUMENTATION, "x-office-address-book"},
- {PK_GROUP_ENUM_ELECTRONICS, "video-display"},
- {PK_GROUP_ENUM_COLLECTIONS, "pk-collection-installed"},
- {0, NULL}
-};
-
-static PkEnumMatch enum_restart_icon_name[] = {
- {PK_RESTART_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
- {PK_RESTART_ENUM_NONE, "dialog-information"},
- {PK_RESTART_ENUM_SYSTEM, "dialog-error"},
- {PK_RESTART_ENUM_SESSION, "dialog-warning"},
- {PK_RESTART_ENUM_APPLICATION, "dialog-warning"},
- {0, NULL}
-};
-
-static PkEnumMatch enum_message_icon_name[] = {
- {PK_MESSAGE_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
- {PK_MESSAGE_ENUM_BROKEN_MIRROR, "dialog-error"},
- {PK_MESSAGE_ENUM_CONNECTION_REFUSED, "dialog-error"},
- {PK_MESSAGE_ENUM_PARAMETER_INVALID, "dialog-error"},
- {PK_MESSAGE_ENUM_PRIORITY_INVALID, "dialog-error"},
- {PK_MESSAGE_ENUM_BACKEND_ERROR, "dialog-error"},
- {PK_MESSAGE_ENUM_DAEMON_ERROR, "dialog-error"},
- {PK_MESSAGE_ENUM_CACHE_BEING_REBUILT, "dialog-information"},
- {PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE, "dialog-warning"},
- {PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS, "dialog-information"},
- {PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE,"dialog-error"},
- {PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED, "dialog-information"},
- {PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED, "dialog-information"},
- {0, NULL}
-};
-
/**
* gpk_size_to_si_size_text:
**/
@@ -200,24 +55,20 @@
frac = (gdouble) (long int) size;
/* first chunk */
- if (frac < 1024) {
+ if (frac < 1024)
return g_strdup_printf ("%li bytes", (long int) size);
- }
/* next chunk */
frac /= 1024.0;
- if (frac < 1024) {
+ if (frac < 1024)
return g_strdup_printf ("%.1lf kB", frac);
- }
/* next chunk */
frac /= 1024.0;
- if (frac < 1024) {
+ if (frac < 1024)
return g_strdup_printf ("%.1lf MB", frac);
- }
/* next chunk */
frac /= 1024.0;
- if (frac < 1024) {
+ if (frac < 1024)
return g_strdup_printf ("%.1lf GB", frac);
- }
/* no way.... */
egg_warning ("cannot have a file this large!");
return NULL;
@@ -248,12 +99,10 @@
}
/* some backends don't provide this */
- if (id->version != NULL) {
+ if (id->version != NULL)
g_string_append_printf (string, "-%s", id->version);
- }
- if (id->arch != NULL) {
+ if (id->arch != NULL)
g_string_append_printf (string, " (%s)", id->arch);
- }
text = g_string_free (string, FALSE);
return text;
@@ -291,9 +140,8 @@
GString *string;
string = g_string_new (id->name);
- if (id->version != NULL) {
+ if (id->version != NULL)
g_string_append_printf (string, "-%s", id->version);
- }
text = g_string_free (string, FALSE);
return text;
@@ -309,1082 +157,18 @@
PkPackageId *id;
/* pk_package_id_new_from_string can't accept NULL */
- if (package_id == NULL) {
+ if (package_id == NULL)
return NULL;
- }
id = pk_package_id_new_from_string (package_id);
- if (id == NULL) {
+ if (id == NULL)
package = g_strdup (package_id);
- } else {
+ else
package = g_strdup (id->name);
- }
pk_package_id_free (id);
return package;
}
/**
- * gpk_error_enum_to_localised_text:
- **/
-const gchar *
-gpk_error_enum_to_localised_text (PkErrorCodeEnum code)
-{
- const gchar *text = NULL;
- switch (code) {
- case PK_ERROR_ENUM_NO_NETWORK:
- text = _("No network connection available");
- break;
- case PK_ERROR_ENUM_NO_CACHE:
- text = _("No package cache is available.");
- break;
- case PK_ERROR_ENUM_OOM:
- text = _("Out of memory");
- break;
- case PK_ERROR_ENUM_CREATE_THREAD_FAILED:
- text = _("Failed to create a thread");
- break;
- case PK_ERROR_ENUM_NOT_SUPPORTED:
- text = _("Not supported by this backend");
- break;
- case PK_ERROR_ENUM_INTERNAL_ERROR:
- text = _("An internal system error has occurred");
- break;
- case PK_ERROR_ENUM_GPG_FAILURE:
- text = _("A security trust relationship is not present");
- break;
- case PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED:
- text = _("The package is not installed");
- break;
- case PK_ERROR_ENUM_PACKAGE_NOT_FOUND:
- text = _("The package was not found");
- break;
- case PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED:
- text = _("The package is already installed");
- break;
- case PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED:
- text = _("The package download failed");
- break;
- case PK_ERROR_ENUM_GROUP_NOT_FOUND:
- text = _("The group was not found");
- break;
- case PK_ERROR_ENUM_GROUP_LIST_INVALID:
- text = _("The group list was invalid");
- break;
- case PK_ERROR_ENUM_DEP_RESOLUTION_FAILED:
- text = _("Dependency resolution failed");
- break;
- case PK_ERROR_ENUM_FILTER_INVALID:
- text = _("Search filter was invalid");
- break;
- case PK_ERROR_ENUM_PACKAGE_ID_INVALID:
- text = _("The package identifier was not well formed");
- break;
- case PK_ERROR_ENUM_TRANSACTION_ERROR:
- text = _("Transaction error");
- break;
- case PK_ERROR_ENUM_REPO_NOT_FOUND:
- text = _("Repository name was not found");
- break;
- case PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE:
- text = _("Could not remove a protected system package");
- break;
- case PK_ERROR_ENUM_TRANSACTION_CANCELLED:
- text = _("The task was canceled");
- break;
- case PK_ERROR_ENUM_PROCESS_KILL:
- text = _("The task was forcibly canceled");
- break;
- case PK_ERROR_ENUM_FAILED_CONFIG_PARSING:
- text = _("Reading the config file failed");
- break;
- case PK_ERROR_ENUM_CANNOT_CANCEL:
- text = _("The task cannot be canceled");
- break;
- case PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE:
- text = _("Source packages cannot be installed");
- break;
- case PK_ERROR_ENUM_NO_LICENSE_AGREEMENT:
- text = _("The license agreement failed");
- break;
- case PK_ERROR_ENUM_FILE_CONFLICTS:
- text = _("Local file conflict between packages");
- break;
- case PK_ERROR_ENUM_PACKAGE_CONFLICTS:
- text = _("Packages are not compatible");
- break;
- case PK_ERROR_ENUM_REPO_NOT_AVAILABLE:
- text = _("Problem connecting to a software source");
- break;
- case PK_ERROR_ENUM_FAILED_INITIALIZATION:
- text = _("Failed to initialize");
- break;
- case PK_ERROR_ENUM_FAILED_FINALISE:
- text = _("Failed to finalise");
- break;
- case PK_ERROR_ENUM_CANNOT_GET_LOCK:
- text = _("Cannot get lock");
- break;
- case PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE:
- text = _("No packages to update");
- break;
- case PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG:
- text = _("Cannot write repository configuration");
- break;
- case PK_ERROR_ENUM_LOCAL_INSTALL_FAILED:
- text = _("Local install failed");
- break;
- case PK_ERROR_ENUM_BAD_GPG_SIGNATURE:
- text = _("Bad GPG signature");
- break;
- case PK_ERROR_ENUM_MISSING_GPG_SIGNATURE:
- text = _("Missing GPG signature");
- break;
- case PK_ERROR_ENUM_REPO_CONFIGURATION_ERROR:
- text = _("Repository configuration invalid");
- break;
- case PK_ERROR_ENUM_INVALID_PACKAGE_FILE:
- text = _("Invalid package file");
- break;
- case PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED:
- text = _("Package install blocked");
- break;
- case PK_ERROR_ENUM_PACKAGE_CORRUPT:
- text = _("Package is corrupt");
- break;
- case PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED:
- text = _("All packages are already installed");
- break;
- case PK_ERROR_ENUM_FILE_NOT_FOUND:
- text = _("The specified file could not be found");
- break;
- case PK_ERROR_ENUM_NO_MORE_MIRRORS_TO_TRY:
- text = _("No more mirrors are available");
- break;
- default:
- egg_warning ("Unknown error");
- }
- return text;
-}
-
-/**
- * gpk_error_enum_to_localised_message:
- **/
-const gchar *
-gpk_error_enum_to_localised_message (PkErrorCodeEnum code)
-{
- const gchar *text = NULL;
- switch (code) {
- case PK_ERROR_ENUM_NO_NETWORK:
- text = _("There is no network connection available.\n"
- "Please check your connection settings and try again");
- break;
- case PK_ERROR_ENUM_NO_CACHE:
- text = _("The package list needs to be rebuilt.\n"
- "This should have been done by the backend automatically.");
- break;
- case PK_ERROR_ENUM_OOM:
- text = _("The service that is responsible for handling user requests is out of memory.\n"
- "Please restart your computer.");
- break;
- case PK_ERROR_ENUM_CREATE_THREAD_FAILED:
- text = _("A thread could not be created to service the user request.");
- break;
- case PK_ERROR_ENUM_NOT_SUPPORTED:
- text = _("The action is not supported by this backend.\n"
- "Please report a bug at " GPK_BUGZILLA_URL " as this should not have happened.");
- break;
- case PK_ERROR_ENUM_INTERNAL_ERROR:
- text = _("A problem that we were not expecting has occurred.\n"
- "Please report this bug at " GPK_BUGZILLA_URL " with the error description.");
- break;
- case PK_ERROR_ENUM_GPG_FAILURE:
- text = _("A security trust relationship could not be made with software source.\n"
- "Please check your security settings.");
- break;
- case PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED:
- text = _("The package that is trying to be removed or updated is not already installed.");
- break;
- case PK_ERROR_ENUM_PACKAGE_NOT_FOUND:
- text = _("The package that is being modified was not found on your system or in any software source.");
- break;
- case PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED:
- text = _("The package that is trying to be installed is already installed.");
- break;
- case PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED:
- text = _("The package download failed.\n"
- "Please check your network connectivity.");
- break;
- case PK_ERROR_ENUM_GROUP_NOT_FOUND:
- text = _("The group type was not found.\n"
- "Please check your group list and try again.");
- break;
- case PK_ERROR_ENUM_GROUP_LIST_INVALID:
- text = _("The group list could not be loaded.\n"
- "Refreshing your cache may help, although this is normally a software "
- "source error.");
- break;
- case PK_ERROR_ENUM_DEP_RESOLUTION_FAILED:
- text = _("A package could not be found that allows the task to complete.\n"
- "More information is available in the detailed report.");
- break;
- case PK_ERROR_ENUM_FILTER_INVALID:
- text = _("The search filter was not correctly formed.");
- break;
- case PK_ERROR_ENUM_PACKAGE_ID_INVALID:
- text = _("The package identifier was not well formed when sent to the server.\n"
- "This normally indicates an internal error and should be reported.");
- break;
- case PK_ERROR_ENUM_TRANSACTION_ERROR:
- text = _("An unspecified task error has occurred.\n"
- "More information is available in the detailed report.");
- break;
- case PK_ERROR_ENUM_REPO_NOT_FOUND:
- text = _("The remote software source name was not found.\n"
- "You may need to enable an item in Software Sources");
- break;
- case PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE:
- text = _("Removing a protected system package is not allowed.");
- break;
- case PK_ERROR_ENUM_TRANSACTION_CANCELLED:
- text = _("The task was canceled successfully and no packages were changed.");
- break;
- case PK_ERROR_ENUM_PROCESS_KILL:
- text = _("The task was canceled successfully and no packages were changed.\n"
- "The backend did not exit cleanly.");
- break;
- case PK_ERROR_ENUM_FAILED_CONFIG_PARSING:
- text = _("The native package configuration file could not be opened.\n"
- "Please make sure configuration is valid.");
- break;
- case PK_ERROR_ENUM_CANNOT_CANCEL:
- text = _("The task is not safe to be canceled at this time.");
- break;
- case PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE:
- text = _("Source packages are not normally installed this way.\n"
- "Check the extension of the file you are trying to install.");
- break;
- case PK_ERROR_ENUM_NO_LICENSE_AGREEMENT:
- text = _("The license agreement was not agreed to.\n"
- "To use this software you have to accept the license.");
- break;
- case PK_ERROR_ENUM_FILE_CONFLICTS:
- text = _("Two packages provide the same file.\n"
- "This is usually due to mixing packages from different software sources.");
- break;
- case PK_ERROR_ENUM_PACKAGE_CONFLICTS:
- text = _("Multiple packages exist that are not compatible with each other.\n"
- "This is usually due to mixing packages from different software sources.");
- break;
- case PK_ERROR_ENUM_REPO_NOT_AVAILABLE:
- text = _("There was a (possibly temporary) problem connecting to a software source\n"
- "Please check the detailed error for further details.");
- break;
- case PK_ERROR_ENUM_FAILED_INITIALIZATION:
- text = _("Failed to initialize packaging backend.\n"
- "This may occur if other packaging tools are being used simultaneously.");
- break;
- case PK_ERROR_ENUM_FAILED_FINALISE:
- text = _("Failed to close down the backend instance.\n"
- "This error can normally be ignored.");
- break;
- case PK_ERROR_ENUM_CANNOT_GET_LOCK:
- text = _("Cannot get the exclusive lock on the packaging backend.\n"
- "Please close any other legacy packaging tools that may be open.");
- break;
- case PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE:
- text = _("None of the selected packages could be updated.");
- break;
- case PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG:
- text = _("The repository configuration could not be modified.");
- break;
- case PK_ERROR_ENUM_LOCAL_INSTALL_FAILED:
- text = _("Installing the local file failed.\n"
- "More information is available in the detailed report.");
- break;
- case PK_ERROR_ENUM_BAD_GPG_SIGNATURE:
- text = _("The package signature could not be verified.");
- break;
- case PK_ERROR_ENUM_MISSING_GPG_SIGNATURE:
- text = _("The package signature was missing and this package is untrusted.\n"
- "This package was not signed with a GPG key when created.");
- break;
- case PK_ERROR_ENUM_REPO_CONFIGURATION_ERROR:
- text = _("Repository configuration was invalid and could not be read.");
- break;
- case PK_ERROR_ENUM_INVALID_PACKAGE_FILE:
- text = _("The package you are attempting to install is not valid.\n"
- "The package file could be corrupt, or not a proper package.");
- break;
- 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;
- case PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED:
- text = _("All of the packages selected for install are already installed on the system.");
- break;
- case PK_ERROR_ENUM_FILE_NOT_FOUND:
- text = _("The specified file could not be found on the system.\n"
- "Check the file still exists and has not been deleted.");
- break;
- case PK_ERROR_ENUM_NO_MORE_MIRRORS_TO_TRY:
- text = _("Required data could not be found on any of the configured software sources.\n"
- "There were no more download mirrors that could be tried.");
- break;
- default:
- egg_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
- "More information is available in the detailed report.");
- }
- return text;
-}
-
-/**
- * gpk_restart_enum_to_localised_text_future:
- **/
-const gchar *
-gpk_restart_enum_to_localised_text_future (PkRestartEnum restart)
-{
- const gchar *text = NULL;
- switch (restart) {
- case PK_RESTART_ENUM_NONE:
- text = _("No restart is necessary for this update");
- break;
- case PK_RESTART_ENUM_APPLICATION:
- text = _("An application restart is required after this update");
- break;
- case PK_RESTART_ENUM_SESSION:
- text = _("You will be required to log off and back on after this update");
- break;
- case PK_RESTART_ENUM_SYSTEM:
- text = _("A system restart is required after this update");
- break;
- default:
- egg_warning ("restart unrecognised: %i", restart);
- }
- return text;
-}
-
-/**
- * gpk_restart_enum_to_localised_text:
- **/
-const gchar *
-gpk_restart_enum_to_localised_text (PkRestartEnum restart)
-{
- const gchar *text = NULL;
- switch (restart) {
- case PK_RESTART_ENUM_NONE:
- text = _("No restart is required");
- break;
- case PK_RESTART_ENUM_SYSTEM:
- text = _("A system restart is required");
- break;
- case PK_RESTART_ENUM_SESSION:
- text = _("You will need to log off and log back on");
- break;
- case PK_RESTART_ENUM_APPLICATION:
- text = _("You need to restart the application");
- break;
- default:
- egg_warning ("restart unrecognised: %i", restart);
- }
- return text;
-}
-
-/**
- * gpk_update_state_enum_to_localised_text:
- **/
-const gchar *
-gpk_update_state_enum_to_localised_text (PkUpdateStateEnum state)
-{
- const gchar *text = NULL;
- switch (state) {
- case PK_UPDATE_STATE_ENUM_STABLE:
- text = _("Stable");
- break;
- case PK_UPDATE_STATE_ENUM_UNSTABLE:
- text = _("Unstable");
- break;
- case PK_UPDATE_STATE_ENUM_TESTING:
- text = _("Testing");
- break;
- default:
- egg_warning ("state unrecognised: %i", state);
- }
- return text;
-}
-
-/**
- * gpk_message_enum_to_localised_text:
- **/
-const gchar *
-gpk_message_enum_to_localised_text (PkMessageEnum message)
-{
- const gchar *text = NULL;
- switch (message) {
- case PK_MESSAGE_ENUM_BROKEN_MIRROR:
- text = _("A mirror is possibly broken");
- break;
- case PK_MESSAGE_ENUM_CONNECTION_REFUSED:
- text = _("The connection was refused");
- break;
- case PK_MESSAGE_ENUM_PARAMETER_INVALID:
- text = _("The parameter was invalid");
- break;
- case PK_MESSAGE_ENUM_PRIORITY_INVALID:
- text = _("The priority was invalid");
- break;
- case PK_MESSAGE_ENUM_BACKEND_ERROR:
- text = _("Generic backend error");
- break;
- case PK_MESSAGE_ENUM_DAEMON_ERROR:
- text = _("Generic daemon error");
- break;
- case PK_MESSAGE_ENUM_CACHE_BEING_REBUILT:
- text = _("The package list cache is being rebuilt");
- break;
- case PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE:
- text = _("An untrusted package was installed");
- break;
- case PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS:
- text = _("A newer package exists");
- break;
- case PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE:
- text = _("Could not find package");
- break;
- case PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED:
- text = _("Configuration files were changed");
- break;
- case PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED:
- text = _("Package is already installed");
- break;
-
- default:
- egg_warning ("message unrecognised: %i", message);
- }
- return text;
-}
-
-/**
- * gpk_status_enum_to_localised_text:
- **/
-const gchar *
-gpk_status_enum_to_localised_text (PkStatusEnum status)
-{
- const gchar *text = NULL;
- switch (status) {
- case PK_STATUS_ENUM_UNKNOWN:
- text = _("Unknown state");
- break;
- case PK_STATUS_ENUM_SETUP:
- text = _("Waiting for service to start");
- break;
- case PK_STATUS_ENUM_WAIT:
- text = _("Waiting for other tasks");
- break;
- case PK_STATUS_ENUM_RUNNING:
- text = _("Running task");
- break;
- case PK_STATUS_ENUM_QUERY:
- text = _("Querying");
- break;
- case PK_STATUS_ENUM_INFO:
- text = _("Getting information");
- break;
- case PK_STATUS_ENUM_REMOVE:
- text = _("Removing");
- break;
- case PK_STATUS_ENUM_DOWNLOAD:
- text = _("Downloading");
- break;
- case PK_STATUS_ENUM_INSTALL:
- text = _("Installing");
- break;
- case PK_STATUS_ENUM_REFRESH_CACHE:
- text = _("Refreshing software list");
- break;
- case PK_STATUS_ENUM_UPDATE:
- text = _("Updating");
- break;
- case PK_STATUS_ENUM_CLEANUP:
- text = _("Cleaning up");
- break;
- case PK_STATUS_ENUM_OBSOLETE:
- text = _("Obsoleting");
- break;
- case PK_STATUS_ENUM_DEP_RESOLVE:
- text = _("Resolving dependencies");
- break;
- case PK_STATUS_ENUM_SIG_CHECK:
- text = _("Checking signatures");
- break;
- case PK_STATUS_ENUM_ROLLBACK:
- text = _("Rolling back");
- break;
- case PK_STATUS_ENUM_TEST_COMMIT:
- text = _("Testing changes");
- break;
- case PK_STATUS_ENUM_COMMIT:
- text = _("Committing changes");
- break;
- case PK_STATUS_ENUM_REQUEST:
- text = _("Requesting data");
- break;
- case PK_STATUS_ENUM_FINISHED:
- text = _("Finished");
- break;
- case PK_STATUS_ENUM_CANCEL:
- text = _("Cancelling");
- break;
- case PK_STATUS_ENUM_DOWNLOAD_REPOSITORY:
- text = _("Downloading repository information");
- break;
- case PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST:
- text = _("Downloading list of packages");
- break;
- case PK_STATUS_ENUM_DOWNLOAD_FILELIST:
- text = _("Downloading file lists");
- break;
- case PK_STATUS_ENUM_DOWNLOAD_CHANGELOG:
- text = _("Downloading lists of changes");
- break;
- case PK_STATUS_ENUM_DOWNLOAD_GROUP:
- text = _("Downloading groups");
- break;
- case PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO:
- text = _("Downloading update information");
- break;
- case PK_STATUS_ENUM_REPACKAGING:
- text = _("Repackaging files");
- break;
- case PK_STATUS_ENUM_LOADING_CACHE:
- text = _("Loading cache");
- break;
- default:
- egg_warning ("status unrecognised: %s", pk_status_enum_to_text (status));
- }
- return text;
-}
-
-/**
- * gpk_update_enum_to_localised_text:
- **/
-gchar *
-gpk_update_enum_to_localised_text (PkInfoEnum info, guint number)
-{
- gchar *text = NULL;
- switch (info) {
- case PK_INFO_ENUM_LOW:
- text = g_strdup_printf (ngettext ("%i trivial update", "%i trivial updates", number), number);
- break;
- case PK_INFO_ENUM_NORMAL:
- text = g_strdup_printf (ngettext ("%i update", "%i updates", number), number);
- break;
- case PK_INFO_ENUM_IMPORTANT:
- text = g_strdup_printf (ngettext ("%i important update", "%i important updates", number), number);
- break;
- case PK_INFO_ENUM_SECURITY:
- text = g_strdup_printf (ngettext ("%i security update", "%i security updates", number), number);
- break;
- case PK_INFO_ENUM_BUGFIX:
- text = g_strdup_printf (ngettext ("%i bug fix update", "%i bug fix updates", number), number);
- break;
- case PK_INFO_ENUM_ENHANCEMENT:
- text = g_strdup_printf (ngettext ("%i enhancement update", "%i enhancement updates", number), number);
- break;
- case PK_INFO_ENUM_BLOCKED:
- text = g_strdup_printf (ngettext ("%i blocked update", "%i blocked updates", number), number);
- break;
- default:
- egg_warning ("update info unrecognised: %s", pk_info_enum_to_text (info));
- }
- return text;
-}
-
-/**
- * gpk_info_enum_to_localised_text:
- **/
-const gchar *
-gpk_info_enum_to_localised_text (PkInfoEnum info)
-{
- const gchar *text = NULL;
- switch (info) {
- case PK_INFO_ENUM_LOW:
- text = _("Trivial update");
- break;
- case PK_INFO_ENUM_NORMAL:
- text = _("Update");
- break;
- case PK_INFO_ENUM_IMPORTANT:
- text = _("Important update");
- break;
- case PK_INFO_ENUM_SECURITY:
- text = _("Security update");
- break;
- case PK_INFO_ENUM_BUGFIX:
- text = _("Bug fix update");
- break;
- case PK_INFO_ENUM_ENHANCEMENT:
- text = _("Enhancement update");
- break;
- case PK_INFO_ENUM_BLOCKED:
- text = _("Blocked update");
- break;
- case PK_INFO_ENUM_INSTALLED:
- case PK_INFO_ENUM_COLLECTION_INSTALLED:
- text = _("Installed");
- break;
- case PK_INFO_ENUM_AVAILABLE:
- case PK_INFO_ENUM_COLLECTION_AVAILABLE:
- text = _("Available");
- break;
- default:
- egg_warning ("info unrecognised: %s", pk_info_enum_to_text (info));
- }
- return text;
-}
-
-/**
- * gpk_info_enum_to_localised_present:
- **/
-const gchar *
-gpk_info_enum_to_localised_present (PkInfoEnum info)
-{
- const gchar *text = NULL;
- switch (info) {
- case PK_INFO_ENUM_DOWNLOADING:
- text = _("Downloading");
- break;
- case PK_INFO_ENUM_UPDATING:
- text = _("Updating");
- break;
- case PK_INFO_ENUM_INSTALLING:
- text = _("Installing");
- break;
- case PK_INFO_ENUM_REMOVING:
- text = _("Removing");
- break;
- case PK_INFO_ENUM_CLEANUP:
- text = _("Cleaning up");
- break;
- case PK_INFO_ENUM_OBSOLETING:
- text = _("Obsoleting");
- break;
- default:
- egg_warning ("info unrecognised: %s", pk_info_enum_to_text (info));
- }
- return text;
-}
-
-/**
- * gpk_info_enum_to_localised_past:
- **/
-const gchar *
-gpk_info_enum_to_localised_past (PkInfoEnum info)
-{
- const gchar *text = NULL;
- switch (info) {
- case PK_INFO_ENUM_DOWNLOADING:
- text = _("Downloaded");
- break;
- case PK_INFO_ENUM_UPDATING:
- text = _("Updated");
- break;
- case PK_INFO_ENUM_INSTALLING:
- text = _("Installed");
- break;
- case PK_INFO_ENUM_REMOVING:
- text = _("Removed");
- break;
- case PK_INFO_ENUM_CLEANUP:
- text = _("Cleaned up");
- break;
- case PK_INFO_ENUM_OBSOLETING:
- text = _("Obsoleted");
- break;
- default:
- egg_warning ("info unrecognised: %s", pk_info_enum_to_text (info));
- }
- return text;
-}
-
-/**
- * gpk_role_enum_to_localised_present:
- **/
-const gchar *
-gpk_role_enum_to_localised_present (PkRoleEnum role)
-{
- const gchar *text = NULL;
- switch (role) {
- case PK_ROLE_ENUM_UNKNOWN:
- text = _("Unknown role type");
- break;
- case PK_ROLE_ENUM_GET_DEPENDS:
- text = _("Getting dependencies");
- break;
- case PK_ROLE_ENUM_GET_UPDATE_DETAIL:
- text = _("Getting update detail");
- break;
- case PK_ROLE_ENUM_GET_DETAILS:
- text = _("Getting details");
- break;
- case PK_ROLE_ENUM_GET_REQUIRES:
- text = _("Getting requires");
- break;
- case PK_ROLE_ENUM_GET_UPDATES:
- text = _("Getting updates");
- break;
- case PK_ROLE_ENUM_SEARCH_DETAILS:
- text = _("Searching details");
- break;
- case PK_ROLE_ENUM_SEARCH_FILE:
- text = _("Searching for file");
- break;
- case PK_ROLE_ENUM_SEARCH_GROUP:
- text = _("Searching groups");
- break;
- case PK_ROLE_ENUM_SEARCH_NAME:
- text = _("Searching for package name");
- break;
- case PK_ROLE_ENUM_REMOVE_PACKAGES:
- text = _("Removing");
- break;
- case PK_ROLE_ENUM_INSTALL_PACKAGES:
- text = _("Installing");
- break;
- case PK_ROLE_ENUM_INSTALL_FILES:
- text = _("Installing file");
- break;
- case PK_ROLE_ENUM_REFRESH_CACHE:
- text = _("Refreshing package cache");
- break;
- case PK_ROLE_ENUM_UPDATE_PACKAGES:
- text = _("Updating packages");
- break;
- case PK_ROLE_ENUM_UPDATE_SYSTEM:
- text = _("Updating system");
- break;
- case PK_ROLE_ENUM_CANCEL:
- text = _("Canceling");
- break;
- case PK_ROLE_ENUM_ROLLBACK:
- text = _("Rolling back");
- break;
- case PK_ROLE_ENUM_GET_REPO_LIST:
- text = _("Getting list of repositories");
- break;
- case PK_ROLE_ENUM_REPO_ENABLE:
- text = _("Enabling repository");
- break;
- case PK_ROLE_ENUM_REPO_SET_DATA:
- text = _("Setting repository data");
- break;
- case PK_ROLE_ENUM_RESOLVE:
- text = _("Resolving");
- break;
- case PK_ROLE_ENUM_GET_FILES:
- text = _("Getting file list");
- break;
- case PK_ROLE_ENUM_WHAT_PROVIDES:
- text = _("Getting what provides");
- break;
- case PK_ROLE_ENUM_SERVICE_PACK:
- text = _("Service pack");
- break;
- case PK_ROLE_ENUM_INSTALL_SIGNATURE:
- text = _("Installing signature");
- break;
- case PK_ROLE_ENUM_GET_PACKAGES:
- text = _("Getting package lists");
- break;
- case PK_ROLE_ENUM_ACCEPT_EULA:
- text = _("Accepting EULA");
- break;
- case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
- text = _("Downloading packages");
- break;
- case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
- text = _("Getting distribution upgrade information");
- break;
- default:
- egg_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
- }
- return text;
-}
-
-/**
- * gpk_role_enum_to_localised_past:
- *
- * These are past tense versions of the action
- **/
-const gchar *
-gpk_role_enum_to_localised_past (PkRoleEnum role)
-{
- const gchar *text = NULL;
- switch (role) {
- case PK_ROLE_ENUM_UNKNOWN:
- text = _("Unknown role type");
- break;
- case PK_ROLE_ENUM_GET_DEPENDS:
- text = _("Got dependencies");
- break;
- case PK_ROLE_ENUM_GET_UPDATE_DETAIL:
- text = _("Got update detail");
- break;
- case PK_ROLE_ENUM_GET_DETAILS:
- text = _("Got details");
- break;
- case PK_ROLE_ENUM_GET_REQUIRES:
- text = _("Got requires");
- break;
- case PK_ROLE_ENUM_GET_UPDATES:
- text = _("Got updates");
- break;
- case PK_ROLE_ENUM_SEARCH_DETAILS:
- text = _("Got details");
- break;
- case PK_ROLE_ENUM_SEARCH_FILE:
- text = _("Searched for file");
- break;
- case PK_ROLE_ENUM_SEARCH_GROUP:
- text = _("Searched groups");
- break;
- case PK_ROLE_ENUM_SEARCH_NAME:
- text = _("Searched for package name");
- break;
- case PK_ROLE_ENUM_REMOVE_PACKAGES:
- text = _("Removed package");
- break;
- case PK_ROLE_ENUM_INSTALL_PACKAGES:
- text = _("Installed package");
- break;
- case PK_ROLE_ENUM_INSTALL_FILES:
- text = _("Installed local file");
- break;
- case PK_ROLE_ENUM_SERVICE_PACK:
- text = _("Updating from service pack");
- break;
- case PK_ROLE_ENUM_REFRESH_CACHE:
- text = _("Refreshed package cache");
- break;
- case PK_ROLE_ENUM_UPDATE_PACKAGES:
- text = _("Updated package");
- break;
- case PK_ROLE_ENUM_UPDATE_SYSTEM:
- text = _("Updated system");
- break;
- case PK_ROLE_ENUM_CANCEL:
- text = _("Canceled");
- break;
- case PK_ROLE_ENUM_ROLLBACK:
- text = _("Rolled back");
- break;
- case PK_ROLE_ENUM_GET_REPO_LIST:
- text = _("Got list of repositories");
- break;
- case PK_ROLE_ENUM_REPO_ENABLE:
- text = _("Enabled repository");
- break;
- case PK_ROLE_ENUM_REPO_SET_DATA:
- text = _("Set repository data");
- break;
- case PK_ROLE_ENUM_RESOLVE:
- text = _("Resolved");
- break;
- case PK_ROLE_ENUM_GET_FILES:
- text = _("Got file list");
- break;
- case PK_ROLE_ENUM_WHAT_PROVIDES:
- text = _("Got what provides");
- break;
- case PK_ROLE_ENUM_INSTALL_SIGNATURE:
- text = _("Installed signature");
- break;
- case PK_ROLE_ENUM_GET_PACKAGES:
- text = _("Got package lists");
- break;
- case PK_ROLE_ENUM_ACCEPT_EULA:
- text = _("Accepted EULA");
- break;
- case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
- text = _("Downloaded packages");
- break;
- case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
- text = _("Got distribution upgrades");
- break;
- default:
- egg_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
- }
- return text;
-}
-
-/**
- * gpk_group_enum_to_localised_text:
- **/
-const gchar *
-gpk_group_enum_to_localised_text (PkGroupEnum group)
-{
- const gchar *text = NULL;
- switch (group) {
- case PK_GROUP_ENUM_ACCESSIBILITY:
- text = _("Accessibility");
- break;
- case PK_GROUP_ENUM_ACCESSORIES:
- text = _("Accessories");
- break;
- case PK_GROUP_ENUM_EDUCATION:
- text = _("Education");
- break;
- case PK_GROUP_ENUM_GAMES:
- text = _("Games");
- break;
- case PK_GROUP_ENUM_GRAPHICS:
- text = _("Graphics");
- break;
- case PK_GROUP_ENUM_INTERNET:
- text = _("Internet");
- break;
- case PK_GROUP_ENUM_OFFICE:
- text = _("Office");
- break;
- case PK_GROUP_ENUM_OTHER:
- text = _("Other");
- break;
- case PK_GROUP_ENUM_PROGRAMMING:
- text = _("Programming");
- break;
- case PK_GROUP_ENUM_MULTIMEDIA:
- text = _("Multimedia");
- break;
- case PK_GROUP_ENUM_SYSTEM:
- text = _("System");
- break;
- case PK_GROUP_ENUM_DESKTOP_GNOME:
- text = _("GNOME desktop");
- break;
- case PK_GROUP_ENUM_DESKTOP_KDE:
- text = _("KDE desktop");
- break;
- case PK_GROUP_ENUM_DESKTOP_XFCE:
- text = _("XFCE desktop");
- break;
- case PK_GROUP_ENUM_DESKTOP_OTHER:
- text = _("Other desktops");
- break;
- case PK_GROUP_ENUM_PUBLISHING:
- text = _("Publishing");
- break;
- case PK_GROUP_ENUM_SERVERS:
- text = _("Servers");
- break;
- case PK_GROUP_ENUM_FONTS:
- text = _("Fonts");
- break;
- case PK_GROUP_ENUM_ADMIN_TOOLS:
- text = _("Admin tools");
- break;
- case PK_GROUP_ENUM_LEGACY:
- text = _("Legacy");
- break;
- case PK_GROUP_ENUM_LOCALIZATION:
- text = _("Localization");
- break;
- case PK_GROUP_ENUM_VIRTUALIZATION:
- text = _("Virtualization");
- break;
- case PK_GROUP_ENUM_SECURITY:
- text = _("Security");
- break;
- case PK_GROUP_ENUM_POWER_MANAGEMENT:
- text = _("Power management");
- break;
- case PK_GROUP_ENUM_COMMUNICATION:
- text = _("Communication");
- break;
- case PK_GROUP_ENUM_NETWORK:
- text = _("Network");
- break;
- case PK_GROUP_ENUM_MAPS:
- text = _("Maps");
- break;
- case PK_GROUP_ENUM_REPOS:
- text = _("Software sources");
- break;
- case PK_GROUP_ENUM_SCIENCE:
- text = _("Science");
- break;
- case PK_GROUP_ENUM_DOCUMENTATION:
- text = _("Documentation");
- break;
- case PK_GROUP_ENUM_ELECTRONICS:
- text = _("Electronics");
- break;
- case PK_GROUP_ENUM_COLLECTIONS:
- text = _("Package collections");
- break;
- case PK_GROUP_ENUM_UNKNOWN:
- text = _("Unknown group");
- break;
- default:
- egg_warning ("group unrecognised: %i", group);
- }
- return text;
-}
-
-/**
- * gpk_info_enum_to_icon_name:
- **/
-const gchar *
-gpk_info_enum_to_icon_name (PkInfoEnum info)
-{
- return pk_enum_find_string (enum_info_icon_name, info);
-}
-
-/**
- * gpk_status_enum_to_icon_name:
- **/
-const gchar *
-gpk_status_enum_to_icon_name (PkStatusEnum status)
-{
- return pk_enum_find_string (enum_status_icon_name, status);
-}
-
-/**
- * gpk_role_enum_to_icon_name:
- **/
-const gchar *
-gpk_role_enum_to_icon_name (PkRoleEnum role)
-{
- return pk_enum_find_string (enum_role_icon_name, role);
-}
-
-/**
- * gpk_group_enum_to_icon_name:
- **/
-const gchar *
-gpk_group_enum_to_icon_name (PkGroupEnum group)
-{
- return pk_enum_find_string (enum_group_icon_name, group);
-}
-
-/**
- * gpk_restart_enum_to_icon_name:
- **/
-const gchar *
-gpk_restart_enum_to_icon_name (PkRestartEnum restart)
-{
- return pk_enum_find_string (enum_restart_icon_name, restart);
-}
-
-/**
- * gpk_message_enum_to_icon_name:
- **/
-const gchar *
-gpk_message_enum_to_icon_name (PkMessageEnum message)
-{
- return pk_enum_find_string (enum_message_icon_name, message);
-}
-
-/**
* gpk_check_privileged_user
**/
gboolean
@@ -1610,23 +394,22 @@
return g_strdup ("none");
/* try and get a print format */
- if (length == 1) {
+ if (length == 1)
return g_strdup (array[0]);
- } else if (length == 2) {
+ else if (length == 2)
return g_strdup_printf (_("%s and %s"),
array[0], array[1]);
- } else if (length == 3) {
+ else if (length == 3)
return g_strdup_printf (_("%s, %s and %s"),
array[0], array[1], array[2]);
- } else if (length == 4) {
+ else if (length == 4)
return g_strdup_printf (_("%s, %s, %s and %s"),
array[0], array[1],
array[2], array[3]);
- } else if (length == 5) {
+ else if (length == 5)
return g_strdup_printf (_("%s, %s, %s, %s and %s"),
array[0], array[1], array[2],
array[3], array[4]);
- }
return NULL;
}
@@ -1640,8 +423,6 @@
gpk_common_test (gpointer data)
{
gchar *text;
- guint i;
- const gchar *string;
PkPackageId *id;
EggTest *test = (EggTest *) data;
@@ -1653,11 +434,10 @@
************************************************************/
egg_test_title (test, "time zero");
text = gpk_time_to_localised_string (0);
- if (text != NULL && strcmp (text, _("Now")) == 0) {
+ if (text != NULL && strcmp (text, _("Now")) == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
@@ -1843,171 +623,6 @@
}
g_free (text);
- /************************************************************
- **************** localised enums **************
- ************************************************************/
- egg_test_title (test, "check we convert all the localised past role enums");
- for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
- string = gpk_role_enum_to_localised_past (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised present role enums");
- for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
- string = gpk_role_enum_to_localised_present (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the role icon name enums");
- for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
- string = gpk_role_enum_to_icon_name (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the info icon names enums");
- for (i=0; i<PK_INFO_ENUM_UNKNOWN; i++) {
- string = gpk_info_enum_to_icon_name (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised status enums");
- for (i=0; i<PK_STATUS_ENUM_UNKNOWN; i++) {
- string = gpk_status_enum_to_localised_text (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the status icon names enums");
- for (i=0; i<PK_STATUS_ENUM_UNKNOWN; i++) {
- string = gpk_status_enum_to_icon_name (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the restart icon names enums");
- for (i=0; i<PK_RESTART_ENUM_UNKNOWN; i++) {
- string = gpk_restart_enum_to_icon_name (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised error enums");
- for (i=0; i<PK_ERROR_ENUM_UNKNOWN; i++) {
- string = gpk_error_enum_to_localised_text (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %s", pk_error_enum_to_text(i));
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised error messages");
- for (i=0; i<PK_ERROR_ENUM_UNKNOWN; i++) {
- string = gpk_error_enum_to_localised_message (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %s", pk_error_enum_to_text(i));
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised restart enums");
- for (i=0; i<PK_RESTART_ENUM_UNKNOWN; i++) {
- string = gpk_restart_enum_to_localised_text (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the message icon name enums");
- for (i=0; i<PK_MESSAGE_ENUM_UNKNOWN; i++) {
- string = gpk_message_enum_to_icon_name (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised message enums");
- for (i=0; i<PK_MESSAGE_ENUM_UNKNOWN; i++) {
- string = gpk_message_enum_to_localised_text (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised restart future enums");
- for (i=0; i<PK_RESTART_ENUM_UNKNOWN; i++) {
- string = gpk_restart_enum_to_localised_text_future (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the localised group enums");
- for (i=0; i<PK_GROUP_ENUM_UNKNOWN; i++) {
- string = gpk_group_enum_to_localised_text (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
- egg_test_success (test, NULL);
-
- /************************************************************/
- egg_test_title (test, "check we convert all the group icon name enums");
- for (i=0; i<PK_GROUP_ENUM_UNKNOWN; i++) {
- string = gpk_group_enum_to_icon_name (i);
- if (string == NULL) {
- egg_test_failed (test, "failed to get %i", i);
- break;
- }
- }
egg_test_success (test, NULL);
egg_test_end (test);
Modified: trunk/src/gpk-common.h
==============================================================================
--- trunk/src/gpk-common.h (original)
+++ trunk/src/gpk-common.h Fri Sep 19 11:51:00 2008
@@ -69,6 +69,7 @@
#define GPK_ICON_SOFTWARE_UPDATE_AVAILABLE "software-update-available"
void gpk_common_test (gpointer data);
+gchar *gpk_size_to_si_size_text (guint64 size);
gchar *gpk_package_get_name (const gchar *package_id);
gchar *gpk_package_id_format_twoline (const PkPackageId *id,
const gchar *summary);
@@ -76,41 +77,6 @@
const gchar *summary);
gchar *gpk_package_id_name_version (const PkPackageId *id);
-const gchar *gpk_role_enum_to_localised_past (PkRoleEnum role)
- G_GNUC_CONST;
-const gchar *gpk_role_enum_to_localised_present (PkRoleEnum role)
- G_GNUC_CONST;
-const gchar *gpk_role_enum_to_icon_name (PkRoleEnum role);
-const gchar *gpk_info_enum_to_localised_text (PkInfoEnum info)
- G_GNUC_CONST;
-const gchar *gpk_info_enum_to_localised_past (PkInfoEnum info)
- G_GNUC_CONST;
-const gchar *gpk_info_enum_to_localised_present (PkInfoEnum info)
- G_GNUC_CONST;
-const gchar *gpk_info_enum_to_icon_name (PkInfoEnum info);
-const gchar *gpk_status_enum_to_localised_text (PkStatusEnum status)
- G_GNUC_CONST;
-const gchar *gpk_status_enum_to_icon_name (PkStatusEnum status);
-const gchar *gpk_restart_enum_to_icon_name (PkRestartEnum restart);
-const gchar *gpk_error_enum_to_localised_text (PkErrorCodeEnum code)
- G_GNUC_CONST;
-const gchar *gpk_error_enum_to_localised_message (PkErrorCodeEnum code);
-const gchar *gpk_restart_enum_to_localised_text (PkRestartEnum restart)
- G_GNUC_CONST;
-const gchar *gpk_update_state_enum_to_localised_text (PkUpdateStateEnum state)
- G_GNUC_CONST;
-const gchar *gpk_message_enum_to_icon_name (PkMessageEnum message);
-const gchar *gpk_message_enum_to_localised_text (PkMessageEnum message)
- G_GNUC_CONST;
-const gchar *gpk_restart_enum_to_localised_text_future(PkRestartEnum restart)
- G_GNUC_CONST;
-const gchar *gpk_group_enum_to_localised_text (PkGroupEnum group)
- G_GNUC_CONST;
-const gchar *gpk_group_enum_to_icon_name (PkGroupEnum group);
-gchar *gpk_size_to_si_size_text (guint64 size);
-gchar *gpk_update_enum_to_localised_text (PkInfoEnum info,
- guint number)
- G_GNUC_CONST;
gchar *gpk_time_to_localised_string (guint time_secs);
gchar **gpk_convert_argv_to_strv (gchar *argv[]);
gboolean gpk_check_privileged_user (const gchar *application_name);
Modified: trunk/src/gpk-dialog.c
==============================================================================
--- trunk/src/gpk-dialog.c (original)
+++ trunk/src/gpk-dialog.c Fri Sep 19 11:51:00 2008
@@ -36,6 +36,7 @@
#include "gpk-common.h"
#include "gpk-dialog.h"
+#include "gpk-enum.h"
enum {
GPK_DIALOG_STORE_IMAGE,
Added: trunk/src/gpk-enum.c
==============================================================================
--- (empty file)
+++ trunk/src/gpk-enum.c Fri Sep 19 11:51:00 2008
@@ -0,0 +1,1524 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <pk-enum.h>
+
+#include "egg-debug.h"
+#include "egg-string.h"
+
+#include "gpk-enum.h"
+#include "gpk-common.h"
+
+/* icon names */
+static PkEnumMatch enum_info_icon_name[] = {
+ {PK_INFO_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
+ {PK_INFO_ENUM_INSTALLED, "pk-package-installed"},
+ {PK_INFO_ENUM_AVAILABLE, "pk-package-available"},
+ {PK_INFO_ENUM_LOW, "pk-update-low"},
+ {PK_INFO_ENUM_NORMAL, "pk-update-normal"},
+ {PK_INFO_ENUM_IMPORTANT, "pk-update-high"},
+ {PK_INFO_ENUM_SECURITY, "pk-update-security"},
+ {PK_INFO_ENUM_BUGFIX, "pk-update-bugfix"},
+ {PK_INFO_ENUM_ENHANCEMENT, "pk-update-enhancement"},
+ {PK_INFO_ENUM_BLOCKED, "pk-package-blocked"},
+ {PK_INFO_ENUM_DOWNLOADING, "pk-package-download"},
+ {PK_INFO_ENUM_UPDATING, "pk-package-update"},
+ {PK_INFO_ENUM_INSTALLING, "pk-package-add"},
+ {PK_INFO_ENUM_REMOVING, "pk-package-delete"},
+ {PK_INFO_ENUM_OBSOLETING, "pk-package-cleanup"},
+ {PK_INFO_ENUM_CLEANUP, "pk-package-cleanup"},
+ {PK_INFO_ENUM_COLLECTION_INSTALLED, "pk-collection-installed"},
+ {PK_INFO_ENUM_COLLECTION_AVAILABLE, "pk-collection-available"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_status_icon_name[] = {
+ {PK_STATUS_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
+ {PK_STATUS_ENUM_WAIT, "pk-wait"},
+ {PK_STATUS_ENUM_SETUP, "pk-setup"},
+ {PK_STATUS_ENUM_RUNNING, "pk-setup"},
+ {PK_STATUS_ENUM_QUERY, "pk-package-search"},
+ {PK_STATUS_ENUM_INFO, "pk-package-info"},
+ {PK_STATUS_ENUM_REFRESH_CACHE, "pk-refresh-cache"},
+ {PK_STATUS_ENUM_REMOVE, "pk-package-delete"},
+ {PK_STATUS_ENUM_DOWNLOAD, "pk-package-download"},
+ {PK_STATUS_ENUM_INSTALL, "pk-package-add"},
+ {PK_STATUS_ENUM_UPDATE, "pk-package-update"},
+ {PK_STATUS_ENUM_CLEANUP, "pk-package-cleanup"},
+ {PK_STATUS_ENUM_OBSOLETE, "pk-package-cleanup"},
+ {PK_STATUS_ENUM_DEP_RESOLVE, "pk-package-info"}, /* TODO: need better icon */
+ {PK_STATUS_ENUM_ROLLBACK, "pk-package-info"}, /* TODO: need better icon */
+ {PK_STATUS_ENUM_COMMIT, "pk-setup"}, /* TODO: need better icon */
+ {PK_STATUS_ENUM_REQUEST, "pk-package-search"},
+ {PK_STATUS_ENUM_FINISHED, "pk-package-cleanup"}, /* TODO: need better icon */
+ {PK_STATUS_ENUM_CANCEL, "pk-package-cleanup"}, /* TODO: need better icon */
+ {PK_STATUS_ENUM_DOWNLOAD_REPOSITORY, "pk-refresh-cache"},
+ {PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST, "pk-refresh-cache"},
+ {PK_STATUS_ENUM_DOWNLOAD_FILELIST, "pk-refresh-cache"},
+ {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"},
+ {PK_STATUS_ENUM_LOADING_CACHE, "pk-refresh-cache"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_role_icon_name[] = {
+ {PK_ROLE_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
+ {PK_ROLE_ENUM_CANCEL, "process-stop.svg"},
+ {PK_ROLE_ENUM_RESOLVE, "pk-package-search"},
+ {PK_ROLE_ENUM_ROLLBACK, "pk-rollback"},
+ {PK_ROLE_ENUM_GET_DEPENDS, "pk-package-info"},
+ {PK_ROLE_ENUM_GET_UPDATE_DETAIL, "pk-package-info"},
+ {PK_ROLE_ENUM_GET_DETAILS, "pk-package-info"},
+ {PK_ROLE_ENUM_GET_REQUIRES, "pk-package-info"},
+ {PK_ROLE_ENUM_GET_UPDATES, "pk-package-info"},
+ {PK_ROLE_ENUM_SEARCH_DETAILS, "pk-package-search"},
+ {PK_ROLE_ENUM_SEARCH_FILE, "pk-package-search"},
+ {PK_ROLE_ENUM_SEARCH_GROUP, "pk-package-search"},
+ {PK_ROLE_ENUM_SEARCH_NAME, "pk-package-search"},
+ {PK_ROLE_ENUM_REFRESH_CACHE, "pk-refresh-cache"},
+ {PK_ROLE_ENUM_REMOVE_PACKAGES, "pk-package-delete"},
+ {PK_ROLE_ENUM_INSTALL_PACKAGES, "pk-package-add"},
+ {PK_ROLE_ENUM_INSTALL_FILES, "pk-package-add"},
+ {PK_ROLE_ENUM_UPDATE_PACKAGES, "pk-package-update"},
+ {PK_ROLE_ENUM_SERVICE_PACK, "pk-package-update"},
+ {PK_ROLE_ENUM_UPDATE_SYSTEM, "system-software-update"},
+ {PK_ROLE_ENUM_GET_REPO_LIST, "pk-package-sources"},
+ {PK_ROLE_ENUM_REPO_ENABLE, "pk-package-sources"},
+ {PK_ROLE_ENUM_REPO_SET_DATA, "pk-package-sources"},
+ {PK_ROLE_ENUM_INSTALL_SIGNATURE, "emblem-system"},
+ {PK_ROLE_ENUM_GET_PACKAGES, "pk-package-search"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_group_icon_name[] = {
+ {PK_GROUP_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
+ {PK_GROUP_ENUM_ACCESSIBILITY, "preferences-desktop-accessibility"},
+ {PK_GROUP_ENUM_ACCESSORIES, "applications-accessories"},
+ {PK_GROUP_ENUM_EDUCATION, "utilities-system-monitor"},
+ {PK_GROUP_ENUM_GAMES, "applications-games"},
+ {PK_GROUP_ENUM_GRAPHICS, "applications-graphics"},
+ {PK_GROUP_ENUM_INTERNET, "applications-internet"},
+ {PK_GROUP_ENUM_OFFICE, "applications-office"},
+ {PK_GROUP_ENUM_OTHER, "applications-other"},
+ {PK_GROUP_ENUM_PROGRAMMING, "applications-development"},
+ {PK_GROUP_ENUM_MULTIMEDIA, "applications-multimedia"},
+ {PK_GROUP_ENUM_SYSTEM, "applications-system"},
+ {PK_GROUP_ENUM_DESKTOP_GNOME, "pk-desktop-gnome"},
+ {PK_GROUP_ENUM_DESKTOP_KDE, "pk-desktop-kde"},
+ {PK_GROUP_ENUM_DESKTOP_XFCE, "pk-desktop-xfce"},
+ {PK_GROUP_ENUM_DESKTOP_OTHER, "user-desktop"},
+ {PK_GROUP_ENUM_PUBLISHING, "accessories-dictionary"},
+ {PK_GROUP_ENUM_SERVERS, "network-server"},
+ {PK_GROUP_ENUM_FONTS, "preferences-desktop-font"},
+ {PK_GROUP_ENUM_ADMIN_TOOLS, "system-lock-screen"},
+ {PK_GROUP_ENUM_LEGACY, "media-floppy"},
+ {PK_GROUP_ENUM_LOCALIZATION, "preferences-desktop-locale"},
+ {PK_GROUP_ENUM_VIRTUALIZATION, "computer"},
+ {PK_GROUP_ENUM_SECURITY, "network-wireless-encrypted"},
+ {PK_GROUP_ENUM_POWER_MANAGEMENT, "battery"},
+ {PK_GROUP_ENUM_COMMUNICATION, "folder-remote"},
+ {PK_GROUP_ENUM_NETWORK, "network-wired"},
+ {PK_GROUP_ENUM_MAPS, "applications-multimedia"},
+ {PK_GROUP_ENUM_REPOS, "system-file-manager"},
+ {PK_GROUP_ENUM_SCIENCE, "application-certificate"},
+ {PK_GROUP_ENUM_DOCUMENTATION, "x-office-address-book"},
+ {PK_GROUP_ENUM_ELECTRONICS, "video-display"},
+ {PK_GROUP_ENUM_COLLECTIONS, "pk-collection-installed"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_restart_icon_name[] = {
+ {PK_RESTART_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
+ {PK_RESTART_ENUM_NONE, "dialog-information"},
+ {PK_RESTART_ENUM_SYSTEM, "dialog-error"},
+ {PK_RESTART_ENUM_SESSION, "dialog-warning"},
+ {PK_RESTART_ENUM_APPLICATION, "dialog-warning"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_message_icon_name[] = {
+ {PK_MESSAGE_ENUM_UNKNOWN, "help-browser"}, /* fall though value */
+ {PK_MESSAGE_ENUM_BROKEN_MIRROR, "dialog-error"},
+ {PK_MESSAGE_ENUM_CONNECTION_REFUSED, "dialog-error"},
+ {PK_MESSAGE_ENUM_PARAMETER_INVALID, "dialog-error"},
+ {PK_MESSAGE_ENUM_PRIORITY_INVALID, "dialog-error"},
+ {PK_MESSAGE_ENUM_BACKEND_ERROR, "dialog-error"},
+ {PK_MESSAGE_ENUM_DAEMON_ERROR, "dialog-error"},
+ {PK_MESSAGE_ENUM_CACHE_BEING_REBUILT, "dialog-information"},
+ {PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE, "dialog-warning"},
+ {PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS, "dialog-information"},
+ {PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE,"dialog-error"},
+ {PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED, "dialog-information"},
+ {PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED, "dialog-information"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_freq[] = {
+ {GPK_FREQ_ENUM_UNKNOWN, "unknown"}, /* fall though value */
+ {GPK_FREQ_ENUM_HOURLY, "hourly"},
+ {GPK_FREQ_ENUM_DAILY, "daily"},
+ {GPK_FREQ_ENUM_WEEKLY, "weekly"},
+ {GPK_FREQ_ENUM_NEVER, "never"},
+ {0, NULL}
+};
+
+static PkEnumMatch enum_update[] = {
+ {GPK_UPDATE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
+ {GPK_UPDATE_ENUM_ALL, "all"},
+ {GPK_UPDATE_ENUM_SECURITY, "security"},
+ {GPK_UPDATE_ENUM_NONE, "none"},
+ {0, NULL}
+};
+
+/**
+ * gpk_freq_enum_from_text:
+ * @freq: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
+ **/
+GpkFreqEnum
+gpk_freq_enum_from_text (const gchar *freq)
+{
+ return pk_enum_find_value (enum_freq, freq);
+}
+
+/**
+ * gpk_freq_enum_to_text:
+ * @freq: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
+ **/
+const gchar *
+gpk_freq_enum_to_text (GpkFreqEnum freq)
+{
+ return pk_enum_find_string (enum_freq, freq);
+}
+
+/**
+ * gpk_update_enum_from_text:
+ * @update: Text describing the enumerated type
+ *
+ * Converts a text enumerated type to its unsigned integer representation
+ *
+ * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
+ **/
+GpkUpdateEnum
+gpk_update_enum_from_text (const gchar *update)
+{
+ return pk_enum_find_value (enum_update, update);
+}
+
+/**
+ * gpk_update_enum_to_text:
+ * @update: The enumerated type value
+ *
+ * Converts a enumerated type to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available"
+ **/
+const gchar *
+gpk_update_enum_to_text (GpkUpdateEnum update)
+{
+ return pk_enum_find_string (enum_update, update);
+}
+
+/**
+ * gpk_error_enum_to_localised_text:
+ **/
+const gchar *
+gpk_error_enum_to_localised_text (PkErrorCodeEnum code)
+{
+ const gchar *text = NULL;
+ switch (code) {
+ case PK_ERROR_ENUM_NO_NETWORK:
+ text = _("No network connection available");
+ break;
+ case PK_ERROR_ENUM_NO_CACHE:
+ text = _("No package cache is available.");
+ break;
+ case PK_ERROR_ENUM_OOM:
+ text = _("Out of memory");
+ break;
+ case PK_ERROR_ENUM_CREATE_THREAD_FAILED:
+ text = _("Failed to create a thread");
+ break;
+ case PK_ERROR_ENUM_NOT_SUPPORTED:
+ text = _("Not supported by this backend");
+ break;
+ case PK_ERROR_ENUM_INTERNAL_ERROR:
+ text = _("An internal system error has occurred");
+ break;
+ case PK_ERROR_ENUM_GPG_FAILURE:
+ text = _("A security trust relationship is not present");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED:
+ text = _("The package is not installed");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_NOT_FOUND:
+ text = _("The package was not found");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED:
+ text = _("The package is already installed");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED:
+ text = _("The package download failed");
+ break;
+ case PK_ERROR_ENUM_GROUP_NOT_FOUND:
+ text = _("The group was not found");
+ break;
+ case PK_ERROR_ENUM_GROUP_LIST_INVALID:
+ text = _("The group list was invalid");
+ break;
+ case PK_ERROR_ENUM_DEP_RESOLUTION_FAILED:
+ text = _("Dependency resolution failed");
+ break;
+ case PK_ERROR_ENUM_FILTER_INVALID:
+ text = _("Search filter was invalid");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_ID_INVALID:
+ text = _("The package identifier was not well formed");
+ break;
+ case PK_ERROR_ENUM_TRANSACTION_ERROR:
+ text = _("Transaction error");
+ break;
+ case PK_ERROR_ENUM_REPO_NOT_FOUND:
+ text = _("Repository name was not found");
+ break;
+ case PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE:
+ text = _("Could not remove a protected system package");
+ break;
+ case PK_ERROR_ENUM_TRANSACTION_CANCELLED:
+ text = _("The task was canceled");
+ break;
+ case PK_ERROR_ENUM_PROCESS_KILL:
+ text = _("The task was forcibly canceled");
+ break;
+ case PK_ERROR_ENUM_FAILED_CONFIG_PARSING:
+ text = _("Reading the config file failed");
+ break;
+ case PK_ERROR_ENUM_CANNOT_CANCEL:
+ text = _("The task cannot be canceled");
+ break;
+ case PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE:
+ text = _("Source packages cannot be installed");
+ break;
+ case PK_ERROR_ENUM_NO_LICENSE_AGREEMENT:
+ text = _("The license agreement failed");
+ break;
+ case PK_ERROR_ENUM_FILE_CONFLICTS:
+ text = _("Local file conflict between packages");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_CONFLICTS:
+ text = _("Packages are not compatible");
+ break;
+ case PK_ERROR_ENUM_REPO_NOT_AVAILABLE:
+ text = _("Problem connecting to a software source");
+ break;
+ case PK_ERROR_ENUM_FAILED_INITIALIZATION:
+ text = _("Failed to initialize");
+ break;
+ case PK_ERROR_ENUM_FAILED_FINALISE:
+ text = _("Failed to finalise");
+ break;
+ case PK_ERROR_ENUM_CANNOT_GET_LOCK:
+ text = _("Cannot get lock");
+ break;
+ case PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE:
+ text = _("No packages to update");
+ break;
+ case PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG:
+ text = _("Cannot write repository configuration");
+ break;
+ case PK_ERROR_ENUM_LOCAL_INSTALL_FAILED:
+ text = _("Local install failed");
+ break;
+ case PK_ERROR_ENUM_BAD_GPG_SIGNATURE:
+ text = _("Bad GPG signature");
+ break;
+ case PK_ERROR_ENUM_MISSING_GPG_SIGNATURE:
+ text = _("Missing GPG signature");
+ break;
+ case PK_ERROR_ENUM_REPO_CONFIGURATION_ERROR:
+ text = _("Repository configuration invalid");
+ break;
+ case PK_ERROR_ENUM_INVALID_PACKAGE_FILE:
+ text = _("Invalid package file");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_INSTALL_BLOCKED:
+ text = _("Package install blocked");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_CORRUPT:
+ text = _("Package is corrupt");
+ break;
+ case PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED:
+ text = _("All packages are already installed");
+ break;
+ case PK_ERROR_ENUM_FILE_NOT_FOUND:
+ text = _("The specified file could not be found");
+ break;
+ case PK_ERROR_ENUM_NO_MORE_MIRRORS_TO_TRY:
+ text = _("No more mirrors are available");
+ break;
+ default:
+ egg_warning ("Unknown error");
+ }
+ return text;
+}
+
+/**
+ * gpk_error_enum_to_localised_message:
+ **/
+const gchar *
+gpk_error_enum_to_localised_message (PkErrorCodeEnum code)
+{
+ const gchar *text = NULL;
+ switch (code) {
+ case PK_ERROR_ENUM_NO_NETWORK:
+ text = _("There is no network connection available.\n"
+ "Please check your connection settings and try again");
+ break;
+ case PK_ERROR_ENUM_NO_CACHE:
+ text = _("The package list needs to be rebuilt.\n"
+ "This should have been done by the backend automatically.");
+ break;
+ case PK_ERROR_ENUM_OOM:
+ text = _("The service that is responsible for handling user requests is out of memory.\n"
+ "Please restart your computer.");
+ break;
+ case PK_ERROR_ENUM_CREATE_THREAD_FAILED:
+ text = _("A thread could not be created to service the user request.");
+ break;
+ case PK_ERROR_ENUM_NOT_SUPPORTED:
+ text = _("The action is not supported by this backend.\n"
+ "Please report a bug at " GPK_BUGZILLA_URL " as this should not have happened.");
+ break;
+ case PK_ERROR_ENUM_INTERNAL_ERROR:
+ text = _("A problem that we were not expecting has occurred.\n"
+ "Please report this bug at " GPK_BUGZILLA_URL " with the error description.");
+ break;
+ case PK_ERROR_ENUM_GPG_FAILURE:
+ text = _("A security trust relationship could not be made with software source.\n"
+ "Please check your security settings.");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED:
+ text = _("The package that is trying to be removed or updated is not already installed.");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_NOT_FOUND:
+ text = _("The package that is being modified was not found on your system or in any software source.");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED:
+ text = _("The package that is trying to be installed is already installed.");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED:
+ text = _("The package download failed.\n"
+ "Please check your network connectivity.");
+ break;
+ case PK_ERROR_ENUM_GROUP_NOT_FOUND:
+ text = _("The group type was not found.\n"
+ "Please check your group list and try again.");
+ break;
+ case PK_ERROR_ENUM_GROUP_LIST_INVALID:
+ text = _("The group list could not be loaded.\n"
+ "Refreshing your cache may help, although this is normally a software "
+ "source error.");
+ break;
+ case PK_ERROR_ENUM_DEP_RESOLUTION_FAILED:
+ text = _("A package could not be found that allows the task to complete.\n"
+ "More information is available in the detailed report.");
+ break;
+ case PK_ERROR_ENUM_FILTER_INVALID:
+ text = _("The search filter was not correctly formed.");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_ID_INVALID:
+ text = _("The package identifier was not well formed when sent to the server.\n"
+ "This normally indicates an internal error and should be reported.");
+ break;
+ case PK_ERROR_ENUM_TRANSACTION_ERROR:
+ text = _("An unspecified task error has occurred.\n"
+ "More information is available in the detailed report.");
+ break;
+ case PK_ERROR_ENUM_REPO_NOT_FOUND:
+ text = _("The remote software source name was not found.\n"
+ "You may need to enable an item in Software Sources");
+ break;
+ case PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE:
+ text = _("Removing a protected system package is not allowed.");
+ break;
+ case PK_ERROR_ENUM_TRANSACTION_CANCELLED:
+ text = _("The task was canceled successfully and no packages were changed.");
+ break;
+ case PK_ERROR_ENUM_PROCESS_KILL:
+ text = _("The task was canceled successfully and no packages were changed.\n"
+ "The backend did not exit cleanly.");
+ break;
+ case PK_ERROR_ENUM_FAILED_CONFIG_PARSING:
+ text = _("The native package configuration file could not be opened.\n"
+ "Please make sure configuration is valid.");
+ break;
+ case PK_ERROR_ENUM_CANNOT_CANCEL:
+ text = _("The task is not safe to be canceled at this time.");
+ break;
+ case PK_ERROR_ENUM_CANNOT_INSTALL_SOURCE_PACKAGE:
+ text = _("Source packages are not normally installed this way.\n"
+ "Check the extension of the file you are trying to install.");
+ break;
+ case PK_ERROR_ENUM_NO_LICENSE_AGREEMENT:
+ text = _("The license agreement was not agreed to.\n"
+ "To use this software you have to accept the license.");
+ break;
+ case PK_ERROR_ENUM_FILE_CONFLICTS:
+ text = _("Two packages provide the same file.\n"
+ "This is usually due to mixing packages from different software sources.");
+ break;
+ case PK_ERROR_ENUM_PACKAGE_CONFLICTS:
+ text = _("Multiple packages exist that are not compatible with each other.\n"
+ "This is usually due to mixing packages from different software sources.");
+ break;
+ case PK_ERROR_ENUM_REPO_NOT_AVAILABLE:
+ text = _("There was a (possibly temporary) problem connecting to a software source\n"
+ "Please check the detailed error for further details.");
+ break;
+ case PK_ERROR_ENUM_FAILED_INITIALIZATION:
+ text = _("Failed to initialize packaging backend.\n"
+ "This may occur if other packaging tools are being used simultaneously.");
+ break;
+ case PK_ERROR_ENUM_FAILED_FINALISE:
+ text = _("Failed to close down the backend instance.\n"
+ "This error can normally be ignored.");
+ break;
+ case PK_ERROR_ENUM_CANNOT_GET_LOCK:
+ text = _("Cannot get the exclusive lock on the packaging backend.\n"
+ "Please close any other legacy packaging tools that may be open.");
+ break;
+ case PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE:
+ text = _("None of the selected packages could be updated.");
+ break;
+ case PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG:
+ text = _("The repository configuration could not be modified.");
+ break;
+ case PK_ERROR_ENUM_LOCAL_INSTALL_FAILED:
+ text = _("Installing the local file failed.\n"
+ "More information is available in the detailed report.");
+ break;
+ case PK_ERROR_ENUM_BAD_GPG_SIGNATURE:
+ text = _("The package signature could not be verified.");
+ break;
+ case PK_ERROR_ENUM_MISSING_GPG_SIGNATURE:
+ text = _("The package signature was missing and this package is untrusted.\n"
+ "This package was not signed with a GPG key when created.");
+ break;
+ case PK_ERROR_ENUM_REPO_CONFIGURATION_ERROR:
+ text = _("Repository configuration was invalid and could not be read.");
+ break;
+ case PK_ERROR_ENUM_INVALID_PACKAGE_FILE:
+ text = _("The package you are attempting to install is not valid.\n"
+ "The package file could be corrupt, or not a proper package.");
+ break;
+ 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;
+ case PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED:
+ text = _("All of the packages selected for install are already installed on the system.");
+ break;
+ case PK_ERROR_ENUM_FILE_NOT_FOUND:
+ text = _("The specified file could not be found on the system.\n"
+ "Check the file still exists and has not been deleted.");
+ break;
+ case PK_ERROR_ENUM_NO_MORE_MIRRORS_TO_TRY:
+ text = _("Required data could not be found on any of the configured software sources.\n"
+ "There were no more download mirrors that could be tried.");
+ break;
+ default:
+ egg_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
+ "More information is available in the detailed report.");
+ }
+ return text;
+}
+
+/**
+ * gpk_restart_enum_to_localised_text_future:
+ **/
+const gchar *
+gpk_restart_enum_to_localised_text_future (PkRestartEnum restart)
+{
+ const gchar *text = NULL;
+ switch (restart) {
+ case PK_RESTART_ENUM_NONE:
+ text = _("No restart is necessary for this update");
+ break;
+ case PK_RESTART_ENUM_APPLICATION:
+ text = _("An application restart is required after this update");
+ break;
+ case PK_RESTART_ENUM_SESSION:
+ text = _("You will be required to log off and back on after this update");
+ break;
+ case PK_RESTART_ENUM_SYSTEM:
+ text = _("A system restart is required after this update");
+ break;
+ default:
+ egg_warning ("restart unrecognised: %i", restart);
+ }
+ return text;
+}
+
+/**
+ * gpk_restart_enum_to_localised_text:
+ **/
+const gchar *
+gpk_restart_enum_to_localised_text (PkRestartEnum restart)
+{
+ const gchar *text = NULL;
+ switch (restart) {
+ case PK_RESTART_ENUM_NONE:
+ text = _("No restart is required");
+ break;
+ case PK_RESTART_ENUM_SYSTEM:
+ text = _("A system restart is required");
+ break;
+ case PK_RESTART_ENUM_SESSION:
+ text = _("You will need to log off and log back on");
+ break;
+ case PK_RESTART_ENUM_APPLICATION:
+ text = _("You need to restart the application");
+ break;
+ default:
+ egg_warning ("restart unrecognised: %i", restart);
+ }
+ return text;
+}
+
+/**
+ * gpk_update_state_enum_to_localised_text:
+ **/
+const gchar *
+gpk_update_state_enum_to_localised_text (PkUpdateStateEnum state)
+{
+ const gchar *text = NULL;
+ switch (state) {
+ case PK_UPDATE_STATE_ENUM_STABLE:
+ text = _("Stable");
+ break;
+ case PK_UPDATE_STATE_ENUM_UNSTABLE:
+ text = _("Unstable");
+ break;
+ case PK_UPDATE_STATE_ENUM_TESTING:
+ text = _("Testing");
+ break;
+ default:
+ egg_warning ("state unrecognised: %i", state);
+ }
+ return text;
+}
+
+/**
+ * gpk_message_enum_to_localised_text:
+ **/
+const gchar *
+gpk_message_enum_to_localised_text (PkMessageEnum message)
+{
+ const gchar *text = NULL;
+ switch (message) {
+ case PK_MESSAGE_ENUM_BROKEN_MIRROR:
+ text = _("A mirror is possibly broken");
+ break;
+ case PK_MESSAGE_ENUM_CONNECTION_REFUSED:
+ text = _("The connection was refused");
+ break;
+ case PK_MESSAGE_ENUM_PARAMETER_INVALID:
+ text = _("The parameter was invalid");
+ break;
+ case PK_MESSAGE_ENUM_PRIORITY_INVALID:
+ text = _("The priority was invalid");
+ break;
+ case PK_MESSAGE_ENUM_BACKEND_ERROR:
+ text = _("Generic backend error");
+ break;
+ case PK_MESSAGE_ENUM_DAEMON_ERROR:
+ text = _("Generic daemon error");
+ break;
+ case PK_MESSAGE_ENUM_CACHE_BEING_REBUILT:
+ text = _("The package list cache is being rebuilt");
+ break;
+ case PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE:
+ text = _("An untrusted package was installed");
+ break;
+ case PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS:
+ text = _("A newer package exists");
+ break;
+ case PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE:
+ text = _("Could not find package");
+ break;
+ case PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED:
+ text = _("Configuration files were changed");
+ break;
+ case PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED:
+ text = _("Package is already installed");
+ break;
+
+ default:
+ egg_warning ("message unrecognised: %i", message);
+ }
+ return text;
+}
+
+/**
+ * gpk_status_enum_to_localised_text:
+ **/
+const gchar *
+gpk_status_enum_to_localised_text (PkStatusEnum status)
+{
+ const gchar *text = NULL;
+ switch (status) {
+ case PK_STATUS_ENUM_UNKNOWN:
+ text = _("Unknown state");
+ break;
+ case PK_STATUS_ENUM_SETUP:
+ text = _("Waiting for service to start");
+ break;
+ case PK_STATUS_ENUM_WAIT:
+ text = _("Waiting for other tasks");
+ break;
+ case PK_STATUS_ENUM_RUNNING:
+ text = _("Running task");
+ break;
+ case PK_STATUS_ENUM_QUERY:
+ text = _("Querying");
+ break;
+ case PK_STATUS_ENUM_INFO:
+ text = _("Getting information");
+ break;
+ case PK_STATUS_ENUM_REMOVE:
+ text = _("Removing");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD:
+ text = _("Downloading");
+ break;
+ case PK_STATUS_ENUM_INSTALL:
+ text = _("Installing");
+ break;
+ case PK_STATUS_ENUM_REFRESH_CACHE:
+ text = _("Refreshing software list");
+ break;
+ case PK_STATUS_ENUM_UPDATE:
+ text = _("Updating");
+ break;
+ case PK_STATUS_ENUM_CLEANUP:
+ text = _("Cleaning up");
+ break;
+ case PK_STATUS_ENUM_OBSOLETE:
+ text = _("Obsoleting");
+ break;
+ case PK_STATUS_ENUM_DEP_RESOLVE:
+ text = _("Resolving dependencies");
+ break;
+ case PK_STATUS_ENUM_SIG_CHECK:
+ text = _("Checking signatures");
+ break;
+ case PK_STATUS_ENUM_ROLLBACK:
+ text = _("Rolling back");
+ break;
+ case PK_STATUS_ENUM_TEST_COMMIT:
+ text = _("Testing changes");
+ break;
+ case PK_STATUS_ENUM_COMMIT:
+ text = _("Committing changes");
+ break;
+ case PK_STATUS_ENUM_REQUEST:
+ text = _("Requesting data");
+ break;
+ case PK_STATUS_ENUM_FINISHED:
+ text = _("Finished");
+ break;
+ case PK_STATUS_ENUM_CANCEL:
+ text = _("Cancelling");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD_REPOSITORY:
+ text = _("Downloading repository information");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST:
+ text = _("Downloading list of packages");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD_FILELIST:
+ text = _("Downloading file lists");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD_CHANGELOG:
+ text = _("Downloading lists of changes");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD_GROUP:
+ text = _("Downloading groups");
+ break;
+ case PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO:
+ text = _("Downloading update information");
+ break;
+ case PK_STATUS_ENUM_REPACKAGING:
+ text = _("Repackaging files");
+ break;
+ case PK_STATUS_ENUM_LOADING_CACHE:
+ text = _("Loading cache");
+ break;
+ default:
+ egg_warning ("status unrecognised: %s", pk_status_enum_to_text (status));
+ }
+ return text;
+}
+
+/**
+ * gpk_update_enum_to_localised_text:
+ **/
+gchar *
+gpk_update_enum_to_localised_text (PkInfoEnum info, guint number)
+{
+ gchar *text = NULL;
+ switch (info) {
+ case PK_INFO_ENUM_LOW:
+ text = g_strdup_printf (ngettext ("%i trivial update", "%i trivial updates", number), number);
+ break;
+ case PK_INFO_ENUM_NORMAL:
+ text = g_strdup_printf (ngettext ("%i update", "%i updates", number), number);
+ break;
+ case PK_INFO_ENUM_IMPORTANT:
+ text = g_strdup_printf (ngettext ("%i important update", "%i important updates", number), number);
+ break;
+ case PK_INFO_ENUM_SECURITY:
+ text = g_strdup_printf (ngettext ("%i security update", "%i security updates", number), number);
+ break;
+ case PK_INFO_ENUM_BUGFIX:
+ text = g_strdup_printf (ngettext ("%i bug fix update", "%i bug fix updates", number), number);
+ break;
+ case PK_INFO_ENUM_ENHANCEMENT:
+ text = g_strdup_printf (ngettext ("%i enhancement update", "%i enhancement updates", number), number);
+ break;
+ case PK_INFO_ENUM_BLOCKED:
+ text = g_strdup_printf (ngettext ("%i blocked update", "%i blocked updates", number), number);
+ break;
+ default:
+ egg_warning ("update info unrecognised: %s", pk_info_enum_to_text (info));
+ }
+ return text;
+}
+
+/**
+ * gpk_info_enum_to_localised_text:
+ **/
+const gchar *
+gpk_info_enum_to_localised_text (PkInfoEnum info)
+{
+ const gchar *text = NULL;
+ switch (info) {
+ case PK_INFO_ENUM_LOW:
+ text = _("Trivial update");
+ break;
+ case PK_INFO_ENUM_NORMAL:
+ text = _("Update");
+ break;
+ case PK_INFO_ENUM_IMPORTANT:
+ text = _("Important update");
+ break;
+ case PK_INFO_ENUM_SECURITY:
+ text = _("Security update");
+ break;
+ case PK_INFO_ENUM_BUGFIX:
+ text = _("Bug fix update");
+ break;
+ case PK_INFO_ENUM_ENHANCEMENT:
+ text = _("Enhancement update");
+ break;
+ case PK_INFO_ENUM_BLOCKED:
+ text = _("Blocked update");
+ break;
+ case PK_INFO_ENUM_INSTALLED:
+ case PK_INFO_ENUM_COLLECTION_INSTALLED:
+ text = _("Installed");
+ break;
+ case PK_INFO_ENUM_AVAILABLE:
+ case PK_INFO_ENUM_COLLECTION_AVAILABLE:
+ text = _("Available");
+ break;
+ default:
+ egg_warning ("info unrecognised: %s", pk_info_enum_to_text (info));
+ }
+ return text;
+}
+
+/**
+ * gpk_info_enum_to_localised_present:
+ **/
+const gchar *
+gpk_info_enum_to_localised_present (PkInfoEnum info)
+{
+ const gchar *text = NULL;
+ switch (info) {
+ case PK_INFO_ENUM_DOWNLOADING:
+ text = _("Downloading");
+ break;
+ case PK_INFO_ENUM_UPDATING:
+ text = _("Updating");
+ break;
+ case PK_INFO_ENUM_INSTALLING:
+ text = _("Installing");
+ break;
+ case PK_INFO_ENUM_REMOVING:
+ text = _("Removing");
+ break;
+ case PK_INFO_ENUM_CLEANUP:
+ text = _("Cleaning up");
+ break;
+ case PK_INFO_ENUM_OBSOLETING:
+ text = _("Obsoleting");
+ break;
+ default:
+ egg_warning ("info unrecognised: %s", pk_info_enum_to_text (info));
+ }
+ return text;
+}
+
+/**
+ * gpk_info_enum_to_localised_past:
+ **/
+const gchar *
+gpk_info_enum_to_localised_past (PkInfoEnum info)
+{
+ const gchar *text = NULL;
+ switch (info) {
+ case PK_INFO_ENUM_DOWNLOADING:
+ text = _("Downloaded");
+ break;
+ case PK_INFO_ENUM_UPDATING:
+ text = _("Updated");
+ break;
+ case PK_INFO_ENUM_INSTALLING:
+ text = _("Installed");
+ break;
+ case PK_INFO_ENUM_REMOVING:
+ text = _("Removed");
+ break;
+ case PK_INFO_ENUM_CLEANUP:
+ text = _("Cleaned up");
+ break;
+ case PK_INFO_ENUM_OBSOLETING:
+ text = _("Obsoleted");
+ break;
+ default:
+ egg_warning ("info unrecognised: %s", pk_info_enum_to_text (info));
+ }
+ return text;
+}
+
+/**
+ * gpk_role_enum_to_localised_present:
+ **/
+const gchar *
+gpk_role_enum_to_localised_present (PkRoleEnum role)
+{
+ const gchar *text = NULL;
+ switch (role) {
+ case PK_ROLE_ENUM_UNKNOWN:
+ text = _("Unknown role type");
+ break;
+ case PK_ROLE_ENUM_GET_DEPENDS:
+ text = _("Getting dependencies");
+ break;
+ case PK_ROLE_ENUM_GET_UPDATE_DETAIL:
+ text = _("Getting update detail");
+ break;
+ case PK_ROLE_ENUM_GET_DETAILS:
+ text = _("Getting details");
+ break;
+ case PK_ROLE_ENUM_GET_REQUIRES:
+ text = _("Getting requires");
+ break;
+ case PK_ROLE_ENUM_GET_UPDATES:
+ text = _("Getting updates");
+ break;
+ case PK_ROLE_ENUM_SEARCH_DETAILS:
+ text = _("Searching details");
+ break;
+ case PK_ROLE_ENUM_SEARCH_FILE:
+ text = _("Searching for file");
+ break;
+ case PK_ROLE_ENUM_SEARCH_GROUP:
+ text = _("Searching groups");
+ break;
+ case PK_ROLE_ENUM_SEARCH_NAME:
+ text = _("Searching for package name");
+ break;
+ case PK_ROLE_ENUM_REMOVE_PACKAGES:
+ text = _("Removing");
+ break;
+ case PK_ROLE_ENUM_INSTALL_PACKAGES:
+ text = _("Installing");
+ break;
+ case PK_ROLE_ENUM_INSTALL_FILES:
+ text = _("Installing file");
+ break;
+ case PK_ROLE_ENUM_REFRESH_CACHE:
+ text = _("Refreshing package cache");
+ break;
+ case PK_ROLE_ENUM_UPDATE_PACKAGES:
+ text = _("Updating packages");
+ break;
+ case PK_ROLE_ENUM_UPDATE_SYSTEM:
+ text = _("Updating system");
+ break;
+ case PK_ROLE_ENUM_CANCEL:
+ text = _("Canceling");
+ break;
+ case PK_ROLE_ENUM_ROLLBACK:
+ text = _("Rolling back");
+ break;
+ case PK_ROLE_ENUM_GET_REPO_LIST:
+ text = _("Getting list of repositories");
+ break;
+ case PK_ROLE_ENUM_REPO_ENABLE:
+ text = _("Enabling repository");
+ break;
+ case PK_ROLE_ENUM_REPO_SET_DATA:
+ text = _("Setting repository data");
+ break;
+ case PK_ROLE_ENUM_RESOLVE:
+ text = _("Resolving");
+ break;
+ case PK_ROLE_ENUM_GET_FILES:
+ text = _("Getting file list");
+ break;
+ case PK_ROLE_ENUM_WHAT_PROVIDES:
+ text = _("Getting what provides");
+ break;
+ case PK_ROLE_ENUM_SERVICE_PACK:
+ text = _("Service pack");
+ break;
+ case PK_ROLE_ENUM_INSTALL_SIGNATURE:
+ text = _("Installing signature");
+ break;
+ case PK_ROLE_ENUM_GET_PACKAGES:
+ text = _("Getting package lists");
+ break;
+ case PK_ROLE_ENUM_ACCEPT_EULA:
+ text = _("Accepting EULA");
+ break;
+ case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
+ text = _("Downloading packages");
+ break;
+ case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
+ text = _("Getting distribution upgrade information");
+ break;
+ default:
+ egg_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
+ }
+ return text;
+}
+
+/**
+ * gpk_role_enum_to_localised_past:
+ *
+ * These are past tense versions of the action
+ **/
+const gchar *
+gpk_role_enum_to_localised_past (PkRoleEnum role)
+{
+ const gchar *text = NULL;
+ switch (role) {
+ case PK_ROLE_ENUM_UNKNOWN:
+ text = _("Unknown role type");
+ break;
+ case PK_ROLE_ENUM_GET_DEPENDS:
+ text = _("Got dependencies");
+ break;
+ case PK_ROLE_ENUM_GET_UPDATE_DETAIL:
+ text = _("Got update detail");
+ break;
+ case PK_ROLE_ENUM_GET_DETAILS:
+ text = _("Got details");
+ break;
+ case PK_ROLE_ENUM_GET_REQUIRES:
+ text = _("Got requires");
+ break;
+ case PK_ROLE_ENUM_GET_UPDATES:
+ text = _("Got updates");
+ break;
+ case PK_ROLE_ENUM_SEARCH_DETAILS:
+ text = _("Got details");
+ break;
+ case PK_ROLE_ENUM_SEARCH_FILE:
+ text = _("Searched for file");
+ break;
+ case PK_ROLE_ENUM_SEARCH_GROUP:
+ text = _("Searched groups");
+ break;
+ case PK_ROLE_ENUM_SEARCH_NAME:
+ text = _("Searched for package name");
+ break;
+ case PK_ROLE_ENUM_REMOVE_PACKAGES:
+ text = _("Removed package");
+ break;
+ case PK_ROLE_ENUM_INSTALL_PACKAGES:
+ text = _("Installed package");
+ break;
+ case PK_ROLE_ENUM_INSTALL_FILES:
+ text = _("Installed local file");
+ break;
+ case PK_ROLE_ENUM_SERVICE_PACK:
+ text = _("Updating from service pack");
+ break;
+ case PK_ROLE_ENUM_REFRESH_CACHE:
+ text = _("Refreshed package cache");
+ break;
+ case PK_ROLE_ENUM_UPDATE_PACKAGES:
+ text = _("Updated package");
+ break;
+ case PK_ROLE_ENUM_UPDATE_SYSTEM:
+ text = _("Updated system");
+ break;
+ case PK_ROLE_ENUM_CANCEL:
+ text = _("Canceled");
+ break;
+ case PK_ROLE_ENUM_ROLLBACK:
+ text = _("Rolled back");
+ break;
+ case PK_ROLE_ENUM_GET_REPO_LIST:
+ text = _("Got list of repositories");
+ break;
+ case PK_ROLE_ENUM_REPO_ENABLE:
+ text = _("Enabled repository");
+ break;
+ case PK_ROLE_ENUM_REPO_SET_DATA:
+ text = _("Set repository data");
+ break;
+ case PK_ROLE_ENUM_RESOLVE:
+ text = _("Resolved");
+ break;
+ case PK_ROLE_ENUM_GET_FILES:
+ text = _("Got file list");
+ break;
+ case PK_ROLE_ENUM_WHAT_PROVIDES:
+ text = _("Got what provides");
+ break;
+ case PK_ROLE_ENUM_INSTALL_SIGNATURE:
+ text = _("Installed signature");
+ break;
+ case PK_ROLE_ENUM_GET_PACKAGES:
+ text = _("Got package lists");
+ break;
+ case PK_ROLE_ENUM_ACCEPT_EULA:
+ text = _("Accepted EULA");
+ break;
+ case PK_ROLE_ENUM_DOWNLOAD_PACKAGES:
+ text = _("Downloaded packages");
+ break;
+ case PK_ROLE_ENUM_GET_DISTRO_UPGRADES:
+ text = _("Got distribution upgrades");
+ break;
+ default:
+ egg_warning ("role unrecognised: %s", pk_role_enum_to_text (role));
+ }
+ return text;
+}
+
+/**
+ * gpk_group_enum_to_localised_text:
+ **/
+const gchar *
+gpk_group_enum_to_localised_text (PkGroupEnum group)
+{
+ const gchar *text = NULL;
+ switch (group) {
+ case PK_GROUP_ENUM_ACCESSIBILITY:
+ text = _("Accessibility");
+ break;
+ case PK_GROUP_ENUM_ACCESSORIES:
+ text = _("Accessories");
+ break;
+ case PK_GROUP_ENUM_EDUCATION:
+ text = _("Education");
+ break;
+ case PK_GROUP_ENUM_GAMES:
+ text = _("Games");
+ break;
+ case PK_GROUP_ENUM_GRAPHICS:
+ text = _("Graphics");
+ break;
+ case PK_GROUP_ENUM_INTERNET:
+ text = _("Internet");
+ break;
+ case PK_GROUP_ENUM_OFFICE:
+ text = _("Office");
+ break;
+ case PK_GROUP_ENUM_OTHER:
+ text = _("Other");
+ break;
+ case PK_GROUP_ENUM_PROGRAMMING:
+ text = _("Programming");
+ break;
+ case PK_GROUP_ENUM_MULTIMEDIA:
+ text = _("Multimedia");
+ break;
+ case PK_GROUP_ENUM_SYSTEM:
+ text = _("System");
+ break;
+ case PK_GROUP_ENUM_DESKTOP_GNOME:
+ text = _("GNOME desktop");
+ break;
+ case PK_GROUP_ENUM_DESKTOP_KDE:
+ text = _("KDE desktop");
+ break;
+ case PK_GROUP_ENUM_DESKTOP_XFCE:
+ text = _("XFCE desktop");
+ break;
+ case PK_GROUP_ENUM_DESKTOP_OTHER:
+ text = _("Other desktops");
+ break;
+ case PK_GROUP_ENUM_PUBLISHING:
+ text = _("Publishing");
+ break;
+ case PK_GROUP_ENUM_SERVERS:
+ text = _("Servers");
+ break;
+ case PK_GROUP_ENUM_FONTS:
+ text = _("Fonts");
+ break;
+ case PK_GROUP_ENUM_ADMIN_TOOLS:
+ text = _("Admin tools");
+ break;
+ case PK_GROUP_ENUM_LEGACY:
+ text = _("Legacy");
+ break;
+ case PK_GROUP_ENUM_LOCALIZATION:
+ text = _("Localization");
+ break;
+ case PK_GROUP_ENUM_VIRTUALIZATION:
+ text = _("Virtualization");
+ break;
+ case PK_GROUP_ENUM_SECURITY:
+ text = _("Security");
+ break;
+ case PK_GROUP_ENUM_POWER_MANAGEMENT:
+ text = _("Power management");
+ break;
+ case PK_GROUP_ENUM_COMMUNICATION:
+ text = _("Communication");
+ break;
+ case PK_GROUP_ENUM_NETWORK:
+ text = _("Network");
+ break;
+ case PK_GROUP_ENUM_MAPS:
+ text = _("Maps");
+ break;
+ case PK_GROUP_ENUM_REPOS:
+ text = _("Software sources");
+ break;
+ case PK_GROUP_ENUM_SCIENCE:
+ text = _("Science");
+ break;
+ case PK_GROUP_ENUM_DOCUMENTATION:
+ text = _("Documentation");
+ break;
+ case PK_GROUP_ENUM_ELECTRONICS:
+ text = _("Electronics");
+ break;
+ case PK_GROUP_ENUM_COLLECTIONS:
+ text = _("Package collections");
+ break;
+ case PK_GROUP_ENUM_UNKNOWN:
+ text = _("Unknown group");
+ break;
+ default:
+ egg_warning ("group unrecognised: %i", group);
+ }
+ return text;
+}
+
+/**
+ * gpk_info_enum_to_icon_name:
+ **/
+const gchar *
+gpk_info_enum_to_icon_name (PkInfoEnum info)
+{
+ return pk_enum_find_string (enum_info_icon_name, info);
+}
+
+/**
+ * gpk_status_enum_to_icon_name:
+ **/
+const gchar *
+gpk_status_enum_to_icon_name (PkStatusEnum status)
+{
+ return pk_enum_find_string (enum_status_icon_name, status);
+}
+
+/**
+ * gpk_role_enum_to_icon_name:
+ **/
+const gchar *
+gpk_role_enum_to_icon_name (PkRoleEnum role)
+{
+ return pk_enum_find_string (enum_role_icon_name, role);
+}
+
+/**
+ * gpk_group_enum_to_icon_name:
+ **/
+const gchar *
+gpk_group_enum_to_icon_name (PkGroupEnum group)
+{
+ return pk_enum_find_string (enum_group_icon_name, group);
+}
+
+/**
+ * gpk_restart_enum_to_icon_name:
+ **/
+const gchar *
+gpk_restart_enum_to_icon_name (PkRestartEnum restart)
+{
+ return pk_enum_find_string (enum_restart_icon_name, restart);
+}
+
+/**
+ * gpk_message_enum_to_icon_name:
+ **/
+const gchar *
+gpk_message_enum_to_icon_name (PkMessageEnum message)
+{
+ return pk_enum_find_string (enum_message_icon_name, message);
+}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef EGG_TEST
+#include "egg-test.h"
+
+void
+gpk_enum_test (gpointer data)
+{
+ guint i;
+ const gchar *string;
+ EggTest *test = (EggTest *) data;
+
+ if (!egg_test_start (test, "GpkEnum"))
+ return;
+
+ /************************************************************
+ **************** localised enums **************
+ ************************************************************/
+ egg_test_title (test, "check we convert all the localised past role enums");
+ for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
+ string = gpk_role_enum_to_localised_past (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised present role enums");
+ for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
+ string = gpk_role_enum_to_localised_present (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the role icon name enums");
+ for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
+ string = gpk_role_enum_to_icon_name (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the info icon names enums");
+ for (i=0; i<PK_INFO_ENUM_UNKNOWN; i++) {
+ string = gpk_info_enum_to_icon_name (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised status enums");
+ for (i=0; i<PK_STATUS_ENUM_UNKNOWN; i++) {
+ string = gpk_status_enum_to_localised_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the status icon names enums");
+ for (i=0; i<PK_STATUS_ENUM_UNKNOWN; i++) {
+ string = gpk_status_enum_to_icon_name (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the restart icon names enums");
+ for (i=0; i<PK_RESTART_ENUM_UNKNOWN; i++) {
+ string = gpk_restart_enum_to_icon_name (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised error enums");
+ for (i=0; i<PK_ERROR_ENUM_UNKNOWN; i++) {
+ string = gpk_error_enum_to_localised_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %s", pk_error_enum_to_text(i));
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised error messages");
+ for (i=0; i<PK_ERROR_ENUM_UNKNOWN; i++) {
+ string = gpk_error_enum_to_localised_message (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %s", pk_error_enum_to_text(i));
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised restart enums");
+ for (i=0; i<PK_RESTART_ENUM_UNKNOWN; i++) {
+ string = gpk_restart_enum_to_localised_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the message icon name enums");
+ for (i=0; i<PK_MESSAGE_ENUM_UNKNOWN; i++) {
+ string = gpk_message_enum_to_icon_name (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised message enums");
+ for (i=0; i<PK_MESSAGE_ENUM_UNKNOWN; i++) {
+ string = gpk_message_enum_to_localised_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised restart future enums");
+ for (i=0; i<PK_RESTART_ENUM_UNKNOWN; i++) {
+ string = gpk_restart_enum_to_localised_text_future (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the localised group enums");
+ for (i=0; i<PK_GROUP_ENUM_UNKNOWN; i++) {
+ string = gpk_group_enum_to_localised_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the group icon name enums");
+ for (i=0; i<PK_GROUP_ENUM_UNKNOWN; i++) {
+ string = gpk_group_enum_to_icon_name (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the freq bitfield");
+ for (i=0; i<=GPK_FREQ_ENUM_UNKNOWN; i++) {
+ string = gpk_freq_enum_to_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "check we convert all the update bitfield");
+ for (i=0; i<=GPK_UPDATE_ENUM_UNKNOWN; i++) {
+ string = gpk_update_enum_to_text (i);
+ if (string == NULL) {
+ egg_test_failed (test, "failed to get %i", i);
+ break;
+ }
+ }
+ egg_test_success (test, NULL);
+
+ egg_test_end (test);
+}
+#endif
+
Added: trunk/src/gpk-enum.h
==============================================================================
--- (empty file)
+++ trunk/src/gpk-enum.h Fri Sep 19 11:51:00 2008
@@ -0,0 +1,98 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 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_ENUM_H
+#define __GPK_ENUM_H
+
+#include <glib-object.h>
+#include <pk-enum.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GpkFreqEnum:
+ *
+ * The frequency type
+ **/
+typedef enum {
+ GPK_FREQ_ENUM_HOURLY,
+ GPK_FREQ_ENUM_DAILY,
+ GPK_FREQ_ENUM_WEEKLY,
+ GPK_FREQ_ENUM_NEVER,
+ GPK_FREQ_ENUM_UNKNOWN
+} GpkFreqEnum;
+
+/**
+ * GpkUpdateEnum:
+ *
+ * The update type
+ **/
+typedef enum {
+ GPK_UPDATE_ENUM_ALL,
+ GPK_UPDATE_ENUM_SECURITY,
+ GPK_UPDATE_ENUM_NONE,
+ GPK_UPDATE_ENUM_UNKNOWN
+} GpkUpdateEnum;
+
+void gpk_enum_test (gpointer data);
+const gchar *gpk_role_enum_to_localised_past (PkRoleEnum role)
+ G_GNUC_CONST;
+const gchar *gpk_role_enum_to_localised_present (PkRoleEnum role)
+ G_GNUC_CONST;
+GpkFreqEnum gpk_freq_enum_from_text (const gchar *freq);
+const gchar *gpk_freq_enum_to_text (GpkFreqEnum freq);
+GpkUpdateEnum gpk_update_enum_from_text (const gchar *update);
+const gchar *gpk_update_enum_to_text (GpkUpdateEnum update);
+const gchar *gpk_role_enum_to_icon_name (PkRoleEnum role);
+const gchar *gpk_info_enum_to_localised_text (PkInfoEnum info)
+ G_GNUC_CONST;
+const gchar *gpk_info_enum_to_localised_past (PkInfoEnum info)
+ G_GNUC_CONST;
+const gchar *gpk_info_enum_to_localised_present (PkInfoEnum info)
+ G_GNUC_CONST;
+const gchar *gpk_info_enum_to_icon_name (PkInfoEnum info);
+const gchar *gpk_status_enum_to_localised_text (PkStatusEnum status)
+ G_GNUC_CONST;
+const gchar *gpk_status_enum_to_icon_name (PkStatusEnum status);
+const gchar *gpk_restart_enum_to_icon_name (PkRestartEnum restart);
+const gchar *gpk_error_enum_to_localised_text (PkErrorCodeEnum code)
+ G_GNUC_CONST;
+const gchar *gpk_error_enum_to_localised_message (PkErrorCodeEnum code);
+const gchar *gpk_restart_enum_to_localised_text (PkRestartEnum restart)
+ G_GNUC_CONST;
+const gchar *gpk_update_state_enum_to_localised_text (PkUpdateStateEnum state)
+ G_GNUC_CONST;
+const gchar *gpk_message_enum_to_icon_name (PkMessageEnum message);
+const gchar *gpk_message_enum_to_localised_text (PkMessageEnum message)
+ G_GNUC_CONST;
+const gchar *gpk_restart_enum_to_localised_text_future(PkRestartEnum restart)
+ G_GNUC_CONST;
+const gchar *gpk_group_enum_to_localised_text (PkGroupEnum group)
+ G_GNUC_CONST;
+const gchar *gpk_group_enum_to_icon_name (PkGroupEnum group);
+gchar *gpk_update_enum_to_localised_text (PkInfoEnum info,
+ guint number)
+ G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GPK_ENUM_H */
+
Modified: trunk/src/gpk-interface.h
==============================================================================
--- trunk/src/gpk-interface.h (original)
+++ trunk/src/gpk-interface.h Fri Sep 19 11:51:00 2008
@@ -53,7 +53,7 @@
#endif /* !G_ENABLE_DEBUG */
-/* NONE:UINT,UINT,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.3LDXHU:1) */
+/* NONE:UINT,UINT,STRING,POINTER (/tmp/dbus-binding-tool-c-marshallers.096QHU:1) */
extern void dbus_glib_marshal_gpk_dbus_VOID__UINT_UINT_STRING_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -101,7 +101,7 @@
}
#define dbus_glib_marshal_gpk_dbus_NONE__UINT_UINT_STRING_POINTER dbus_glib_marshal_gpk_dbus_VOID__UINT_UINT_STRING_POINTER
-/* NONE:UINT,UINT,BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.3LDXHU:2) */
+/* NONE:UINT,UINT,BOXED,POINTER (/tmp/dbus-binding-tool-c-marshallers.096QHU:2) */
extern void dbus_glib_marshal_gpk_dbus_VOID__UINT_UINT_BOXED_POINTER (GClosure *closure,
GValue *return_value,
guint n_param_values,
Modified: trunk/src/gpk-log.c
==============================================================================
--- trunk/src/gpk-log.c (original)
+++ trunk/src/gpk-log.c Fri Sep 19 11:51:00 2008
@@ -33,19 +33,18 @@
#include <polkit-gnome/polkit-gnome.h>
-/* local .la */
-#include <egg-unique.h>
-
#include <pk-client.h>
#include <pk-control.h>
#include <pk-package-id.h>
#include <pk-common.h>
+#include "egg-unique.h"
#include "egg-debug.h"
#include "egg-string.h"
#include "gpk-common.h"
#include "gpk-gnome.h"
+#include "gpk-enum.h"
static GladeXML *glade_xml = NULL;
static GtkListStore *list_store = NULL;
Modified: trunk/src/gpk-prefs.c
==============================================================================
--- trunk/src/gpk-prefs.c (original)
+++ trunk/src/gpk-prefs.c Fri Sep 19 11:51:00 2008
@@ -40,6 +40,7 @@
#include "egg-debug.h"
#include "egg-unique.h"
+#include "gpk-enum.h"
#define PK_FREQ_HOURLY_TEXT _("Hourly")
#define PK_FREQ_DAILY_TEXT _("Daily")
@@ -89,24 +90,24 @@
{
gchar *value;
const gchar *action;
- PkFreqEnum freq = PK_FREQ_ENUM_UNKNOWN;
+ GpkFreqEnum freq = GPK_FREQ_ENUM_UNKNOWN;
GConfClient *client;
client = gconf_client_get_default ();
value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
if (strcmp (value, PK_FREQ_HOURLY_TEXT) == 0) {
- freq = PK_FREQ_ENUM_HOURLY;
+ freq = GPK_FREQ_ENUM_HOURLY;
} else if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0) {
- freq = PK_FREQ_ENUM_DAILY;
+ freq = GPK_FREQ_ENUM_DAILY;
} else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0) {
- freq = PK_FREQ_ENUM_WEEKLY;
+ freq = GPK_FREQ_ENUM_WEEKLY;
} else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0) {
- freq = PK_FREQ_ENUM_NEVER;
+ freq = GPK_FREQ_ENUM_NEVER;
} else {
g_assert (FALSE);
}
- action = pk_freq_enum_to_text (freq);
+ action = gpk_freq_enum_to_text (freq);
egg_debug ("Changing %s to %s", GPK_CONF_FREQUENCY_GET_UPDATES, action);
gconf_client_set_string (client, GPK_CONF_FREQUENCY_GET_UPDATES, action, NULL);
g_free (value);
@@ -121,22 +122,22 @@
{
gchar *value;
const gchar *action;
- PkFreqEnum freq = PK_FREQ_ENUM_UNKNOWN;
+ GpkFreqEnum freq = GPK_FREQ_ENUM_UNKNOWN;
GConfClient *client;
client = gconf_client_get_default ();
value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
if (strcmp (value, PK_FREQ_DAILY_TEXT) == 0) {
- freq = PK_FREQ_ENUM_DAILY;
+ freq = GPK_FREQ_ENUM_DAILY;
} else if (strcmp (value, PK_FREQ_WEEKLY_TEXT) == 0) {
- freq = PK_FREQ_ENUM_WEEKLY;
+ freq = GPK_FREQ_ENUM_WEEKLY;
} else if (strcmp (value, PK_FREQ_NEVER_TEXT) == 0) {
- freq = PK_FREQ_ENUM_NEVER;
+ freq = GPK_FREQ_ENUM_NEVER;
} else {
g_assert (FALSE);
}
- action = pk_freq_enum_to_text (freq);
+ action = gpk_freq_enum_to_text (freq);
egg_debug ("Changing %s to %s", GPK_CONF_FREQUENCY_GET_UPGRADES, action);
gconf_client_set_string (client, GPK_CONF_FREQUENCY_GET_UPGRADES, action, NULL);
g_free (value);
@@ -151,7 +152,7 @@
{
gchar *value;
const gchar *action;
- PkUpdateEnum update = PK_UPDATE_ENUM_UNKNOWN;
+ GpkUpdateEnum update = GPK_UPDATE_ENUM_UNKNOWN;
GConfClient *client;
GtkWidget *notify_widget;
@@ -163,19 +164,19 @@
}
notify_widget = glade_xml_get_widget (glade_xml, "checkbutton_notify_updates");
if (strcmp (value, PK_UPDATE_ALL_TEXT) == 0) {
- update = PK_UPDATE_ENUM_ALL;
+ update = GPK_UPDATE_ENUM_ALL;
gtk_widget_set_sensitive (notify_widget, FALSE);
} else if (strcmp (value, PK_UPDATE_SECURITY_TEXT) == 0) {
- update = PK_UPDATE_ENUM_SECURITY;
+ update = GPK_UPDATE_ENUM_SECURITY;
gtk_widget_set_sensitive (notify_widget, TRUE);
} else if (strcmp (value, PK_UPDATE_NONE_TEXT) == 0) {
- update = PK_UPDATE_ENUM_NONE;
+ update = GPK_UPDATE_ENUM_NONE;
gtk_widget_set_sensitive (notify_widget, TRUE);
} else {
g_assert (FALSE);
}
- action = pk_update_enum_to_text (update);
+ action = gpk_update_enum_to_text (update);
egg_debug ("Changing %s to %s", GPK_CONF_AUTO_UPDATE, action);
gconf_client_set_string (client, GPK_CONF_AUTO_UPDATE, action, NULL);
g_free (value);
@@ -191,7 +192,7 @@
gchar *value;
gboolean is_writable;
GtkWidget *widget;
- PkFreqEnum freq;
+ GpkFreqEnum freq;
GConfClient *client;
client = gconf_client_get_default ();
@@ -203,7 +204,7 @@
return;
}
egg_debug ("value from gconf %s", value);
- freq = pk_freq_enum_from_text (value);
+ freq = gpk_freq_enum_from_text (value);
g_free (value);
g_object_unref (client);
@@ -231,7 +232,7 @@
gchar *value;
gboolean is_writable;
GtkWidget *widget;
- PkFreqEnum freq;
+ GpkFreqEnum freq;
GConfClient *client;
client = gconf_client_get_default ();
@@ -243,7 +244,7 @@
return;
}
egg_debug ("value from gconf %s", value);
- freq = pk_freq_enum_from_text (value);
+ freq = gpk_freq_enum_from_text (value);
g_free (value);
g_object_unref (client);
@@ -270,7 +271,7 @@
gchar *value;
gboolean is_writable;
GtkWidget *widget;
- PkUpdateEnum update;
+ GpkUpdateEnum update;
GConfClient *client;
client = gconf_client_get_default ();
@@ -282,7 +283,7 @@
return;
}
egg_debug ("value from gconf %s", value);
- update = pk_update_enum_from_text (value);
+ update = gpk_update_enum_from_text (value);
g_free (value);
g_object_unref (client);
Modified: trunk/src/gpk-repo.c
==============================================================================
--- trunk/src/gpk-repo.c (original)
+++ trunk/src/gpk-repo.c Fri Sep 19 11:51:00 2008
@@ -45,6 +45,7 @@
#include "gpk-common.h"
#include "gpk-error.h"
#include "gpk-animated-icon.h"
+#include "gpk-enum.h"
static GladeXML *glade_xml = NULL;
static GtkListStore *list_store = NULL;
Modified: trunk/src/gpk-self-test.c
==============================================================================
--- trunk/src/gpk-self-test.c (original)
+++ trunk/src/gpk-self-test.c Fri Sep 19 11:51:00 2008
@@ -24,6 +24,7 @@
#include "egg-test.h"
#include "egg-debug.h"
#include "gpk-common.h"
+#include "gpk-enum.h"
void egg_string_test (EggTest *test);
void gpk_dbus_test (EggTest *test);
@@ -42,8 +43,9 @@
egg_debug_init (TRUE);
/* tests go here */
-// egg_string_test (test);
-// gpk_common_test (test);
+ egg_string_test (test);
+ gpk_enum_test (test);
+ gpk_common_test (test);
// gpk_dbus_test (test);
gpk_client_dialog_test (test);
Modified: trunk/src/gpk-update-viewer.c
==============================================================================
--- trunk/src/gpk-update-viewer.c (original)
+++ trunk/src/gpk-update-viewer.c Fri Sep 19 11:51:00 2008
@@ -54,6 +54,7 @@
#include "gpk-cell-renderer-uri.h"
#include "gpk-animated-icon.h"
#include "gpk-client.h"
+#include "gpk-enum.h"
static GladeXML *glade_xml = NULL;
static GtkListStore *list_store_preview = NULL;
Modified: trunk/src/gpk-watch.c
==============================================================================
--- trunk/src/gpk-watch.c (original)
+++ trunk/src/gpk-watch.c Fri Sep 19 11:51:00 2008
@@ -57,6 +57,7 @@
#include "gpk-inhibit.h"
#include "gpk-smart-icon.h"
#include "gpk-consolekit.h"
+#include "gpk-enum.h"
static void gpk_watch_class_init (GpkWatchClass *klass);
static void gpk_watch_init (GpkWatch *watch);
@@ -961,11 +962,10 @@
/* port is optional too */
port = gconf_client_get_int (watch->priv->gconf_client, "/system/http_proxy/port", NULL);
- if (port == 0) {
+ if (port == 0)
connection = g_strdup (host);
- } else {
+ else
connection = g_strdup_printf ("%s:%i", host, port);
- }
/* the whole auth section is optional */
if (egg_strzero (auth))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]