* add new addresses to the addressbook automatically when sending.
[modest] / src / maemo / modest-maemo-utils.c
index 5c36574..522392b 100644 (file)
@@ -329,7 +329,14 @@ on_camel_account_get_supported_secure_authentication (
                        GList *result = NULL;
                        TnyIterator* iter = tny_list_create_iterator(auth_types);
                        while (!tny_iterator_is_done(iter)) {
-                               const gchar *auth_name = tny_pair_get_name(TNY_PAIR(tny_iterator_get_current(iter)));
+                               TnyPair *pair = TNY_PAIR(tny_iterator_get_current(iter));
+                               const gchar *auth_name = NULL;
+                               if (pair) {
+                                       auth_name = tny_pair_get_name(pair);
+                                       g_object_unref (pair);
+                                       pair = NULL;
+                               }
+
                                printf("DEBUG: %s: auth_name=%s\n", __FUNCTION__, auth_name);
                                ModestPair *matching = modest_pair_list_find_by_first_as_string (pairs, 
                                        auth_name);
@@ -539,6 +546,35 @@ on_hide (GtkDialog *dialog, gpointer user_data)
 }
 #endif
 
+/* user_data for the idle callback: */
+typedef struct 
+{
+       GtkWindow *parent_window;
+       gchar *message;
+} ModestIdleNoteInfo;
+
+static gboolean
+on_idle_show_information(gpointer user_data)
+{
+       ModestIdleNoteInfo *info = (ModestIdleNoteInfo*)user_data;
+       
+       modest_maemo_show_information_note_and_forget (info->parent_window, info->message);
+       
+       g_free (info->message);
+       g_slice_free (ModestIdleNoteInfo, info);
+       
+       return FALSE; /* Don't call this again. */
+}
+
+void modest_maemo_show_information_note_in_main_context_and_forget (GtkWindow *parent_window, const gchar* message)
+{
+       ModestIdleNoteInfo *info = g_slice_new (ModestIdleNoteInfo);
+       info->parent_window = parent_window;
+       info->message = g_strdup (message);
+       
+       g_idle_add (on_idle_show_information, info);
+}
+
 void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *dialog)
 {
        gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window);
@@ -548,6 +584,8 @@ void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *d
        gtk_widget_show (GTK_WIDGET (dialog));
 }
 
+
+
 void
 modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable)
 {