gnome-packagekit r450 - in trunk: . data po src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-packagekit r450 - in trunk: . data po src
- Date: Sun, 7 Dec 2008 18:31:51 +0000 (UTC)
Author: rhughes
Date: Sun Dec 7 18:31:51 2008
New Revision: 450
URL: http://svn.gnome.org/viewvc/gnome-packagekit?rev=450&view=rev
Log:
from git
Modified:
trunk/configure.ac
trunk/data/gnome-packagekit.schemas.in
trunk/po/POTFILES.in
trunk/src/egg-test.c
trunk/src/gpk-application.c
trunk/src/gpk-auto-refresh.c
trunk/src/gpk-client-run.c
trunk/src/gpk-client-run.h
trunk/src/gpk-client.c
trunk/src/gpk-common.c
trunk/src/gpk-enum.c
trunk/src/gpk-self-test.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sun Dec 7 18:31:51 2008
@@ -113,7 +113,7 @@
AC_SUBST(DBUS_LIBS)
PKG_CHECK_MODULES(GTK, \
- gtk+-2.0 >= $GTK_REQUIRED gdk-2.0)
+ gtk+-2.0 >= $GTK_REQUIRED gdk-2.0 fontconfig)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
Modified: trunk/data/gnome-packagekit.schemas.in
==============================================================================
--- trunk/data/gnome-packagekit.schemas.in (original)
+++ trunk/data/gnome-packagekit.schemas.in Sun Dec 7 18:31:51 2008
@@ -388,6 +388,18 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gnome_settings_daemon/gtk-modules/pk-gtk-module</key>
+ <applyto>/apps/gnome_settings_daemon/gtk-modules/pk-gtk-module</applyto>
+ <owner>gnome-packagekit</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>GTK+ module for font installation</short>
+ <long>This key determines if applications should be able to prompt for fonts</long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Sun Dec 7 18:31:51 2008
@@ -54,5 +54,6 @@
src/gpk-update-icon.c
src/gpk-update-viewer.c
src/gpk-watch.c
+src/gpk-desktop.c
python/packagekit/gtkwidgets.py
Modified: trunk/src/egg-test.c
==============================================================================
--- trunk/src/egg-test.c (original)
+++ trunk/src/egg-test.c Sun Dec 7 18:31:51 2008
@@ -32,6 +32,7 @@
guint total;
guint succeeded;
gboolean started;
+ gboolean titled;
gchar *type;
GTimer *timer;
GMainLoop *loop;
@@ -51,6 +52,7 @@
test->succeeded = 0;
test->type = NULL;
test->started = FALSE;
+ test->titled = FALSE;
test->timer = g_timer_new ();
test->loop = g_main_loop_new (NULL, FALSE);
test->hang_loop_id = 0;
@@ -207,6 +209,12 @@
va_list args;
gchar *va_args_buffer = NULL;
+ /* already titled? */
+ if (test->titled) {
+ g_print ("Already titled!\n");
+ exit (1);
+ }
+
/* reset the value egg_test_elapsed replies with */
g_timer_reset (test->timer);
@@ -214,8 +222,9 @@
g_vasprintf (&va_args_buffer, format, args);
va_end (args);
g_print ("> check #%u\t%s: \t%s...", test->total+1, test->type, va_args_buffer);
- g_free(va_args_buffer);
+ g_free (va_args_buffer);
+ test->titled = TRUE;
test->total++;
}
@@ -228,6 +237,11 @@
va_list args;
gchar *va_args_buffer = NULL;
+ /* not titled? */
+ if (!test->titled) {
+ g_print ("Not titled!\n");
+ exit (1);
+ }
if (format == NULL) {
g_print ("...OK\n");
goto finish;
@@ -236,8 +250,9 @@
g_vasprintf (&va_args_buffer, format, args);
va_end (args);
g_print ("...OK [%s]\n", va_args_buffer);
- g_free(va_args_buffer);
+ g_free (va_args_buffer);
finish:
+ test->titled = FALSE;
test->succeeded++;
}
@@ -249,6 +264,12 @@
{
va_list args;
gchar *va_args_buffer = NULL;
+
+ /* not titled? */
+ if (!test->titled) {
+ g_print ("Not titled!\n");
+ exit (1);
+ }
if (format == NULL) {
g_print ("FAILED\n");
goto failed;
@@ -257,7 +278,7 @@
g_vasprintf (&va_args_buffer, format, args);
va_end (args);
g_print ("FAILED [%s]\n", va_args_buffer);
- g_free(va_args_buffer);
+ g_free (va_args_buffer);
failed:
exit (1);
}
Modified: trunk/src/gpk-application.c
==============================================================================
--- trunk/src/gpk-application.c (original)
+++ trunk/src/gpk-application.c Sun Dec 7 18:31:51 2008
@@ -641,7 +641,8 @@
if (pk_bitfield_contain (state, GPK_STATE_INSTALLED)) {
/* run this single package id */
package_ids = pk_package_ids_from_id (package_id);
- exec = gpk_client_run_show (package_ids);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
+ exec = gpk_client_run_show (GTK_WINDOW (widget), package_ids);
if (exec != NULL) {
ret = g_spawn_command_line_async (exec, &error);
if (!ret) {
@@ -1702,7 +1703,8 @@
ret = gpk_client_install_package_ids (application->priv->gclient, package_ids, NULL);
/* can we show the user the new application? */
if (ret) {
- exec = gpk_client_run_show (package_ids);
+ widget = glade_xml_get_widget (application->priv->glade_xml, "window_manager");
+ exec = gpk_client_run_show (GTK_WINDOW (widget), package_ids);
if (exec != NULL) {
ret = g_spawn_command_line_async (exec, &error);
if (!ret) {
@@ -2293,6 +2295,7 @@
static void
gpk_application_menu_refresh_cb (GtkAction *action, GpkApplication *application)
{
+ gpk_client_set_interaction (application->priv->gclient, GPK_CLIENT_INTERACT_WARNING_CONFIRM_PROGRESS);
gpk_client_refresh_cache (application->priv->gclient, NULL);
}
Modified: trunk/src/gpk-auto-refresh.c
==============================================================================
--- trunk/src/gpk-auto-refresh.c (original)
+++ trunk/src/gpk-auto-refresh.c Sun Dec 7 18:31:51 2008
@@ -51,6 +51,7 @@
#define GPK_AUTO_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPK_TYPE_AUTO_REFRESH, GpkAutoRefreshPrivate))
#define GPK_AUTO_REFRESH_PERIODIC_CHECK 60*60 /* force check for updates every this much time */
+#define GPK_UPDATES_LOGIN_TIMEOUT 3 /* seconds */
#define GS_DBUS_SERVICE "org.gnome.ScreenSaver"
#define GS_DBUS_PATH "/org/gnome/ScreenSaver"
@@ -75,6 +76,7 @@
gboolean on_battery;
gboolean network_active;
gboolean force_get_updates_login;
+ guint force_get_updates_login_timeout_id;
guint timeout_id;
EggDbusMonitor *monitor_gs;
EggDbusMonitor *monitor_gpm;
@@ -279,6 +281,15 @@
g_return_val_if_fail (GPK_IS_AUTO_REFRESH (arefresh), FALSE);
+ if (!arefresh->priv->force_get_updates_login) {
+ arefresh->priv->force_get_updates_login = TRUE;
+ if (gconf_client_get_bool (arefresh->priv->gconf_client, GPK_CONF_FORCE_GET_UPDATES_LOGIN, NULL)) {
+ egg_debug ("forcing get update due to GConf");
+ gpk_auto_refresh_signal_get_updates (arefresh);
+ return TRUE;
+ }
+ }
+
/* get this each time, as it may have changed behind out back */
thresh = gpk_auto_refresh_convert_frequency_text (arefresh, GPK_CONF_FREQUENCY_GET_UPDATES);
if (thresh == 0) {
@@ -374,12 +385,13 @@
/* only force a check if the user REALLY, REALLY wants to break
* set policy and have an update at startup */
if (!arefresh->priv->force_get_updates_login) {
- arefresh->priv->force_get_updates_login = TRUE;
force = gconf_client_get_bool (arefresh->priv->gconf_client, GPK_CONF_FORCE_GET_UPDATES_LOGIN, NULL);
if (force) {
- egg_debug ("forcing get update due to GConf");
- gpk_auto_refresh_signal_get_updates (arefresh);
- return TRUE;
+ /* don't immediately send the signal, if we are called during object initialization
+ * we need to wait until upper layers finish hooking up to the signal first. */
+ if (arefresh->priv->force_get_updates_login_timeout_id == 0)
+ arefresh->priv->force_get_updates_login_timeout_id =
+ g_timeout_add_seconds (GPK_UPDATES_LOGIN_TIMEOUT, (GSourceFunc) gpk_auto_refresh_maybe_get_updates, arefresh);
}
}
@@ -591,6 +603,7 @@
arefresh->priv->network_active = FALSE;
arefresh->priv->force_get_updates_login = FALSE;
arefresh->priv->timeout_id = 0;
+ arefresh->priv->force_get_updates_login_timeout_id = 0;
arefresh->priv->proxy_gs = NULL;
arefresh->priv->proxy_gpm = NULL;
@@ -656,6 +669,8 @@
if (arefresh->priv->timeout_id != 0)
g_source_remove (arefresh->priv->timeout_id);
+ if (arefresh->priv->force_get_updates_login_timeout_id != 0)
+ g_source_remove (arefresh->priv->force_get_updates_login_timeout_id);
g_object_unref (arefresh->priv->control);
g_object_unref (arefresh->priv->monitor_gs);
Modified: trunk/src/gpk-client-run.c
==============================================================================
--- trunk/src/gpk-client-run.c (original)
+++ trunk/src/gpk-client-run.c Sun Dec 7 18:31:51 2008
@@ -70,6 +70,19 @@
}
/**
+ * gpk_client_run_delete_event_cb:
+ **/
+static gboolean
+gpk_client_run_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ /* clear full_path */
+ g_free (full_path);
+ full_path = NULL;
+ gtk_main_quit ();
+ return FALSE;
+}
+
+/**
* gpk_client_run_button_action_cb:
**/
static void
@@ -179,7 +192,7 @@
gchar *exec = NULL;
gchar *summary = NULL;
gchar *joint = NULL;
- gchar *menu_path;
+ gchar *menu_path = NULL;
GtkTreeIter iter;
GKeyFile *file;
PkPackageId *id;
@@ -200,8 +213,8 @@
goto out;
}
+ /* get exec */
exec = g_key_file_get_string (file, G_KEY_FILE_DESKTOP_GROUP, "TryExec", NULL);
- /* try harder */
if (exec == NULL)
exec = g_key_file_get_string (file, G_KEY_FILE_DESKTOP_GROUP, "Exec", NULL);
@@ -211,34 +224,46 @@
goto out;
}
- name = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL, NULL);
+ /* get name */
+ text = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL, NULL);
+ if (text != NULL)
+ name = g_markup_escape_text (text, -1);
+ g_free (text);
+
+ /* get icon */
icon = g_key_file_get_string (file, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL);
- summary = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, "Comment", NULL, NULL);
- /* try harder */
- if (summary == NULL)
- summary = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, "GenericName", NULL, NULL);
+ if (icon == NULL || !gpk_desktop_check_icon_valid (icon)) {
+ g_free (icon);
+ icon = g_strdup (gpk_info_enum_to_icon_name (PK_INFO_ENUM_AVAILABLE));
+ }
+
+ /* get summary */
+ text = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, "Comment", NULL, NULL);
+ if (text == NULL)
+ text = g_key_file_get_locale_string (file, G_KEY_FILE_DESKTOP_GROUP, "GenericName", NULL, NULL);
+ if (text != NULL)
+ summary = g_markup_escape_text (text, -1);
+ g_free (text);
+
+ /* get application path */
+ text = gpk_desktop_get_menu_path (filename);
+ if (text != NULL)
+ menu_path = g_markup_escape_text (text, -1);
+ g_free (text);
/* put formatted text into treeview */
gtk_list_store_append (list_store, &iter);
joint = g_strdup_printf ("%s - %s", name, summary);
id = pk_package_id_new_from_string (package_id);
text = gpk_package_id_format_twoline (id, joint);
- menu_path = gpk_desktop_get_menu_path (filename);
- if (menu_path) {
+ if (menu_path != NULL) {
/* TRANSLATORS: the path in the menu, e.g. Applications -> Games -> Dave */
- fulltext = g_strdup_printf("%s\n\n<i>%s %s</i>", text, _("Menu:"), menu_path);
+ fulltext = g_strdup_printf("%s\n\n<i>%s</i>", text, menu_path);
g_free (text);
text = fulltext;
}
pk_package_id_free (id);
- /* might not be valid */
- if (!gpk_desktop_check_icon_valid (icon)) {
- g_free (icon);
- icon = NULL;
- }
- if (icon == NULL)
- icon = g_strdup (gpk_info_enum_to_icon_name (PK_INFO_ENUM_AVAILABLE));
gtk_list_store_set (list_store, &iter,
GPK_CHOOSER_COLUMN_TEXT, fulltext,
GPK_CHOOSER_COLUMN_FULL_PATH, exec,
@@ -308,7 +333,7 @@
* Return value: the package_id of the selected package, or NULL
**/
gchar *
-gpk_client_run_show (gchar **package_ids)
+gpk_client_run_show (GtkWindow *window, gchar **package_ids)
{
GladeXML *glade_xml;
GtkWidget *widget;
@@ -324,7 +349,7 @@
/* connect up default actions */
widget = glade_xml_get_widget (glade_xml, "dialog_simple");
- g_signal_connect_swapped (widget, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (widget, "delete_event", G_CALLBACK (gpk_client_run_delete_event_cb), NULL);
/* set a size, if the screen allows */
gpk_window_set_size_request (GTK_WINDOW (widget), 600, 300);
@@ -342,6 +367,10 @@
widget = glade_xml_get_widget (glade_xml, "hbox_filter");
gtk_widget_hide (widget);
+ /* hide the refresh button */
+ widget = glade_xml_get_widget (glade_xml, "button_refresh");
+ gtk_widget_hide (widget);
+
/* set icon name */
widget = glade_xml_get_widget (glade_xml, "dialog_simple");
gtk_window_set_icon_name (GTK_WINDOW (widget), GPK_ICON_SOFTWARE_INSTALLER);
@@ -366,6 +395,7 @@
/* add columns to the tree view */
pk_treeview_add_general_columns (GTK_TREE_VIEW (widget));
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), FALSE);
/* add all the apps */
len = gpk_client_run_add_package_ids (package_ids);
@@ -374,8 +404,14 @@
goto out;
}
- /* show window */
+ /* make modal if window set */
widget = glade_xml_get_widget (glade_xml, "dialog_simple");
+ if (window != NULL) {
+ gtk_window_set_modal (GTK_WINDOW (widget), TRUE);
+ gtk_window_set_transient_for (GTK_WINDOW (widget), window);
+ }
+
+ /* show window */
gtk_widget_show (widget);
/* wait for button press */
@@ -387,7 +423,7 @@
if (GTK_IS_WIDGET (widget))
gtk_widget_hide (widget);
- g_object_unref (glade_xml);
+ //g_object_unref (glade_xml);
return full_path;
}
Modified: trunk/src/gpk-client-run.h
==============================================================================
--- trunk/src/gpk-client-run.h (original)
+++ trunk/src/gpk-client-run.h Sun Dec 7 18:31:51 2008
@@ -28,7 +28,8 @@
G_BEGIN_DECLS
void gpk_client_run_self_test (gpointer data);
-gchar *gpk_client_run_show (gchar **package_ids);
+gchar *gpk_client_run_show (GtkWindow *window,
+ gchar **package_ids);
G_END_DECLS
Modified: trunk/src/gpk-client.c
==============================================================================
--- trunk/src/gpk-client.c (original)
+++ trunk/src/gpk-client.c Sun Dec 7 18:31:51 2008
@@ -35,6 +35,7 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
+#include <fontconfig/fontconfig.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <polkit-gnome/polkit-gnome.h>
@@ -1183,6 +1184,10 @@
GtkResponseType button;
gchar *title_name;
+ /* check the user wanted to call this method */
+ if (!gclient->priv->show_confirm)
+ return TRUE;
+
/* make title */
if (gclient->priv->parent_title != NULL)
title_name = g_strdup_printf ("%s %s", gclient->priv->parent_title, title);
@@ -2356,25 +2361,75 @@
}
/**
+ * gpk_client_font_tag_to_lang:
+ **/
+static gchar *
+gpk_client_font_tag_to_lang (const gchar *tag)
+{
+ gchar *lang = NULL;
+#if 0
+ *** We do not yet enable this code due to a few bugs in fontconfig ***
+ http://bugs.freedesktop.org/show_bug.cgi?id=18846 and
+ http://bugs.freedesktop.org/show_bug.cgi?id=18847
+
+ FcPattern *pat = NULL;
+ FcChar8 *fclang;
+ FcResult res;
+
+ /* parse the tag */
+ pat = FcNameParse ((FcChar8 *) tag);
+ if (pat == NULL) {
+ egg_warning ("cannot parse: '%s'", tag);
+ goto out;
+ }
+ FcPatternPrint (pat);
+ res = FcPatternGetString (pat, FC_LANG, 0, &fclang);
+ if (res != FcResultMatch) {
+ egg_warning ("failed to get string for: '%s': %i", tag, res);
+ goto out;
+ }
+ lang = g_strdup ((gchar *) fclang);
+out:
+ if (pat != NULL)
+ FcPatternDestroy (pat);
+#else
+ guint len;
+
+ /* verify we have enough to remove prefix */
+ len = strlen (tag);
+ if (len < 7)
+ goto out;
+ /* this is a bodge */
+ lang = g_strdup (&tag[6]);
+out:
+#endif
+ return lang;
+}
+
+
+/**
* gpk_client_font_tag_to_localised_name:
**/
static gchar *
gpk_client_font_tag_to_localised_name (GpkClient *gclient, const gchar *tag)
{
- guint len;
+ gchar *lang;
gchar *language = NULL;
gchar *name;
- len = strlen (tag);
- if (len < 7) {
- /* TRANSLATORS: the user specified an invalid ISO639 code */
- name = g_strdup_printf ("%s: %s", _("Invalid language code"), tag);
+ /* use fontconfig to get the language code */
+ lang = gpk_client_font_tag_to_lang (tag);
+ if (lang == NULL) {
+ /* TRANSLATORS: we could not parse the ISO639 code from the fontconfig tag name */
+ name = g_strdup_printf ("%s: %s", _("Language tag not parsed"), tag);
goto out;
}
- language = gpk_language_iso639_to_language (gclient->priv->language, &tag[6]);
+
+ /* convert to localisable name */
+ language = gpk_language_iso639_to_language (gclient->priv->language, lang);
if (language == NULL) {
- /* TRANSLATORS: we could not find a valid ISO639 code */
- name = g_strdup_printf ("%s: %s", _("Language code not matched"), tag);
+ /* TRANSLATORS: we could not find en_US string for ISO639 code */
+ name = g_strdup_printf ("%s: %s", _("Language code not matched"), lang);
goto out;
}
@@ -2383,6 +2438,7 @@
if (name == NULL)
name = g_strdup (language);
out:
+ g_free (lang);
g_free (language);
return name;
}
@@ -3713,3 +3769,126 @@
return GPK_CLIENT (gclient);
}
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef EGG_TEST
+#include "egg-test.h"
+
+void
+gpk_client_test (gpointer data)
+{
+ EggTest *test = (EggTest *) data;
+ GpkClient *gclient;
+ gchar *lang;
+ gchar *language;
+ gchar *package;
+ gboolean ret;
+ gchar *fonts[] = { ":lang=mn", NULL };
+ GError *error;
+
+ if (egg_test_start (test, "GpkChooser") == FALSE)
+ return;
+
+ /************************************************************/
+ egg_test_title (test, "get GpkClient object");
+ gclient = gpk_client_new ();
+ if (gclient != NULL)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, NULL);
+
+ /************************************************************/
+ egg_test_title (test, "convert tag to lang");
+ lang = gpk_client_font_tag_to_lang (":lang=mn");
+ if (egg_strequal (lang, "mn"))
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "lang '%s'", lang);
+ g_free (lang);
+
+ /************************************************************/
+ egg_test_title (test, "convert tag to language");
+ language = gpk_client_font_tag_to_localised_name (gclient, ":lang=mn");
+ if (egg_strequal (language, "Mongolian"))
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "language '%s'", language);
+ g_free (language);
+
+ /************************************************************/
+ egg_test_title (test, "test trusted path");
+ ret = gpk_client_path_is_trusted ("/usr/libexec/gst-install-plugins-helper");
+ if (ret)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "failed to identify trusted");
+
+ /************************************************************/
+ egg_test_title (test, "test trusted path");
+ ret = gpk_client_path_is_trusted ("/usr/bin/totem");
+ if (!ret)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "identify untrusted as trusted!");
+
+ /************************************************************/
+ egg_test_title (test, "get package for exec");
+ package = gpk_client_get_package_for_exec (gclient, "/usr/bin/totem");
+ if (egg_strequal (package, "totem"))
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "package '%s'", package);
+ g_free (package);
+
+ /************************************************************/
+ egg_test_title (test, "set exec");
+ ret = gpk_client_set_parent_exec (gclient, "/usr/bin/totem");
+ if (ret)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "failed to set exec");
+
+ /************************************************************/
+ egg_test_title (test, "install fonts (no UI)");
+ error = NULL;
+ gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_NEVER);
+ ret = gpk_client_install_fonts (gclient, fonts, &error);
+ if (ret)
+ egg_test_success (test, NULL);
+ else {
+ /* success until we can do the server parts */
+ egg_test_success (test, "failed to install font : %s", error->message);
+ g_error_free (error);
+ }
+
+ /************************************************************/
+ egg_test_title (test, "install fonts (if found)");
+ error = NULL;
+ gpk_client_set_interaction (gclient, pk_bitfield_from_enums (GPK_CLIENT_INTERACT_CONFIRM, GPK_CLIENT_INTERACT_FINISHED, -1));
+ ret = gpk_client_install_fonts (gclient, fonts, &error);
+ if (ret)
+ egg_test_success (test, NULL);
+ else {
+ /* success until we can do the server parts */
+ egg_test_success (test, "failed to install font : %s", error->message);
+ g_error_free (error);
+ }
+
+ /************************************************************/
+ egg_test_title (test, "install fonts (always)");
+ error = NULL;
+ gpk_client_set_interaction (gclient, GPK_CLIENT_INTERACT_ALWAYS);
+ ret = gpk_client_install_fonts (gclient, fonts, &error);
+ if (ret)
+ egg_test_success (test, NULL);
+ else {
+ /* success until we can do the server parts */
+ egg_test_success (test, "failed to install font : %s", error->message);
+ g_error_free (error);
+ }
+
+ egg_test_end (test);
+}
+#endif
+
Modified: trunk/src/gpk-common.c
==============================================================================
--- trunk/src/gpk-common.c (original)
+++ trunk/src/gpk-common.c Sun Dec 7 18:31:51 2008
@@ -133,9 +133,8 @@
gchar *text;
GString *string;
- if (id == NULL) {
+ if (id == NULL)
return g_strdup("");
- }
string = g_string_new (id->name);
if (id->version != NULL)
@@ -521,71 +520,64 @@
/************************************************************/
egg_test_title (test, "time 1s");
text = gpk_time_to_localised_string (1);
- if (text != NULL && strcmp (text, "1 second") == 0) {
+ if (text != NULL && strcmp (text, "1 second") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "time 1m");
text = gpk_time_to_localised_string (1*60);
- if (text != NULL && strcmp (text, "1 minute") == 0) {
+ if (text != NULL && strcmp (text, "1 minute") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "time 1h");
text = gpk_time_to_localised_string (1*60*60);
- if (text != NULL && strcmp (text, "1 hour") == 0) {
+ if (text != NULL && strcmp (text, "1 hour") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "time 30s");
text = gpk_time_to_localised_string (30);
- if (text != NULL && strcmp (text, "30 seconds") == 0) {
+ if (text != NULL && strcmp (text, "30 seconds") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "time 30m");
text = gpk_time_to_localised_string (30*60);
- if (text != NULL && strcmp (text, "30 minutes") == 0) {
+ if (text != NULL && strcmp (text, "30 minutes") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "time 30m1s");
text = gpk_time_to_localised_string (30*60+1);
- if (text != NULL && strcmp (text, "30 minutes 1 second") == 0) {
+ if (text != NULL && strcmp (text, "30 minutes 1 second") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "time 30m10s");
text = gpk_time_to_localised_string (30*60+10);
- if (text != NULL && strcmp (text, "30 minutes 10 seconds") == 0) {
+ if (text != NULL && strcmp (text, "30 minutes 10 seconds") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************
@@ -593,30 +585,27 @@
************************************************************/
egg_test_title (test, "get name null");
text = gpk_package_get_name (NULL);
- if (text == NULL) {
+ if (text == NULL)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
/************************************************************/
egg_test_title (test, "get name not id");
text = gpk_package_get_name ("ania");
- if (text != NULL && strcmp (text, "ania") == 0) {
+ if (text != NULL && strcmp (text, "ania") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "get name just id");
text = gpk_package_get_name ("simon;1.0.0;i386;moo");
- if (text != NULL && strcmp (text, "simon") == 0) {
+ if (text != NULL && strcmp (text, "simon") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************
@@ -626,11 +615,10 @@
id = pk_package_id_new_from_string ("simon;0.0.1;i386;data");
text = gpk_package_id_format_twoline (id, NULL);
pk_package_id_free (id);
- if (text != NULL && strcmp (text, "simon-0.0.1 (i386)") == 0) {
+ if (text != NULL && strcmp (text, "simon-0.0.1 (i386)") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
@@ -638,11 +626,10 @@
id = pk_package_id_new_from_string ("simon;0.0.1;;data");
text = gpk_package_id_format_twoline (id, NULL);
pk_package_id_free (id);
- if (text != NULL && strcmp (text, "simon-0.0.1") == 0) {
+ if (text != NULL && strcmp (text, "simon-0.0.1") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
@@ -650,11 +637,10 @@
id = pk_package_id_new_from_string ("simon;;;data");
text = gpk_package_id_format_twoline (id, NULL);
pk_package_id_free (id);
- if (text != NULL && strcmp (text, "simon") == 0) {
+ if (text != NULL && strcmp (text, "simon") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
/************************************************************/
@@ -662,15 +648,12 @@
id = pk_package_id_new_from_string ("simon;0.0.1;;data");
text = gpk_package_id_format_twoline (id, "dude");
pk_package_id_free (id);
- if (text != NULL && strcmp (text, "<b>dude</b>\nsimon-0.0.1") == 0) {
+ if (text != NULL && strcmp (text, "<b>dude</b>\nsimon-0.0.1") == 0)
egg_test_success (test, NULL);
- } else {
+ else
egg_test_failed (test, "failed, got %s", text);
- }
g_free (text);
- egg_test_success (test, NULL);
-
egg_test_end (test);
}
#endif
Modified: trunk/src/gpk-enum.c
==============================================================================
--- trunk/src/gpk-enum.c (original)
+++ trunk/src/gpk-enum.c Sun Dec 7 18:31:51 2008
@@ -437,6 +437,9 @@
case PK_ERROR_ENUM_NO_DISTRO_UPGRADE_DATA:
text = _("No distribution upgrade data is available");
break;
+ case PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE:
+ text = _("Package is incompatible with this system");
+ break;
default:
egg_warning ("Unknown error");
}
@@ -613,6 +616,9 @@
text = _("Required upgrade data could not be found in any of the configured software sources.\n"
"The list of distribution upgrades will be unavailable.");
break;
+ case PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE:
+ text = _("The package that is trying to be installed is incompatible with this system.");
+ break;
default:
egg_warning ("Unknown error, please report a bug at " GPK_BUGZILLA_URL ".\n"
"More information is available in the detailed report.");
Modified: trunk/src/gpk-self-test.c
==============================================================================
--- trunk/src/gpk-self-test.c (original)
+++ trunk/src/gpk-self-test.c Sun Dec 7 18:31:51 2008
@@ -31,6 +31,7 @@
void gpk_dbus_test (EggTest *test);
void gpk_language_test (EggTest *test);
void gpk_client_dialog_test (EggTest *test);
+void gpk_client_test (EggTest *test);
int
main (int argc, char **argv)
@@ -51,6 +52,7 @@
gpk_common_test (test);
// gpk_dbus_test (test);
gpk_language_test (test);
+ gpk_client_test (test);
gpk_client_dialog_test (test);
return egg_test_finish (test);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]