Commit dea84972 authored by Manish Singh's avatar Manish Singh
Browse files

fix setting of $localedir, and use $CONFIG_SHELL to run config.status

* configure.in: fix setting of $localedir, and use $CONFIG_SHELL
to run config.status (variation upon gimp-joke-990122-1)

* plug-ins/fp/fp_gtk.c: make label code consistent so we
don't get confused (gimp-ruth-990131-0)

* app/app_procs.c: toast stale swap files on startup

* app/general.[ch]: removed prune_filename

* app/by_color_select.c
* app/colormap_dialog.i.c
* app/fileops.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/gimpbrush.c
* app/gradient.c
* app/info_window.c
* app/menus.c
* app/palette.c
* app/patterns.c: s/prune_filename/g_basename/

-Yosh
parent 5d92f178
Sun Feb 7 02:44:44 PST 1999 Manish Singh <yosh@gimp.org>
* configure.in: fix setting of $localedir, and use $CONFIG_SHELL
to run config.status (variation upon gimp-joke-990122-1)
* plug-ins/fp/fp_gtk.c: make label code consistent so we
don't get confused (gimp-ruth-990131-0)
* app/app_procs.c: toast stale swap files on startup
* app/general.[ch]: removed prune_filename
* app/by_color_select.c
* app/colormap_dialog.i.c
* app/fileops.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/gimpbrush.c
* app/gradient.c
* app/info_window.c
* app/menus.c
* app/palette.c
* app/patterns.c: s/prune_filename/g_basename/
Sat Feb 6 18:16:57 GMT 1999 Austin Donnelly <austin@gimp.org>
* app/gdisplay.c: gdisplay_format_title now parses a format string
......
......@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <gtk/gtk.h>
......@@ -95,6 +97,7 @@ static int splash_logo_load_size (GtkWidget *window);
static void splash_logo_draw (GtkWidget *widget);
static void splash_text_draw (GtkWidget *widget);
static void splash_logo_expose (GtkWidget *widget);
static void toast_old_temp_files (void);
static gint is_app_exit_finish_done = FALSE;
......@@ -491,6 +494,7 @@ app_init (void)
RESET_BAR();
parse_gimprc (); /* parse the local GIMP configuration file */
if (always_restore_session)
restore_session = TRUE;
......@@ -534,6 +538,7 @@ app_init (void)
/* Add the swap file */
if (swap_path == NULL)
swap_path = "/tmp";
toast_old_temp_files ();
path = g_strdup_printf ("%s/gimpswap.%ld", swap_path, (long)getpid ());
tile_swap_add (path, NULL, NULL);
g_free (path);
......@@ -730,13 +735,38 @@ quit_invoker (Argument *args)
return return_args;
}
static void
toast_old_temp_files (void)
{
DIR *dir;
struct dirent *entry;
GString *filename = g_string_new ("");
dir = opendir (swap_path);
if (!dir)
return;
while ((entry = readdir (dir)) != NULL)
if (!strncmp (entry->d_name, "gimpswap.", 9))
{
/* don't try to kill swap files of running processes
* yes, I know they might not all be gimp processes, and when you
* unlink, it's refcounted, but lets not confuse the user by
* "where did my disk space go?" cause the filename is gone
* if the kill succeeds, and there running process isn't gimp
* we'll probably get it the next time around
*/
int pid = atoi (entry->d_name + 9);
if (kill (pid, 0))
{
g_string_sprintf (filename, "%s/%s", swap_path, entry->d_name);
unlink (filename->str);
}
}
closedir (dir);
g_string_free (filename, TRUE);
}
......@@ -805,7 +805,7 @@ by_color_select_draw (ByColorDialog *bcd,
gtk_widget_draw (bcd->preview, NULL);
/* Update the gimage label to reflect the displayed gimage name */
gtk_label_set_text (GTK_LABEL (bcd->gimage_name), prune_filename (gimage_filename (gimage)));
gtk_label_set_text (GTK_LABEL (bcd->gimage_name), g_basename (gimage_filename (gimage)));
}
static gint
......
......@@ -786,7 +786,7 @@ create_image_menu_cb (gpointer im, gpointer d)
*data->default_index = data->num_items;
}
image_name = prune_filename (gimage_filename (gimage));
image_name = g_basename (gimage_filename (gimage));
menu_item_label = g_strdup_printf ("%s-%d", image_name,
pdb_image_to_id (gimage));
menu_item = gtk_menu_item_new_with_label (menu_item_label);
......
......@@ -241,7 +241,7 @@ gimp_brush_load(GimpBrush *brush, char *filename)
/* Check if the current brush is the default one */
/* lets see if it works with out this for now */
/* if (strcmp(default_brush, prune_filename(filename)) == 0) {
/* if (strcmp(default_brush, g_basename(filename)) == 0) {
active_brush = brush;
have_default_brush = 1;
}*/ /* if */
......
......@@ -241,7 +241,7 @@ gimp_brush_load(GimpBrush *brush, char *filename)
/* Check if the current brush is the default one */
/* lets see if it works with out this for now */
/* if (strcmp(default_brush, prune_filename(filename)) == 0) {
/* if (strcmp(default_brush, g_basename(filename)) == 0) {
active_brush = brush;
have_default_brush = 1;
}*/ /* if */
......
......@@ -218,7 +218,7 @@ gdisplay_format_title (GDisplay *gdisp,
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", prune_filename (gimage_filename (gimage)));
"%s", g_basename (gimage_filename (gimage)));
break;
case 'F': /* full filename */
......
......@@ -133,7 +133,7 @@ info_window_create (void *gdisp_ptr)
gdisp = (GDisplay *) gdisp_ptr;
title = prune_filename (gimage_filename (gdisp->gimage));
title = g_basename (gimage_filename (gdisp->gimage));
type = gimage_base_type (gdisp->gimage);
/* create the info dialog */
......
......@@ -122,7 +122,7 @@ gdisplay_close_window (GDisplay *gdisp,
*/
if (!kill_it && (gdisp->gimage->ref_count == 1) &&
(gdisp->gimage->dirty > 0) && confirm_on_close )
gdisplay_close_warning_dialog (prune_filename (gimage_filename (gdisp->gimage)), gdisp);
gdisplay_close_warning_dialog (g_basename (gimage_filename (gdisp->gimage)), gdisp);
else
{
/* If POPUP_SHELL references this shell, then reset it. */
......
......@@ -218,7 +218,7 @@ gdisplay_format_title (GDisplay *gdisp,
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", prune_filename (gimage_filename (gimage)));
"%s", g_basename (gimage_filename (gimage)));
break;
case 'F': /* full filename */
......
......@@ -651,7 +651,7 @@ file_save_callback (GtkWidget *w,
}
else
file_save (gdisplay->gimage, gimage_filename (gdisplay->gimage),
prune_filename (gimage_filename(gdisplay->gimage)), 2);
g_basename (gimage_filename(gdisplay->gimage)), 2);
}
}
......@@ -751,7 +751,7 @@ file_revert_callback (GtkWidget *w,
else
{
filename = gimage_filename (gdisplay->gimage);
raw_filename = prune_filename (filename);
raw_filename = g_basename (filename);
if ((gimage = file_open_image (filename, raw_filename)) != NULL)
gdisplay_reconnect (gdisplay, gimage);
......
......@@ -218,7 +218,7 @@ gdisplay_format_title (GDisplay *gdisp,
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", prune_filename (gimage_filename (gimage)));
"%s", g_basename (gimage_filename (gimage)));
break;
case 'F': /* full filename */
......
......@@ -122,7 +122,7 @@ gdisplay_close_window (GDisplay *gdisp,
*/
if (!kill_it && (gdisp->gimage->ref_count == 1) &&
(gdisp->gimage->dirty > 0) && confirm_on_close )
gdisplay_close_warning_dialog (prune_filename (gimage_filename (gdisp->gimage)), gdisp);
gdisplay_close_warning_dialog (g_basename (gimage_filename (gdisp->gimage)), gdisp);
else
{
/* If POPUP_SHELL references this shell, then reset it. */
......
......@@ -24,22 +24,6 @@
#include <glib.h>
#include "general.h"
/* prune filename removes all of the leading path information to a filename */
char *
prune_filename (char *filename)
{
char *last_slash = filename;
while (*filename)
if (*filename++ == '/')
last_slash = filename;
return last_slash;
}
char*
search_in_path (char *search_path,
char *filename)
......
......@@ -47,7 +47,6 @@ struct _ParseInfo
};
char * prune_filename (char *);
char * search_in_path (char *, char *);
char * xstrsep (char **p, char *delim);
int get_token (ParseInfo *info);
......
......@@ -241,7 +241,7 @@ gimp_brush_load(GimpBrush *brush, char *filename)
/* Check if the current brush is the default one */
/* lets see if it works with out this for now */
/* if (strcmp(default_brush, prune_filename(filename)) == 0) {
/* if (strcmp(default_brush, g_basename(filename)) == 0) {
active_brush = brush;
have_default_brush = 1;
}*/ /* if */
......
......@@ -5417,7 +5417,7 @@ grad_load_gradient(char *filename)
grad = grad_new_gradient();
grad->filename = g_strdup(filename);
grad->name = g_strdup(prune_filename(filename));
grad->name = g_strdup(g_basename(filename));
fgets(line, 1024, file);
num_segments = atoi(line);
......
......@@ -5417,7 +5417,7 @@ grad_load_gradient(char *filename)
grad = grad_new_gradient();
grad->filename = g_strdup(filename);
grad->name = g_strdup(prune_filename(filename));
grad->name = g_strdup(g_basename(filename));
fgets(line, 1024, file);
num_segments = atoi(line);
......
......@@ -5417,7 +5417,7 @@ grad_load_gradient(char *filename)
grad = grad_new_gradient();
grad->filename = g_strdup(filename);
grad->name = g_strdup(prune_filename(filename));
grad->name = g_strdup(g_basename(filename));
fgets(line, 1024, file);
num_segments = atoi(line);
......
......@@ -133,7 +133,7 @@ info_window_create (void *gdisp_ptr)
gdisp = (GDisplay *) gdisp_ptr;
title = prune_filename (gimage_filename (gdisp->gimage));
title = g_basename (gimage_filename (gdisp->gimage));
type = gimage_base_type (gdisp->gimage);
/* create the info dialog */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment