added gimp_get_temp_filename().
2006-03-30 Sven Neumann <sven@gimp.org> * app/core/gimp-utils.[ch]: added gimp_get_temp_filename(). * tools/pdbgen/pdb/fileops.pdb (temp_name): removed the implementation here and call gimp_get_temp_filename() instead. * app/pdb/fileops_cmds.c: regenerated.
This commit is contained in:
parent
55578d0d3e
commit
acc84675a5
5 changed files with 60 additions and 56 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2006-03-30 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimp-utils.[ch]: added gimp_get_temp_filename().
|
||||
|
||||
* tools/pdbgen/pdb/fileops.pdb (temp_name): removed the
|
||||
implementation here and call gimp_get_temp_filename() instead.
|
||||
|
||||
* app/pdb/fileops_cmds.c: regenerated.
|
||||
|
||||
2006-03-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/pdb/procedural_db.h (structs Argument and ProcArg): renamed
|
||||
|
|
|
|||
|
|
@ -26,6 +26,16 @@
|
|||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
|
|
@ -34,6 +44,9 @@
|
|||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "config/gimpbaseconfig.c"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimp-utils.h"
|
||||
|
||||
|
||||
|
|
@ -326,3 +339,33 @@ gimp_parameters_free (GParameter *params,
|
|||
g_free (params);
|
||||
}
|
||||
}
|
||||
|
||||
gchar *
|
||||
gimp_get_temp_filename (Gimp *gimp,
|
||||
const gchar *extension)
|
||||
{
|
||||
static gint id = 0;
|
||||
static gint pid;
|
||||
gchar *filename;
|
||||
gchar *basename;
|
||||
gchar *path;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (extension != NULL, NULL);
|
||||
|
||||
if (id == 0)
|
||||
pid = getpid ();
|
||||
|
||||
basename = g_strdup_printf ("gimp-temp-%d%d.%s",
|
||||
pid, id++, extension);
|
||||
|
||||
path = gimp_config_path_expand (GIMP_BASE_CONFIG (gimp->config)->temp_path,
|
||||
TRUE, NULL);
|
||||
|
||||
filename = g_build_filename (path, basename, NULL);
|
||||
|
||||
g_free (path);
|
||||
g_free (basename);
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,5 +60,8 @@ GParameter * gimp_parameters_append_valist (GType object_type,
|
|||
void gimp_parameters_free (GParameter *params,
|
||||
gint n_params);
|
||||
|
||||
gchar * gimp_get_temp_filename (Gimp *gimp,
|
||||
const gchar *extension);
|
||||
|
||||
|
||||
#endif /* __APP_GIMP_UTILS_H__ */
|
||||
|
|
|
|||
|
|
@ -21,20 +21,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
|
@ -46,7 +33,7 @@
|
|||
#include "procedural_db.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
|
||||
#include "config/gimpbaseconfig.h"
|
||||
#include "core/gimp-utils.h"
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagefile.h"
|
||||
|
|
@ -838,26 +825,7 @@ temp_name_invoker (ProcRecord *proc_record,
|
|||
extension = (gchar *) g_value_get_string (&args[0].value);
|
||||
|
||||
if (success)
|
||||
{
|
||||
static gint id = 0;
|
||||
static gint pid;
|
||||
gchar *filename;
|
||||
gchar *path;
|
||||
|
||||
if (id == 0)
|
||||
pid = getpid ();
|
||||
|
||||
filename = g_strdup_printf ("gimp_temp_%d%d.%s",
|
||||
pid, id++, extension);
|
||||
|
||||
path = gimp_config_path_expand (GIMP_BASE_CONFIG (gimp->config)->temp_path,
|
||||
TRUE, NULL);
|
||||
|
||||
name = g_build_filename (path, filename, NULL);
|
||||
|
||||
g_free (path);
|
||||
g_free (filename);
|
||||
}
|
||||
name = gimp_get_temp_filename (gimp, extension);
|
||||
|
||||
return_vals = procedural_db_return_values (proc_record, success);
|
||||
|
||||
|
|
|
|||
|
|
@ -386,28 +386,9 @@ HELP
|
|||
);
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw(<process.h> "config/gimpbaseconfig.h") ],
|
||||
headers => [ qw("core/gimp-utils.h") ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
static gint id = 0;
|
||||
static gint pid;
|
||||
gchar *filename;
|
||||
gchar *path;
|
||||
|
||||
if (id == 0)
|
||||
pid = getpid ();
|
||||
|
||||
filename = g_strdup_printf ("gimp_temp_%d%d.%s",
|
||||
pid, id++, extension);
|
||||
|
||||
path = gimp_config_path_expand (GIMP_BASE_CONFIG (gimp->config)->temp_path,
|
||||
TRUE, NULL);
|
||||
|
||||
name = g_build_filename (path, filename, NULL);
|
||||
|
||||
g_free (path);
|
||||
g_free (filename);
|
||||
}
|
||||
name = gimp_get_temp_filename (gimp, extension);
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
|
@ -671,7 +652,7 @@ done:
|
|||
CODE
|
||||
|
||||
|
||||
@headers = qw(<sys/types.h> <unistd.h> <gdk-pixbuf/gdk-pixbuf.h>
|
||||
@headers = qw(<gdk-pixbuf/gdk-pixbuf.h>
|
||||
"libgimpbase/gimpbase.h" "libgimpconfig/gimpconfig.h"
|
||||
"libgimpthumb/gimpthumb.h"
|
||||
"core/gimp.h" "core/gimpimagefile.h"
|
||||
|
|
|
|||
Loading…
Reference in a new issue