diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-01-17 09:53:44 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-01-17 09:53:44 +0000 |
commit | a8ae07a985d677f74bc039b2274487449a5d7873 (patch) | |
tree | fb34644a2c45c10d5a76c754cc352395998042ef /src/import.c | |
parent | 25512eb7721957b26de8cf7bb6efcd2f83cd0047 (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/import.c')
-rw-r--r-- | src/import.c | 51 |
1 files changed, 30 insertions, 21 deletions
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) |