diff --git a/ChangeLog b/ChangeLog index 3a073e89e2..cceac80c57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-07-04 Sven Neumann + + * app/widgets/gimphelp.[ch]: added a function to get the location + where the user manual is expected if it is installed locally. + + * app/dialogs/preferences-dialog.c: inform the user about the + presence or absence of the user manual. + 2008-07-04 Sven Neumann * plug-ins/help-browser/dialog.c (browser_dialog_make_index_foreach): diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index da2b671666..c977c77270 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -43,6 +43,7 @@ #include "widgets/gimpdevices.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpgrideditor.h" +#include "widgets/gimphelp.h" #include "widgets/gimphelp-ids.h" #include "widgets/gimpmessagebox.h" #include "widgets/gimpmessagedialog.h" @@ -1799,14 +1800,53 @@ prefs_dialog_new (Gimp *gimp, { GtkWidget *combo; + GtkWidget *hbox; + GtkWidget *image; + GtkWidget *label; + gchar *dir; + gint width; - table = prefs_table_new (1, GTK_CONTAINER (vbox2)); + table = prefs_table_new (2, GTK_CONTAINER (vbox2)); combo = prefs_boolean_combo_box_add (object, "user-manual-online", _("Use the online version"), _("Use a locally installed copy"), _("User manual:"), GTK_TABLE (table), 0, size_group); gimp_help_set_help_data (combo, NULL, NULL); + + dir = gimp_help_get_manual_location (); + + if (g_file_test (dir, G_FILE_TEST_IS_DIR)) + { + image = gtk_image_new_from_stock (GIMP_STOCK_INFO, + GTK_ICON_SIZE_MENU); + label = gtk_label_new (_("The user manual is installed locally.")); + } + else + { + image = gtk_image_new_from_stock (GIMP_STOCK_WARNING, + GTK_ICON_SIZE_MENU); + label = gtk_label_new (_("The user manual is not installed.")); + } + + hbox = gtk_hbox_new (FALSE, 6); + gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 1, 2); + gtk_widget_show (hbox); + + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); + gtk_widget_show (image); + + gimp_label_set_attributes (GTK_LABEL (label), + PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC, + -1); + gtk_widget_get_size_request (combo, &width, NULL); + gtk_widget_set_size_request (label, width - 20, -1); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + gtk_widget_show (label); + + g_free (dir); } /* Help Browser */ diff --git a/app/widgets/gimphelp.c b/app/widgets/gimphelp.c index c07ec46f3c..60a12b86dd 100644 --- a/app/widgets/gimphelp.c +++ b/app/widgets/gimphelp.c @@ -127,6 +127,12 @@ gimp_help_show (Gimp *gimp, } } +gchar * +gimp_help_get_manual_location (void) +{ + return g_build_filename (gimp_data_directory (), "help", NULL); +} + /* private functions */ @@ -454,7 +460,7 @@ gimp_help_get_default_domain_uri (Gimp *gimp) if (config->user_manual_online) return g_strdup (config->user_manual_online_uri); - dir = g_build_filename (gimp_data_directory (), "help", NULL); + dir = gimp_help_get_manual_location (); uri = g_filename_to_uri (dir, NULL, NULL); g_free (dir); diff --git a/app/widgets/gimphelp.h b/app/widgets/gimphelp.h index 17c2aa28d4..4c28f3e66f 100644 --- a/app/widgets/gimphelp.h +++ b/app/widgets/gimphelp.h @@ -27,10 +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 + */ +gchar * gimp_help_get_manual_location (void); #endif /* __GIMP_HELP_H__ */