[balsa] Deprecation cleanup and fix gcc issues



commit f2e6e02a2764ed913c2a87952912e1b1ac4d6f38
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Apr 16 21:08:09 2011 -0400

    Deprecation cleanup and fix gcc issues

 ChangeLog                        |   39 ++++++++++++++++++++++++++++++++++++++
 libbalsa/files.c                 |    4 +--
 libbalsa/filter-funcs.c          |    3 --
 libbalsa/identity.c              |   17 +++++++++++++--
 libbalsa/imap-server.c           |    4 +--
 libbalsa/mailbox_imap.c          |    4 +--
 libbalsa/mailbox_local.c         |    5 +---
 libbalsa/mailbox_maildir.c       |    2 -
 libbalsa/misc.c                  |    8 +++++++
 libbalsa/rfc2445.c               |    2 -
 libbalsa/rfc3156.c               |   14 ++++++------
 libbalsa/server.c                |    6 +---
 libbalsa/smtp-server.c           |   15 ++++++++++---
 libinit_balsa/assistant_helper.c |    7 ++++++
 src/ab-window.c                  |    9 ++++++++
 src/address-book-config.c        |    3 --
 src/balsa-index.c                |   12 +++++++++++
 src/balsa-mime-widget-text.c     |    4 +++
 src/filter-edit-callbacks.c      |   17 ++++++++++++++++
 src/filter-edit-dialog.c         |   13 +++++++++++-
 src/mailbox-conf.c               |   21 ++++++++++++++++++++
 src/main-window.c                |   28 +++++++++-----------------
 src/pref-manager.c               |    8 +++++++
 src/save-restore.c               |    6 +++++
 src/sendmsg-window.c             |   13 +++++++++--
 src/store-address.c              |    9 ++++++++
 26 files changed, 210 insertions(+), 63 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0074906..3a4832e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2011-04-16  Peter Bloomfield
+
+	Deprecation cleanup and fix gcc issues
+
+	* libbalsa/files.c (libbalsa_icon_finder):
+	* libbalsa/filter-funcs.c (libbalsa_filter_export_sieve):
+	* libbalsa/identity.c (libbalsa_identity_get_signature),
+	(ident_dialog_add_gpg_menu), (add_show_menu),
+	(ident_dialog_add_smtp_menu):
+	* libbalsa/imap-server.c (libbalsa_imap_server_finalize):
+	* libbalsa/mailbox_imap.c (libbalsa_mailbox_imap_open):
+	* libbalsa/mailbox_local.c (libbalsa_mailbox_local_load_config):
+	* libbalsa/mailbox_maildir.c
+	(libbalsa_mailbox_maildir_add_message):
+	* libbalsa/misc.c (libbalsa_charset_button_new):
+	* libbalsa/rfc2445.c (date_time_2445_to_time_t):
+	* libbalsa/rfc3156.c (get_passphrase_cb):
+	* libbalsa/server.c (libbalsa_server_user_cb):
+	* libbalsa/smtp-server.c (libbalsa_smtp_server_finalize),
+	(libbalsa_smtp_server_class_init), (smtp_server_tls_widget):
+	* libinit_balsa/assistant_helper.c (balsa_init_add_table_option):
+	* src/ab-window.c (balsa_ab_window_load_books),
+	(balsa_ab_window_init):
+	* src/address-book-config.c (create_generic_dialog):
+	* src/balsa-index.c (bndx_pipe_response), (balsa_index_pipe):
+	* src/balsa-mime-widget-text.c (text_view_populate_popup):
+	* src/filter-edit-callbacks.c (fe_user_header_add),
+	(get_field_frame):
+	* src/filter-edit-dialog.c (fe_build_option_menu):
+	* src/mailbox-conf.c (mailbox_conf_combo_box_make),
+	(balsa_server_conf_get_advanced_widget),
+	(mailbox_conf_view_new_full):
+	* src/main-window.c:
+	* src/pref-manager.c (add_show_menu), (pm_combo_box_new):
+	* src/save-restore.c (config_filter_load), (config_filters_save):
+	* src/sendmsg-window.c (edit_with_gnome_check),
+	(sw_get_user_codeset):
+	* src/store-address.c (store_address_book_frame):
+
 2011-04-15  Pawel Salek
 
 	* src/balsa-message.c:
diff --git a/libbalsa/files.c b/libbalsa/files.c
index 19d8f4f..e12e0c9 100644
--- a/libbalsa/files.c
+++ b/libbalsa/files.c
@@ -135,7 +135,6 @@ libbalsa_icon_finder(const char *mime_type, const LibbalsaVfs * for_file,
     gchar *icon = NULL;
     GdkPixbuf *pixbuf = NULL;
     gint width, height;
-    const gchar * filename = NULL;
     GtkIconTheme *icon_theme;
 
     if (!gtk_icon_size_lookup(size, &width, &height))
@@ -145,7 +144,6 @@ libbalsa_icon_finder(const char *mime_type, const LibbalsaVfs * for_file,
         content_type = mime_type;
     else if (for_file) {
         content_type = libbalsa_vfs_get_mime_type(for_file);
-        filename = libbalsa_vfs_get_uri(for_file);
     } else
 	content_type = "application/octet-stream";
 
@@ -165,7 +163,7 @@ libbalsa_icon_finder(const char *mime_type, const LibbalsaVfs * for_file,
             }
             g_strfreev(icon_names);
             g_object_unref(icon);
-            
+
             /* last resort: try gnome-mime-<base mime type> */
             if (!pixbuf) {
                 gchar * base_type_icon = g_strdup_printf("gnome-mime-%s", content_type);
diff --git a/libbalsa/filter-funcs.c b/libbalsa/filter-funcs.c
index 4fbf7dd..1418c11 100644
--- a/libbalsa/filter-funcs.c
+++ b/libbalsa/filter-funcs.c
@@ -867,13 +867,10 @@ gboolean
 libbalsa_filter_export_sieve(LibBalsaFilter* fil, gchar* filename)
 {
     FILE * fp;
-    GString * buffer;
     gint nb = 0;
 
     fp=fopen(filename,"w");
     if (!fp) return FALSE;
-    buffer=g_string_new("# Sieve script automatically generated by Balsa "
-                        "(Exporting a Balsa filter)\n");
     g_warning("%s: FIXME!\n", __func__);
 #if 0
     
diff --git a/libbalsa/identity.c b/libbalsa/identity.c
index 99dca2d..1b20dd7 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -325,7 +325,6 @@ gchar*
 libbalsa_identity_get_signature(LibBalsaIdentity* identity, GtkWindow *parent)
 {
     FILE *fp = NULL;
-    size_t len = 0;
     gchar *ret = NULL, *path;
 
     if (identity->signature_path == NULL ||
@@ -337,7 +336,7 @@ libbalsa_identity_get_signature(LibBalsaIdentity* identity, GtkWindow *parent)
         /* signature is executable */
 	fp = popen(path,"r");
         if (fp) {
-            len = libbalsa_readfile_nostat(fp, &ret);
+            libbalsa_readfile_nostat(fp, &ret);
             pclose(fp);
         } else
             libbalsa_information_parented
@@ -348,7 +347,7 @@ libbalsa_identity_get_signature(LibBalsaIdentity* identity, GtkWindow *parent)
         /* sign is normal file */
         fp = fopen(path, "r");
         if (fp) {
-            len = libbalsa_readfile_nostat(fp, &ret);
+            libbalsa_readfile_nostat(fp, &ret);
             fclose(fp);
         } else
             libbalsa_information_parented(parent, LIBBALSA_INFORMATION_ERROR,
@@ -2103,7 +2102,11 @@ ident_dialog_add_gpg_menu(GtkWidget * table, gint row, GtkDialog * dialog,
     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
     gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    opt_menu = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     opt_menu = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     values = g_ptr_array_sized_new(3);
     g_object_set_data_full(G_OBJECT(opt_menu), "identity-value", values,
                            (GDestroyNotify) ident_dialog_free_values);
@@ -2127,7 +2130,11 @@ add_show_menu(const char *label, gpointer data, GtkWidget * menu)
     GPtrArray *values =
         g_object_get_data(G_OBJECT(menu), "identity-value");
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(menu), label);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_combo_box_append_text(GTK_COMBO_BOX(menu), label);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     g_ptr_array_add(values, data);
 }
 
@@ -2153,7 +2160,11 @@ ident_dialog_add_smtp_menu(GtkWidget * table, gint row, GtkDialog * dialog,
     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
     gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    combo_box = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     combo_box = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), combo_box);
     values = g_ptr_array_sized_new(g_slist_length(smtp_servers));
     g_object_set_data_full(G_OBJECT(combo_box), "identity-value", values,
diff --git a/libbalsa/imap-server.c b/libbalsa/imap-server.c
index 27af875..00c05e1 100644
--- a/libbalsa/imap-server.c
+++ b/libbalsa/imap-server.c
@@ -233,18 +233,16 @@ libbalsa_imap_server_init(LibBalsaImapServer * imap_server)
 static void
 libbalsa_imap_server_finalize(GObject * object)
 {
-    LibBalsaServer *server;
     LibBalsaImapServer *imap_server;
 
     g_return_if_fail(LIBBALSA_IS_IMAP_SERVER(object));
 
-    server = LIBBALSA_SERVER(object);
     imap_server = LIBBALSA_IMAP_SERVER(object);
 
     LOCK_SERVERS();
     g_hash_table_remove(imap_servers, imap_server->key);
     UNLOCK_SERVERS();
-    
+
     g_source_remove(imap_server->connection_cleanup_id);
 
 #if 0
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 3e6d7fe..c2e130c 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -1073,7 +1073,6 @@ static gboolean
 libbalsa_mailbox_imap_open(LibBalsaMailbox * mailbox, GError **err)
 {
     LibBalsaMailboxImap *mimap;
-    LibBalsaServer *server;
     unsigned i;
     guint total_messages;
     struct ImapCacheManager *icm;
@@ -1082,7 +1081,6 @@ libbalsa_mailbox_imap_open(LibBalsaMailbox * mailbox, GError **err)
     g_return_val_if_fail(LIBBALSA_IS_MAILBOX_IMAP(mailbox), FALSE);
 
     mimap = LIBBALSA_MAILBOX_IMAP(mailbox);
-    server = LIBBALSA_MAILBOX_REMOTE_SERVER(mailbox);
 
     mimap->handle = libbalsa_mailbox_imap_get_selected_handle(mimap, err);
     if (!mimap->handle) {
@@ -1094,7 +1092,7 @@ libbalsa_mailbox_imap_open(LibBalsaMailbox * mailbox, GError **err)
     mimap->opened         = TRUE;
     mailbox->disconnected = FALSE;
     total_messages = imap_mbox_handle_get_exists(mimap->handle);
-    mimap->messages_info = g_array_sized_new(FALSE, TRUE, 
+    mimap->messages_info = g_array_sized_new(FALSE, TRUE,
 					     sizeof(struct message_info),
 					     total_messages);
     mimap->msgids = g_ptr_array_sized_new(total_messages);
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index d230529..8c5c90a 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -418,12 +418,9 @@ static void
 libbalsa_mailbox_local_load_config(LibBalsaMailbox * mailbox,
 				   const gchar * prefix)
 {
-    LibBalsaMailboxLocal *local;
     gchar* path;
     g_return_if_fail(LIBBALSA_IS_MAILBOX_LOCAL(mailbox));
 
-    local = LIBBALSA_MAILBOX_LOCAL(mailbox);
-
     g_free(mailbox->url);
 
     path = libbalsa_conf_get_string("Path");
@@ -434,7 +431,7 @@ libbalsa_mailbox_local_load_config(LibBalsaMailbox * mailbox,
 	LIBBALSA_MAILBOX_CLASS(parent_class)->load_config(mailbox, prefix);
 }
 
-/* 
+/*
  * Save and restore the message tree.
  */
 
diff --git a/libbalsa/mailbox_maildir.c b/libbalsa/mailbox_maildir.c
index 4b1598d..8d6a769 100644
--- a/libbalsa/mailbox_maildir.c
+++ b/libbalsa/mailbox_maildir.c
@@ -901,7 +901,6 @@ libbalsa_mailbox_maildir_add_message(LibBalsaMailbox * mailbox,
     char *new_filename;
     struct message_info *msg_info;
     gint retval;
-    LibBalsaMailboxMaildir *mdir;
     time_t mtime;
 
     /* open tempfile */
@@ -947,7 +946,6 @@ libbalsa_mailbox_maildir_add_message(LibBalsaMailbox * mailbox,
     free_message_info(msg_info);
     g_free(tmp);
 
-    mdir = (LibBalsaMailboxMaildir *) mailbox;
     if ((mtime = libbalsa_mailbox_get_mtime(mailbox)) != 0)
 	/* If we checked or synced the mailbox less than 1 second ago,
 	 * the cached modification time could be the same as the new
diff --git a/libbalsa/misc.c b/libbalsa/misc.c
index a884e34..14f44db 100644
--- a/libbalsa/misc.c
+++ b/libbalsa/misc.c
@@ -673,13 +673,21 @@ libbalsa_charset_button_new(void)
     LibBalsaCodeset n, active = WEST_EUROPE;
     const gchar *locale_charset;
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    combo_box = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     combo_box = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     locale_charset = g_mime_locale_charset();
 
     for (n = 0; n < LIBBALSA_NUM_CODESETS; n++) {
         LibBalsaCodesetInfo *info = &libbalsa_codeset_info[n];
         gchar *tmp = g_strdup_printf("%s (%s)", _(info->label), info->std);
+#if GTK_CHECK_VERSION(2, 24, 0)
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), tmp);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
         gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), tmp);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
         g_free(tmp);
 
 	if (!g_ascii_strcasecmp(info->std, locale_charset))
diff --git a/libbalsa/rfc2445.c b/libbalsa/rfc2445.c
index dc3d3dd..fd2dbf0 100644
--- a/libbalsa/rfc2445.c
+++ b/libbalsa/rfc2445.c
@@ -502,7 +502,6 @@ date_time_2445_to_time_t(const gchar * date_time)
     gint len;
     struct tm tm_buf;
     char strbuf[17];
-    gboolean is_utc;
     time_t the_time;
     struct tm utc_tm;
     time_t utc_time;
@@ -519,7 +518,6 @@ date_time_2445_to_time_t(const gchar * date_time)
     /* fill for conversion... */
     strcpy(strbuf, date_time);	/* safe, due to checks above */
     if (len == 16) {
-	is_utc = TRUE;
 	strbuf[15] = '\0';
     }
     FILL_TM(tm_buf.tm_sec, strbuf, 13);
diff --git a/libbalsa/rfc3156.c b/libbalsa/rfc3156.c
index d022d0f..a56e12c 100644
--- a/libbalsa/rfc3156.c
+++ b/libbalsa/rfc3156.c
@@ -1803,11 +1803,11 @@ get_passphrase_cb(void *opaque, const char *uid_hint,
 {
     GMimeGpgmeContext *context;
     gchar *passwd = NULL;
-    int foo;
+    int foo, bar;
 
     if (!opaque || !GMIME_IS_GPGME_CONTEXT(opaque)) {
 	foo = write(fd, "\n", 1);
-	return GPG_ERR_USER_1;
+	return foo > 0 ? GPG_ERR_USER_1 : GPG_ERR_EIO;
     }
     context = GMIME_GPGME_CONTEXT(opaque);
 
@@ -1818,10 +1818,10 @@ get_passphrase_cb(void *opaque, const char *uid_hint,
     /* check if we have the passphrase already cached... */
     if ((passwd = check_cache(pcache, uid_hint, prev_was_bad))) {
 	foo = write(fd, passwd, strlen(passwd));
-	foo = write(fd, "\n", 1);
+	bar = write(fd, "\n", 1);
 	wipe_string(passwd);
 	g_free(passwd);
-	return GPG_ERR_NO_ERROR;
+	return foo > 0 && bar > 0 ? GPG_ERR_NO_ERROR : GPG_ERR_EIO;
     }
 #endif
 
@@ -1857,15 +1857,15 @@ get_passphrase_cb(void *opaque, const char *uid_hint,
 
     if (!passwd) {
 	foo = write(fd, "\n", 1);
-	return GPG_ERR_CANCELED;
+	return foo > 0 ? GPG_ERR_CANCELED : GPG_ERR_EIO;
     }
 
     /* send the passphrase and erase the string */
     foo = write(fd, passwd, strlen(passwd));
     wipe_string(passwd);
     g_free(passwd);
-    foo = write(fd, "\n", 1);
-    return GPG_ERR_NO_ERROR;
+    bar = write(fd, "\n", 1);
+    return foo > 0 && bar > 0 ? GPG_ERR_NO_ERROR : GPG_ERR_EIO;
 }
 
 
diff --git a/libbalsa/server.c b/libbalsa/server.c
index 1b49c51..fd42f06 100644
--- a/libbalsa/server.c
+++ b/libbalsa/server.c
@@ -435,8 +435,7 @@ libbalsa_server_user_cb(ImapUserEventType ue, void *arg, ...)
     }
     case IME_GET_USER:  { /* for eg kerberos */
         gchar **user;
-        gchar *dummy;
-        dummy = va_arg(alist, gchar*); /* Ignore the method */
+        va_arg(alist, gchar*); /* Ignore the method */
         user = va_arg(alist, gchar**);
         ok = va_arg(alist, int*);
         *ok = 1; /* consider popping up a dialog window here */
@@ -448,10 +447,9 @@ libbalsa_server_user_cb(ImapUserEventType ue, void *arg, ...)
         long vfy_result;
         SSL *ssl;
         X509 *cert;
-        const char *reason;
         ok = va_arg(alist, int*);
         vfy_result = va_arg(alist, long);
-        reason =  X509_verify_cert_error_string(vfy_result);
+        X509_verify_cert_error_string(vfy_result);
 #if 0
         printf("IMAP:TLS: failed cert verification: %ld : %s.\n",
                vfy_result, reason);
diff --git a/libbalsa/smtp-server.c b/libbalsa/smtp-server.c
index 7ef1406..babdd2b 100644
--- a/libbalsa/smtp-server.c
+++ b/libbalsa/smtp-server.c
@@ -65,12 +65,10 @@ typedef struct _LibBalsaSmtpServerClass {
 static void
 libbalsa_smtp_server_finalize(GObject * object)
 {
-    LibBalsaServer *server;
     LibBalsaSmtpServer *smtp_server;
 
     g_return_if_fail(LIBBALSA_IS_SMTP_SERVER(object));
 
-    server = LIBBALSA_SERVER(object);
     smtp_server = LIBBALSA_SMTP_SERVER(object);
 
     auth_destroy_context(smtp_server->authctx);
@@ -86,10 +84,8 @@ static void
 libbalsa_smtp_server_class_init(LibBalsaSmtpServerClass * klass)
 {
     GObjectClass *object_class;
-    LibBalsaServerClass *server_class;
 
     object_class = G_OBJECT_CLASS(klass);
-    server_class = LIBBALSA_SERVER_CLASS(klass);
 
     parent_class = g_type_class_peek_parent(klass);
 
@@ -383,11 +379,22 @@ GtkWidget *
 smtp_server_tls_widget(LibBalsaSmtpServer * smtp_server)
 {
     LibBalsaServer *server = LIBBALSA_SERVER(smtp_server);
+#if GTK_CHECK_VERSION(2, 24, 0)
+    GtkWidget *combo_box = gtk_combo_box_text_new();
+
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                   _("Never"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                   _("If Possible"));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                   _("Required"));
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     GtkWidget *combo_box = gtk_combo_box_new_text();
 
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), _("Never"));
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), _("If Possible"));
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), _("Required"));
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
 
     switch (server->tls_mode) {
     case Starttls_DISABLED:
diff --git a/libinit_balsa/assistant_helper.c b/libinit_balsa/assistant_helper.c
index b04f100..7b62d88 100644
--- a/libinit_balsa/assistant_helper.c
+++ b/libinit_balsa/assistant_helper.c
@@ -152,9 +152,16 @@ balsa_init_add_table_option(GtkTable *table, guint num,
     gtk_table_attach(table, l, 0, 1, num + 1, num + 2,
                      GTK_FILL, GTK_FILL, 5, 2);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    *dest = om = gtk_combo_box_text_new();
+    for(i=0; optns[i]; i++)
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(om),
+                                       _(optns[i]));
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     *dest = om = gtk_combo_box_new_text();
     for(i=0; optns[i]; i++)
         gtk_combo_box_append_text(GTK_COMBO_BOX(om), _(optns[i]));
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_label_set_mnemonic_widget(GTK_LABEL(l), om);
     gtk_combo_box_set_active(GTK_COMBO_BOX(om), 0);
     gtk_table_attach(table, om, 1, 2, num + 1, num + 2,
diff --git a/src/ab-window.c b/src/ab-window.c
index 77ad125..d50886f 100644
--- a/src/ab-window.c
+++ b/src/ab-window.c
@@ -203,8 +203,13 @@ balsa_ab_window_load_books(BalsaAbWindow * ab)
          ab_list = ab_list->next, ++offset) {
         LibBalsaAddressBook *address_book = ab_list->data;
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ab->combo_box),
+                                       address_book->name);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
         gtk_combo_box_append_text(GTK_COMBO_BOX(ab->combo_box),
                                   address_book->name);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
 
         if (ab->current_address_book == NULL)
             ab->current_address_book = address_book;
@@ -258,7 +263,11 @@ balsa_ab_window_init(BalsaAbWindow *ab)
                                 (balsa_ab_window_select_recipient));
 
     /* The address book selection menu */
+#if GTK_CHECK_VERSION(2, 24, 0)
+    ab->combo_box = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     ab->combo_box = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
 
     ab->current_address_book = balsa_app.default_address_book;
 
diff --git a/src/address-book-config.c b/src/address-book-config.c
index aab3e78..7247f30 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -323,18 +323,15 @@ create_generic_dialog(AddressBookConfig * abc, const gchar * type)
     GtkWidget *dialog;
     gchar *title;
     const gchar *action;
-    const gchar *name;
     LibBalsaAddressBook *ab;
 
     ab = abc->address_book;
     if (ab) {
         title = g_strdup_printf(_("Modify %s Address Book"), type);
         action = GTK_STOCK_APPLY;
-        name = ab->name;
     } else {
         title = g_strdup_printf(_("Add %s Address Book"), type);
         action = GTK_STOCK_ADD;
-        name = NULL;
     }
 
     dialog =
diff --git a/src/balsa-index.c b/src/balsa-index.c
index efb8ef1..fa1894b 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -2656,8 +2656,13 @@ bndx_pipe_response(GtkWidget * dialog, gint response,
         gchar *pipe_cmd;
         GList *active_cmd;
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+        pipe_cmd = gtk_combo_box_text_get_active_text
+                   (GTK_COMBO_BOX_TEXT(info->entry));
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
         pipe_cmd =
             gtk_combo_box_get_active_text(GTK_COMBO_BOX(info->entry));
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
         active_cmd =
             g_list_find_custom(balsa_app.pipe_cmds, pipe_cmd,
                                (GCompareFunc) strcmp);
@@ -2734,9 +2739,16 @@ balsa_index_pipe(BalsaIndex * index)
     gtk_container_add(GTK_CONTAINER(vbox), label =
                       gtk_label_new(_("Specify the program to run:")));
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    info->entry = entry = gtk_combo_box_text_new_with_entry();
+    for (list = balsa_app.pipe_cmds; list; list = list->next)
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(entry),
+                                       list->data);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     info->entry = entry = gtk_combo_box_entry_new_text();
     for (list = balsa_app.pipe_cmds; list; list = list->next)
         gtk_combo_box_append_text(GTK_COMBO_BOX(entry), list->data);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_combo_box_set_active(GTK_COMBO_BOX(entry), 0);
     gtk_container_add(GTK_CONTAINER(vbox), entry);
 
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index ee54ce3..6f090bf 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -539,7 +539,11 @@ text_view_populate_popup(GtkTextView *textview, GtkMenu *menu,
     GtkWidget *menu_item;
     gint phrase_hl;
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    gtk_widget_hide(GTK_WIDGET(menu));
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_widget_hide_all(GTK_WIDGET(menu));
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     if (text_view_url_popup(textview, menu))
 	return;
 
diff --git a/src/filter-edit-callbacks.c b/src/filter-edit-callbacks.c
index b64c522..79ff018 100644
--- a/src/filter-edit-callbacks.c
+++ b/src/filter-edit-callbacks.c
@@ -478,14 +478,24 @@ fe_user_header_add(const gchar * user_header)
 
         /* First clear the combo box... */
         for (lst = fe_user_headers_list; lst; lst = lst->next)
+#if GTK_CHECK_VERSION(2, 24, 0)
+            gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(fe_user_header),
+                                      0);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
             gtk_combo_box_remove_text(GTK_COMBO_BOX(fe_user_header), 0);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
 
         fe_add_new_user_header(user_header);
 
         /* ...then remake it with the new string... */
         for (lst = fe_user_headers_list; lst; lst = lst->next)
+#if GTK_CHECK_VERSION(2, 24, 0)
+            gtk_combo_box_text_append_text
+                (GTK_COMBO_BOX_TEXT(fe_user_header), lst->data);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
             gtk_combo_box_append_text(GTK_COMBO_BOX(fe_user_header),
                                       lst->data);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
 
         fe_user_header_set_active(user_header);
     }
@@ -961,10 +971,17 @@ get_field_frame(void)
     g_signal_connect(G_OBJECT(fe_matching_fields_us_head), "toggled",
                      G_CALLBACK(fe_match_field_user_header_cb), NULL);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    fe_user_header = gtk_combo_box_text_new_with_entry();
+    for (list = fe_user_headers_list; list; list = list->next)
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(fe_user_header),
+                                       list->data);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     fe_user_header = gtk_combo_box_entry_new_text();
     for (list = fe_user_headers_list; list; list = list->next)
         gtk_combo_box_append_text(GTK_COMBO_BOX(fe_user_header),
                                   list->data);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     g_signal_connect(G_OBJECT(fe_user_header), "changed",
                      G_CALLBACK(fe_condition_changed_cb), NULL);
     gtk_table_attach(GTK_TABLE(table),
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 24e8433..3015788 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -154,9 +154,19 @@ fe_build_option_menu(option_list options[], gint num, GCallback func,
     if (num < 1)
 	return (NULL);
 
-    combo_box = gtk_combo_box_new_text();
     info = g_new(struct fe_combo_box_info, 1);
     info->values = NULL;
+#if GTK_CHECK_VERSION(2, 24, 0)
+    combo_box = gtk_combo_box_text_new();
+
+    for (i = 0; i < num; i++) {
+	gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                       _(options[i].text));
+	info->values =
+	    g_slist_append(info->values, GINT_TO_POINTER(options[i].value));
+    }
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
+    combo_box = gtk_combo_box_new_text();
 
     for (i = 0; i < num; i++) {
 	gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box),
@@ -164,6 +174,7 @@ fe_build_option_menu(option_list options[], gint num, GCallback func,
 	info->values =
 	    g_slist_append(info->values, GINT_TO_POINTER(options[i].value));
     }
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
     if (func)
 	g_signal_connect(G_OBJECT(combo_box), "changed", func, cb_data);
diff --git a/src/mailbox-conf.c b/src/mailbox-conf.c
index 9b4db59..bd7a782 100644
--- a/src/mailbox-conf.c
+++ b/src/mailbox-conf.c
@@ -165,7 +165,12 @@ mailbox_conf_combo_box_make(GtkComboBox * combo_box, unsigned cnt,
 
     info->tags = NULL;
     for (i = cnt; --i >= 0;) {
+#if GTK_CHECK_VERSION(2, 24, 0)
+        gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                        _(data[i].label));
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
         gtk_combo_box_prepend_text(combo_box, _(data[i].label));
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
         info->tags =
             g_slist_prepend(info->tags, GINT_TO_POINTER(data[i].tag));
     }
@@ -236,7 +241,11 @@ balsa_server_conf_get_advanced_widget(BalsaServerConf *bsc, LibBalsaServer *s,
 
     label = libbalsa_create_label(_("Use _TLS:"), GTK_WIDGET(bsc->table), 1);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    bsc->tls_option = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     bsc->tls_option = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     mailbox_conf_combo_box_make(GTK_COMBO_BOX(bsc->tls_option),
                                 ELEMENTS(tls_menu), tls_menu);
     gtk_combo_box_set_active(GTK_COMBO_BOX(bsc->tls_option),
@@ -1462,7 +1471,11 @@ mailbox_conf_view_new_full(LibBalsaMailbox * mailbox,
     if (size_group)
         gtk_size_group_add_widget(size_group, label);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    view_info->identity_combo_box = widget = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     view_info->identity_combo_box = widget = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     if (mcw)
         g_signal_connect(view_info->identity_combo_box, "changed",
                          G_CALLBACK(check_for_blank_fields), mcw);
@@ -1474,7 +1487,11 @@ mailbox_conf_view_new_full(LibBalsaMailbox * mailbox,
         gchar *name;
 
         name = internet_address_to_string(ident->ia, FALSE);
+#if GTK_CHECK_VERSION(2, 24, 0)
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), name);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
         gtk_combo_box_append_text(GTK_COMBO_BOX(widget), name);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
         g_free(name);
         if (identity_name
             && strcmp(identity_name, ident->identity_name) == 0)
@@ -1501,7 +1518,11 @@ mailbox_conf_view_new_full(LibBalsaMailbox * mailbox,
         if (size_group)
             gtk_size_group_add_widget(size_group, label);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+        view_info->chk_crypt = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
         view_info->chk_crypt = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
         gtk_label_set_mnemonic_widget(GTK_LABEL(label), view_info->chk_crypt);
         mailbox_conf_combo_box_make(GTK_COMBO_BOX(view_info->chk_crypt),
                                     ELEMENTS(chk_crypt_menu),
diff --git a/src/main-window.c b/src/main-window.c
index 5a6b2c9..24e4291 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -1257,13 +1257,21 @@ bw_create_index_widget(BalsaWindow *bw)
 
     bw->sos_bar = gtk_hbox_new(FALSE, 5);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    bw->filter_choice = gtk_combo_box_text_new();
+    for(i=0; i<ELEMENTS(view_filters); i++)
+        gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT
+                                       (bw->filter_choice), i,
+                                       view_filters[i].str);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     bw->filter_choice = gtk_combo_box_new_text();
-    gtk_box_pack_start(GTK_BOX(bw->sos_bar), bw->filter_choice,
-                       FALSE, FALSE, 0);
     for(i=0; i<ELEMENTS(view_filters); i++)
         gtk_combo_box_insert_text(GTK_COMBO_BOX(bw->filter_choice),
                                   i, view_filters[i].str);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_combo_box_set_active(GTK_COMBO_BOX(bw->filter_choice), 0);
+    gtk_box_pack_start(GTK_BOX(bw->sos_bar), bw->filter_choice,
+                       FALSE, FALSE, 0);
     gtk_widget_show(bw->filter_choice);
     bw->sos_entry = gtk_entry_new();
     /* gtk_label_set_mnemonic_widget(GTK_LABEL(bw->filter_choice),
@@ -2738,21 +2746,6 @@ bw_mailbox_tab_n_cb(GtkAction * action, gpointer data)
  * show the about box for Balsa
  */
 static void
-bw_show_about_box_url_hook(GtkAboutDialog * about, const gchar * link,
-                           gpointer data)
-{
-    GError *err = NULL;
-
-    gtk_show_uri(NULL, link, gtk_get_current_event_time(), &err);
-
-    if (err) {
-        balsa_information(LIBBALSA_INFORMATION_WARNING,
-                          _("Error showing %s: %s\n"), link, err->message);
-        g_error_free(err);
-    }
-}
-
-static void
 bw_show_about_box(GtkAction * action, gpointer user_data)
 {
     const gchar *authors[] = {
@@ -2775,7 +2768,6 @@ bw_show_about_box(GtkAction * action, gpointer user_data)
         gdk_pixbuf_new_from_file(BALSA_DATA_PREFIX
                                  "/pixmaps/balsa_logo.png", NULL);
 
-    gtk_about_dialog_set_url_hook(bw_show_about_box_url_hook, NULL, NULL);
     gtk_show_about_dialog(GTK_WINDOW(user_data),
                           "version", BALSA_VERSION,
                           "copyright",
diff --git a/src/pref-manager.c b/src/pref-manager.c
index bdd636a..b3dcda8 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -3396,7 +3396,11 @@ add_show_menu(const char* label, gint level, GtkWidget* menu)
     struct pm_combo_box_info *info =
         g_object_get_data(G_OBJECT(menu), PM_COMBO_BOX_INFO);
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(menu), label);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     gtk_combo_box_append_text(GTK_COMBO_BOX(menu), label);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     info->levels = g_slist_append(info->levels, GINT_TO_POINTER(level));
 }
 
@@ -3730,7 +3734,11 @@ pm_combo_box_info_free(struct pm_combo_box_info * info)
 static GtkWidget *
 pm_combo_box_new(void)
 {
+#if GTK_CHECK_VERSION(2, 24, 0)
+    GtkWidget *combo_box = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     GtkWidget *combo_box = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     struct pm_combo_box_info *info = g_new0(struct pm_combo_box_info, 1);
 
     g_object_set_data_full(G_OBJECT(combo_box), PM_COMBO_BOX_INFO, info,
diff --git a/src/save-restore.c b/src/save-restore.c
index 7939fe0..fd1dddd 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -1957,6 +1957,8 @@ config_filter_load(const gchar * key, const gchar * value, gpointer data)
     long int dummy;
 
     dummy = strtol(value, &endptr, 10);
+    if (dummy == LONG_MIN || dummy == LONG_MAX)
+        g_message("Value is too large");
     if (*endptr) {              /* Bad format. */
         libbalsa_conf_remove_group(key);
         return FALSE;
@@ -2006,6 +2008,8 @@ config_filters_save(void)
     for(list = balsa_app.filters; list; list = list->next) {
 	fil = (LibBalsaFilter*)(list->data);
 	i=snprintf(tmp,tmp_len,"%d",nb++);
+        if (i >= tmp_len)
+            g_message("Group name was truncated");
 	libbalsa_conf_push_group(buffer);
 	libbalsa_filter_save_config(fil);
 	libbalsa_conf_pop_group();
@@ -2014,6 +2018,8 @@ config_filters_save(void)
     /* This loop takes care of cleaning up old filter sections */
     while (TRUE) {
 	i=snprintf(tmp,tmp_len,"%d",nb++);
+        if (i >= tmp_len)
+            g_message("Group name was truncated");
 	if (libbalsa_conf_has_group(buffer)) {
 	    libbalsa_conf_remove_group(buffer);
 	}
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index e75d63b..587bd22 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -1113,7 +1113,6 @@ edit_with_gnome_check(gpointer data) {
     GtkTextBuffer *buffer;
 
     pid_t pid;
-    gint curposition;
     gchar line[81]; /* FIXME:All lines should wrap at this line */
     /* Editor not ready */
     pid = waitpid (data_real->pid_editor, NULL, WNOHANG);
@@ -1160,7 +1159,6 @@ edit_with_gnome_check(gpointer data) {
 #endif                          /* HAVE_GTKSOURCEVIEW */
     sw_buffer_signals_block(data_real->bsmsg, buffer);
     gtk_text_buffer_set_text(buffer, "", 0);
-    curposition = 0;
     while(fgets(line, sizeof(line), tmp))
         gtk_text_buffer_insert_at_cursor(buffer, line, -1);
     sw_buffer_signals_unblock(data_real->bsmsg, buffer);
@@ -1885,13 +1883,22 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
     if (change_type) {
         GtkWidget *label = gtk_label_new(_("Attach as MIME type:"));
         GtkWidget *hbox = gtk_hbox_new(FALSE, 5);
-        combo_box = gtk_combo_box_new_text();
 
         gtk_box_pack_start(content_box, hbox, TRUE, TRUE, 5);
         gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION(2, 24, 0)
+        combo_box = gtk_combo_box_text_new();
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                       mime_type);
+        gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                       "application/octet-stream");
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
+        combo_box = gtk_combo_box_new_text();
         gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), mime_type);
         gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box),
                                   "application/octet-stream");
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
+
         gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
         g_signal_connect(G_OBJECT(combo_box), "changed",
                          G_CALLBACK(sw_charset_combo_box_changed),
diff --git a/src/store-address.c b/src/store-address.c
index 1c0b93b..0f686a8 100644
--- a/src/store-address.c
+++ b/src/store-address.c
@@ -282,7 +282,11 @@ store_address_book_frame(StoreAddressInfo * info)
     LibBalsaAddressBook *address_book;
     guint default_ab_offset = 0, off;
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+    combo_box = gtk_combo_box_text_new();
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
     combo_box = gtk_combo_box_new_text();
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
     g_signal_connect(combo_box, "changed",
                      G_CALLBACK(store_address_book_menu_cb), info);
     if (balsa_app.address_book_list) {
@@ -298,8 +302,13 @@ store_address_book_frame(StoreAddressInfo * info)
 	    if (info->current_address_book == NULL)
 		info->current_address_book = address_book;
 
+#if GTK_CHECK_VERSION(2, 24, 0)
+            gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
+                                           address_book->name);
+#else                           /* GTK_CHECK_VERSION(2, 24, 0) */
 	    gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box),
                                       address_book->name);
+#endif                          /* GTK_CHECK_VERSION(2, 24, 0) */
 	    if (address_book == balsa_app.default_address_book)
                 default_ab_offset = off;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]