aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-01-17 09:53:44 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-01-17 09:53:44 +0000
commita8ae07a985d677f74bc039b2274487449a5d7873 (patch)
treefb34644a2c45c10d5a76c754cc352395998042ef /src
parent25512eb7721957b26de8cf7bb6efcd2f83cd0047 (diff)
modified the window management of export / import dialog.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@903 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/export.c51
-rw-r--r--src/import.c51
2 files changed, 60 insertions, 42 deletions
diff --git a/src/export.c b/src/export.c
index d81a014c..581f9a12 100644
--- a/src/export.c
+++ b/src/export.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto
*
* 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
@@ -55,25 +55,31 @@ static GtkWidget *src_button;
static GtkWidget *file_button;
static GtkWidget *ok_button;
static GtkWidget *cancel_button;
+static gboolean export_finished;
static gboolean export_ack;
-static void export_create(void);
-static void export_ok_cb(GtkWidget *widget, gpointer data);
-static void export_cancel_cb(GtkWidget *widget, gpointer data);
-static void export_srcsel_cb(GtkWidget *widget, gpointer data);
-static void export_filesel_cb(GtkWidget *widget, gpointer data);
-static gint delete_event(GtkWidget *widget, GdkEventAny *event, gpointer data);
-static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data);
+static void export_create (void);
+static void export_ok_cb (GtkWidget *widget,
+ gpointer data);
+static void export_cancel_cb (GtkWidget *widget,
+ gpointer data);
+static void export_srcsel_cb (GtkWidget *widget,
+ gpointer data);
+static void export_filesel_cb (GtkWidget *widget,
+ gpointer data);
+static gint delete_event (GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data);
+static gboolean key_pressed (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data);
gint export_mbox(FolderItem *default_src)
{
gint ok = 0;
gchar *src_id = NULL;
- if (!window)
- export_create();
- else
- gtk_widget_show(window);
+ export_create();
change_dir(get_startup_dir());
@@ -83,14 +89,16 @@ gint export_mbox(FolderItem *default_src)
if (src_id) {
gtk_entry_set_text(GTK_ENTRY(src_entry), src_id);
g_free(src_id);
- } else
- gtk_entry_set_text(GTK_ENTRY(src_entry), "");
- gtk_entry_set_text(GTK_ENTRY(file_entry), "");
+ }
gtk_widget_grab_focus(file_entry);
manage_window_set_transient(GTK_WINDOW(window));
- gtk_main();
+ export_finished = FALSE;
+ export_ack = FALSE;
+
+ while (!export_finished)
+ gtk_main_iteration();
if (export_ack) {
const gchar *srcdir, *utf8mbox;
@@ -119,7 +127,10 @@ gint export_mbox(FolderItem *default_src)
}
}
- gtk_widget_hide(window);
+ gtk_widget_destroy(window);
+ window = NULL;
+ src_entry = file_entry = NULL;
+ src_button = file_button = ok_button = cancel_button = NULL;
return ok;
}
@@ -211,16 +222,14 @@ static void export_create(void)
static void export_ok_cb(GtkWidget *widget, gpointer data)
{
+ export_finished = TRUE;
export_ack = TRUE;
- if (gtk_main_level() > 1)
- gtk_main_quit();
}
static void export_cancel_cb(GtkWidget *widget, gpointer data)
{
+ export_finished = TRUE;
export_ack = FALSE;
- if (gtk_main_level() > 1)
- gtk_main_quit();
}
static void export_filesel_cb(GtkWidget *widget, gpointer data)
diff --git a/src/import.c b/src/import.c
index e7f68ee7..8e8b3840 100644
--- a/src/import.c
+++ b/src/import.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto
*
* 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
@@ -56,40 +56,48 @@ static GtkWidget *file_button;
static GtkWidget *dest_button;
static GtkWidget *ok_button;
static GtkWidget *cancel_button;
+static gboolean import_finished;
static gboolean import_ack;
-static void import_create(void);
-static void import_ok_cb(GtkWidget *widget, gpointer data);
-static void import_cancel_cb(GtkWidget *widget, gpointer data);
-static void import_filesel_cb(GtkWidget *widget, gpointer data);
-static void import_destsel_cb(GtkWidget *widget, gpointer data);
-static gint delete_event(GtkWidget *widget, GdkEventAny *event, gpointer data);
-static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data);
+static void import_create (void);
+static void import_ok_cb (GtkWidget *widget,
+ gpointer data);
+static void import_cancel_cb (GtkWidget *widget,
+ gpointer data);
+static void import_filesel_cb (GtkWidget *widget,
+ gpointer data);
+static void import_destsel_cb (GtkWidget *widget,
+ gpointer data);
+static gint delete_event (GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data);
+static gboolean key_pressed (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data);
gint import_mbox(FolderItem *default_dest)
{
gint ok = 0;
gchar *dest_id = NULL;
- if (!window)
- import_create();
- else
- gtk_widget_show(window);
+ import_create();
- gtk_entry_set_text(GTK_ENTRY(file_entry), "");
if (default_dest && default_dest->path)
dest_id = folder_item_get_identifier(default_dest);
if (dest_id) {
gtk_entry_set_text(GTK_ENTRY(dest_entry), dest_id);
g_free(dest_id);
- } else
- gtk_entry_set_text(GTK_ENTRY(dest_entry), "");
+ }
gtk_widget_grab_focus(file_entry);
manage_window_set_transient(GTK_WINDOW(window));
- gtk_main();
+ import_finished = FALSE;
+ import_ack = FALSE;
+
+ while (!import_finished)
+ gtk_main_iteration();
if (import_ack) {
const gchar *utf8filename, *destdir;
@@ -125,7 +133,10 @@ gint import_mbox(FolderItem *default_dest)
}
}
- gtk_widget_hide(window);
+ gtk_widget_destroy(window);
+ window = NULL;
+ file_entry = dest_entry = NULL;
+ file_button = dest_button = ok_button = cancel_button = NULL;
return ok;
}
@@ -217,16 +228,14 @@ static void import_create(void)
static void import_ok_cb(GtkWidget *widget, gpointer data)
{
+ import_finished = TRUE;
import_ack = TRUE;
- if (gtk_main_level() > 1)
- gtk_main_quit();
}
static void import_cancel_cb(GtkWidget *widget, gpointer data)
{
+ import_finished = TRUE;
import_ack = FALSE;
- if (gtk_main_level() > 1)
- gtk_main_quit();
}
static void import_filesel_cb(GtkWidget *widget, gpointer data)