Commit 8b5b8df8 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

generate app/file/Makefile

2001-10-25  Michael Natterer  <mitch@gimp.org>

	* configure.in: generate app/file/Makefile

	* app/Makefile.am
	* app/file-open.[ch]
	* app/file-save.[ch]
	* app/file-utils.[ch]: removed...

	* app/file/Makefile.am
	* app/file/file-open.[ch]
	* app/file/file-save.[ch]
	* app/file/file-utils.[ch]: ...and added here.

	* app/gui/file-commands.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c
	* tools/pdbgen/pdb/fileops.pdb: changed includes accordingly.

	* app/app_procs.[ch]: removed app_exit_finish() and
	app_exit_finish_done() from the public API, call gtk_main() here,
	pass "no_data" to gimp_new() and "restore_session" to
	gui_restore().

	* app/main.c: removed global variable "double_speed", don't
	call gtk_main() in main.c. Added some missing log domains.

	* app/appenv.h: removed "double_speed".

	* app/core/gimp.[ch]: added "gboolean no_data" property which
	must be passed to gimp_new().

	* app/display/gimpdisplay-foreach.[ch]: added gdisplays_set_busy()
	and gdisplays_unset_busy().

	* app/gui/about-dialog.c: don't include "appenv.h", declare
	"double_speed" extern.

	* app/gui/brush-select.[ch]
	* app/gui/gradient-select.[ch]
	* app/gui/palette-select.[ch]
	* app/gui/pattern-select.[ch]: made the list of dialogs and the
	global selection dialogs private. Added functions which get a
	dialog by PDB callback_name. Pass a "Gimp" and the callback_name
	to the constructors. Don't include "app_procs.h" for "the_gimp"
	and "appenv.h" for "no_data" any more. Use the passed "Gimp"
	instead and look at gimp->no_data.

	* app/gui/toolbox.[ch]: pass a "Gimp" to the constructor.

	* app/gui/gui.[ch]: use the new gdisplays_[un]set_busy() functions,
	use the passed "Gimp" all over the place, don't include
	"appenv.h" and "app_procs.h". gui_really_quit_dialog() takes
	a "quit_func" callback now and calls it instead of calling
	app_exit_finish() (which is now private) directly.

	* app/gui/convert-dialog.c
	* app/gui/dialogs-constructors.c
	* app/gui/palette-import-dialog.c
	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/gradient_select.pdb
	* tools/pdbgen/pdb/pattern_select.pdb: changed accordingly.

	* app/pdb/brush_select_cmds.c
	* app/pdb/fileops_cmds.c
	* app/pdb/gradient_select_cmds.c
	* app/pdb/pattern_select_cmds.c: regenerated.

2001-10-25  Michael Natterer  <mitch@gimp.org>

	* POTFILES.in: app/file-*.c -> app/file/file-*.c
parent 21cc5af7
2001-10-25 Michael Natterer <mitch@gimp.org>
* configure.in: generate app/file/Makefile
* app/Makefile.am
* app/file-open.[ch]
* app/file-save.[ch]
* app/file-utils.[ch]: removed...
* app/file/Makefile.am
* app/file/file-open.[ch]
* app/file/file-save.[ch]
* app/file/file-utils.[ch]: ...and added here.
* app/gui/file-commands.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c
* tools/pdbgen/pdb/fileops.pdb: changed includes accordingly.
* app/app_procs.[ch]: removed app_exit_finish() and
app_exit_finish_done() from the public API, call gtk_main() here,
pass "no_data" to gimp_new() and "restore_session" to
gui_restore().
* app/main.c: removed global variable "double_speed", don't
call gtk_main() in main.c. Added some missing log domains.
* app/appenv.h: removed "double_speed".
* app/core/gimp.[ch]: added "gboolean no_data" property which
must be passed to gimp_new().
* app/display/gimpdisplay-foreach.[ch]: added gdisplays_set_busy()
and gdisplays_unset_busy().
* app/gui/about-dialog.c: don't include "appenv.h", declare
"double_speed" extern.
* app/gui/brush-select.[ch]
* app/gui/gradient-select.[ch]
* app/gui/palette-select.[ch]
* app/gui/pattern-select.[ch]: made the list of dialogs and the
global selection dialogs private. Added functions which get a
dialog by PDB callback_name. Pass a "Gimp" and the callback_name
to the constructors. Don't include "app_procs.h" for "the_gimp"
and "appenv.h" for "no_data" any more. Use the passed "Gimp"
instead and look at gimp->no_data.
* app/gui/toolbox.[ch]: pass a "Gimp" to the constructor.
* app/gui/gui.[ch]: use the new gdisplays_[un]set_busy() functions,
use the passed "Gimp" all over the place, don't include
"appenv.h" and "app_procs.h". gui_really_quit_dialog() takes
a "quit_func" callback now and calls it instead of calling
app_exit_finish() (which is now private) directly.
* app/gui/convert-dialog.c
* app/gui/dialogs-constructors.c
* app/gui/palette-import-dialog.c
* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/pattern_select.pdb: changed accordingly.
* app/pdb/brush_select_cmds.c
* app/pdb/fileops_cmds.c
* app/pdb/gradient_select_cmds.c
* app/pdb/pattern_select_cmds.c: regenerated.
2001-10-24 Sven Neumann <sven@gimp.org>
* plug-ins/perl/examples/glowing_steel: merged Raphaels patch for
......
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs base core pdb plug-in xcf tools display widgets gui
SUBDIRS = paint-funcs base core xcf file pdb plug-in tools display widgets gui
scriptdata =
......@@ -45,15 +45,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
gimprc.c \
gimprc.h \
##
## file load/save stuff
##
file-open.c \
file-open.h \
file-save.c \
file-save.h \
file-utils.h \
file-utils.c \
##
## stuff for plug-in/
##
plug_in.c \
......@@ -128,8 +119,9 @@ gimp_LDADD = @STRIP_BEGIN@ \
widgets/libappwidgets.a \
plug-in/libappplug-in.a \
core/libappcore.a \
pdb/libapppdb.a \
xcf/libappxcf.a \
file/libappfile.a \
pdb/libapppdb.a \
paint-funcs/libapppaint-funcs.a \
base/libappbase.a \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
......
......@@ -30,6 +30,9 @@
#include "core/gimpimage.h"
#include "core/gimpobject.h"
#include "file/file-open.h"
#include "file/file-save.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplay-ops.h"
......@@ -40,8 +43,6 @@
#include "file-save-dialog.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-save.h"
#include "gimprc.h"
#include "undo.h"
......
......@@ -66,22 +66,20 @@
#include "libgimp/gimpintl.h"
Gimp *the_gimp = NULL;
/* local prototypes */
static void app_init_update_status (const gchar *text1,
const gchar *text2,
gdouble percentage);
static void app_exit_finish (void);
static gboolean is_app_exit_finish_done = FALSE;
/* global variables */
static void
app_init_update_status (const gchar *text1,
const gchar *text2,
gdouble percentage)
{
if (! no_interface && ! no_splash)
{
splash_update (text1, text2, percentage);
}
}
Gimp *the_gimp = NULL;
/* public functions */
void
app_init (gint gimp_argc,
......@@ -93,7 +91,7 @@ app_init (gint gimp_argc,
/* Create an instance of the "Gimp" object which is the root of the
* core object system
*/
the_gimp = gimp_new (be_verbose);
the_gimp = gimp_new (be_verbose, no_data);
/* Check if the user's gimp_directory exists
*/
......@@ -182,7 +180,7 @@ app_init (gint gimp_argc,
/* FIXME: This needs to go in preferences */
message_handler = MESSAGE_BOX;
gui_restore (the_gimp);
gui_restore (the_gimp, restore_session);
}
/* Parse the rest of the command line arguments as images to load
......@@ -201,6 +199,8 @@ app_init (gint gimp_argc,
{
gui_post_init (the_gimp);
}
gtk_main ();
}
void
......@@ -208,19 +208,28 @@ app_exit (gboolean kill_it)
{
/* If it's the user's perogative, and there are dirty images */
if (! kill_it && gdisplays_dirty () && ! no_interface)
gui_really_quit_dialog ();
gui_really_quit_dialog (G_CALLBACK (app_exit_finish));
else
app_exit_finish ();
}
void
app_exit_finish (void)
{
if (app_exit_finish_done ())
return;
is_app_exit_finish_done = TRUE;
/* private functions */
static void
app_init_update_status (const gchar *text1,
const gchar *text2,
gdouble percentage)
{
if (! no_interface && ! no_splash)
{
splash_update (text1, text2, percentage);
}
}
static void
app_exit_finish (void)
{
message_handler = CONSOLE;
if (! no_interface)
......@@ -249,9 +258,3 @@ app_exit_finish (void)
*/
gtk_exit (0);
}
gboolean
app_exit_finish_done (void)
{
return is_app_exit_finish_done;
}
......@@ -26,11 +26,9 @@
extern Gimp *the_gimp;
void app_init (gint gimp_argc,
gchar **gimp_argv);
void app_exit (gboolean kill_it);
void app_exit_finish (void);
gboolean app_exit_finish_done (void);
void app_init (gint gimp_argc,
gchar **gimp_argv);
void app_exit (gboolean kill_it);
#endif /* __APP_PROCS_H__ */
......@@ -52,7 +52,6 @@ extern gchar **batch_cmds;
/* other global variables */
extern gchar *prog_name;
extern MessageHandlerType message_handler;
extern gboolean double_speed;
#endif /* __APPENV_H__ */
......@@ -118,6 +118,7 @@ gimp_init (Gimp *gimp)
gimp_core_config_init (gimp);
gimp->be_verbose = FALSE;
gimp->no_data = FALSE;
gimp->create_display_func = NULL;
gimp->gui_set_busy_func = NULL;
......@@ -300,13 +301,15 @@ gimp_finalize (GObject *object)
}
Gimp *
gimp_new (gboolean be_verbose)
gimp_new (gboolean be_verbose,
gboolean no_data)
{
Gimp *gimp;
gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
gimp->be_verbose = be_verbose ? TRUE : FALSE;
gimp->no_data = no_data ? TRUE : FALSE;
return gimp;
}
......
......@@ -45,6 +45,7 @@ struct _Gimp
GimpCoreConfig *config;
gboolean be_verbose;
gboolean no_data;
GimpCreateDisplayFunc create_display_func;
GimpSetBusyFunc gui_set_busy_func;
......@@ -115,7 +116,8 @@ struct _GimpClass
GType gimp_get_type (void);
Gimp * gimp_new (gboolean be_verbose);
Gimp * gimp_new (gboolean be_verbose,
gboolean no_data);
void gimp_initialize (Gimp *gimp,
GimpInitStatusFunc status_callback);
......
......@@ -39,8 +39,6 @@
#include "about-dialog.h"
#include "authors.h"
#include "appenv.h"
#include "libgimp/gimpintl.h"
#include "pixmaps/wilber2.xpm"
......@@ -70,6 +68,8 @@ static void about_dialog_tool_drop (GtkWidget *widget,
static gboolean about_dialog_timer (gpointer data);
extern gboolean double_speed;
static GtkWidget *about_dialog = NULL;
static GtkWidget *logo_area = NULL;
static GtkWidget *scroll_area = NULL;
......@@ -95,7 +95,6 @@ static gint cur_scroll_text = 0;
static gint cur_scroll_index = 0;
static gint shuffle_array[G_N_ELEMENTS (authors)];
static gchar *drop_text[] =
{
"We are The GIMP." ,
......@@ -110,6 +109,7 @@ static gchar *hadja_text[] =
"Tvärtom!"
};
GtkWidget *
about_dialog_create (void)
{
......
......@@ -618,13 +618,15 @@ static void
indexed_custom_palette_button_callback (GtkWidget *widget,
gpointer data)
{
IndexedDialog *dialog = (IndexedDialog *)data;
IndexedDialog *dialog = (IndexedDialog *) data;
if (dialog->palette_select == NULL)
{
dialog->palette_select =
palette_select_new (_("Select Custom Palette"),
GIMP_OBJECT (theCustomPalette)->name);
palette_select_new (the_gimp,
_("Select Custom Palette"),
GIMP_OBJECT (theCustomPalette)->name,
NULL);
g_signal_connect (G_OBJECT (dialog->palette_select->shell), "destroy",
G_CALLBACK (indexed_palette_select_destroy_callback),
......
......@@ -161,7 +161,7 @@ GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context)
{
return toolbox_create ();
return toolbox_create (context->gimp);
}
GtkWidget *
......@@ -182,28 +182,28 @@ GtkWidget *
dialogs_brush_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return brush_dialog_create ();
return brush_dialog_create (context->gimp);
}
GtkWidget *
dialogs_pattern_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return pattern_dialog_create ();
return pattern_dialog_create (context->gimp);
}
GtkWidget *
dialogs_gradient_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return gradient_dialog_create ();
return gradient_dialog_create (context->gimp);
}
GtkWidget *
dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context)
{
return palette_dialog_create ();
return palette_dialog_create (context->gimp);
}
GtkWidget *
......
......@@ -48,13 +48,14 @@
#include "core/gimpdocuments.h"
#include "core/gimpimage.h"
#include "file/file-open.h"
#include "file/file-utils.h"
#include "file-dialog-utils.h"
#include "file-open-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"
......
......@@ -37,14 +37,15 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "file/file-save.h"
#include "file/file-utils.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"
......
......@@ -97,7 +97,7 @@ palette_import_select_grad_callback (GtkWidget *widget,
gpointer data)
{
/* Popup grad edit box .... */
gradient_dialog_create ();
gradient_dialog_create (the_gimp);
}
static void
......
......@@ -355,3 +355,31 @@ gdisplays_reconnect (GimpImage *old,
gdisplay_reconnect (gdisp, new);
}
}
void
gdisplays_set_busy (void)
{
GSList *list;
GimpDisplay *gdisp;
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = list->data;
gdisplay_install_override_cursor (gdisp, GDK_WATCH);
}
}
void
gdisplays_unset_busy (void)
{
GSList *list;
GimpDisplay *gdisp;
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = list->data;
gdisplay_remove_override_cursor (gdisp);
}
}
......@@ -47,6 +47,8 @@ void gdisplays_delete (void);
void gdisplays_flush (void);
void gdisplays_flush_now (void);
void gdisplays_nav_preview_resized (void);
void gdisplays_set_busy (void);
void gdisplays_unset_busy (void);
#endif /* __GIMP_DISPLAY_FOREACH_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
* Copyright (C) 1997 Josh MacDonald
*
* 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"
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#ifdef G_OS_WIN32
#include <io.h>
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWGRP
#define S_IWGRP (_S_IWRITE>>3)
#define S_IWOTH (_S_IWRITE>>6)
#endif
#ifndef S_IRGRP
#define S_IRGRP (_S_IREAD>>3)
#define S_IROTH (_S_IREAD>>6)
#endif
#define uid_t gint
#define gid_t gint
#define geteuid() 0
#define getegid() 0
#endif
#include <glib-object.h>
#include "core/core-types.h"
#include "core/gimpimage.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
GSList *load_procs = NULL;
/* public functions */
GimpImage *
file_open_image (Gimp *gimp,
const gchar *filename,
const gchar *raw_filename,
const gchar *open_mode,
PlugInProcDef *file_proc,
RunModeType run_mode,
gint *status)
{
ProcRecord *proc;
Argument *args;
Argument *return_vals;
gint gimage_id;
gint i;
struct stat statbuf;
*status = GIMP_PDB_CANCEL; /* inhibits error messages by caller */
if (! file_proc)
file_proc = file_proc_find (load_procs, filename);
if (! file_proc)
{
/* no errors when making thumbnails */
if (run_mode == RUN_INTERACTIVE)
g_message (_("%s failed.\n"
"%s: Unknown file type."),
open_mode, filename);
return NULL;
}
/* check if we are opening a file */
if (stat (filename, &statbuf) == 0)
{
uid_t euid;
gid_t egid;
if (! (statbuf.st_mode & S_IFREG))
{
/* no errors when making thumbnails */
if (run_mode == RUN_INTERACTIVE)
g_message (_("%s failed.\n"
"%s is not a regular file."),
open_mode, filename);
return NULL;
}
euid = geteuid ();
egid = getegid ();
if (! ((statbuf.st_mode & S_IRUSR) ||
((statbuf.st_mode & S_IRGRP) &&
(statbuf.st_uid != euid)) ||
((statbuf.st_mode & S_IROTH) &&
(statbuf.st_uid != euid) &&
(statbuf.st_gid != egid))))
{
/* no errors when making thumbnails */
if (run_mode == RUN_INTERACTIVE)
g_message (_("%s failed.\n"
"%s: Permission denied."),
open_mode, filename);
return NULL;
}
}
proc = &file_proc->db_info;
args = g_new0 (Argument, proc->num_args);
for (i = 0; i < proc->num_args; i++)
args[i].arg_type = proc->args[i].arg_type;