Commit 9b3bc08e authored by Henrik Brix Andersen's avatar Henrik Brix Andersen Committed by Henrik Brix Andersen
Browse files

Replaced the netscape-dependent web browser plug-in with a user

2003-09-22 Henrik Brix Andersen <brix@gimp.org>

Replaced the netscape-dependent web browser plug-in with a user
configureable plug-in. This fixes bug #119120:

* app/config/gimpguiconfig.[ch]: added gchar *web_browser member

* app/config/gimprc-blurbs.h: added web browser blurb

* etc/gimprc
* docs/gimprc-1.3.5.in: regenerated using gimpconfig-dump

* app/gui/preferences-dialog.c (prefs_dialog_new): added UI for
specifying external web browser

* configure.in
* plug-ins/Makefile.am
* plug-ins/webbrowser/Makefile.am
* plug-ins/webbrowser/README
* plug-ins/webbrowser/web-browser.scm
* plug-ins/webbrowser/webbrowser.c : removed the old netscape-dependent
web browser plug-in

* po-plug-ins/POTFILES.in
* plug-ins/common/plugin-defs.pl
* plug-ins/common/webbrowser.c: added a new web browser plug-in

* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am: regenerated

* app/widgets/gimphelp.c
* app/widgets/widget-enums.[ch]
* plug-ins/helpbrowser/dialog.c
* plug-ins/maze/maze_face.c: changed accordingly + whitespace
clean-up

* po-script-fu/POTFILES.in
* plug-ins/script-fu/scripts/Makefile.am
* plug-ins/script-fu/scripts/web-browser.scm: use the new web
browser plug-in to add menu entries to <Toolbox>/Help/
parent c9ef4b23
2003-09-22 Henrik Brix Andersen <brix@gimp.org>
Replaced the netscape-dependent web browser plug-in with a user
configureable plug-in. This fixes bug #119120:
* app/config/gimpguiconfig.[ch]: added gchar *web_browser member
* app/config/gimprc-blurbs.h: added web browser blurb
* etc/gimprc
* docs/gimprc-1.3.5.in: regenerated using gimpconfig-dump
* app/gui/preferences-dialog.c (prefs_dialog_new): added UI for
specifying external web browser
* configure.in
* plug-ins/Makefile.am
* plug-ins/webbrowser/Makefile.am
* plug-ins/webbrowser/README
* plug-ins/webbrowser/web-browser.scm
* plug-ins/webbrowser/webbrowser.c : removed the old netscape-dependent
web browser plug-in
* po-plug-ins/POTFILES.in
* plug-ins/common/plugin-defs.pl
* plug-ins/common/webbrowser.c: added a new web browser plug-in
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am: regenerated
* app/widgets/gimphelp.c
* app/widgets/widget-enums.[ch]
* plug-ins/helpbrowser/dialog.c
* plug-ins/maze/maze_face.c: changed accordingly + whitespace
clean-up
* po-script-fu/POTFILES.in
* plug-ins/script-fu/scripts/Makefile.am
* plug-ins/script-fu/scripts/web-browser.scm: use the new web
browser plug-in to add menu entries to <Toolbox>/Help/
2003-09-22 Sven Neumann <sven@gimp.org>
 
* app/gui/menus.c (menus_restore) (menus_save): removed gimprc
......@@ -49,7 +49,13 @@ static void gimp_gui_config_get_property (GObject *object,
GParamSpec *pspec);
#define DEFAULT_THEME "Default"
#define DEFAULT_THEME "Default"
#ifdef G_OS_WIN32
#define DEFAULT_WEB_BROWSER "\"C:\Program Files\Internet Explorer\iexplore.exe\" \"%s\""
#else
#define DEFAULT_WEB_BROWSER "mozilla \"%s\""
#endif
enum
{
......@@ -73,13 +79,14 @@ enum
PROP_THEME_PATH,
PROP_THEME,
PROP_USE_HELP,
PROP_HELP_BROWSER
PROP_HELP_BROWSER,
PROP_WEB_BROWSER
};
static GObjectClass *parent_class = NULL;
GType
GType
gimp_gui_config_get_type (void)
{
static GType config_type = 0;
......@@ -99,8 +106,8 @@ gimp_gui_config_get_type (void)
NULL /* instance_init */
};
config_type = g_type_register_static (GIMP_TYPE_DISPLAY_CONFIG,
"GimpGuiConfig",
config_type = g_type_register_static (GIMP_TYPE_DISPLAY_CONFIG,
"GimpGuiConfig",
&config_info, 0);
}
......@@ -207,6 +214,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
GIMP_TYPE_HELP_BROWSER_TYPE,
GIMP_HELP_BROWSER_GIMP,
0);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_WEB_BROWSER,
"web-browser", WEB_BROWSER_BLURB,
GIMP_PARAM_PATH_FILE,
DEFAULT_WEB_BROWSER,
0);
}
static void
......@@ -215,9 +227,10 @@ gimp_gui_config_finalize (GObject *object)
GimpGuiConfig *gui_config;
gui_config = GIMP_GUI_CONFIG (object);
g_free (gui_config->theme_path);
g_free (gui_config->theme);
g_free (gui_config->web_browser);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -245,7 +258,7 @@ gimp_gui_config_set_property (GObject *object,
break;
case PROP_INFO_WINDOW_PER_DISPLAY:
gui_config->info_window_per_display = g_value_get_boolean (value);
break;
break;
case PROP_TRUST_DIRTY_FLAG:
gui_config->trust_dirty_flag = g_value_get_boolean (value);
break;
......@@ -296,6 +309,10 @@ gimp_gui_config_set_property (GObject *object,
case PROP_HELP_BROWSER:
gui_config->help_browser = g_value_get_enum (value);
break;
case PROP_WEB_BROWSER:
g_free (gui_config->web_browser);
gui_config->web_browser = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -375,6 +392,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_HELP_BROWSER:
g_value_set_enum (value, gui_config->help_browser);
break;
case PROP_WEB_BROWSER:
g_value_set_string (value, gui_config->web_browser);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......
......@@ -60,6 +60,7 @@ struct _GimpGuiConfig
gchar *theme;
gboolean use_help;
GimpHelpBrowserType help_browser;
gchar *web_browser;
gint last_tip; /* saved in sessionrc */
};
......
......@@ -358,5 +358,12 @@ N_("Sets an upper limit to the memory that is used per image to keep " \
#define USE_HELP_BLURB \
N_("When enabled, pressing F1 will open the help browser.")
#define WEB_BROWSER_BLURB \
N_("Sets the external web browser to be used. This can be an absolute " \
"path or the name of an executable to search for in the user's PATH. " \
"If the command contains '%s' it will be replaced with the URL, else " \
"the URL will be appended to the command with a space separating the " \
"two.")
#endif /* __GIMP_RC_BLURBS_H__ */
......@@ -1854,7 +1854,20 @@ prefs_dialog_new (Gimp *gimp,
prefs_enum_option_menu_add (config, "thumbnail-size", 0, 0,
_("Size of Thumbnail Files:"),
GTK_TABLE (table), 1);
/* External Browser */
vbox2 = prefs_frame_new (_("Web Browser"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
fileselection = gimp_prop_file_entry_new (config, "web-browser",
_("Select Web Browser"),
FALSE, FALSE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Web Browser to Use:"), 1.0, 0.5,
fileselection, 1, TRUE);
/* Rescan Font List */
vbox2 = prefs_frame_new (_("Fonts"), GTK_CONTAINER (vbox), FALSE);
hbox = gtk_hbox_new (FALSE, 2);
......
......@@ -1854,7 +1854,20 @@ prefs_dialog_new (Gimp *gimp,
prefs_enum_option_menu_add (config, "thumbnail-size", 0, 0,
_("Size of Thumbnail Files:"),
GTK_TABLE (table), 1);
/* External Browser */
vbox2 = prefs_frame_new (_("Web Browser"), GTK_CONTAINER (vbox), FALSE);
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
fileselection = gimp_prop_file_entry_new (config, "web-browser",
_("Select Web Browser"),
FALSE, FALSE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Web Browser to Use:"), 1.0, 0.5,
fileselection, 1, TRUE);
/* Rescan Font List */
vbox2 = prefs_frame_new (_("Fonts"), GTK_CONTAINER (vbox), FALSE);
hbox = gtk_hbox_new (FALSE, 2);
......
......@@ -66,15 +66,15 @@ struct _GimpIdleHelp
/* local function prototypes */
static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (Gimp *gimp,
const gchar *help_domain,
const gchar *help_locale,
const gchar *help_id);
static void gimp_help_netscape (Gimp *gimp,
const gchar *help_domain,
const gchar *help_locale,
const gchar *help_id);
static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (Gimp *gimp,
const gchar *help_domain,
const gchar *help_locale,
const gchar *help_id);
static void gimp_help_webbrowser (Gimp *gimp,
const gchar *help_domain,
const gchar *help_locale,
const gchar *help_id);
/* public functions */
......@@ -142,11 +142,11 @@ gimp_idle_help (gpointer data)
idle_help->help_id))
break;
case GIMP_HELP_BROWSER_NETSCAPE:
gimp_help_netscape (idle_help->gimp,
idle_help->help_domain,
idle_help->help_locale,
idle_help->help_id);
case GIMP_HELP_BROWSER_WEBBROWSER:
gimp_help_webbrowser (idle_help->gimp,
idle_help->help_domain,
idle_help->help_locale,
idle_help->help_id);
break;
default:
......@@ -163,16 +163,16 @@ gimp_idle_help (gpointer data)
static void
gimp_help_internal_not_found_callback (GtkWidget *widget,
gboolean use_netscape,
gboolean use_webbrowser,
gpointer data)
{
Gimp *gimp = GIMP (data);
if (use_netscape)
if (use_webbrowser)
g_object_set (gimp->config,
"help-browser", GIMP_HELP_BROWSER_NETSCAPE,
"help-browser", GIMP_HELP_BROWSER_WEBBROWSER,
NULL);
gtk_main_quit ();
}
......@@ -211,7 +211,7 @@ gimp_help_internal (Gimp *gimp,
_("Could not find the GIMP Help Browser procedure.\n"
"It probably was not compiled because\n"
"you don't have GtkXmHTML installed."),
_("Use Netscape instead"),
_("Use web browser instead"),
GTK_STOCK_CANCEL,
NULL, NULL,
gimp_help_internal_not_found_callback,
......@@ -222,7 +222,7 @@ gimp_help_internal (Gimp *gimp,
busy = FALSE;
return (GIMP_GUI_CONFIG (gimp->config)->help_browser
!= GIMP_HELP_BROWSER_NETSCAPE);
!= GIMP_HELP_BROWSER_WEBBROWSER);
}
n_domains = plug_ins_help_domains (gimp, &help_domains, &help_uris);
......@@ -253,7 +253,7 @@ gimp_help_internal (Gimp *gimp,
gimp_query_boolean_box (_("Could not start GIMP Help Browser"),
NULL, NULL, FALSE,
_("Could not start the GIMP Help Browser."),
_("Use Netscape instead"),
_("Use web browser instead"),
GTK_STOCK_CANCEL,
NULL, NULL,
gimp_help_internal_not_found_callback,
......@@ -264,7 +264,7 @@ gimp_help_internal (Gimp *gimp,
busy = FALSE;
return (GIMP_GUI_CONFIG (gimp->config)->help_browser
!= GIMP_HELP_BROWSER_NETSCAPE);
!= GIMP_HELP_BROWSER_WEBBROWSER);
}
else
{
......@@ -289,10 +289,10 @@ gimp_help_internal (Gimp *gimp,
}
static void
gimp_help_netscape (Gimp *gimp,
const gchar *help_domain,
const gchar *help_locale,
const gchar *help_id)
gimp_help_webbrowser (Gimp *gimp,
const gchar *help_domain,
const gchar *help_locale,
const gchar *help_id)
{
Argument *return_vals;
gint nreturn_vals;
......@@ -322,9 +322,7 @@ gimp_help_netscape (Gimp *gimp,
procedural_db_run_proc (gimp,
"plug_in_web_browser",
&nreturn_vals,
GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
GIMP_PDB_STRING, url,
GIMP_PDB_INT32, FALSE,
GIMP_PDB_END);
procedural_db_destroy_args (return_vals, nreturn_vals);
......
......@@ -31,7 +31,7 @@ gimp_aspect_type_get_type (void)
static const GEnumValue gimp_help_browser_type_enum_values[] =
{
{ GIMP_HELP_BROWSER_GIMP, N_("Internal"), "gimp" },
{ GIMP_HELP_BROWSER_NETSCAPE, N_("Netscape"), "netscape" },
{ GIMP_HELP_BROWSER_WEBBROWSER, N_("Web Browser"), "webbrowser" },
{ 0, NULL, NULL }
};
......
......@@ -20,7 +20,7 @@
#define __WIDGETS_ENUMS_H__
/*
/*
* these enums that are registered with the type system
*/
......@@ -42,8 +42,8 @@ GType gimp_help_browser_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_HELP_BROWSER_GIMP, /*< desc="Internal" >*/
GIMP_HELP_BROWSER_NETSCAPE /*< desc="Netscape" >*/
GIMP_HELP_BROWSER_GIMP, /*< desc="Internal" >*/
GIMP_HELP_BROWSER_WEBBROWSER /*< desc="Web Browser" >*/
} GimpHelpBrowserType;
......
......@@ -683,14 +683,14 @@ if test "$gdk_target" = x11; then
GIMP_REMOTE='gimp-remote-1.3';
have_libxmu=yes
LIBXMU="$X_LIBS $X_PRE_LIBS -lX11 -lXmu -lXt",
[AC_MSG_WARN(*** webbrowser plug-in and gimp-remote will not be built (XMU header file not found) ***)])],
[AC_MSG_WARN(*** gimp-remote will not be built (XMU header file not found) ***)])],
[AC_CHECK_LIB(Xmu, XmuUpdateMapHints,
[AC_CHECK_HEADER(X11/Xmu/WinUtil.h,
GIMP_REMOTE='gimp-remote-1.3';
have_libxmu=yes
LIBXMU="$X_LIBS $X_PRE_LIBS -lX11 -lXmu -lXt",
[AC_MSG_WARN(*** webbrowser plug-in and gimp-remote will not be built (XMU header file not found) ***)])],
AC_MSG_WARN(*** webbrowser plug-in and gimp-remote will not be built (XMU library not found) ***), -lXt)], -lXt)
[AC_MSG_WARN(*** gimp-remote will not be built (XMU header file not found) ***)])],
AC_MSG_WARN(*** gimp-remote will not be built (XMU library not found) ***), -lXt)], -lXt)
CFLAGS="$gimp_save_CFLAGS"
LDFLAGS="$gimp_save_LDFLAGS"
fi
......@@ -703,10 +703,6 @@ AC_SUBST(LIBXMU)
AC_SUBST(LIBSCREENSHOT)
AC_SUBST(GIMP_REMOTE)
## webbrowser has ifdefs for Win32
AM_CONDITIONAL(BUILD_WEBBROWSER,
test x"$have_libxmu" = xyes || test x"$os_win32" = xyes)
###################
# Check for libtiff
......@@ -1322,7 +1318,6 @@ plug-ins/libgck/gck/Makefile
plug-ins/dbbrowser/Makefile
plug-ins/script-fu/Makefile
plug-ins/script-fu/scripts/Makefile
plug-ins/webbrowser/Makefile
plug-ins/xjt/Makefile
plug-ins/FractalExplorer/Makefile
plug-ins/FractalExplorer/fractalexplorer-examples/Makefile
......
......@@ -672,7 +672,15 @@ and no.
(help-browser gimp)
Sets the browser used by the help system. Possible values are gimp and
netscape.
webbrowser.
.TP
(web-browser "mozilla \"%s\"")
Sets the external web browser to be used. This can be an absolute path or the
name of an executable to search for in the user's PATH. If the command
contains '%s' it will be replaced with the URL, else the URL will be appended
to the command with a space separating the two. This is a single filename.
.TP
(fractalexplorer-path "${gimp_dir}/fractalexplorer:${gimp_data_dir}/fractalexplorer")
......
......@@ -672,7 +672,15 @@ and no.
(help-browser gimp)
Sets the browser used by the help system. Possible values are gimp and
netscape.
webbrowser.
.TP
(web-browser "mozilla \"%s\"")
Sets the external web browser to be used. This can be an absolute path or the
name of an executable to search for in the user's PATH. If the command
contains '%s' it will be replaced with the URL, else the URL will be appended
to the command with a space separating the two. This is a single filename.
.TP
(fractalexplorer-path "${gimp_dir}/fractalexplorer:${gimp_data_dir}/fractalexplorer")
......
......@@ -524,10 +524,18 @@
# (use-help yes)
# Sets the browser used by the help system. Possible values are gimp and
# netscape.
# webbrowser.
#
# (help-browser gimp)
# Sets the external web browser to be used. This can be an absolute path or
# the name of an executable to search for in the user's PATH. If the command
# contains '%s' it will be replaced with the URL, else the URL will be
# appended to the command with a space separating the two. This is a single
# filename.
#
# (web-browser "mozilla \"%s\"")
# Where to search for fractals used by the Fractal Explorer plug-in. This is
# a colon-separated list of folders to search.
#
......
......@@ -15,10 +15,6 @@ if BUILD_HELPBROWSER
helpbrowser = helpbrowser
endif
if BUILD_WEBBROWSER
webbrowser = webbrowser
endif
if BUILD_XJT
xjt = xjt
endif
......@@ -57,7 +53,6 @@ SUBDIRS = \
rcm \
sgi \
sel2path \
$(webbrowser) \
$(win32dirs) \
$(xjt) \
common
......@@ -127,6 +127,7 @@ vinvert
vpropagate
warp
waves
webbrowser
whirlpinch
winclipboard
wind
......
......@@ -146,6 +146,7 @@ libexec_PROGRAMS = \
vpropagate \
warp \
waves \
webbrowser \
whirlpinch \
$(WINCLIPBOARD) \
wind \
......@@ -1660,6 +1661,16 @@ waves_LDADD = \
@GTK_LIBS@ \
@INTLLIBS@
webbrowser_SOURCES = \
webbrowser.c
webbrowser_LDADD = \
$(top_builddir)/libgimp/libgimp-$(LT_RELEASE).la \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
@GLIB_LIBS@ \
@INTLLIBS@
whirlpinch_SOURCES = \
whirlpinch.c
......
......@@ -124,6 +124,7 @@
'vpropagate' => { libdep => 'gtk', ui => 1 },
'warp' => { libdep => 'gtk', ui => 1 },
'waves' => { libdep => 'gtk', ui => 1 },
'webbrowser' => { libdep => 'glib' },
'whirlpinch' => { libdep => 'gtk', ui => 1 },
'winclipboard' => { libdep => 'glib', ui => 1, optional => 1 },
'wind' => { libdep => 'gtk', ui => 1 },
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Web Browser Plug-in
* Copyright (C) 2003 Henrik Brix Andersen <brix@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h> /* strlen, strstr */
#include <glib.h>
#include <libgimp/gimp.h>
#include "libgimp/stdplugins-intl.h"
#define PLUG_IN_NAME "plug_in_web_browser"
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static gboolean browser_open_url (const gchar *url);
static gchar* strreplace (const gchar *string,
const gchar *delimiter,
const gchar *replacement);
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run /* run_proc */
};
MAIN ()
static void
query (void)
{
static GimpParamDef args[] =
{
{ GIMP_PDB_STRING, "url", "URL to open" }
};
gimp_install_procedure (PLUG_IN_NAME,
"Open an URL in the user specified web browser",
"Opens the given URL in the user specified web browser.",
"Henrik Brix Andersen <brix@gimp.org>",
"2003",
"2003/09/16",
NULL, NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpRunMode run_mode;
GimpPDBStatusType status;
run_mode = param[0].data.d_int32;
status = GIMP_PDB_SUCCESS;
INIT_I18N ();
if (nparams == 1 &&
param[0].data.d_string != NULL &&
strlen (param[0].data.d_string))
{
if (! browser_open_url (param[0].data.d_string))
status = GIMP_PDB_EXECUTION_ERROR;
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
static gboolean
browser_open_url (const gchar *url)
{
GError *error = NULL;
gchar *browser;
gchar *cmd;
gchar **argv;
gboolean retval;