aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-28 03:02:42 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-28 03:02:42 +0800
commit45701621c5447e0a106912bfe498a044d4cb2119 (patch)
tree147b34f5bd4c3c419961b9549cff35f6996d12b9
parentc3ccc6c5476928a2581888aaca63fa289f5f9f37 (diff)
downloadgsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.tar
gsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.tar.gz
gsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.tar.bz2
gsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.tar.lz
gsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.tar.xz
gsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.tar.zst
gsoc2013-evolution-45701621c5447e0a106912bfe498a044d4cb2119.zip
Don't need this anymore. (do_get_pass): Since we already have the entry
2001-07-27 Jeffrey Stedfast <fejj@ximian.com> * mail-mt.c (focus_on_entry): Don't need this anymore. (do_get_pass): Since we already have the entry widget, no need to do the nasty focus_on_entry hack. svn path=/trunk/; revision=11453
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/folder-browser-factory.c2
-rw-r--r--mail/folder-browser-ui.c21
-rw-r--r--mail/mail-mt.c87
-rw-r--r--mail/mail-session.c2
5 files changed, 56 insertions, 62 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 776c96a0a1..728b13a248 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-27 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-mt.c (focus_on_entry): Don't need this anymore.
+ (do_get_pass): Since we already have the entry widget, no need to
+ do the nasty focus_on_entry hack.
+
2001-07-26 Peter Williams <peterw@ximian.com>
* mail-mt.c (do_get_pass): Figure out whether we're getting the password
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index ff7e8d649a..568d1cfaf5 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -75,7 +75,7 @@ control_activate (BonoboControl *control,
BonoboUIComponent *uic,
FolderBrowser *fb)
{
- GtkWidget *folder_browser;
+ GtkWidget *folder_browser;
Bonobo_UIContainer container;
container = bonobo_control_get_remote_ui_container (control);
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index 255e553a03..8c659b5fe9 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -310,16 +310,15 @@ folder_browser_ui_add_list (FolderBrowser *fb)
{
int state;
BonoboUIComponent *uic = fb->uicomp;
-
+
ui_add (fb, "list", list_verbs, list_pixcache);
-
+
/* Hide Deleted */
-
- if (fb->folder && CAMEL_IS_VTRASH_FOLDER(fb->folder)) {
- bonobo_ui_component_set_prop(uic, "/commands/HideDeleted", "sensitive", "0", NULL);
+ if (fb->folder && CAMEL_IS_VTRASH_FOLDER (fb->folder)) {
+ bonobo_ui_component_set_prop (uic, "/commands/HideDeleted", "sensitive", "0", NULL);
state = FALSE;
} else {
- state = mail_config_get_hide_deleted();
+ state = mail_config_get_hide_deleted ();
}
bonobo_ui_component_set_prop (uic, "/commands/HideDeleted", "state", state ? "1" : "0", NULL);
bonobo_ui_component_add_listener (uic, "HideDeleted", folder_browser_toggle_hide_deleted,
@@ -327,21 +326,18 @@ folder_browser_ui_add_list (FolderBrowser *fb)
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
folder_browser_toggle_hide_deleted (uic, "", Bonobo_UIComponent_STATE_CHANGED,
state ? "1" : "0", fb);
-
+
/* Threaded toggle */
-
state = mail_config_get_thread_list (FOLDER_BROWSER (fb)->uri);
bonobo_ui_component_set_prop (uic, "/commands/ViewThreaded", "state", state ? "1" : "0", NULL);
bonobo_ui_component_add_listener (uic, "ViewThreaded", folder_browser_toggle_threads, fb);
/* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
folder_browser_toggle_threads (uic, "", Bonobo_UIComponent_STATE_CHANGED, state ? "1" : "0", fb);
-
+
/* Property menu */
-
folder_browser_setup_property_menu (fb, fb->uicomp);
-
+
/* View menu */
-
folder_browser_setup_view_menus (fb, fb->uicomp);
}
@@ -349,7 +345,6 @@ void
folder_browser_ui_rm_list (FolderBrowser *fb)
{
/* View menu */
-
folder_browser_discard_view_menus (fb);
}
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 369af19548..742c849e6f 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -394,14 +394,6 @@ struct _pass_msg {
GtkWidget *tb;
};
-/* libgnomeui's idea of an api/gui is very weird ... hence this dumb hack */
-static void
-focus_on_entry (GtkWidget *widget, void *user_data)
-{
- if (GTK_IS_ENTRY (widget))
- gtk_widget_grab_focus (widget);
-}
-
static void
pass_got (char *string, void *data)
{
@@ -410,7 +402,7 @@ pass_got (char *string, void *data)
if (string) {
const MailConfigAccount *mca;
gboolean remember;
-
+
m->result = g_strdup (string);
remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->tb));
@@ -435,15 +427,15 @@ do_get_pass(struct _mail_msg *mm)
GtkWidget *dialogue;
GtkWidget *tb, *entry;
GList *children, *iter;
-
+
/* this api is just awful ... hence the hacks */
- dialogue = gnome_request_dialog(m->secret, m->prompt, NULL,
- 0, pass_got, m, NULL);
+ dialogue = gnome_request_dialog (m->secret, m->prompt, NULL,
+ 0, pass_got, m, NULL);
/* Remember the password? */
tb = gtk_check_button_new_with_label (_("Remember this password"));
gtk_widget_show (tb);
-
+
mca = mail_config_get_account_by_source_url (m->service_url);
if (mca)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tb), mca->source->save_passwd);
@@ -456,41 +448,40 @@ do_get_pass(struct _mail_msg *mm)
gtk_widget_hide (tb);
}
}
-
+
/* do some dirty stuff to put the checkbutton after the entry */
entry = NULL;
children = gtk_container_children (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox));
-
+
for (iter = children; iter; iter = iter->next) {
if (GTK_IS_ENTRY (iter->data)) {
entry = GTK_WIDGET (iter->data);
break;
}
}
-
+
g_list_free (children);
-
+
if (entry) {
gtk_object_ref (GTK_OBJECT (entry));
gtk_container_remove (GTK_CONTAINER (GNOME_DIALOG (dialogue)->vbox), entry);
}
-
+
gtk_box_pack_end (GTK_BOX (GNOME_DIALOG (dialogue)->vbox),
tb, TRUE, FALSE, 0);
-
+
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));
}
-
+
m->tb = tb;
-
- e_container_foreach_leaf((GtkContainer *)dialogue, focus_on_entry, NULL);
-
+
/* hrm, we can't run this async since the gui_port from which we're called
will reply to our message for us */
- gnome_dialog_run_and_close((GnomeDialog *)dialogue);
-
+ gnome_dialog_run_and_close ((GnomeDialog *)dialogue);
+
/*gtk_widget_show(dialogue);*/
}
@@ -498,7 +489,7 @@ static void
do_free_pass(struct _mail_msg *mm)
{
/*struct _pass_msg *m = (struct _pass_msg *)mm;*/
-
+
/* the string is passed out so we dont need to free it */
}
@@ -511,43 +502,43 @@ struct _mail_msg_op get_pass_op = {
/* returns the password, or NULL if cancelled */
char *
-mail_get_password(CamelService *service, const char *prompt, gboolean secret)
+mail_get_password (CamelService *service, const char *prompt, gboolean secret)
{
char *ret;
struct _pass_msg *m, *r;
EMsgPort *pass_reply;
-
- pass_reply = e_msgport_new();
-
- m = mail_msg_new(&get_pass_op, pass_reply, sizeof(*m));
-
+
+ pass_reply = e_msgport_new ();
+
+ m = mail_msg_new (&get_pass_op, pass_reply, sizeof (struct _pass_msg));
+
m->prompt = prompt;
m->secret = secret;
m->service_url = camel_url_to_string (service->url,
CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
-
- if (pthread_self() == mail_gui_thread) {
- do_get_pass((struct _mail_msg *)m);
+
+ if (pthread_self () == mail_gui_thread) {
+ do_get_pass ((struct _mail_msg *)m);
r = m;
} else {
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-
+
/* 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(pass_reply);
- r = (struct _pass_msg *)e_msgport_get(pass_reply);
- pthread_mutex_unlock(&lock);
+ pthread_mutex_lock (&lock);
+ e_msgport_put (mail_gui_port, (EMsg *)m);
+ e_msgport_wait (pass_reply);
+ r = (struct _pass_msg *)e_msgport_get (pass_reply);
+ pthread_mutex_unlock (&lock);
}
-
- g_assert(r == m);
-
+
+ g_assert (r == m);
+
ret = m->result;
-
+
g_free (m->service_url);
- mail_msg_free(m);
- e_msgport_destroy(pass_reply);
-
+ mail_msg_free (m);
+ e_msgport_destroy (pass_reply);
+
return ret;
}
diff --git a/mail/mail-session.c b/mail/mail-session.c
index c511885a9d..b864f3b32b 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -154,6 +154,8 @@ get_password (CamelSession *session, const char *prompt, gboolean secret,
char *key, *ans;
key = make_key (service, item);
+ if (!key)
+ return NULL;
ans = g_hash_table_lookup (mail_session->passwords, key);
if (ans) {