Farewell glib-1.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4509 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-05-20 23:13:29 +00:00 committed by exg
commit afa4292466
13 changed files with 9 additions and 507 deletions

View file

@ -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) {

View file

@ -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
}

View file

@ -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);

View file

@ -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