added a function to get the location where the user manual is expected if

2008-07-04  Sven Neumann  <sven@gimp.org>

	* 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.


svn path=/trunk/; revision=26058
This commit is contained in:
Sven Neumann 2008-07-04 18:41:58 +00:00 committed by Sven Neumann
parent b40e638987
commit 9a253efe4a
4 changed files with 65 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2008-07-04 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org>
* plug-ins/help-browser/dialog.c (browser_dialog_make_index_foreach):

View File

@ -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 */

View File

@ -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);

View File

@ -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__ */