aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-11-15 00:20:17 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-11-15 00:20:17 +0800
commit0217b6c0dd6245e757241190134d91e7a1be5a0e (patch)
tree6cf4b009a844dc6aaa0ff78dc4b99f297271ce1a
parent8b11b6d44967267acb681b968ead847b3d0dd1b4 (diff)
downloadgsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.tar
gsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.tar.gz
gsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.tar.bz2
gsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.tar.lz
gsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.tar.xz
gsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.tar.zst
gsoc2013-evolution-0217b6c0dd6245e757241190134d91e7a1be5a0e.zip
Updated. (emfv_popup_copy): Updated.
2003-11-14 Jeffrey Stedfast <fejj@ximian.com> * em-folder-view.c (emfv_popup_move): Updated. (emfv_popup_copy): Updated. * em-folder-tree.c (emft_popup_copy): Updated. (emft_popup_move): Updated. * em-folder-selection.c (create_dialog): New convenience function to construct the dialog contents for all three public functions. (em_folder_selection_run_dialog): Now longer takes a caption arg. (em_folder_selection_run_dialog_uri): Same. (em_select_folder): Here too. svn path=/trunk/; revision=23353
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/em-folder-selection.c94
-rw-r--r--mail/em-folder-selection.h7
-rw-r--r--mail/em-folder-tree.c2
-rw-r--r--mail/em-folder-view.c12
5 files changed, 81 insertions, 48 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 814acad478..bff558acd8 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2003-11-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * em-folder-view.c (emfv_popup_move): Updated.
+ (emfv_popup_copy): Updated.
+
+ * em-folder-tree.c (emft_popup_copy): Updated.
+ (emft_popup_move): Updated.
+
+ * em-folder-selection.c (create_dialog): New convenience function
+ to construct the dialog contents for all three public functions.
+ (em_folder_selection_run_dialog): Now longer takes a caption arg.
+ (em_folder_selection_run_dialog_uri): Same.
+ (em_select_folder): Here too.
+
2003-11-13 Jeffrey Stedfast <fejj@ximian.com>
* mail-component.c (mail_component_get_tree_model): Use
diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c
index 38045e6857..3be462c88a 100644
--- a/mail/em-folder-selection.c
+++ b/mail/em-folder-selection.c
@@ -35,11 +35,53 @@
#include "mail-tools.h"
+static void
+folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, GtkDialog *dialog)
+{
+ gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, TRUE);
+}
+
+static GtkWidget *
+create_dialog (GtkWindow *parent, EMFolderTree *emft, const char *title, const char *default_uri, gboolean allow_create)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_dialog_new ();
+
+ if (parent)
+ gtk_window_set_transient_for ((GtkWindow *) dialog, parent);
+
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 300);
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_title (GTK_WINDOW (dialog), title);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 6);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 6);
+
+ if (allow_create)
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_NEW, GTK_RESPONSE_APPLY, NULL);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ if (default_uri == NULL)
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
+ else
+ em_folder_tree_set_selected (emft, default_uri);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), GTK_WIDGET (emft), TRUE, TRUE, 6);
+
+ g_signal_connect (emft, "folder-selected", G_CALLBACK (folder_selected_cb), dialog);
+
+ return dialog;
+}
+
CamelFolder *
-em_folder_selection_run_dialog (GtkWindow *parent_window,
- const char *title,
- const char *caption,
- CamelFolder *default_folder)
+em_folder_selection_run_dialog (GtkWindow *parent_window, const char *title, CamelFolder *default_folder)
{
CamelFolder *selected_folder;
EMFolderTreeModel *model;
@@ -48,23 +90,18 @@ em_folder_selection_run_dialog (GtkWindow *parent_window,
const char *uri;
int response;
- dialog = gtk_dialog_new_with_buttons (title, parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_NEW, GTK_RESPONSE_APPLY,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
-
model = mail_component_get_tree_model (mail_component_peek ());
emft = em_folder_tree_new_with_model (model);
gtk_widget_show (emft);
- gtk_box_pack_start_defaults ((GtkBox *) ((GtkDialog *) dialog)->vbox, emft);
-
if (default_folder) {
char *default_uri;
default_uri = mail_tools_folder_to_url (default_folder);
- em_folder_tree_set_selected ((EMFolderTree *) emft, default_uri);
+ dialog = create_dialog (parent_window, (EMFolderTree *) emft, title, default_uri, FALSE);
g_free (default_uri);
+ } else {
+ dialog = create_dialog (parent_window, (EMFolderTree *) emft, title, NULL, FALSE);
}
response = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -87,10 +124,7 @@ em_folder_selection_run_dialog (GtkWindow *parent_window,
/* FIXME: This isn't the way to do it, but then neither is the above, really ... */
char *
-em_folder_selection_run_dialog_uri (GtkWindow *parent_window,
- const char *title,
- const char *caption,
- const char *default_uri)
+em_folder_selection_run_dialog_uri (GtkWindow *parent_window, const char *title, const char *default_uri)
{
EMFolderTreeModel *model;
GtkWidget *dialog;
@@ -99,19 +133,14 @@ em_folder_selection_run_dialog_uri (GtkWindow *parent_window,
int response;
char *ret;
- dialog = gtk_dialog_new_with_buttons (title, parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_NEW, GTK_RESPONSE_APPLY,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
-
model = mail_component_get_tree_model (mail_component_peek ());
emft = em_folder_tree_new_with_model (model);
gtk_widget_show (emft);
- gtk_box_pack_start_defaults ((GtkBox *) ((GtkDialog *) dialog)->vbox, emft);
-
if (default_uri)
- em_folder_tree_set_selected ((EMFolderTree *) emft, default_uri);
+ dialog = create_dialog (parent_window, (EMFolderTree *) emft, title, default_uri, FALSE);
+ else
+ dialog = create_dialog (parent_window, (EMFolderTree *) emft, title, NULL, FALSE);
response = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -138,7 +167,7 @@ struct _select_folder_data {
};
static void
-emfs_response (GtkDialog *dialog, int response, struct _select_folder_data *d)
+emfs_response (GtkWidget *dialog, int response, struct _select_folder_data *d)
{
EMFolderTree *emft = g_object_get_data ((GObject *) dialog, "emft");
const char *uri;
@@ -154,27 +183,22 @@ emfs_response (GtkDialog *dialog, int response, struct _select_folder_data *d)
}
void
-em_select_folder (GtkWindow *parent_window, const char *title, const char *text,
- const char *default_uri, void (*done) (const char *uri, void *user_data), void *user_data)
+em_select_folder (GtkWindow *parent_window, const char *title, const char *default_uri,
+ void (*done) (const char *uri, void *user_data), void *user_data)
{
struct _select_folder_data *d;
EMFolderTreeModel *model;
GtkWidget *dialog;
GtkWidget *emft;
- dialog = gtk_dialog_new_with_buttons (title, parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_NEW, GTK_RESPONSE_APPLY,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
-
model = mail_component_get_tree_model (mail_component_peek ());
emft = em_folder_tree_new_with_model (model);
gtk_widget_show (emft);
- gtk_box_pack_start_defaults ((GtkBox *) ((GtkDialog *) dialog)->vbox, emft);
-
if (default_uri)
- em_folder_tree_set_selected ((EMFolderTree *) emft, default_uri);
+ dialog = create_dialog (parent_window, (EMFolderTree *) emft, title, default_uri, FALSE);
+ else
+ dialog = create_dialog (parent_window, (EMFolderTree *) emft, title, NULL, FALSE);
d = g_malloc0 (sizeof (*d));
d->data = user_data;
diff --git a/mail/em-folder-selection.h b/mail/em-folder-selection.h
index 8237e546f7..cbcbc20826 100644
--- a/mail/em-folder-selection.h
+++ b/mail/em-folder-selection.h
@@ -34,16 +34,13 @@ extern "C" {
CamelFolder *em_folder_selection_run_dialog (GtkWindow *parent_window,
const char *title,
- const char *caption,
CamelFolder *default_folder);
char *em_folder_selection_run_dialog_uri (GtkWindow *parent_window,
const char *title,
- const char *caption,
- const char *default_folder_uri);
+ const char *default_uri);
-void em_select_folder (GtkWindow *parent_window, const char *title, const char *text,
- const char *default_folder_uri,
+void em_select_folder (GtkWindow *parent_window, const char *title, const char *default_uri,
void (*done)(const char *uri, void *data),
void *data);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 6016aeaa85..8566cbf451 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1220,7 +1220,6 @@ emft_popup_copy (GtkWidget *item, EMFolderTree *emft)
cfd->delete = FALSE;
em_select_folder (NULL, _("Select folder"),
- _("Select destination to copy folder into"),
NULL, emft_popup_copy_folder_selected, cfd);
}
@@ -1234,7 +1233,6 @@ emft_popup_move (GtkWidget *item, EMFolderTree *emft)
cfd->delete = TRUE;
em_select_folder (NULL, _("Select folder"),
- _("Select destination to move folder into"),
NULL, emft_popup_copy_folder_selected, cfd);
}
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 45fe46dbbb..ffece26fac 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -579,28 +579,28 @@ static void
emfv_popup_move(GtkWidget *w, EMFolderView *emfv)
{
struct _move_data *d;
-
+
d = g_malloc(sizeof(*d));
d->emfv = emfv;
g_object_ref(emfv);
d->uids = message_list_get_selected(emfv->list);
d->delete = TRUE;
-
- em_select_folder ((GtkWindow *) emfv, _("Select folder"), NULL, NULL, emfv_popup_move_cb, d);
+
+ em_select_folder ((GtkWindow *) emfv, _("Select folder"), NULL, emfv_popup_move_cb, d);
}
static void
emfv_popup_copy(GtkWidget *w, EMFolderView *emfv)
{
struct _move_data *d;
-
+
d = g_malloc(sizeof(*d));
d->emfv = emfv;
g_object_ref(emfv);
d->uids = message_list_get_selected(emfv->list);
d->delete = FALSE;
-
- em_select_folder ((GtkWindow *) emfv, _("Select folder"), NULL, NULL, emfv_popup_move_cb, d);
+
+ em_select_folder ((GtkWindow *) emfv, _("Select folder"), NULL, emfv_popup_move_cb, d);
}
static void