Code cleanup around glib version check (2.28 minimum).
authorwwp <wwp@free.fr>
Mon, 28 May 2018 15:44:59 +0000 (17:44 +0200)
committerwwp <wwp@free.fr>
Mon, 28 May 2018 15:44:59 +0000 (17:44 +0200)
src/common/utils.c
src/common/utils.h
src/gtk/gtkutils.c
src/gtk/gtkutils.h
src/plugins/libravatar/libravatar.c
src/plugins/libravatar/libravatar_prefs.c
src/plugins/libravatar/libravatar_prefs.h
src/plugins/vcalendar/vcal_dbus.c
src/prefs_account.c
src/wizard.c

index 5172982..0a7f421 100644 (file)
 
 static gboolean debug_mode = FALSE;
 
 
 static gboolean debug_mode = FALSE;
 
-#if !GLIB_CHECK_VERSION(2, 26, 0)
-guchar *g_base64_decode_wa(const gchar *text, gsize *out_len)
-{
-       guchar *ret;
-       gsize input_length;
-       gint state = 0;
-       guint save = 0;
-
-       input_length = strlen(text);
-
-       ret = g_malloc0((input_length / 4) * 3 + 1);
-
-       *out_len = g_base64_decode_step(text, input_length, ret, &state, &save);
-
-       return ret;
-}
-#endif
-
 /* Return true if we are running as root.  This function should beused
    instead of getuid () == 0.  */
 gboolean superuser_p (void)
 /* Return true if we are running as root.  This function should beused
    instead of getuid () == 0.  */
 gboolean superuser_p (void)
index b37495e..a1f356e 100644 (file)
@@ -74,19 +74,6 @@ typedef gint64 goffset;
   #define HAVE_U32_TYPEDEF
 #endif
 
   #define HAVE_U32_TYPEDEF
 #endif
 
-#if !GLIB_CHECK_VERSION(2, 26, 0)
-#define g_base64_decode(t,l)   g_base64_decode_wa((t),(l))
-guchar *g_base64_decode_wa(const gchar *text, gsize *out_len);
-#endif
-
-#if !GLIB_CHECK_VERSION(2, 25, 0)
-# ifdef G_OS_WIN32
-       typedef _g_stat_struct GStatBuf;
-# else
-       typedef struct stat GStatBuf;
-# endif
-#endif
-
 #ifndef BIG_ENDIAN_HOST
   #if (G_BYTE_ORDER == G_BIG_ENDIAN)
     #define BIG_ENDIAN_HOST 1
 #ifndef BIG_ENDIAN_HOST
   #if (G_BYTE_ORDER == G_BIG_ENDIAN)
     #define BIG_ENDIAN_HOST 1
index 5165ff1..89d092c 100644 (file)
@@ -1807,7 +1807,7 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, int box_width,
        return pixbuf;
 }
 
        return pixbuf;
 }
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
 static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl, AutoConfigureData *data)
 {
        gboolean smtp = strcmp(data->tls_service, "submission") == 0 ? TRUE : FALSE;
 static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl, AutoConfigureData *data)
 {
        gboolean smtp = strcmp(data->tls_service, "submission") == 0 ? TRUE : FALSE;
index 592e575..b290bb6 100644 (file)
@@ -205,7 +205,7 @@ claws_input_add    (gint          source,
        }                                                                       \
 }
 
        }                                                                       \
 }
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
 typedef struct _AutoConfigureData {
        const gchar *ssl_service;
        const gchar *tls_service;
 typedef struct _AutoConfigureData {
        const gchar *ssl_service;
        const gchar *tls_service;
index f07c6a2..de5100a 100644 (file)
@@ -79,7 +79,7 @@ static gboolean libravatar_header_update_hook(gpointer source, gpointer data)
 
 static gchar *federated_base_url_from_address(const gchar *address)
 {
 
 static gchar *federated_base_url_from_address(const gchar *address)
 {
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        gchar *base_url = NULL;
 
        if (!libravatarprefs.allow_federated) {
        gchar *base_url = NULL;
 
        if (!libravatarprefs.allow_federated) {
index 84e4fd9..3183def 100644 (file)
@@ -58,7 +58,7 @@ struct LibravatarPrefsPage
        GtkWidget *defm_radio[NUM_DEF_BUTTONS];
        GtkWidget *defm_url_text;
        GtkWidget *allow_redirects_check;
        GtkWidget *defm_radio[NUM_DEF_BUTTONS];
        GtkWidget *defm_url_text;
        GtkWidget *allow_redirects_check;
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        GtkWidget *allow_federated_check;
 #endif
        GtkWidget *timeout;
        GtkWidget *allow_federated_check;
 #endif
        GtkWidget *timeout;
@@ -85,7 +85,7 @@ static PrefParam param[] = {
        { "allow_redirects", "TRUE",
          &libravatarprefs.allow_redirects,
           P_BOOL, NULL, NULL, NULL },
        { "allow_redirects", "TRUE",
          &libravatarprefs.allow_redirects,
           P_BOOL, NULL, NULL, NULL },
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        { "allow_federated", "TRUE",
          &libravatarprefs.allow_federated,
           P_BOOL, NULL, NULL, NULL },
        { "allow_federated", "TRUE",
          &libravatarprefs.allow_federated,
           P_BOOL, NULL, NULL, NULL },
@@ -373,7 +373,7 @@ static GtkWidget *p_create_frame_network(struct LibravatarPrefsPage *page)
 {
        GtkWidget *vbox, *chk_redirects, *spinner, *hbox;
        GtkAdjustment *adj;
 {
        GtkWidget *vbox, *chk_redirects, *spinner, *hbox;
        GtkAdjustment *adj;
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        GtkWidget *chk_federated;
 #endif
 
        GtkWidget *chk_federated;
 #endif
 
@@ -388,7 +388,7 @@ static GtkWidget *p_create_frame_network(struct LibravatarPrefsPage *page)
        page->allow_redirects_check = chk_redirects;
        gtk_box_pack_start(GTK_BOX(vbox), chk_redirects, FALSE, FALSE, 0);
 
        page->allow_redirects_check = chk_redirects;
        gtk_box_pack_start(GTK_BOX(vbox), chk_redirects, FALSE, FALSE, 0);
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        chk_federated = create_checkbox(_("_Enable federated servers"),
                                _("Try to get avatar from sender's domain "
                                  "libravatar server"));
        chk_federated = create_checkbox(_("_Enable federated servers"),
                                _("Try to get avatar from sender's domain "
                                  "libravatar server"));
@@ -526,7 +526,7 @@ static void libravatar_prefs_save_func(PrefsPage * _page)
        libravatarprefs.allow_redirects = gtk_toggle_button_get_active(
                GTK_TOGGLE_BUTTON(page->allow_redirects_check));
        /* federation */
        libravatarprefs.allow_redirects = gtk_toggle_button_get_active(
                GTK_TOGGLE_BUTTON(page->allow_redirects_check));
        /* federation */
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        libravatarprefs.allow_federated = gtk_toggle_button_get_active(
                GTK_TOGGLE_BUTTON(page->allow_federated_check));
 #endif
        libravatarprefs.allow_federated = gtk_toggle_button_get_active(
                GTK_TOGGLE_BUTTON(page->allow_federated_check));
 #endif
index 2e81aff..49be964 100644 (file)
@@ -44,7 +44,7 @@ struct _LibravatarPrefs
        guint           default_mode;
        gchar           *default_mode_url;
        gboolean        allow_redirects;
        guint           default_mode;
        gchar           *default_mode_url;
        gboolean        allow_redirects;
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        gboolean        allow_federated;
 #endif
        guint           timeout;
        gboolean        allow_federated;
 #endif
        guint           timeout;
index c716031..f609872 100644 (file)
@@ -34,8 +34,6 @@
 #include "vcal_manager.h"
 #include "vcal_folder.h"
 
 #include "vcal_manager.h"
 #include "vcal_folder.h"
 
-#if(GLIB_CHECK_VERSION(2,26,0))
-
 static guint dbus_own_id;
 
 static void add_event_to_builder_if_match(VCalEvent *event, GVariantBuilder *array,
 static guint dbus_own_id;
 
 static void add_event_to_builder_if_match(VCalEvent *event, GVariantBuilder *array,
@@ -208,14 +206,3 @@ void disconnect_dbus(void)
        g_free(interface_vtable);
        interface_vtable = NULL;
 }
        g_free(interface_vtable);
        interface_vtable = NULL;
 }
-
-#else
-void connect_dbus(void)
-{
-       debug_print("DBUS calendar export is not supported with Glib < 2.26\n");
-}
-void disconnect_dbus(void)
-{
-       debug_print("DBUS calendar export is not supported with Glib < 2.26\n");
-}
-#endif
index 86bfe81..6701400 100644 (file)
@@ -915,7 +915,7 @@ static void prefs_account_signature_edit_cb (GtkWidget      *widget,
 static void pop_bfr_smtp_tm_set_sens           (GtkWidget      *widget,
                                                 gpointer        data);
 
 static void pop_bfr_smtp_tm_set_sens           (GtkWidget      *widget,
                                                 gpointer        data);
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if (defined USE_GNUTLS)
 static void auto_configure_cb                  (GtkWidget      *widget,
                                                 gpointer        data);
 
 static void auto_configure_cb                  (GtkWidget      *widget,
                                                 gpointer        data);
 
@@ -1139,7 +1139,7 @@ static void basic_create_widget_func(PrefsPage * _page,
        auto_configure_lbl = gtk_label_new("");
        gtk_label_set_justify(GTK_LABEL(auto_configure_lbl), GTK_JUSTIFY_LEFT);
        gtk_box_pack_start(GTK_BOX (optmenubox), auto_configure_lbl, FALSE, FALSE, 0);
        auto_configure_lbl = gtk_label_new("");
        gtk_label_set_justify(GTK_LABEL(auto_configure_lbl), GTK_JUSTIFY_LEFT);
        gtk_box_pack_start(GTK_BOX (optmenubox), auto_configure_lbl, FALSE, FALSE, 0);
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if (defined USE_GNUTLS)
        gtk_widget_show(auto_configure_btn);
        gtk_widget_show(auto_configure_lbl);
        g_signal_connect (G_OBJECT (auto_configure_btn), "clicked",
        gtk_widget_show(auto_configure_btn);
        gtk_widget_show(auto_configure_lbl);
        g_signal_connect (G_OBJECT (auto_configure_btn), "clicked",
@@ -3992,7 +3992,7 @@ static void prefs_account_select_folder_cb(GtkWidget *widget, gpointer data)
        }
 }
 
        }
 }
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if (defined USE_GNUTLS)
 static void auto_configure_cb (GtkWidget *widget, gpointer data)
 {
        gchar *address = NULL;
 static void auto_configure_cb (GtkWidget *widget, gpointer data)
 {
        gchar *address = NULL;
index d48fab8..68da688 100644 (file)
@@ -112,7 +112,7 @@ typedef struct
        GtkWidget *smtp_cert_table;
        GtkWidget *recv_cert_table;
 #endif
        GtkWidget *smtp_cert_table;
        GtkWidget *recv_cert_table;
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        GtkWidget *auto_configure_lbl;
        GtkWidget *auto_configure_btn;
        GtkWidget *auto_configure_cancel_btn;
        GtkWidget *auto_configure_lbl;
        GtkWidget *auto_configure_btn;
        GtkWidget *auto_configure_cancel_btn;
@@ -1248,7 +1248,7 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_show(wizard->recv_use_tls);
                gtk_widget_show(wizard->recv_cert_table);
 #endif
                gtk_widget_show(wizard->recv_use_tls);
                gtk_widget_show(wizard->recv_cert_table);
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
                gtk_widget_show(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_show(wizard->auto_configure_lbl);
                gtk_widget_show(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_show(wizard->auto_configure_lbl);
@@ -1280,7 +1280,7 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_show(wizard->recv_use_tls);
                gtk_widget_show(wizard->recv_cert_table);
 #endif
                gtk_widget_show(wizard->recv_use_tls);
                gtk_widget_show(wizard->recv_cert_table);
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
                gtk_widget_show(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_show(wizard->auto_configure_lbl);
                gtk_widget_show(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_show(wizard->auto_configure_lbl);
@@ -1329,7 +1329,7 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_hide(wizard->recv_password);
                gtk_widget_hide(wizard->recv_username_label);
                gtk_widget_hide(wizard->recv_password_label);
                gtk_widget_hide(wizard->recv_password);
                gtk_widget_hide(wizard->recv_username_label);
                gtk_widget_hide(wizard->recv_password_label);
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
                gtk_widget_hide(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_hide(wizard->auto_configure_lbl);
                gtk_widget_hide(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_hide(wizard->auto_configure_lbl);
@@ -1355,7 +1355,7 @@ static void wizard_protocol_changed(GtkComboBox *combo, gpointer data)
        wizard_protocol_change(wizard, protocol);       
 }
 
        wizard_protocol_change(wizard, protocol);       
 }
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
 static void auto_configure_cb (GtkWidget *widget, gpointer data)
 {
        gchar *address = NULL;
 static void auto_configure_cb (GtkWidget *widget, gpointer data)
 {
        gchar *address = NULL;
@@ -1464,7 +1464,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        GtkWidget *button;
        GtkWidget *recv_cert_table;
 #endif
        GtkWidget *button;
        GtkWidget *recv_cert_table;
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        GtkWidget *auto_configure_btn;
        GtkWidget *auto_configure_cancel_btn;
        GtkWidget *auto_configure_lbl;
        GtkWidget *auto_configure_btn;
        GtkWidget *auto_configure_cancel_btn;
        GtkWidget *auto_configure_lbl;
@@ -1520,7 +1520,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_type, 1,2,0,1, 
                         GTK_EXPAND|GTK_FILL, 0, 0, 0);
 
        gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_type, 1,2,0,1, 
                         GTK_EXPAND|GTK_FILL, 0, 0, 0);
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        auto_configure_btn = gtk_button_new_with_label(_("Auto-configure"));
        auto_configure_cancel_btn = gtk_button_new_with_label(_("Cancel"));
        gtk_table_attach(GTK_TABLE(recv_table), auto_configure_btn, 0,1,1,2,
        auto_configure_btn = gtk_button_new_with_label(_("Auto-configure"));
        auto_configure_cancel_btn = gtk_button_new_with_label(_("Cancel"));
        gtk_table_attach(GTK_TABLE(recv_table), auto_configure_btn, 0,1,1,2,
@@ -1926,7 +1926,7 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
        gtk_widget_hide(wizard->recv_imap_label);
        gtk_widget_hide(wizard->recv_imap_subdir);
        gtk_widget_hide(wizard->subsonly_checkbtn);
        gtk_widget_hide(wizard->recv_imap_label);
        gtk_widget_hide(wizard->recv_imap_subdir);
        gtk_widget_hide(wizard->subsonly_checkbtn);
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        gtk_widget_hide(wizard->auto_configure_cancel_btn);
 #endif
        wizard_protocol_change(wizard, tmpl.recvtype);
        gtk_widget_hide(wizard->auto_configure_cancel_btn);
 #endif
        wizard_protocol_change(wizard, tmpl.recvtype);