aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-session.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-11-12 22:59:35 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-11-12 22:59:35 +0800
commitf9804e11931411358ce98ad5a7726de6d68f2115 (patch)
treea8fb046c3abbc7c0e07147c21557a3e22504dbda /mail/mail-session.c
parent83f816df158441ca750b0bc12b7ccab2d43c0e43 (diff)
downloadgsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.gz
gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.tar.zst
gsoc2013-evolution-f9804e11931411358ce98ad5a7726de6d68f2115.zip
Commented out stuff that doesn't build yet. Also fixed idl build rule.
2002-11-13 Not Zed <NotZed@Ximian.com> * Makefile.am: Commented out stuff that doesn't build yet. Also fixed idl build rule. importers still not built. * main.c (main): bonobactivationise. remove push visual/colormap. (main): no longer activate activation, let bonobo_init do it. * mail-signature-editor.c (menu_help): Change help api. * mail-session.c (user_message_destroy_noreply): removed. Not used? * mail-local.c (load_metainfo): xml root->children. * mail-format.c (g_string_append_len): Removed, it exists now. 2002-11-12 Not Zed <NotZed@Ximian.com> * subscribe-dialog.c: gnome2ised, use gtkdialog. (subscribe_get_global_extras): use a weak ref rather than destroy signal. * message-tag-followup.c: gnome2ised. * message-tag-editor.c: gnome2ised & converted to gtkdialog. * message-list.c: gnome2ised. (message_list_finalise): From destroy method. maybe should be destroy still. * message-browser.c: port to gnome2 (message_browser_finalise): renamed from destroy method. * mail-stream-gtkhtml.c: removed redundant camel_class_get_global_classfuncs() call. * mail-signature-editor.c: gtkdialogised, & bonobo api changes. * mail-search-dialogue.c: gtkdialogised. * mail-folder-cache.c: cleaned up camel ref/hook casts. * mail-composer-prefs.c (mail_composer_prefs_get_type): convert to gtype. * mail-font-prefs.c (mail_font_prefs_destroy): from finalise. * mail-config.c: s/bonobo_config/e_config_listener/ Added /apps/Evolution prefix to the evolution keys. Changed to use e_config_listener, etc. (mail_config_init): remove bonobo_config stuff. (mail_config_check_service): gtk dialogise. (check_response): from check_cancelled. * mail-config-druid.c (mail_config_druid_destroy): renamed from _finalize, turned into destroy handler. (construct): set type to toplevel, GTK_WINDOW_DIALOG no longer exists. * mail-config-factory.c (mail_config_register_factory): bonobo api changes. * mail-crypto.c (mail_crypto_get_pgp_cipher_context): cleaned up unref casts. * mail-display.c (write_data_to_file): gnome->gtkdialog. (on_link_clicked): use ascii_str*cmp on url. (save_part): g_path stuff. (launch_cb): gtk dialog. (pixmap_press): de-oafify. (pixbuf_for_mime_type): gnome-vfs api changes. (do_attachment_header): Change the pixmap to a gtkimage. (do_signature): " (pixbuf_gen_idle): " (do_attachment_header): ascii_str*cmp (do_attachment_header): gnome pixmap->gtkimage. (mail_display_destroy): protect against gtk mentalness. (html_button_press_event): ascii_str*cmp (drag_data_get_cb): added comment for translators of filename. * mail-format.c (component_supports): de-oafise. (is_anonymous): ascii_strncmp (attachment_header): remove utf8<>locale stuff, and gnomevfs api changes. (format_mime_part): fix g_strdown call. (write_field_row_begin): kill utf8->gtk stuff. (write_address): " (default_header_index): ascii_strcasecmp (handle_text_plain): " (handle_text_enriched): " (handle_multipart_encrypted): remove utf/gtk stuff. (handle_message_external_body): ascii_str*cmp * mail-identify.c (mail_identify_mime_part): (identify_by_magic): gnome vfs api changes. * mail-importer.c: Converted. * mail-local.c (load_metainfo): xml childs -> children. (mls_get_folder): g_strerror. (mls_delete_folder): g_strerror. (reconfigure_got_folder): Gnome->GtkDialog (reconfigure_response): from reconfigure_clicked. * mail-mt.c (mail_msg_check_error): gnome -> gtk dialog (error_response): renmae from error_gone. destroy widget on any response. * mail-offline-handler.c (impl_finalise): renamed from impl_destroy since thats what it should be anyway. * mail-ops.c: removed utf8 widget conversion & camel_object_un/ref casts. * mail-preferences.c (mail_preferences_get_type): glib2'ised. * mail-search.c (mail_search_finalise): renmaed from destroy & properly chain. (mail_search_get_type): glib2 & make gtkdialog parent. (entry_run_search): run search when entry activated. not sure if gtkdialog has anohter way to do this on an arbitrary widget. * mail-send-recv.c (dialogue_response): renamed from clicked. Use gtkdialog. * mail-session.c (request_password_deleted): removed, redundant. (pass_response): rename from pass_got, changed for gtkdialog. (user_message_destroy): Removed, redundant. (user_message_response): Renamed from user_message_clicked. 2002-11-11 Not Zed <NotZed@Ximian.com> * mail-stream-gtkhtml.c (mail_stream_gtkhtml_class_init): dont use get_global_classfuncs, just get the type * mail-tools.c: converted gnome2 api's. * mail-vfolder.c (vfolder_editor_response): clicked->response. (vfolder_editor_destroy): Removed. (vfolder_edit): gtk dialog api (edit_rule_response): clicked->response. (vfolder_edit_rule): gnomedialog->gtkdialog. (vfolder_gui_add_rule): " (new_rule_clicked): clicked->response svn path=/trunk/; revision=18723
Diffstat (limited to 'mail/mail-session.c')
-rw-r--r--mail/mail-session.c178
1 files changed, 85 insertions, 93 deletions
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 011f09edca..11285f8a12 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -25,14 +25,13 @@
#endif
#include <stdlib.h>
+
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkstock.h>
+
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-config.h>
#include <libgnome/gnome-sound.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnomeui/gnome-stock.h>
-
#include <gal/widgets/e-unicode.h>
#include "camel/camel-filter-driver.h"
@@ -150,9 +149,8 @@ make_key (CamelService *service, const char *item)
/* ********************************************************************** */
-static GnomeDialog *password_dialogue = NULL;
+static GtkDialog *password_dialogue = NULL;
static EDList password_list = E_DLIST_INITIALISER(password_list);
-static int password_destroy_id;
struct _pass_msg {
struct _mail_msg msg;
@@ -167,7 +165,9 @@ struct _pass_msg {
char *service_url;
char *key;
+ MailConfigService *config_service;
GtkWidget *check;
+ GtkWidget *entry;
char *result;
int ismain;
};
@@ -175,29 +175,20 @@ struct _pass_msg {
static void do_get_pass(struct _mail_msg *mm);
static void
-pass_got (char *string, void *data)
+pass_response(GtkDialog *dialogue, int button, void *data)
{
struct _pass_msg *m = data;
-
- if (string) {
- MailConfigService *service = NULL;
- const MailConfigAccount *mca;
+
+ switch(button) {
+ case GTK_RESPONSE_OK: {
gboolean cache, remember;
- m->result = g_strdup (string);
- remember = cache = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->check));
+ m->result = g_strdup(gtk_entry_get_text((GtkEntry *)m->entry));
+ remember = cache = m->check?gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->check)):FALSE;
+
if (m->service_url) {
- mca = mail_config_get_account_by_source_url (m->service_url);
- if (mca) {
- service = mca->source;
- } else {
- mca = mail_config_get_account_by_transport_url (m->service_url);
- if (mca)
- service = mca->transport;
- }
-
- if (service) {
- mail_config_service_set_save_passwd (service, cache);
+ if (m->service) {
+ mail_config_service_set_save_passwd (m->config_service, cache);
/* set `cache' to TRUE because people don't want to have to
re-enter their passwords for this session even if they told
@@ -217,14 +208,14 @@ pass_got (char *string, void *data)
if (remember)
e_passwords_remember_password (m->key);
}
- } else {
+ break; }
+ default:
camel_exception_set(m->ex, CAMEL_EXCEPTION_USER_CANCEL, _("User canceled operation."));
+ break;
}
- if (password_destroy_id) {
- gtk_signal_disconnect((GtkObject *)password_dialogue, password_destroy_id);
- password_destroy_id = 0;
- }
+ gtk_widget_destroy((GtkWidget *)dialogue);
+ g_object_unref(dialogue);
password_dialogue = NULL;
e_msgport_reply((EMsg *)m);
@@ -234,22 +225,10 @@ pass_got (char *string, void *data)
}
static void
-request_password_deleted(GtkWidget *w, struct _pass_msg *m)
-{
- password_destroy_id = 0;
- pass_got(NULL, m);
-}
-
-static void
request_password(struct _pass_msg *m)
{
- const MailConfigAccount *mca = NULL;
- GtkWidget *dialogue;
- GtkWidget *check, *check_label, *entry;
- GList *children, *iter;
- gboolean show;
char *title;
- unsigned int accel_key;
+ const MailConfigAccount *mca = NULL;
/* If we already have a password_dialogue up, save this request till later */
if (!m->ismain && password_dialogue) {
@@ -257,6 +236,38 @@ request_password(struct _pass_msg *m)
return;
}
+ if (m->service_url) {
+ if ( (mca = mail_config_get_account_by_source_url(m->service_url)) )
+ m->config_service = mca->source;
+ else if ( (mca = mail_config_get_account_by_transport_url (m->service_url)) )
+ m->config_service = mca->transport;
+ }
+
+ if (mca)
+ title = g_strdup_printf (_("Enter Password for %s"), mca->name);
+ else
+ title = g_strdup (_("Enter Password"));
+
+ password_dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", m->prompt);
+ g_signal_connect(password_dialogue, "response", G_CALLBACK(pass_response), m);
+ gtk_window_set_title (GTK_WINDOW (password_dialogue), title);
+ g_free (title);
+
+ m->entry = gtk_entry_new();
+ gtk_entry_set_visibility((GtkEntry *)m->entry, !m->secret);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialogue)->vbox), m->entry, TRUE, FALSE, 0);
+ gtk_widget_show(m->entry);
+
+ if (m->service_url == NULL || m->service != NULL) {
+ m->check = gtk_check_button_new_with_mnemonic(m->service_url? _("_Remember this password") :
+ _("_Remember this password for the remainder of this session"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m->check), m->config_service->save_passwd);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialogue)->vbox), m->check, TRUE, FALSE, 0);
+ gtk_widget_show(m->check);
+ }
+
+#if 0
+
/* FIXME: Remove this total snot */
/* assume we can use any widget to translate string for display */
@@ -264,7 +275,7 @@ request_password(struct _pass_msg *m)
title = e_utf8_to_gtk_string (GTK_WIDGET (check_label), m->prompt);
password_dialogue = (GnomeDialog *)dialogue = gnome_request_dialog (m->secret, title, NULL, 0, pass_got, m, NULL);
g_free(title);
- password_destroy_id = gtk_signal_connect((GtkObject *)dialogue, "destroy", request_password_deleted, m);
+ password_destroy_id = g_signal_connect((GtkObject *)dialogue, "destroy", request_password_deleted, m);
check = gtk_check_button_new ();
gtk_misc_set_alignment (GTK_MISC (check_label), 0.0, 0.5);
@@ -309,7 +320,7 @@ request_password(struct _pass_msg *m)
g_list_free (children);
if (entry) {
- gtk_object_ref (GTK_OBJECT (entry));
+ g_object_ref((entry));
gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox), entry);
}
@@ -318,7 +329,7 @@ request_password(struct _pass_msg *m)
if (entry) {
gtk_box_pack_end (GTK_BOX (GNOME_DIALOG (dialogue)->vbox), entry, TRUE, FALSE, 0);
gtk_widget_grab_focus (entry);
- gtk_object_unref (GTK_OBJECT (entry));
+ g_object_unref((entry));
}
m->check = check;
@@ -334,11 +345,12 @@ request_password(struct _pass_msg *m)
gtk_window_set_title (GTK_WINDOW (dialogue), title);
g_free (title);
+#endif
if (m->ismain)
- gnome_dialog_run_and_close ((GnomeDialog *)dialogue);
+ gtk_dialog_run(password_dialogue);
else
- gtk_widget_show(dialogue);
+ gtk_widget_show((GtkWidget *)password_dialogue);
}
static void
@@ -444,9 +456,8 @@ forget_password (CamelSession *session, CamelService *service, const char *item,
/* ********************************************************************** */
-static GnomeDialog *message_dialogue;
+static GtkDialog *message_dialogue;
static EDList message_list = E_DLIST_INITIALISER(password_list);
-static guint message_destroy_id;
struct _user_message_msg {
struct _mail_msg msg;
@@ -461,48 +472,31 @@ struct _user_message_msg {
static void do_user_message (struct _mail_msg *mm);
-/* if we dont have to wait for reply, we just check to see if any newly waiting prompts are there */
-static void
-user_message_destroy_noreply(GnomeDialog *gd, void *data)
-{
- struct _user_message_msg *m;
-
- message_dialogue = NULL;
- if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list)))
- do_user_message((struct _mail_msg *)m);
-}
-
/* clicked, send back the reply */
static void
-user_message_clicked(GnomeDialog *gd, int button, struct _user_message_msg *m)
+user_message_response(GtkDialog *gd, int button, struct _user_message_msg *m)
{
+ gtk_widget_destroy((GtkWidget *)gd);
+ g_object_unref(gd);
+
message_dialogue = NULL;
- if (message_destroy_id) {
- gtk_signal_disconnect((GtkObject *)gd, message_destroy_id);
- message_destroy_id = 0;
+ /* if !allow_cancel, then we've already replied */
+ if (m->allow_cancel) {
+ m->result = button == GTK_RESPONSE_OK;
+ e_msgport_reply((EMsg *)m);
}
- m->result = button == 0;
- e_msgport_reply((EMsg *)m);
-
/* check for pendings */
if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list)))
do_user_message((struct _mail_msg *)m);
}
static void
-user_message_destroy(GnomeDialog *gd, struct _user_message_msg *m)
-{
- message_destroy_id = 0;
- user_message_clicked(gd, -1, m);
-}
-
-static void
do_user_message (struct _mail_msg *mm)
{
struct _user_message_msg *m = (struct _user_message_msg *)mm;
- const char *msg_type;
+ GtkMessageType msg_type;
if (!m->ismain && message_dialogue != NULL) {
e_dlist_addtail(&message_list, (EDListNode *)m);
@@ -511,35 +505,33 @@ do_user_message (struct _mail_msg *mm)
switch (m->type) {
case CAMEL_SESSION_ALERT_INFO:
- msg_type = GNOME_MESSAGE_BOX_INFO;
+ msg_type = GTK_MESSAGE_INFO;
break;
case CAMEL_SESSION_ALERT_WARNING:
- msg_type = GNOME_MESSAGE_BOX_WARNING;
+ msg_type = GTK_MESSAGE_WARNING;
break;
case CAMEL_SESSION_ALERT_ERROR:
- msg_type = GNOME_MESSAGE_BOX_ERROR;
+ msg_type = GTK_MESSAGE_ERROR;
break;
default:
- msg_type = NULL;
+ msg_type = GTK_MESSAGE_INFO;
}
- message_dialogue = (GnomeDialog *)gnome_message_box_new(m->prompt, msg_type, GNOME_STOCK_BUTTON_OK,
- m->allow_cancel ? GNOME_STOCK_BUTTON_CANCEL : NULL,
- NULL);
- gnome_dialog_set_default(message_dialogue, 1);
- gnome_dialog_set_close(message_dialogue, TRUE);
- gtk_window_set_policy (GTK_WINDOW (message_dialogue), TRUE, TRUE, TRUE);
+ message_dialogue = (GtkDialog *)gtk_message_dialog_new(
+ NULL, 0, msg_type,
+ m->allow_cancel?GTK_BUTTONS_OK_CANCEL:GTK_BUTTONS_OK,
+ m->prompt);
+ gtk_dialog_set_default_response(message_dialogue, m->allow_cancel?GTK_RESPONSE_CANCEL:GTK_RESPONSE_OK);
+ g_object_set(message_dialogue, "allow_shrink", TRUE, "allow_grow", TRUE, NULL);
/* We only need to wait for the result if we allow cancel otherwise show but send result back instantly */
if (m->allow_cancel) {
- gtk_signal_connect((GtkObject*)message_dialogue, "clicked", user_message_clicked, m);
- message_destroy_id = gtk_signal_connect((GtkObject*)message_dialogue, "destroy", user_message_destroy, m);
+ g_signal_connect(message_dialogue, "response", G_CALLBACK(user_message_response), m);
if (m->ismain)
- gnome_dialog_run_and_close ((GnomeDialog *)message_dialogue);
+ gtk_dialog_run(message_dialogue);
else
gtk_widget_show((GtkWidget *)message_dialogue);
} else {
- gtk_signal_connect((GtkObject *)message_dialogue, "destroy", user_message_destroy_noreply, NULL);
gtk_widget_show((GtkWidget *)message_dialogue);
m->result = TRUE;
e_msgport_reply((EMsg *)m);
@@ -760,7 +752,7 @@ register_timeout (CamelSession *session, guint32 interval, CamelTimeoutCallback
MAIL_SESSION_UNLOCK(session, lock);
- camel_object_ref((CamelObject *)ms);
+ camel_object_ref(ms);
mail_async_event_emit(ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc)main_register_timeout, (CamelObject *)session, (void *)ret, NULL);
return ret;
@@ -802,7 +794,7 @@ remove_timeout (CamelSession *session, guint handle)
MAIL_SESSION_UNLOCK(session, lock);
if (remove) {
- camel_object_ref((CamelObject *)ms);
+ camel_object_ref(ms);
mail_async_event_emit(ms->async, MAIL_ASYNC_GUI,
(MailAsyncFunc)main_remove_timeout, (CamelObject *)session, (void *)handle, NULL);
} else
@@ -913,7 +905,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException
g_string_free (fsearch, TRUE);
g_string_free (faction, TRUE);
- gtk_object_unref (GTK_OBJECT (fc));
+ g_object_unref(fc);
return driver;
}