[balsa/gtk3] Bump glib and gtk required versions



commit ccee4f78e047649de47e12ce514c04db75e36626
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 2 20:02:07 2013 -0400

    Bump glib and gtk required versions
    
        * configure.ac: bump glib and gtk required versions.
        * libbalsa/imap-server.c (libbalsa_imap_server_init),
        (libbalsa_imap_server_finalize): drop conditional code.
        * libbalsa/libbalsa-conf.c (lbc_lock), (lbc_unlock): ditto.
        * libbalsa/libbalsa.c (libbalsa_init): ditto.
        * libbalsa/mime-stream-shared.c (lbmss_stream_class_init),
        (libbalsa_mime_stream_shared_lock),
        (libbalsa_mime_stream_shared_unlock): ditto.
        * libinit_balsa/assistant_page_user.c
        (balsa_druid_page_user_init): ditto.
        * src/balsa-mime-widget-text.c (bm_widget_new_vcard): ditto.
        * src/balsa-mime-widget-vcalendar.c (balsa_vevent_widget):
        ditto.
        * src/filter-edit-callbacks.c (fe_apply_pressed),
        (fe_filters_list_selection_changed): ditto.
        * src/filter-edit-dialog.c (fe_make_color_buttons): ditto.
        * src/folder-conf.c (folder_conf_imap_sub_node): ditto.
        * src/main-window.c: ditto.
        * src/main-window.h: ditto.
        * src/main.c (threads_init): ditto.
        * src/sendmsg-window.c (render_attach_size): ditto.

 ChangeLog                           |   24 ++++
 configure.ac                        |   32 +-----
 libbalsa/imap-server.c              |   18 ---
 libbalsa/libbalsa-conf.c            |   12 --
 libbalsa/libbalsa.c                 |    5 -
 libbalsa/mime-stream-shared.c       |   25 -----
 libinit_balsa/assistant_page_user.c |    6 -
 src/balsa-mime-widget-text.c        |    5 -
 src/balsa-mime-widget-vcalendar.c   |    5 -
 src/filter-edit-callbacks.c         |   32 ------
 src/filter-edit-dialog.c            |   14 ---
 src/folder-conf.c                   |    5 -
 src/main-window.c                   |  203 -----------------------------------
 src/main-window.h                   |   10 --
 src/main.c                          |    4 -
 src/sendmsg-window.c                |    4 -
 16 files changed, 28 insertions(+), 376 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9c7c04f..92de35d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2013-05-02  Peter Bloomfield
 
+       * configure.ac: bump glib and gtk required versions.
+       * libbalsa/imap-server.c (libbalsa_imap_server_init),
+       (libbalsa_imap_server_finalize): drop conditional code.
+       * libbalsa/libbalsa-conf.c (lbc_lock), (lbc_unlock): ditto.
+       * libbalsa/libbalsa.c (libbalsa_init): ditto.
+       * libbalsa/mime-stream-shared.c (lbmss_stream_class_init),
+       (libbalsa_mime_stream_shared_lock),
+       (libbalsa_mime_stream_shared_unlock): ditto.
+       * libinit_balsa/assistant_page_user.c
+       (balsa_druid_page_user_init): ditto.
+       * src/balsa-mime-widget-text.c (bm_widget_new_vcard): ditto.
+       * src/balsa-mime-widget-vcalendar.c (balsa_vevent_widget):
+       ditto.
+       * src/filter-edit-callbacks.c (fe_apply_pressed),
+       (fe_filters_list_selection_changed): ditto.
+       * src/filter-edit-dialog.c (fe_make_color_buttons): ditto.
+       * src/folder-conf.c (folder_conf_imap_sub_node): ditto.
+       * src/main-window.c: ditto.
+       * src/main-window.h: ditto.
+       * src/main.c (threads_init): ditto.
+       * src/sendmsg-window.c (render_attach_size): ditto.
+
+2013-05-02  Peter Bloomfield
+
        * libbalsa/libbalsa.c (libbalsa_init): reduce glib requirement
        to 2.32.
        * src/main.c (threads_init): ditto.
diff --git a/configure.ac b/configure.ac
index b594e59..ae49199 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,11 +163,6 @@ AC_ARG_WITH([macosx-desktop],
                  [Use Mac OS X Desktop Integration (default=no, extremely experimental)]),
                  [use_igemacint=$withval],[use_igemacint=no])
 
-AC_ARG_WITH(nm,
-   AC_HELP_STRING([--with-nm],
-                  [Enable NetworkManager (default=yes)]),
-                  [with_nm=$withval],[with_nm=yes])
-
 AC_ARG_ENABLE([pcre], 
    AC_HELP_STRING([--enable-pcre],
                   [Use Perl-compatible regular expressions if available (default=no)]),
@@ -343,16 +338,16 @@ dnl Make sure ld finds zlib:
 LIBS="$LIBS -lz"
 
 PKG_CHECK_MODULES(BALSA, [
-glib-2.0 >= 2.28.0
-gtk+-3.0
+glib-2.0 >= 2.32.0
+gtk+-3.0 >= 3.4.0
 gmime-$with_gmime
-gio-2.0 >= 2.27.0
+gio-2.0
 gthread-2.0
 $gnome_extras
 ])
 
 PKG_CHECK_MODULES(BALSA_AB, [
-   glib-2.0 >= 2.27.0
+   glib-2.0
    gtk+-3.0
    gmime-$with_gmime
    $gnome_extras
@@ -751,24 +746,6 @@ if test x$with_libnotify != xno; then
     with_libnotify=" >= 0.$notifyver"
 fi
 
-# NetworkManager
-AC_MSG_CHECKING([whether to use NetworkManager])
-if test "$with_nm" != no ; then
-  if $PKG_CONFIG --atleast-version=2.32.0 glib-2.0 ; then
-    with_nm="no; using GNetworkMonitor instead"
-  else
-    PKG_CHECK_EXISTS([libnm-glib], 
-    [ PKG_CHECK_MODULES(LIBNM_GLIB, [ libnm-glib >= 0.7.0]) ],
-    [ PKG_CHECK_MODULES(LIBNM_GLIB, [ libnm_glib >= 0.7.0]) ])
-
-    AC_DEFINE(HAVE_LIBNM_GLIB,1,
-              [ Defined if NetworkManager-glib-devel is found.])
-    BALSA_CFLAGS="$BALSA_CFLAGS $LIBNM_GLIB_CFLAGS"
-    LIBS="$LIBS $LIBNM_GLIB_LIBS"
-  fi
-fi
-AC_MSG_RESULT($with_nm)
-
 # Compface configuration
 #
 AC_MSG_CHECKING([whether to build Compface support])
@@ -1043,7 +1020,6 @@ echo "                  Use LDAP: $with_ldap"
 echo "                   Use GSS: $with_gss"
 echo "                Use SQLite: $with_sqlite"
 echo "                   Use SSL: $with_ssl"
-echo "        Use NetworkManager: $with_nm"
 echo "              Use GtkSpell: $with_gtkspell"
 echo "             Use Libnotify: $with_libnotify"
 echo "         Use GtkSourceView: $with_gtksourceview"
diff --git a/libbalsa/imap-server.c b/libbalsa/imap-server.c
index a33c021..01d5b89 100644
--- a/libbalsa/imap-server.c
+++ b/libbalsa/imap-server.c
@@ -67,11 +67,7 @@ struct LibBalsaImapServer_ {
     gboolean offline_mode;
     
 #if defined(BALSA_USE_THREADS)
-#if GLIB_CHECK_VERSION(2, 32, 0)
     GMutex lock; /* protects the following members */
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    GMutex *lock; /* protects the following members */
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #endif
     guint used_connections;
     GList *used_handles;
@@ -108,15 +104,9 @@ static gboolean connection_cleanup(gpointer ptr);
 static pthread_mutex_t imap_servers_lock = PTHREAD_MUTEX_INITIALIZER;
 #define LOCK_SERVERS()   pthread_mutex_lock(&imap_servers_lock)
 #define UNLOCK_SERVERS() pthread_mutex_unlock(&imap_servers_lock)
-#if GLIB_CHECK_VERSION(2, 32, 0)
 #define LOCK_SERVER(server)    g_mutex_lock(&((server)->lock))
 #define TRYLOCK_SERVER(server) g_mutex_trylock(&((server)->lock))
 #define UNLOCK_SERVER(server)  g_mutex_unlock(&((server)->lock))
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-#define LOCK_SERVER(server)    g_mutex_lock((server)->lock)
-#define TRYLOCK_SERVER(server) g_mutex_trylock((server)->lock)
-#define UNLOCK_SERVER(server)  g_mutex_unlock((server)->lock)
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #else
 #define LOCK_SERVERS()
 #define UNLOCK_SERVERS()
@@ -224,11 +214,7 @@ libbalsa_imap_server_init(LibBalsaImapServer * imap_server)
     LIBBALSA_SERVER(imap_server)->protocol = "imap";
     imap_server->key = NULL;
 #if defined(BALSA_USE_THREADS)
-#if GLIB_CHECK_VERSION(2, 32, 0)
     g_mutex_init(&imap_server->lock);
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    imap_server->lock = g_mutex_new();
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #endif
     imap_server->max_connections = MAX_CONNECTIONS_PER_SERVER;
     imap_server->used_connections = 0;
@@ -266,11 +252,7 @@ libbalsa_imap_server_finalize(GObject * object)
 #endif
     libbalsa_imap_server_force_disconnect(imap_server);
 #if defined(BALSA_USE_THREADS)
-#if GLIB_CHECK_VERSION(2, 32, 0)
     g_mutex_clear(&imap_server->lock);
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    g_mutex_free(imap_server->lock);
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #endif
     g_free(imap_server->key); imap_server->key = NULL;
 
diff --git a/libbalsa/libbalsa-conf.c b/libbalsa/libbalsa-conf.c
index 6c9888d..f0dd35d 100644
--- a/libbalsa/libbalsa-conf.c
+++ b/libbalsa/libbalsa-conf.c
@@ -147,11 +147,7 @@ lbc_init(LibBalsaConf * conf, const gchar * filename,
 }
 
 #ifdef BALSA_USE_THREADS
-#if GLIB_CHECK_VERSION(2, 32, 0)
 static GRecMutex lbc_mutex;
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-static GStaticRecMutex lbc_mutex = G_STATIC_REC_MUTEX_INIT;
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #endif                          /* BALSA_USE_THREADS */
 
 static void
@@ -160,11 +156,7 @@ lbc_lock(void)
     static gboolean initialized = FALSE;
 
 #ifdef BALSA_USE_THREADS
-#if GLIB_CHECK_VERSION(2, 32, 0)
     g_rec_mutex_lock(&lbc_mutex);
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    g_static_rec_mutex_lock(&lbc_mutex);
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #endif                          /* BALSA_USE_THREADS */
     if (!initialized) {
         lbc_init(&lbc_conf, "config", ".gnome2");
@@ -177,11 +169,7 @@ static void
 lbc_unlock(void)
 {
 #ifdef BALSA_USE_THREADS
-#if GLIB_CHECK_VERSION(2, 32, 0)
     g_rec_mutex_unlock(&lbc_mutex);
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    g_static_rec_mutex_unlock(&lbc_mutex);
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 #endif                          /* BALSA_USE_THREADS */
 }
 
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 7f27ac2..0da513f 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -91,11 +91,6 @@ libbalsa_init(LibBalsaInformationFunc information_callback)
 #endif
 
 #ifdef BALSA_USE_THREADS
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-    if (!g_thread_supported()) {
-       g_error("Threads have not been initialised.");
-    }
-#endif                          /* !GLIB_CHECK_VERSION(2, 32, 0) */
     main_thread_id = pthread_self();
 #endif
 
diff --git a/libbalsa/mime-stream-shared.c b/libbalsa/mime-stream-shared.c
index 7a56098..081aec4 100644
--- a/libbalsa/mime-stream-shared.c
+++ b/libbalsa/mime-stream-shared.c
@@ -71,13 +71,8 @@ static GMimeStream *lbmss_stream_substream(GMimeStream * stream,
                                            gint64 start, gint64 end);
 
 static GMimeStreamFsClass *parent_class = NULL;
-#if GLIB_CHECK_VERSION(2, 32, 0)
 static GMutex lbmss_mutex;
 static GCond lbmss_cond;
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-static GMutex *lbmss_mutex;
-static GCond *lbmss_cond;
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 
 GType
 libbalsa_mime_stream_shared_get_type(void)
@@ -112,10 +107,6 @@ lbmss_stream_class_init(LibBalsaMimeStreamSharedClass * klass)
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
     parent_class = g_type_class_ref(GMIME_TYPE_STREAM_FS);
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-    lbmss_mutex  = g_mutex_new();
-    lbmss_cond   = g_cond_new();
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 
     object_class->finalize  = lbmss_finalize;
 
@@ -289,21 +280,12 @@ libbalsa_mime_stream_shared_lock(GMimeStream * stream)
     lock = stream_shared->lock;
     thread_self = g_thread_self();
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
     g_mutex_lock(&lbmss_mutex);
     while (lock->count > 0 && lock->thread != thread_self)
         g_cond_wait(&lbmss_cond, &lbmss_mutex);
     ++lock->count;
     lock->thread = thread_self;
     g_mutex_unlock(&lbmss_mutex);
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    g_mutex_lock(lbmss_mutex);
-    while (lock->count > 0 && lock->thread != thread_self)
-        g_cond_wait(lbmss_cond, lbmss_mutex);
-    ++lock->count;
-    lock->thread = thread_self;
-    g_mutex_unlock(lbmss_mutex);
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 }
 
 /**
@@ -330,17 +312,10 @@ libbalsa_mime_stream_shared_unlock(GMimeStream * stream)
     lock = stream_shared->lock;
     g_return_if_fail(lock->count > 0);
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
     g_mutex_lock(&lbmss_mutex);
     if (--lock->count == 0)
         g_cond_signal(&lbmss_cond);
     g_mutex_unlock(&lbmss_mutex);
-#else                           /* GLIB_CHECK_VERSION(2, 32, 0) */
-    g_mutex_lock(lbmss_mutex);
-    if (--lock->count == 0)
-        g_cond_signal(lbmss_cond);
-    g_mutex_unlock(lbmss_mutex);
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 }
 
 #endif                          /* BALSA_USE_THREADS */
diff --git a/libinit_balsa/assistant_page_user.c b/libinit_balsa/assistant_page_user.c
index 0986c64..f30283e 100644
--- a/libinit_balsa/assistant_page_user.c
+++ b/libinit_balsa/assistant_page_user.c
@@ -90,14 +90,8 @@ balsa_druid_page_user_init(BalsaDruidPageUser * user,
     gtk_box_pack_start(GTK_BOX(page), GTK_WIDGET(label), FALSE, TRUE, 0);
 
     grid = GTK_GRID(gtk_grid_new());
-#if GTK_CHECK_VERSION(3, 0, 2)
     gtk_grid_set_row_spacing(grid, 2);
     gtk_grid_set_column_spacing(grid, 5);
-#else                   /* GTK_CHECK_VERSION(3, 0, 2) */
-    /* work around row <=> column spacing bug */
-    gtk_grid_set_row_spacing(grid, 5);
-    gtk_grid_set_column_spacing(grid, 2);
-#endif                  /* GTK_CHECK_VERSION(3, 0, 2) */
 
 #if 0
     label = GTK_LABEL(gtk_label_new(_(header21)));
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index b15e85d..791674f 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -1210,13 +1210,8 @@ bm_widget_new_vcard(BalsaMessage *bm, LibBalsaMessageBody *mime_body,
 
     mw->widget = gtk_grid_new();
     grid = (GtkGrid*)mw->widget;
-#if GTK_CHECK_VERSION(3, 2, 0)
     gtk_grid_set_row_spacing(grid, 6);
     gtk_grid_set_column_spacing(grid, 12);
-#else                           /* GTK_CHECK_VERSION(3, 2, 0) */
-    gtk_grid_set_row_spacing(grid, 12);
-    gtk_grid_set_column_spacing(grid, 6);
-#endif                          /* GTK_CHECK_VERSION(3, 2, 0) */
 
     w = gtk_button_new_with_mnemonic(_("S_tore Address"));
     gtk_grid_attach(grid, w, 0, 0, 2, 1);
diff --git a/src/balsa-mime-widget-vcalendar.c b/src/balsa-mime-widget-vcalendar.c
index 40e8c63..a117152 100644
--- a/src/balsa-mime-widget-vcalendar.c
+++ b/src/balsa-mime-widget-vcalendar.c
@@ -167,13 +167,8 @@ balsa_vevent_widget(LibBalsaVEvent * event, gboolean may_reply,
     LibBalsaIdentity *vevent_ident = NULL;
 
     grid = GTK_GRID(gtk_grid_new());
-#if GTK_CHECK_VERSION(3, 2, 0)
     gtk_grid_set_row_spacing(grid, 6);
     gtk_grid_set_column_spacing(grid, 12);
-#else                           /* GTK_CHECK_VERSION(3, 2, 0) */
-    gtk_grid_set_row_spacing(grid, 12);
-    gtk_grid_set_column_spacing(grid, 6);
-#endif                          /* GTK_CHECK_VERSION(3, 2, 0) */
     GRID_ATTACH(grid, event->summary, _("Summary:"));
     GRID_ATTACH_ADDRESS(grid, event->organizer, _("Organizer:"));
     GRID_ATTACH_DATE(grid, event->start, _("Start:"));
diff --git a/src/filter-edit-callbacks.c b/src/filter-edit-callbacks.c
index f192ba3..6534e1b 100644
--- a/src/filter-edit-callbacks.c
+++ b/src/filter-edit-callbacks.c
@@ -1897,26 +1897,16 @@ fe_apply_pressed(GtkWidget * widget, gpointer data)
     fil->action=action;
 
     if (fil->action == FILTER_COLOR) {
-#if GTK_CHECK_VERSION(3, 4, 0)
         GdkRGBA rgba;
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-        GdkColor color;
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
         GString *string = g_string_new(NULL);
         GtkToggleButton *toggle_button;
         gchar *color_string;
 
         toggle_button = (GTK_TOGGLE_BUTTON(fe_foreground_set));
         if (gtk_toggle_button_get_active(toggle_button)) {
-#if GTK_CHECK_VERSION(3, 4, 0)
             gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(fe_foreground),
                                        &rgba);
             color_string = gdk_rgba_to_string(&rgba);
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-            gtk_color_button_get_color(GTK_COLOR_BUTTON(fe_foreground),
-                                       &color);
-            color_string = gdk_color_to_string(&color);
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
             g_string_append_printf(string, "foreground:%s", color_string);
             g_free(color_string);
             gtk_toggle_button_set_active(toggle_button, FALSE);
@@ -1924,15 +1914,9 @@ fe_apply_pressed(GtkWidget * widget, gpointer data)
 
         toggle_button = (GTK_TOGGLE_BUTTON(fe_background_set));
         if (gtk_toggle_button_get_active(toggle_button)) {
-#if GTK_CHECK_VERSION(3, 4, 0)
             gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(fe_background),
                                        &rgba);
             color_string = gdk_rgba_to_string(&rgba);
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-            gtk_color_button_get_color(GTK_COLOR_BUTTON(fe_background),
-                                       &color);
-            color_string = gdk_color_to_string(&color);
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
             if (string->len > 0)
                 g_string_append_c(string, ';');
             g_string_append_printf(string, "background:%s", color_string);
@@ -2078,37 +2062,21 @@ fe_filters_list_selection_changed(GtkTreeSelection * selection,
     gtk_combo_box_set_active(GTK_COMBO_BOX(fe_op_codes_option_menu), pos);
     if (fil->action == FILTER_COLOR) {
         gchar **parts, **p;
-#if GTK_CHECK_VERSION(3, 4, 0)
         GdkRGBA rgba;
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-        GdkColor color;
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
 
         parts = g_strsplit(fil->action_string, ";", 2);
         for (p = parts; *p; p++) {
             if (g_str_has_prefix(*p, "foreground:")) {
-#if GTK_CHECK_VERSION(3, 4, 0)
                 gdk_rgba_parse(&rgba, (*p) + 11);
                 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fe_foreground),
                                            &rgba);
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-                gdk_color_parse((*p) + 11, &color);
-                gtk_color_button_set_color(GTK_COLOR_BUTTON(fe_foreground),
-                                           &color);
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                              (fe_foreground_set), TRUE);
             }
             if (g_str_has_prefix(*p, "background:")) {
-#if GTK_CHECK_VERSION(3, 4, 0)
                 gdk_rgba_parse(&rgba, (*p) + 11);
                 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fe_background),
                                            &rgba);
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-                gdk_color_parse((*p) + 11, &color);
-                gtk_color_button_set_color(GTK_COLOR_BUTTON(fe_background),
-                                           &color);
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                              (fe_background_set), TRUE);
             }
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index ff8e04d..49136b3 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -339,11 +339,7 @@ fe_make_color_buttons(void)
 {
     GtkWidget *grid_widget;
     GtkGrid *grid;
-#if GTK_CHECK_VERSION(3, 4, 0)
     GdkRGBA rgba;
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-    GdkColor color;
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
 
     grid_widget = gtk_grid_new();
     grid = GTK_GRID(grid_widget);
@@ -352,13 +348,8 @@ fe_make_color_buttons(void)
 
     fe_foreground_set = gtk_check_button_new_with_mnemonic(_("Foreground"));
     gtk_grid_attach(grid, fe_foreground_set, 0, 0, 1, 1);
-#if GTK_CHECK_VERSION(3, 4, 0)
     gdk_rgba_parse(&rgba, "black");
     fe_foreground = gtk_color_button_new_with_rgba(&rgba);
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-    gdk_color_parse("black", &color);
-    fe_foreground = gtk_color_button_new_with_color(&color);
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
     gtk_widget_set_sensitive(fe_foreground, FALSE);
     gtk_grid_attach(grid, fe_foreground, 1, 0, 1, 1);
     g_signal_connect(fe_foreground_set, "toggled",
@@ -368,13 +359,8 @@ fe_make_color_buttons(void)
 
     fe_background_set = gtk_check_button_new_with_mnemonic(_("Background"));
     gtk_grid_attach(grid, fe_background_set, 0, 1, 1, 1);
-#if GTK_CHECK_VERSION(3, 4, 0)
     gdk_rgba_parse(&rgba, "white");
     fe_background = gtk_color_button_new_with_rgba(&rgba);
-#else                           /* GTK_CHECK_VERSION(3, 4, 0) */
-    gdk_color_parse("white", &color);
-    fe_background = gtk_color_button_new_with_color(&color);
-#endif                          /* GTK_CHECK_VERSION(3, 4, 0) */
     gtk_widget_set_sensitive(fe_background, FALSE);
     gtk_grid_attach(grid, fe_background, 1, 1, 1, 1);
     g_signal_connect(fe_background_set, "toggled",
diff --git a/src/folder-conf.c b/src/folder-conf.c
index 35dae75..6219126 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -823,13 +823,8 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
     }
 
     grid = libbalsa_create_grid();
-#if GTK_CHECK_VERSION(3, 2, 0)
     gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
     gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
-#else                           /* GTK_CHECK_VERSION(3, 2, 0) */
-    gtk_grid_set_row_spacing(GTK_GRID(grid), 12);
-    gtk_grid_set_column_spacing(GTK_GRID(grid), 6);
-#endif                          /* GTK_CHECK_VERSION(3, 2, 0) */
     gtk_container_set_border_width(GTK_CONTAINER(grid), 12);
     if (mn)
         content = grid;
diff --git a/src/main-window.c b/src/main-window.c
index 649c870..696c2c5 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -45,11 +45,7 @@
 #  include "macosx-helpers.h"
 #endif
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
 #include <gio/gio.h>
-#elif defined(HAVE_LIBNM_GLIB)
-#include <nm-client.h>
-#endif
 
 #include "ab-window.h"
 #include "balsa-app.h"
@@ -115,13 +111,6 @@ static void bw_check_messages_thread(struct check_messages_thread_info
 #endif
 static void bw_display_new_mail_notification(int num_new, int has_new);
 
-#if !GLIB_CHECK_VERSION(2, 32, 0) && defined(HAVE_LIBNM_GLIB)
-static void bw_nm_client_state_report(NMState state);
-static void bw_nm_client_state_changed_cb(GObject * gobject,
-                                          GParamSpec * pspec,
-                                          gpointer data);
-#endif
-
 static void balsa_window_class_init(BalsaWindowClass * klass);
 static void balsa_window_init(BalsaWindow * window);
 static void balsa_window_real_open_mbnode(BalsaWindow *window,
@@ -1000,7 +989,6 @@ balsa_window_class_init(BalsaWindowClass * klass)
 
 }
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
 static gboolean bw_change_connection_status_idle(gpointer data);
 #define PRINT_NETWORK_STATUS(available)                 \
     g_printerr("Network is %s (%u)\n",                  \
@@ -1021,12 +1009,10 @@ bw_network_changed_cb(GNetworkMonitor * monitor,
                    GINT_TO_POINTER(available));
     }
 }
-#endif                          /* GLIB_CHECK_VERSION(2, 32, 0) */
 
 static void
 balsa_window_init(BalsaWindow * window)
 {
-#if GLIB_CHECK_VERSION(2, 32, 0)
     GNetworkMonitor *monitor;
 
     monitor = g_network_monitor_get_default();
@@ -1036,18 +1022,6 @@ balsa_window_init(BalsaWindow * window)
     g_signal_connect(monitor, "network-changed",
                      G_CALLBACK(bw_network_changed_cb), window);
     window->last_check_time = 0;
-#elif defined(HAVE_LIBNM_GLIB)
-    NMClient *client = nm_client_new();
-    if (client) {
-        window->nm_state = nm_client_get_state(client);
-        bw_nm_client_state_report(window->nm_state);
-        g_signal_connect(client, "notify::state",
-                         G_CALLBACK(bw_nm_client_state_changed_cb),
-                         window);
-        window->last_check_time = 0;
-    } else
-        fprintf (stderr, "Could not get NetworkManager client.\n");
-#endif /* LIBNM_GLIB */
 }
 
 static gboolean
@@ -2873,15 +2847,9 @@ bw_show_about_box(GtkAction * action, gpointer user_data)
 static void
 bw_check_mailbox_list(BalsaWindow * window, GList * mailbox_list)
 {
-#if GLIB_CHECK_VERSION(2, 32, 0)
     if (window && !window->network_available) {
         return;
     }
-#elif defined(HAVE_LIBNM_GLIB)
-    if (window && window->nm_state != NM_STATE_CONNECTED) {
-        return;
-    }
-#endif /* LIBNM_GLIB */
 
     for ( ; mailbox_list; mailbox_list = mailbox_list->next) {
         LibBalsaMailbox *mailbox =
@@ -2999,19 +2967,11 @@ bw_mailbox_check(LibBalsaMailbox * mailbox, BalsaWindow * window)
     if (libbalsa_mailbox_get_subscribe(mailbox) == LB_MAILBOX_SUBSCRIBE_NO)
         return;
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
     if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
         if (window && !window->network_available) {
                 return;
         }
     }
-#elif defined(HAVE_LIBNM_GLIB)
-    if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
-            if (window && window->nm_state != NM_STATE_CONNECTED) {
-                return;
-        }
-    }
-#endif /* LIBNM_GLIB */
 
     libbalsa_mailbox_check(mailbox);
 }
@@ -3096,13 +3056,8 @@ check_new_messages_real(BalsaWindow * window, int type)
     if (window)
         bw_set_sensitive(window, "GetNewMail", TRUE);
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
     if (window->network_available)
         time(&window->last_check_time);
-#elif defined(HAVE_LIBNM_GLIB)
-    if (window->nm_state == NM_STATE_CONNECTED)
-        time(&window->last_check_time);
-#endif                          /* defined(HAVE_LIBNM_GLIB) */
 #endif
 }
 
@@ -3227,15 +3182,9 @@ bw_mailbox_check(LibBalsaMailbox * mailbox, BalsaWindow * window)
         return;
 
     if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
-#if GLIB_CHECK_VERSION(2, 32, 0)
         if (window && !window->network_available) {
                 return;
         }
-#elif defined(HAVE_LIBNM_GLIB)
-            if (window && window->nm_state != NM_STATE_CONNECTED) {
-                return;
-        }
-#endif /* LIBNM_GLIB */
 
        string = g_strdup_printf(_("IMAP mailbox: %s"), mailbox->url);
         if (balsa_app.debug)
@@ -3286,13 +3235,8 @@ bw_check_messages_thread(struct check_messages_thread_info *info)
     if (info->window) {
         g_idle_add((GSourceFunc) bw_check_messages_thread_idle_cb,
                    g_object_ref(info->window));
-#if GLIB_CHECK_VERSION(2, 32, 0)
         if (info->window->network_available)
             time(&info->window->last_check_time);
-#elif defined(HAVE_LIBNM_GLIB)
-        if (info->window->nm_state == NM_STATE_CONNECTED)
-            time(&info->window->last_check_time);
-#endif                          /* defined(HAVE_LIBNM_GLIB) */
         g_object_unref(info->window);
     }
     pthread_mutex_unlock(&checking_mail_lock);
@@ -3671,7 +3615,6 @@ bw_display_new_mail_notification(int num_new, int has_new)
     g_free(msg);
 }
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
 /*Callback to create or disconnect an IMAP mbox. */
 static gboolean
 mw_mbox_change_connection_status(GtkTreeModel * model, GtkTreePath * path,
@@ -3739,152 +3682,6 @@ bw_change_connection_status_idle(gpointer arg)
     return FALSE;
 }
 
-#elif defined(HAVE_LIBNM_GLIB)
-/*Callback to create or disconnect an IMAP mbox. */
-static gboolean
-mw_mbox_change_connection_status(GtkTreeModel * model, GtkTreePath * path,
-                                 GtkTreeIter * iter, gpointer arg)
-{
-    BalsaMailboxNode *mbnode;
-    LibBalsaMailbox *mailbox;
-    gboolean is_connected = GPOINTER_TO_INT(arg);
-
-    gtk_tree_model_get(model, iter, 0, &mbnode, -1);
-    g_return_val_if_fail(mbnode, FALSE);
-
-    if ((mailbox = mbnode->mailbox)) {  /* mailbox, not a folder */
-        if (LIBBALSA_IS_MAILBOX_IMAP(mailbox)) {
-            const gchar *host =
-                LIBBALSA_MAILBOX_REMOTE(mailbox)->server->host;
-            if (!(g_str_has_prefix(host, "localhost/")
-                  || g_str_has_prefix(host, "127.")
-                  || g_str_has_prefix(host, "::1"))) {
-                if (is_connected) {
-                    libbalsa_mailbox_imap_reconnect
-                        (LIBBALSA_MAILBOX_IMAP(mailbox));
-                } else {
-                    libbalsa_mailbox_imap_force_disconnect
-                        (LIBBALSA_MAILBOX_IMAP(mailbox));
-                }
-            }
-        }
-    }
-    g_object_unref(mbnode);
-
-    return FALSE;
-}
-
-static gboolean
-check_new_messages_idle(gpointer user_data)
-{
-    check_new_messages_cb(NULL, balsa_app.main_window);
-    return FALSE;
-}
-
-static void*
-bw_change_connection_status_thread(void *arg)
-{
-    gboolean is_connected = GPOINTER_TO_INT(arg);
-
-    gtk_tree_model_foreach(GTK_TREE_MODEL(balsa_app.mblist_tree_store),
-                          (GtkTreeModelForeachFunc)
-                           mw_mbox_change_connection_status,
-                          arg);
-
-    /* GLib timeouts are now triggered by g_get_monotonic_time(),
-     * which doesn't increment while we're suspended, so we must
-     * check for ourselves whether a scheduled mail check was
-     * missed. */
-    if (is_connected &&
-        difftime(time(NULL), balsa_app.main_window->last_check_time) >
-        balsa_app.check_mail_timer * 60) {
-        /* Check the mail now, and reset the timer, remembering it
-           must be called from a main thread. */
-        g_idle_add(check_new_messages_idle, NULL);
-    }
-
-    return NULL;
-}
-
-#if !(0 && defined(BALSA_USE_THREADS))
-static gboolean
-bw_change_connection_status_idle(gpointer data)
-{
-    return GPOINTER_TO_INT(bw_change_connection_status_thread(data));
-}
-#endif /* BALSA_USE_THREADS */
-
-static void
-bw_nm_client_state_report(NMState state)
-{
-    const gchar *state_string;
-
-    switch (state) {
-    default:
-    case NM_STATE_UNKNOWN:
-        state_string = "Unknown";
-        break;
-    case NM_STATE_ASLEEP:
-        state_string = "Asleep";
-        break;
-    case NM_STATE_CONNECTING:
-        state_string = "Connecting...";
-        break;
-    case NM_STATE_CONNECTED:
-        state_string = "Connected";
-        break;
-    case NM_STATE_DISCONNECTED:
-        state_string = "Disconnected";
-        break;
-    }
-
-    fprintf(stderr, "Status: %s (%u)\n", state_string, (guint) time(NULL));
-}
-
-/** Responds to NetworkManager events and creates, alternatively
-forcefully destroys the IMAP connections. */
-static void
-bw_nm_client_state_changed_cb(GObject * gobject, GParamSpec * pspec,
-                              gpointer data)
-{
-    NMClient *client = NM_CLIENT(gobject);
-    BalsaWindow *window;
-    NMState new_state = nm_client_get_state(client);
-    NMState old_state;
-    gboolean is_connected;
-
-    if (!BALSA_IS_WINDOW(data))
-        return;
-
-    window = BALSA_WINDOW(data);
-    old_state = window->nm_state;
-
-    if (new_state == old_state) {
-        /* Notify signal does not guarantee that anything really
-         * changed. */
-        return;
-    }
-
-    bw_nm_client_state_report(new_state);
-    window->nm_state = new_state;
-
-    is_connected = (new_state == NM_STATE_CONNECTED);
-    if (is_connected || old_state == NM_STATE_CONNECTED) {
-#if 0 && defined(BALSA_USE_THREADS)
-        pthread_t thread_id;
-
-        if (pthread_create(&thread_id, NULL,
-                           (void *) &bw_change_connection_status_thread,
-                           GINT_TO_POINTER(is_connected)) == 0)
-            pthread_detach(thread_id);
-#else /* BALSA_USE_THREADS */
-        g_idle_add(bw_change_connection_status_idle,
-                   GINT_TO_POINTER(is_connected));
-#endif /* BALSA_USE_THREADS */
-    }
-}
-#endif /* LIBNM_GLIB */
-
 GtkWidget *
 balsa_window_find_current_index(BalsaWindow * window)
 {
diff --git a/src/main-window.h b/src/main-window.h
index 172f828..8de7e36 100644
--- a/src/main-window.h
+++ b/src/main-window.h
@@ -28,11 +28,7 @@
 #include <libnotify/notify.h>
 #endif
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
 #include <gio/gio.h>
-#elif defined(HAVE_LIBNM_GLIB)
-#include <nm-client.h>
-#endif
 
 #include "mailbox-node.h"
 #include "toolbar-factory.h"
@@ -100,15 +96,9 @@ struct _BalsaWindow {
     NotifyNotification *new_mail_note;
 #endif                         /* HAVE_NOTIFY */
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
     /* Support GNetworkMonitor: */
     gboolean network_available;
     time_t last_check_time;
-#elif defined(HAVE_LIBNM_GLIB)
-    /* NetworkManager state */
-    NMState nm_state;
-    time_t last_check_time;
-#endif                          /* defined(HAVE_LIBNM_GLIB) */
 };
 
 struct _BalsaWindowClass {
diff --git a/src/main.c b/src/main.c
index 1e51992..ed611de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -255,10 +255,6 @@ pthread_mutex_t checking_mail_lock = PTHREAD_MUTEX_INITIALIZER;
 static void
 threads_init(void)
 {
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-    g_type_init();
-#endif                          /* !GLIB_CHECK_VERSION(2, 32, 0) */
-
     pthread_mutex_init(&send_messages_lock, NULL);
     if (pipe(mail_thread_pipes) < 0) {
        g_log("BALSA Init", G_LOG_LEVEL_DEBUG,
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 3e3da59..a6ad6ae 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -2886,11 +2886,7 @@ render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
     if (mode == LIBBALSA_ATTACH_AS_EXTBODY)
         sstr = g_strdup("-");
     else
-#if GLIB_CHECK_VERSION(2, 30, 0)
         sstr = g_format_size(size);
-#else                           /* GLIB_CHECK_VERSION(2, 30, 0) */
-        sstr = g_format_size_for_display((goffset) size);
-#endif                          /* GLIB_CHECK_VERSION(2, 30, 0) */
     g_object_set(cell, "text", sstr, NULL);
     g_free(sstr);
 }


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