summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2007-05-20 23:13:29 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-05-20 23:13:29 +0000
commitafa4292466c6de093d0cdf359a91160886933507 (patch)
treec75be7d3d2bc7309fb363c13cd557a406a9267e2 /src/fe-common
parentcb1287ab63549186e1841a7e63f7a7d5b4be3b4d (diff)
downloadirssi-afa4292466c6de093d0cdf359a91160886933507.zip
Farewell glib-1.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4509 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/fe-channels.c5
-rw-r--r--src/fe-common/core/fe-recode.c8
-rw-r--r--src/fe-common/core/formats.c26
-rw-r--r--src/fe-common/core/keyboard.c5
4 files changed, 5 insertions, 39 deletions
diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c
index 8a1208ab..a3325ef8 100644
--- a/src/fe-common/core/fe-channels.c
+++ b/src/fe-common/core/fe-channels.c
@@ -508,12 +508,7 @@ void fe_channels_nicklist(CHANNEL_REC *channel, int flags)
g_slist_free(nicklist);
/* sort the nicklist */
-#if GLIB_MAJOR_VERSION < 2
- /* glib1 doesn't have g_slist_sort_with_data, so non-standard prefixes won't be sorted correctly */
- sorted = g_slist_sort(sorted, (GCompareFunc)nicklist_compare_glib1);
-#else
sorted = g_slist_sort_with_data(sorted, (GCompareDataFunc) nicklist_compare, (void *)nick_flags);
-#endif
/* display the nicks */
if ((flags & CHANNEL_NICKLIST_FLAG_COUNT) == 0) {
diff --git a/src/fe-common/core/fe-recode.c b/src/fe-common/core/fe-recode.c
index 08173af7..203e69f7 100644
--- a/src/fe-common/core/fe-recode.c
+++ b/src/fe-common/core/fe-recode.c
@@ -38,7 +38,6 @@ for ((var) = (head); \
(var); \
(var) = g_slist_next((var)))
-#ifdef HAVE_GLIB2
char *recode_fallback = NULL;
char *recode_out_default = NULL;
char *term_charset = NULL;
@@ -210,27 +209,20 @@ static void read_settings(void)
g_free(old_recode_fallback);
g_free(old_recode_out_default);
}
-#endif
void fe_recode_init (void)
{
-/* FIXME: print this is not supported instead */
-#ifdef HAVE_GLIB2
command_bind("recode", NULL, (SIGNAL_FUNC) fe_recode_cmd);
command_bind("recode add", NULL, (SIGNAL_FUNC) fe_recode_add_cmd);
command_bind("recode remove", NULL, (SIGNAL_FUNC) fe_recode_remove_cmd);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
read_settings();
-#endif
}
void fe_recode_deinit (void)
{
-/* FIXME: print this is not supported instead */
-#ifdef HAVE_GLIB2
command_unbind("recode", (SIGNAL_FUNC) fe_recode_cmd);
command_unbind("recode add", (SIGNAL_FUNC) fe_recode_add_cmd);
command_unbind("recode remove", (SIGNAL_FUNC) fe_recode_remove_cmd);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
-#endif
}
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c
index 2a10ad10..04fa5cb9 100644
--- a/src/fe-common/core/formats.c
+++ b/src/fe-common/core/formats.c
@@ -32,10 +32,8 @@
#include "formats.h"
#include "themes.h"
#include "translation.h"
-#ifdef HAVE_GLIB2
#include "recode.h"
#include "utf8.h"
-#endif
static const char *format_backs = "04261537";
static const char *format_fores = "kbgcrmyw";
@@ -299,7 +297,7 @@ void format_create_dest_tag(TEXT_DEST_REC *dest, void *server,
dest->window = window != NULL ? window :
window_find_closest(server, target, level);
}
-#ifdef HAVE_GLIB2
+
static int advance (char const **str, gboolean utf8)
{
if (utf8) {
@@ -315,21 +313,17 @@ static int advance (char const **str, gboolean utf8)
return 1;
}
}
-#endif
+
/* Return length of text part in string (ie. without % codes) */
int format_get_length(const char *str)
{
GString *tmp;
int len;
-#ifdef HAVE_GLIB2
gboolean utf8;
-#endif
g_return_val_if_fail(str != NULL, 0);
-#ifdef HAVE_GLIB2
utf8 = is_utf8() && g_utf8_validate(str, -1, NULL);
-#endif
tmp = g_string_new(NULL);
len = 0;
@@ -346,12 +340,8 @@ int format_get_length(const char *str)
if (*str != '%')
len++;
}
-#ifdef HAVE_GLIB2
+
len += advance(&str, utf8);
-#else
- len++;
- str++;
-#endif
}
g_string_free(tmp, TRUE);
@@ -365,16 +355,13 @@ int format_real_length(const char *str, int len)
{
GString *tmp;
const char *start;
-#ifdef HAVE_GLIB2
const char *oldstr;
gboolean utf8;
-#endif
+
g_return_val_if_fail(str != NULL, 0);
g_return_val_if_fail(len >= 0, 0);
-#ifdef HAVE_GLIB2
utf8 = is_utf8() && g_utf8_validate(str, -1, NULL);
-#endif
start = str;
tmp = g_string_new(NULL);
@@ -394,15 +381,10 @@ int format_real_length(const char *str, int len)
}
}
-#ifdef HAVE_GLIB2
oldstr = str;
len -= advance(&str, utf8);
if (len < 0)
str = oldstr;
-#else
- len--;
- str++;
-#endif
}
g_string_free(tmp, TRUE);
diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c
index 691f3742..d97f5c05 100644
--- a/src/fe-common/core/keyboard.c
+++ b/src/fe-common/core/keyboard.c
@@ -571,11 +571,8 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key)
g_strconcat(keyboard->key_state, "-", key, NULL);
g_free_and_null(keyboard->key_state);
-#if GLIB_MAJOR_VERSION == 2
-# define GSearchFunc GCompareFunc
-#endif
rec = g_tree_search(key_states,
- (GSearchFunc) key_states_search,
+ (GCompareFunc) key_states_search,
combo);
if (rec == NULL) {
/* unknown key combo, eat the invalid key