changed the description for GIMP_HELP_BROWSER_GIMP.

2004-10-13  Sven Neumann  <sven@gimp.org>

	* app/widgets/widgets-enums.[ch]: changed the description for
	GIMP_HELP_BROWSER_GIMP.

	* app/dialogs/file-save-dialog.c:
	* app/widgets/gimphelp.c: use a GimpDialog embedding a
	GimpMessageBox instead of gimp_query_boolean_box which looks
	somewhat old fashioned.
This commit is contained in:
Sven Neumann 2004-10-13 11:57:07 +00:00 committed by Sven Neumann
parent 6b489baaeb
commit 8a5502f89e
5 changed files with 117 additions and 93 deletions

View File

@ -1,3 +1,13 @@
2004-10-13 Sven Neumann <sven@gimp.org>
* app/widgets/widgets-enums.[ch]: changed the description for
GIMP_HELP_BROWSER_GIMP.
* app/dialogs/file-save-dialog.c:
* app/widgets/gimphelp.c: use a GimpDialog embedding a
GimpMessageBox instead of gimp_query_boolean_box which looks
somewhat old fashioned.
2004-10-13 Sven Neumann <sven@gimp.org> 2004-10-13 Sven Neumann <sven@gimp.org>
* app/widgets/gimphelp.c: improved error messages on missing help * app/widgets/gimphelp.c: improved error messages on missing help

View File

@ -36,6 +36,7 @@
#include "widgets/gimpfiledialog.h" #include "widgets/gimpfiledialog.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "file-save-dialog.h" #include "file-save-dialog.h"
@ -50,8 +51,8 @@ static void file_save_dialog_response (GtkWidget *save_dialog,
static void file_save_overwrite (GtkWidget *save_dialog, static void file_save_overwrite (GtkWidget *save_dialog,
const gchar *uri, const gchar *uri,
const gchar *raw_filename); const gchar *raw_filename);
static void file_save_overwrite_callback (GtkWidget *widget, static void file_save_overwrite_response (GtkWidget *dialog,
gboolean overwrite, gint response_id,
gpointer data); gpointer data);
static gboolean file_save_dialog_save_image (GtkWidget *save_dialog, static gboolean file_save_dialog_save_image (GtkWidget *save_dialog,
GimpImage *gimage, GimpImage *gimage,
@ -148,74 +149,78 @@ file_save_overwrite (GtkWidget *save_dialog,
const gchar *uri, const gchar *uri,
const gchar *raw_filename) const gchar *raw_filename)
{ {
OverwriteData *overwrite_data; OverwriteData *overwrite_data = g_new0 (OverwriteData, 1);
GtkWidget *query_box; GtkWidget *dialog;
GtkWidget *box;
gchar *filename; gchar *filename;
gchar *message;
overwrite_data = g_new0 (OverwriteData, 1);
overwrite_data->save_dialog = save_dialog; overwrite_data->save_dialog = save_dialog;
overwrite_data->uri = g_strdup (uri); overwrite_data->uri = g_strdup (uri);
overwrite_data->raw_filename = g_strdup (raw_filename); overwrite_data->raw_filename = g_strdup (raw_filename);
dialog = gimp_dialog_new (_("File exists"), "gimp-file-overwrite",
save_dialog, 0,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Replace"), GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (file_save_overwrite_response),
overwrite_data);
box = gimp_message_box_new (GIMP_STOCK_WARNING);
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
gtk_widget_show (box);
filename = file_utils_uri_to_utf8_filename (uri); filename = file_utils_uri_to_utf8_filename (uri);
message = g_strdup_printf (_("A file named '%s' already exists.\n\n" gimp_message_box_set_primary_text (GIMP_MESSAGE_BOX (box),
"Do you want to replace it with the image " _("A file named '%s' already exists."),
"you are saving?"), filename); filename);
g_free (filename); g_free (filename);
query_box = gimp_query_boolean_box (_("File exists!"), gimp_message_box_set_text (GIMP_MESSAGE_BOX (box),
save_dialog, _("Do you want to replace it with the image "
gimp_standard_help_func, NULL, "you are saving?"));
GIMP_STOCK_QUESTION,
message,
_("Replace"), GTK_STOCK_CANCEL,
NULL, NULL,
file_save_overwrite_callback,
overwrite_data);
g_free (message);
gtk_window_set_transient_for (GTK_WINDOW (query_box),
GTK_WINDOW (save_dialog));
gimp_file_dialog_set_sensitive (GIMP_FILE_DIALOG (save_dialog), FALSE); gimp_file_dialog_set_sensitive (GIMP_FILE_DIALOG (save_dialog), FALSE);
gtk_dialog_set_response_sensitive (GTK_DIALOG (save_dialog), gtk_dialog_set_response_sensitive (GTK_DIALOG (save_dialog),
GTK_RESPONSE_CANCEL, FALSE); GTK_RESPONSE_CANCEL, FALSE);
gtk_widget_show (query_box); gtk_widget_show (dialog);
} }
static void static void
file_save_overwrite_callback (GtkWidget *widget, file_save_overwrite_response (GtkWidget *dialog,
gboolean overwrite, gint response_id,
gpointer data) gpointer data)
{ {
OverwriteData *overwrite_data = data; OverwriteData *overwrite_data = data;
GimpFileDialog *dialog = GIMP_FILE_DIALOG (overwrite_data->save_dialog); GimpFileDialog *save_dialog = GIMP_FILE_DIALOG (overwrite_data->save_dialog);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), gtk_dialog_set_response_sensitive (GTK_DIALOG (save_dialog),
GTK_RESPONSE_CANCEL, TRUE); GTK_RESPONSE_CANCEL, TRUE);
if (overwrite) gtk_widget_destroy (dialog);
{
gtk_widget_hide (widget);
if (response_id == GTK_RESPONSE_OK)
{
if (file_save_dialog_save_image (overwrite_data->save_dialog, if (file_save_dialog_save_image (overwrite_data->save_dialog,
dialog->gimage, save_dialog->gimage,
overwrite_data->uri, overwrite_data->uri,
overwrite_data->raw_filename, overwrite_data->raw_filename,
dialog->file_proc, save_dialog->file_proc,
dialog->set_uri_and_proc, save_dialog->set_uri_and_proc,
dialog->set_image_clean)) save_dialog->set_image_clean))
{ {
gtk_widget_hide (overwrite_data->save_dialog); gtk_widget_hide (overwrite_data->save_dialog);
} }
} }
gimp_file_dialog_set_sensitive (dialog, TRUE); gimp_file_dialog_set_sensitive (save_dialog, TRUE);
g_free (overwrite_data->uri); g_free (overwrite_data->uri);
g_free (overwrite_data->raw_filename); g_free (overwrite_data->raw_filename);

View File

@ -43,6 +43,7 @@
#include "gimphelp.h" #include "gimphelp.h"
#include "gimphelp-ids.h" #include "gimphelp-ids.h"
#include "gimpmessagebox.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -63,14 +64,20 @@ struct _GimpIdleHelp
/* local function prototypes */ /* local function prototypes */
static gint gimp_idle_help (gpointer data); static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (Gimp *gimp);
static void gimp_help_call (Gimp *gimp, static gboolean gimp_help_browser (Gimp *gimp);
const gchar *procedure, static void gimp_help_browser_error (Gimp *gimp,
const gchar *help_domain, const gchar *title,
const gchar *help_locales, const gchar *primary,
const gchar *help_id); const gchar *text);
static gchar * gimp_help_get_locales (GimpGuiConfig *config);
static void gimp_help_call (Gimp *gimp,
const gchar *procedure,
const gchar *help_domain,
const gchar *help_locales,
const gchar *help_id);
static gchar * gimp_help_get_locales (GimpGuiConfig *config);
/* public functions */ /* public functions */
@ -128,7 +135,7 @@ gimp_idle_help (gpointer data)
if (config->help_browser == GIMP_HELP_BROWSER_GIMP) if (config->help_browser == GIMP_HELP_BROWSER_GIMP)
{ {
if (gimp_help_internal (idle_help->gimp)) if (gimp_help_browser (idle_help->gimp))
procedure = "extension_gimp_help_browser_temp"; procedure = "extension_gimp_help_browser_temp";
} }
@ -153,23 +160,8 @@ gimp_idle_help (gpointer data)
return FALSE; return FALSE;
} }
static void
gimp_help_internal_not_found_callback (GtkWidget *widget,
gboolean use_web_browser,
gpointer data)
{
Gimp *gimp = GIMP (data);
if (use_web_browser)
g_object_set (gimp->config,
"help-browser", GIMP_HELP_BROWSER_WEB_BROWSER,
NULL);
gtk_main_quit ();
}
static gboolean static gboolean
gimp_help_internal (Gimp *gimp) gimp_help_browser (Gimp *gimp)
{ {
static gboolean busy = FALSE; static gboolean busy = FALSE;
ProcRecord *proc_rec; ProcRecord *proc_rec;
@ -190,20 +182,11 @@ gimp_help_internal (Gimp *gimp)
if (! proc_rec) if (! proc_rec)
{ {
GtkWidget *dialog = gimp_help_browser_error (gimp,
gimp_query_boolean_box (_("Help browser not found"), _("Help browser not found"),
NULL, NULL, NULL, GIMP_STOCK_WARNING, _("Could not find GIMP help browser."),
_("Could not find GIMP help browser.\n\n" _("The GIMP help browser plug-in appears "
"The GIMP help browser plug-in appears " "to be missing from your installation."));
"to be missing from your installation."),
_("Use _web browser instead"),
GTK_STOCK_CANCEL,
NULL, NULL,
gimp_help_internal_not_found_callback,
gimp);
gtk_widget_show (dialog);
gtk_main ();
busy = FALSE; busy = FALSE;
return FALSE; return FALSE;
@ -225,19 +208,10 @@ gimp_help_internal (Gimp *gimp)
if (! proc_rec) if (! proc_rec)
{ {
GtkWidget *dialog = gimp_help_browser_error (gimp,
gimp_query_boolean_box (_("Help browser doesn't start"), _("Help browser doesn't start"),
NULL, NULL, NULL, GIMP_STOCK_WARNING, _("Could not start the GIMP help browser plug-in."),
_("Could not start the GIMP help browser " NULL);
"plug-in."),
_("Use web browser instead"),
GTK_STOCK_CANCEL,
NULL, NULL,
gimp_help_internal_not_found_callback,
gimp);
gtk_widget_show (dialog);
gtk_main ();
busy = FALSE; busy = FALSE;
return FALSE; return FALSE;
@ -248,6 +222,40 @@ gimp_help_internal (Gimp *gimp)
return TRUE; return TRUE;
} }
static void
gimp_help_browser_error (Gimp *gimp,
const gchar *title,
const gchar *primary,
const gchar *text)
{
GtkWidget *dialog;
GtkWidget *box;
dialog = gimp_dialog_new (title, "gimp-help-error",
NULL, 0,
NULL, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("Use _web browser instead"), GTK_RESPONSE_OK,
NULL);
box = gimp_message_box_new (GIMP_STOCK_WARNING);
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
gtk_widget_show (box);
gimp_message_box_set_primary_text (GIMP_MESSAGE_BOX (box), primary);
gimp_message_box_set_text (GIMP_MESSAGE_BOX (box), text);
if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
g_object_set (gimp->config,
"help-browser", GIMP_HELP_BROWSER_WEB_BROWSER,
NULL);
gtk_widget_destroy (dialog);
}
static void static void
gimp_help_call (Gimp *gimp, gimp_help_call (Gimp *gimp,
const gchar *procedure, const gchar *procedure,
@ -347,3 +355,4 @@ gimp_help_get_locales (GimpGuiConfig *config)
return locale; return locale;
} }

View File

@ -124,7 +124,7 @@ gimp_help_browser_type_get_type (void)
{ {
static const GEnumValue values[] = static const GEnumValue values[] =
{ {
{ GIMP_HELP_BROWSER_GIMP, N_("Internal"), "gimp" }, { GIMP_HELP_BROWSER_GIMP, N_("GIMP help browser"), "gimp" },
{ GIMP_HELP_BROWSER_WEB_BROWSER, N_("Web browser"), "web-browser" }, { GIMP_HELP_BROWSER_WEB_BROWSER, N_("Web browser"), "web-browser" },
{ 0, NULL, NULL } { 0, NULL, NULL }
}; };

View File

@ -100,8 +100,8 @@ GType gimp_help_browser_type_get_type (void) G_GNUC_CONST;
typedef enum typedef enum
{ {
GIMP_HELP_BROWSER_GIMP, /*< desc="Internal" >*/ GIMP_HELP_BROWSER_GIMP, /*< desc="GIMP help browser" >*/
GIMP_HELP_BROWSER_WEB_BROWSER /*< desc="Web browser" >*/ GIMP_HELP_BROWSER_WEB_BROWSER /*< desc="Web browser" >*/
} GimpHelpBrowserType; } GimpHelpBrowserType;