1999-03-14 07:03:11 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2000-02-26 11:41:06 +08:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
1999-03-14 07:03:11 +08:00
|
|
|
*
|
|
|
|
* gimpfileselection.c
|
2000-04-20 23:48:00 +08:00
|
|
|
* Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
|
1999-03-14 07:03:11 +08:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
1999-11-18 05:13:50 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1999-03-14 07:03:11 +08:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2000-02-26 11:41:06 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
1999-03-14 07:03:11 +08:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
1999-11-18 05:13:50 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-03-14 07:03:11 +08:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2001-01-25 06:36:18 +08:00
|
|
|
|
1999-03-14 07:03:11 +08:00
|
|
|
#include "config.h"
|
1999-05-29 05:56:04 +08:00
|
|
|
|
2000-02-26 11:41:06 +08:00
|
|
|
#include <glib.h> /* Needed here by Win32 gcc compilation */
|
1999-05-29 05:56:04 +08:00
|
|
|
|
1999-04-22 14:50:29 +08:00
|
|
|
#include <sys/types.h>
|
1999-03-14 07:03:11 +08:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
|
2000-05-31 07:38:46 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-26 05:17:07 +08:00
|
|
|
#include "gimpwidgetstypes.h"
|
|
|
|
|
1999-03-14 07:03:11 +08:00
|
|
|
#include "gimpfileselection.h"
|
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimp/libgimp-intl.h"
|
1999-03-14 07:03:11 +08:00
|
|
|
|
2000-05-31 07:38:46 +08:00
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifdef G_OS_WIN32
|
Win32 portability changes:
* config.h.win32, README.win32: Small changes.
* tools/pdbgen/pdb/*.pdb: Include <string.h>.
* app/*_cmds.c: Autogenerated files reflect above changes.
* libgimp/makefile.msc app/makefile.msc: Various updates,
including new object files. Gtk+ directory now should be called
gtk+ (not gtk-plus). Use win32-specific gdk subdir. Glib directory
now should be called just glib.
* libgimp/gimp.def: Updates.
* libgimp/gimpfeatures.h.win32: Made current with
gimpfeatures.h.in.
* libgimp/gimpfileselection.c: Define S_ISDIR and S_ISREG if
necessary.
* tools/pdbgen/pdb/fileops.pdb: Must have a
statement (even an empty one) after a label.
* app/fileops_cmds.c: Autogenerated file reflects above changes.
* app/crop.c: Include <string.h>.
* app/{app_procs,batch,fileops,datafiles,errorconsole,general,
plug_in,temp_buf,tile_swap}.c: Test NATIVE_WIN32, not
_MSC_VER. (NATIVE_WIN32 means we are using the Microsoft C
runtime, even if we might be compiling with gcc.)
* app/fileops.c: Don't include <process.h> here.
* app/fileops.h: Do include <process.h> here.
* app/gimpparasite.c: Include config.h, guard inclusion of
<unistd.h>. (Is the inclusion of unistd.h in source files all over
the place really necessary?)
* app/ink.c: MSC doesn't handle conversion from unsigned __int64
to double, so cast to signed.
* app/lut_funcs.c: Include config.h, and define rint() if necessary.
* app/pixel_processor.c: Include config.h without "..", like in
all the other places. Include <string.h>
* app/text_tool.c: Guard the "POINTS" identifier that clashes with
<windows.h>, sigh.
1999-05-05 05:32:17 +08:00
|
|
|
# ifndef S_ISDIR
|
|
|
|
# define S_ISDIR(m) ((m) & _S_IFDIR)
|
|
|
|
# endif
|
|
|
|
# ifndef S_ISREG
|
|
|
|
# define S_ISREG(m) ((m) & _S_IFREG)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
|
1999-11-20 22:27:07 +08:00
|
|
|
enum
|
|
|
|
{
|
1999-06-18 03:13:08 +08:00
|
|
|
FILENAME_CHANGED,
|
1999-03-14 07:03:11 +08:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2001-09-21 18:47:19 +08:00
|
|
|
|
|
|
|
static void gimp_file_selection_class_init (GimpFileSelectionClass *klass);
|
|
|
|
static void gimp_file_selection_init (GimpFileSelection *gfs);
|
|
|
|
|
|
|
|
static void gimp_file_selection_destroy (GtkObject *object);
|
|
|
|
|
|
|
|
static void gimp_file_selection_entry_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static gint gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_file_selection_browse_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
|
|
|
|
|
|
|
|
|
1999-12-07 06:44:40 +08:00
|
|
|
static guint gimp_file_selection_signals[LAST_SIGNAL] = { 0 };
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
static GtkHBoxClass *parent_class = NULL;
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
GType
|
|
|
|
gimp_file_selection_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gfs_type = 0;
|
2000-04-20 23:48:00 +08:00
|
|
|
|
2001-09-21 18:47:19 +08:00
|
|
|
if (! gfs_type)
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
{
|
2001-08-11 00:36:19 +08:00
|
|
|
static const GTypeInfo gfs_info =
|
2001-08-05 04:38:54 +08:00
|
|
|
{
|
2001-08-11 00:36:19 +08:00
|
|
|
sizeof (GimpFileSelectionClass),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_file_selection_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
2001-08-05 04:38:54 +08:00
|
|
|
sizeof (GimpFileSelection),
|
2001-08-11 00:36:19 +08:00
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_file_selection_init,
|
2001-08-05 04:38:54 +08:00
|
|
|
};
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
|
2001-09-21 18:47:19 +08:00
|
|
|
gfs_type = g_type_register_static (GTK_TYPE_HBOX,
|
|
|
|
"GimpFileSelection",
|
2001-08-11 00:36:19 +08:00
|
|
|
&gfs_info, 0);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
}
|
2001-09-21 18:47:19 +08:00
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
return gfs_type;
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gimp_file_selection_class_init (GimpFileSelectionClass *klass)
|
1999-03-14 07:03:11 +08:00
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
object_class = (GtkObjectClass *) klass;
|
1999-03-14 07:03:11 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
1999-03-14 07:03:11 +08:00
|
|
|
|
1999-06-18 03:13:08 +08:00
|
|
|
gimp_file_selection_signals[FILENAME_CHANGED] =
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_new ("filename_changed",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpFileSelectionClass,
|
|
|
|
filename_changed),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
1999-06-18 03:13:08 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
object_class->destroy = gimp_file_selection_destroy;
|
1999-03-14 07:03:11 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
klass->filename_changed = NULL;
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_file_selection_init (GimpFileSelection *gfs)
|
|
|
|
{
|
2000-02-18 21:59:18 +08:00
|
|
|
gfs->title = NULL;
|
1999-03-14 07:03:11 +08:00
|
|
|
gfs->file_selection = NULL;
|
2000-02-18 21:59:18 +08:00
|
|
|
gfs->check_valid = FALSE;
|
|
|
|
|
2000-04-20 23:48:00 +08:00
|
|
|
gfs->file_exists = NULL;
|
1999-03-14 07:03:11 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_box_set_spacing (GTK_BOX (gfs), 2);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (gfs), FALSE);
|
|
|
|
|
1999-03-14 07:03:11 +08:00
|
|
|
gfs->browse_button = gtk_button_new_with_label (" ... ");
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, FALSE, 0);
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_connect (G_OBJECT(gfs->browse_button), "clicked",
|
|
|
|
G_CALLBACK (gimp_file_selection_browse_callback),
|
|
|
|
gfs);
|
1999-03-14 07:03:11 +08:00
|
|
|
gtk_widget_show (gfs->browse_button);
|
|
|
|
|
|
|
|
gfs->entry = gtk_entry_new ();
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 0);
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_connect (G_OBJECT (gfs->entry), "activate",
|
|
|
|
G_CALLBACK (gimp_file_selection_entry_callback),
|
|
|
|
gfs);
|
|
|
|
g_signal_connect (G_OBJECT (gfs->entry), "focus_out_event",
|
|
|
|
G_CALLBACK (gimp_file_selection_entry_focus_out_callback),
|
|
|
|
gfs);
|
1999-03-14 07:03:11 +08:00
|
|
|
gtk_widget_show (gfs->entry);
|
|
|
|
}
|
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
static void
|
|
|
|
gimp_file_selection_destroy (GtkObject *object)
|
1999-03-14 07:03:11 +08:00
|
|
|
{
|
2001-08-05 04:38:54 +08:00
|
|
|
GimpFileSelection *gfs;
|
1999-03-14 07:03:11 +08:00
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (object));
|
|
|
|
|
|
|
|
gfs = GIMP_FILE_SELECTION (object);
|
|
|
|
|
|
|
|
if (gfs->file_selection)
|
1999-03-14 07:03:11 +08:00
|
|
|
{
|
2001-08-05 04:38:54 +08:00
|
|
|
gtk_widget_destroy (gfs->file_selection);
|
|
|
|
gfs->file_selection = NULL;
|
|
|
|
}
|
1999-03-14 07:03:11 +08:00
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
if (gfs->title)
|
|
|
|
{
|
|
|
|
g_free (gfs->title);
|
|
|
|
gfs->title = NULL;
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
2001-08-05 04:38:54 +08:00
|
|
|
|
|
|
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
2000-02-09 05:59:31 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_selection_new:
|
|
|
|
* @title: The title of the #GtkFileSelection dialog.
|
|
|
|
* @filename: The initial filename.
|
|
|
|
* @dir_only: #TRUE if the file selection should accept directories only.
|
|
|
|
* @check_valid: #TRUE if the widget should check if the entered file
|
|
|
|
* really exists.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpFileSelection widget.
|
|
|
|
*
|
|
|
|
* Returns: A pointer to the new #GimpFileSelection widget.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
1999-11-20 22:27:07 +08:00
|
|
|
GtkWidget *
|
2000-11-18 08:25:42 +08:00
|
|
|
gimp_file_selection_new (const gchar *title,
|
|
|
|
const gchar *filename,
|
|
|
|
gboolean dir_only,
|
|
|
|
gboolean check_valid)
|
1999-03-14 07:03:11 +08:00
|
|
|
{
|
|
|
|
GimpFileSelection *gfs;
|
|
|
|
|
2001-08-10 22:41:39 +08:00
|
|
|
gfs = g_object_new (GIMP_TYPE_FILE_SELECTION, NULL);
|
1999-03-14 07:03:11 +08:00
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
gfs->title = g_strdup (title);
|
|
|
|
gfs->dir_only = dir_only;
|
1999-03-14 07:03:11 +08:00
|
|
|
gfs->check_valid = check_valid;
|
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
if (check_valid)
|
|
|
|
{
|
|
|
|
gfs->file_exists = gtk_image_new_from_stock (GTK_STOCK_NO,
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_box_pack_start (GTK_BOX (gfs), gfs->file_exists, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (gfs->file_exists);
|
|
|
|
}
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
gimp_file_selection_set_filename (gfs, filename);
|
1999-03-14 07:03:11 +08:00
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
return GTK_WIDGET (gfs);
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
2000-02-09 05:59:31 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_selection_get_filename:
|
|
|
|
* @gfs: The file selection you want to know the filename from.
|
|
|
|
*
|
|
|
|
* Note that you have to g_free() the returned string.
|
|
|
|
*
|
|
|
|
* Returns: The file or directory the user has entered.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
1999-11-20 22:27:07 +08:00
|
|
|
gchar *
|
1999-03-14 07:03:11 +08:00
|
|
|
gimp_file_selection_get_filename (GimpFileSelection *gfs)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_FILE_SELECTION (gfs), NULL);
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
return gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
|
|
|
}
|
|
|
|
|
2000-02-09 05:59:31 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_selection_set_filename:
|
|
|
|
* @gfs: The file selection you want to set the filename for.
|
|
|
|
* @filename: The new filename.
|
|
|
|
*
|
|
|
|
* If you specified @check_valid as #TRUE in gimp_file_selection_new()
|
|
|
|
* the #GimpFileSelection will immediately check the validity of the file
|
|
|
|
* name.
|
|
|
|
*
|
|
|
|
*/
|
1999-03-14 07:03:11 +08:00
|
|
|
void
|
|
|
|
gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
2000-11-18 08:25:42 +08:00
|
|
|
const gchar *filename)
|
1999-03-14 07:03:11 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
|
|
|
|
|
2000-12-17 08:28:32 +08:00
|
|
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename ? filename : "");
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
/* update everything
|
|
|
|
*/
|
|
|
|
gimp_file_selection_entry_callback (gfs->entry, (gpointer) gfs);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_file_selection_entry_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpFileSelection *gfs;
|
|
|
|
gchar *filename;
|
|
|
|
gint len;
|
|
|
|
|
|
|
|
gfs = GIMP_FILE_SELECTION (data);
|
|
|
|
|
|
|
|
/* filenames still need more sanity checking
|
|
|
|
* (erase double G_DIR_SEPARATORS, ...)
|
|
|
|
*/
|
|
|
|
filename = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
|
|
|
|
filename = g_strstrip (filename);
|
|
|
|
|
|
|
|
while (((len = strlen (filename)) > 1) &&
|
|
|
|
(filename[len - 1] == G_DIR_SEPARATOR))
|
|
|
|
filename[len - 1] = '\0';
|
|
|
|
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_handlers_block_by_func (G_OBJECT (gfs->entry),
|
|
|
|
gimp_file_selection_entry_callback,
|
|
|
|
gfs);
|
1999-03-14 07:03:11 +08:00
|
|
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_handlers_unblock_by_func (G_OBJECT (gfs->entry),
|
|
|
|
gimp_file_selection_entry_callback,
|
|
|
|
gfs);
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
if (gfs->file_selection)
|
|
|
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
|
|
|
filename);
|
|
|
|
g_free (filename);
|
|
|
|
|
|
|
|
gimp_file_selection_check_filename (gfs);
|
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_editable_set_position (GTK_EDITABLE (gfs->entry), -1);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_emit (G_OBJECT (gfs),
|
|
|
|
gimp_file_selection_signals[FILENAME_CHANGED], 0);
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
2000-08-10 01:04:16 +08:00
|
|
|
static gboolean
|
1999-03-14 07:03:11 +08:00
|
|
|
gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gimp_file_selection_entry_callback (widget, data);
|
|
|
|
|
2001-08-14 21:49:21 +08:00
|
|
|
return FALSE;
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
1999-06-18 03:13:08 +08:00
|
|
|
/* local callbacks of gimp_file_selection_browse_callback() */
|
1999-03-14 07:03:11 +08:00
|
|
|
static void
|
|
|
|
gimp_file_selection_filesel_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpFileSelection *gfs;
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
const gchar *filename;
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
gfs = GIMP_FILE_SELECTION (data);
|
|
|
|
filename =
|
|
|
|
gtk_file_selection_get_filename (GTK_FILE_SELECTION (gfs->file_selection));
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
|
|
|
|
2000-02-28 08:45:58 +08:00
|
|
|
gtk_widget_hide (gfs->file_selection);
|
|
|
|
|
1999-06-18 03:13:08 +08:00
|
|
|
/* update everything */
|
1999-03-14 07:03:11 +08:00
|
|
|
gimp_file_selection_entry_callback (gfs->entry, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_file_selection_browse_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpFileSelection *gfs;
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
gfs = GIMP_FILE_SELECTION (data);
|
|
|
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
|
|
|
|
|
|
|
if (gfs->file_selection == NULL)
|
|
|
|
{
|
|
|
|
if (gfs->dir_only)
|
|
|
|
{
|
2001-11-22 02:50:50 +08:00
|
|
|
gfs->file_selection =
|
|
|
|
gtk_file_selection_new (gfs->title ?
|
2002-02-09 01:59:40 +08:00
|
|
|
gfs->title : _("Select Folder"));
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
/* hiding these widgets uses internal gtk+ knowledge, but it's
|
|
|
|
* easier than creating my own directory browser -- michael
|
|
|
|
*/
|
|
|
|
gtk_widget_hide
|
|
|
|
(GTK_FILE_SELECTION (gfs->file_selection)->fileop_del_file);
|
|
|
|
gtk_widget_hide
|
|
|
|
(GTK_FILE_SELECTION (gfs->file_selection)->file_list->parent);
|
|
|
|
}
|
|
|
|
else
|
2001-11-22 02:50:50 +08:00
|
|
|
{
|
|
|
|
gfs->file_selection =
|
|
|
|
gtk_file_selection_new (gfs->title ?
|
|
|
|
gfs->title : _("Select File"));
|
|
|
|
}
|
1999-03-14 07:03:11 +08:00
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
gtk_window_set_position (GTK_WINDOW (gfs->file_selection),
|
|
|
|
GTK_WIN_POS_MOUSE);
|
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (gfs->file_selection),
|
|
|
|
"file_select", "Gimp");
|
1999-12-31 04:16:58 +08:00
|
|
|
|
|
|
|
/* slightly compress the dialog */
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (gfs->file_selection), 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (GTK_FILE_SELECTION (gfs->file_selection)->button_area), 2);
|
|
|
|
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_connect
|
|
|
|
(G_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->ok_button),
|
1999-06-18 03:13:08 +08:00
|
|
|
"clicked",
|
2001-07-31 19:33:13 +08:00
|
|
|
G_CALLBACK (gimp_file_selection_filesel_ok_callback),
|
1999-06-18 03:13:08 +08:00
|
|
|
gfs);
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_connect
|
|
|
|
(G_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->selection_entry),
|
1999-06-18 03:13:08 +08:00
|
|
|
"activate",
|
2001-07-31 19:33:13 +08:00
|
|
|
G_CALLBACK (gimp_file_selection_filesel_ok_callback),
|
1999-06-18 03:13:08 +08:00
|
|
|
gfs);
|
2000-02-12 21:07:59 +08:00
|
|
|
|
2001-07-31 19:33:13 +08:00
|
|
|
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button),
|
|
|
|
"clicked",
|
|
|
|
G_CALLBACK (gtk_widget_hide),
|
|
|
|
gfs->file_selection);
|
|
|
|
g_signal_connect_swapped (GTK_OBJECT (gfs), "unmap",
|
|
|
|
G_CALLBACK (gtk_widget_hide),
|
|
|
|
gfs->file_selection);
|
|
|
|
g_signal_connect_swapped (GTK_OBJECT (gfs->file_selection),
|
|
|
|
"delete_event",
|
|
|
|
G_CALLBACK (gtk_widget_hide),
|
|
|
|
gfs->file_selection);
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
|
|
|
filename);
|
2000-02-12 21:07:59 +08:00
|
|
|
|
1999-03-14 07:03:11 +08:00
|
|
|
if (! GTK_WIDGET_VISIBLE (gfs->file_selection))
|
|
|
|
gtk_widget_show (gfs->file_selection);
|
|
|
|
else
|
|
|
|
gdk_window_raise (gfs->file_selection->window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
|
|
|
{
|
2002-02-18 22:34:50 +08:00
|
|
|
gchar *filename;
|
|
|
|
gboolean exists;
|
1999-03-14 07:03:11 +08:00
|
|
|
|
|
|
|
if (! gfs->check_valid)
|
|
|
|
return;
|
2000-11-18 08:25:42 +08:00
|
|
|
|
2000-04-20 23:48:00 +08:00
|
|
|
if (gfs->file_exists == NULL)
|
1999-03-14 07:03:11 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2002-02-18 22:34:50 +08:00
|
|
|
if (gfs->dir_only)
|
|
|
|
exists = g_file_test (filename, G_FILE_TEST_IS_DIR);
|
2000-04-20 23:48:00 +08:00
|
|
|
else
|
2002-02-18 22:34:50 +08:00
|
|
|
exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
|
2000-02-18 21:59:18 +08:00
|
|
|
|
1999-11-07 02:19:41 +08:00
|
|
|
g_free (filename);
|
2002-02-18 22:34:50 +08:00
|
|
|
|
|
|
|
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
|
|
|
exists ? GTK_STOCK_YES : GTK_STOCK_NO,
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
1999-03-14 07:03:11 +08:00
|
|
|
}
|