diff options
author | Dan Winship <danw@src.gnome.org> | 2001-04-28 05:08:51 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-04-28 05:08:51 +0800 |
commit | d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d (patch) | |
tree | 73ddf644a1422e6c0a2b0338fe2b961f5fcdf4f3 /mail/mail-mt.c | |
parent | 63e96e100291b330e75cc3b3b49795c720e5ffa0 (diff) | |
download | gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.tar gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.tar.gz gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.tar.bz2 gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.tar.lz gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.tar.xz gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.tar.zst gsoc2013-evolution-d4b3c14fcd52e273d549e20ae84ead8cf1f75d8d.zip |
Renamed from session.c and made to be a subclass of CamelSession.
* mail-session.c: Renamed from session.c and made to be a subclass
of CamelSession.
* mail-mt.c (mail_user_message): Renamed from mail_get_accept and
made more general-purpose, to implement the new
camel_session_alert_user.
svn path=/trunk/; revision=9618
Diffstat (limited to 'mail/mail-mt.c')
-rw-r--r-- | mail/mail-mt.c | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/mail/mail-mt.c b/mail/mail-mt.c index a4c924cab6..2b0ba7f22a 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -664,69 +664,57 @@ mail_get_password(const char *prompt, gboolean secret) /* ********************************************************************** */ -struct _accept_msg { +struct _user_message_msg { struct _mail_msg msg; + const char *type; const char *prompt; + gboolean allow_cancel; gboolean result; }; static void -do_get_accept (struct _mail_msg *mm) +do_user_message (struct _mail_msg *mm) { - struct _accept_msg *m = (struct _accept_msg *)mm; + struct _user_message_msg *m = (struct _user_message_msg *)mm; GtkWidget *dialog; - GtkWidget *label; - dialog = gnome_dialog_new (_("Do you accept?"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); + dialog = gnome_message_box_new (m->prompt, m->type, + m->allow_cancel ? GNOME_STOCK_BUTTON_CANCEL : GNOME_STOCK_BUTTON_OK, + m->allow_cancel ? GNOME_STOCK_BUTTON_OK: NULL, + NULL); gnome_dialog_set_default (GNOME_DIALOG (dialog), 1); gtk_window_set_policy (GTK_WINDOW (dialog), TRUE, TRUE, TRUE); - label = gtk_label_new (m->prompt); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, - TRUE, TRUE, 0); - gtk_widget_show (label); - /* hrm, we can't run this async since the gui_port from which we're called will reply to our message for us */ - m->result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == 0; -} - -static void -do_free_accept (struct _mail_msg *mm) -{ - /*struct _accept_msg *m = (struct _accept_msg *)mm;*/ - - /* nothing to do here */ + m->result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) != 0; } -struct _mail_msg_op get_accept_op = { +struct _mail_msg_op user_message_op = { + NULL, + do_user_message, NULL, - do_get_accept, NULL, - do_free_accept, }; /* prompt the user with a yes/no question and return the response */ gboolean -mail_get_accept (const char *prompt) +mail_user_message (const char *type, const char *prompt, gboolean allow_cancel) { - struct _accept_msg *m, *r; - EMsgPort *accept_reply; + struct _user_message_msg *m, *r; + EMsgPort *user_message_reply; gboolean accept; - accept_reply = e_msgport_new (); + user_message_reply = e_msgport_new (); - m = mail_msg_new (&get_accept_op, accept_reply, sizeof (*m)); + m = mail_msg_new (&user_message_op, user_message_reply, sizeof (*m)); + m->type = type; m->prompt = prompt; + m->allow_cancel = allow_cancel; if (pthread_self () == mail_gui_thread) { - do_get_accept ((struct _mail_msg *)m); + do_user_message ((struct _mail_msg *)m); r = m; } else { static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; @@ -734,8 +722,8 @@ mail_get_accept (const char *prompt) /* we want this single-threaded, this is the easiest way to do it without blocking ? */ pthread_mutex_lock (&lock); e_msgport_put (mail_gui_port, (EMsg *)m); - e_msgport_wait (accept_reply); - r = (struct _accept_msg *)e_msgport_get (accept_reply); + e_msgport_wait (user_message_reply); + r = (struct _user_message_msg *)e_msgport_get (user_message_reply); pthread_mutex_unlock (&lock); } @@ -744,7 +732,7 @@ mail_get_accept (const char *prompt) accept = m->result; mail_msg_free (m); - e_msgport_destroy (accept_reply); + e_msgport_destroy (user_message_reply); return accept; } |