Code cleanup around glib version check (2.28 minimum).

This commit is contained in:
wwp 2018-05-28 17:44:59 +02:00 committed by Andrej Kacian
parent 7dbdb3ebae
commit 6e6295e102
10 changed files with 20 additions and 64 deletions

View file

@ -90,24 +90,6 @@
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)

View file

@ -74,19 +74,6 @@ typedef gint64 goffset;
#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

View file

@ -1807,7 +1807,7 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, int box_width,
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;

View 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;

View 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)
{
#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
#if defined USE_GNUTLS
gchar *base_url = NULL;
if (!libravatarprefs.allow_federated) {

View file

@ -58,7 +58,7 @@ struct LibravatarPrefsPage
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;
@ -85,7 +85,7 @@ static PrefParam param[] = {
{ "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 },
@ -374,7 +374,7 @@ static GtkWidget *p_create_frame_network(struct LibravatarPrefsPage *page)
{
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
@ -389,7 +389,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);
#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"));
@ -527,7 +527,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 */
#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

View file

@ -44,7 +44,7 @@ struct _LibravatarPrefs
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;

View file

@ -34,8 +34,6 @@
#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,
@ -208,14 +206,3 @@ void disconnect_dbus(void)
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

View 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);
#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
#if (defined USE_GNUTLS)
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);
#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",
@ -3989,7 +3989,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;

View file

@ -112,7 +112,7 @@ typedef struct
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;
@ -1246,7 +1246,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
#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);
@ -1278,7 +1278,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
#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);
@ -1327,7 +1327,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);
#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);
@ -1353,7 +1353,7 @@ static void wizard_protocol_changed(GtkComboBox *combo, gpointer data)
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;
@ -1462,7 +1462,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
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;
@ -1518,7 +1518,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);
#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,
@ -1925,7 +1925,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);
#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);