More code clean-up. Better use of libgimp routines, etc.

This commit is contained in:
Maurits Rijk
2002-12-19 22:23:37 +00:00
parent c7af92e8d3
commit 449d4913fa
14 changed files with 149 additions and 351 deletions

View File

@ -23,16 +23,12 @@
#include "config.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "imap_default_dialog.h"
#include "imap_file.h"
#include "imap_main.h"
#include "imap_table.h"
#include "libgimp/stdplugins-intl.h"
@ -41,12 +37,9 @@ static void
open_cb(GtkWidget *widget, gpointer data)
{
const gchar *filename;
struct stat buf;
int err;
filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data));
err = stat(filename, &buf);
if (!err && (buf.st_mode & S_IFREG)) {
if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
gtk_widget_hide((GtkWidget*) data);
load(filename);
} else {
@ -99,20 +92,13 @@ static void
save_cb(GtkWidget *widget, gpointer data)
{
const gchar *filename;
struct stat buf;
int err;
filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data));
err = stat(filename, &buf);
if (err) {
gtk_widget_hide((GtkWidget*) data);
save_as(filename);
} else { /* File exists */
if (buf.st_mode & S_IFREG) {
do_file_exists_dialog(data);
} else {
/* Fix me! */
}
if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
do_file_exists_dialog(data);
} else {
gtk_widget_hide((GtkWidget*) data);
save_as(filename);
}
}