gimp r26067 - in trunk: . app/dialogs app/widgets
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26067 - in trunk: . app/dialogs app/widgets
- Date: Sat, 5 Jul 2008 12:01:00 +0000 (UTC)
Author: neo
Date: Sat Jul 5 12:01:00 2008
New Revision: 26067
URL: http://svn.gnome.org/viewvc/gimp?rev=26067&view=rev
Log:
2008-07-05 Sven Neumann <sven gimp org>
* app/dialogs/preferences-dialog.c
* app/widgets/gimphelp.[ch]: improved test for user manual
installation and moved the code out of the prefs dialog.
Modified:
trunk/ChangeLog
trunk/app/dialogs/preferences-dialog.c
trunk/app/widgets/gimphelp.c
trunk/app/widgets/gimphelp.h
Modified: trunk/app/dialogs/preferences-dialog.c
==============================================================================
--- trunk/app/dialogs/preferences-dialog.c (original)
+++ trunk/app/dialogs/preferences-dialog.c Sat Jul 5 12:01:00 2008
@@ -1805,7 +1805,6 @@
GtkWidget *label;
const gchar *icon;
const gchar *text;
- gchar *dir;
table = prefs_table_new (2, GTK_CONTAINER (vbox2));
combo = prefs_boolean_combo_box_add (object, "user-manual-online",
@@ -1815,9 +1814,7 @@
GTK_TABLE (table), 0, size_group);
gimp_help_set_help_data (combo, NULL, NULL);
- dir = gimp_help_get_user_manual_location ();
-
- if (g_file_test (dir, G_FILE_TEST_IS_DIR))
+ if (gimp_help_user_manual_is_installed (gimp))
{
icon = GIMP_STOCK_INFO;
text = _("There's a local installation of the user manual.");
@@ -1845,8 +1842,6 @@
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
-
- g_free (dir);
}
/* Help Browser */
Modified: trunk/app/widgets/gimphelp.c
==============================================================================
--- trunk/app/widgets/gimphelp.c (original)
+++ trunk/app/widgets/gimphelp.c Sat Jul 5 12:01:00 2008
@@ -81,11 +81,13 @@
const gchar *help_locales,
const gchar *help_id);
-static gint gimp_help_get_help_domains (Gimp *gimp,
- gchar ***domain_names,
- gchar ***domain_uris);
-static gchar * gimp_help_get_default_domain_uri (Gimp *gimp);
-static gchar * gimp_help_get_locales (Gimp *gimp);
+static gint gimp_help_get_help_domains (Gimp *gimp,
+ gchar ***domain_names,
+ gchar ***domain_uris);
+static gchar * gimp_help_get_default_domain_uri (Gimp *gimp);
+static gchar * gimp_help_get_locales (Gimp *gimp);
+
+static gchar * gimp_help_get_user_manual_basedir (void);
/* public functions */
@@ -127,10 +129,45 @@
}
}
-gchar *
-gimp_help_get_user_manual_location (void)
+gboolean
+gimp_help_user_manual_is_installed (Gimp *gimp)
{
- return g_build_filename (gimp_data_directory (), "help", NULL);
+ gchar *basedir;
+ gboolean found = FALSE;
+
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
+
+ basedir = gimp_help_get_user_manual_basedir ();
+
+ if (g_file_test (basedir, G_FILE_TEST_IS_DIR))
+ {
+ gchar *locales = gimp_help_get_locales (gimp);
+ const gchar *s = locales;
+ const gchar *p;
+
+ for (p = strchr (s, ':'); p && !found; p = strchr (s, ':'))
+ {
+ gchar *locale = g_strndup (s, p - s);
+ gchar *path;
+
+ path = g_build_filename (basedir, locale, "gimp-help.xml", NULL);
+
+ g_printerr ("%s\n", path);
+
+ found = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+
+ g_free (path);
+ g_free (locale);
+
+ s = p + 1;
+ }
+
+ g_free (locales);
+ }
+
+ g_free (basedir);
+
+ return found;
}
@@ -461,7 +498,7 @@
if (config->user_manual_online)
return g_strdup (config->user_manual_online_uri);
- dir = gimp_help_get_user_manual_location ();
+ dir = gimp_help_get_user_manual_basedir ();
uri = g_filename_to_uri (dir, NULL, NULL);
g_free (dir);
@@ -478,3 +515,9 @@
return g_strjoinv (":", (gchar **) g_get_language_names ());
}
+
+static gchar *
+gimp_help_get_user_manual_basedir (void)
+{
+ return g_build_filename (gimp_data_directory (), "help", NULL);
+}
Modified: trunk/app/widgets/gimphelp.h
==============================================================================
--- trunk/app/widgets/gimphelp.h (original)
+++ trunk/app/widgets/gimphelp.h Sat Jul 5 12:01:00 2008
@@ -27,15 +27,15 @@
*
* there should be no need to use it directly
*/
-void gimp_help_show (Gimp *gimp,
- GimpProgress *progress,
- const gchar *help_domain,
- const gchar *help_id);
+void gimp_help_show (Gimp *gimp,
+ GimpProgress *progress,
+ const gchar *help_domain,
+ const gchar *help_id);
-/* returns the folder where the user manual should be installed
+/* checks if the user manual is installed locally
*/
-gchar * gimp_help_get_user_manual_location (void);
+gboolean gimp_help_user_manual_is_installed (Gimp *gimp);
#endif /* __GIMP_HELP_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]