mirror of https://github.com/GNOME/gimp.git
app/dialogs/preferences-dialog.c improved test for user manual
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. svn path=/trunk/; revision=26067
This commit is contained in:
parent
ac19e7deb8
commit
dafeb12c57
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2008-07-05 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/tools/gimprectangletool.c:
|
||||
|
|
|
@ -1805,7 +1805,6 @@ prefs_dialog_new (Gimp *gimp,
|
|||
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 @@ prefs_dialog_new (Gimp *gimp,
|
|||
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 @@ prefs_dialog_new (Gimp *gimp,
|
|||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
g_free (dir);
|
||||
}
|
||||
|
||||
/* Help Browser */
|
||||
|
|
|
@ -81,11 +81,13 @@ static void gimp_help_call (Gimp *gimp,
|
|||
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 @@ gimp_help_show (Gimp *gimp,
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ gimp_help_get_default_domain_uri (Gimp *gimp)
|
|||
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 @@ gimp_help_get_locales (Gimp *gimp)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Reference in New Issue