/pidgin/main: 1d643f401252: Remove old GLib version checks.
Elliott Sales de Andrade
qulogic at pidgin.im
Sun Jan 20 21:30:49 EST 2013
Changeset: 1d643f401252f6d166877ee4b279e92602a63be2
Author: Elliott Sales de Andrade <qulogic at pidgin.im>
Date: 2013-01-20 20:31 -0500
Branch: default
URL: http://hg.pidgin.im/pidgin/main/rev/1d643f401252
Description:
Remove old GLib version checks.
diffstat:
finch/libgnt/gnt.h | 13 -----
finch/libgnt/gntcolors.c | 3 -
finch/libgnt/gntcolors.h | 2 -
finch/libgnt/gntfilesel.c | 100 -----------------------------------------
finch/libgnt/gntmain.c | 10 ----
finch/libgnt/gntprogressbar.c | 9 ---
finch/libgnt/gntstyle.c | 32 +------------
finch/libgnt/gntwm.c | 36 +--------------
libpurple/plugins/log_reader.c | 6 +-
9 files changed, 5 insertions(+), 206 deletions(-)
diffs (truncated from 506 to 300 lines):
diff --git a/finch/libgnt/gnt.h b/finch/libgnt/gnt.h
--- a/finch/libgnt/gnt.h
+++ b/finch/libgnt/gnt.h
@@ -40,19 +40,6 @@
#include "gntkeys.h"
/**
- * Get things to compile in Glib < 2.8
- */
-#if !GLIB_CHECK_VERSION(2,8,0)
- #define G_PARAM_STATIC_NAME G_PARAM_PRIVATE
- #define G_PARAM_STATIC_NICK G_PARAM_PRIVATE
- #define G_PARAM_STATIC_BLURB G_PARAM_PRIVATE
-#endif
-
-#if !GLIB_CHECK_VERSION(2,14,0)
- #define g_timeout_add_seconds(time, callback, data) g_timeout_add(time * 1000, callback, data)
-#endif
-
-/**
* Initialize GNT.
*/
void gnt_init(void);
diff --git a/finch/libgnt/gntcolors.c b/finch/libgnt/gntcolors.c
--- a/finch/libgnt/gntcolors.c
+++ b/finch/libgnt/gntcolors.c
@@ -142,7 +142,6 @@ gnt_uninit_colors()
restore_colors();
}
-#if GLIB_CHECK_VERSION(2,6,0)
int
gnt_colors_get_color(char *key)
{
@@ -293,8 +292,6 @@ void gnt_color_pairs_parse(GKeyFile *kfi
g_strfreev(keys);
}
-#endif /* GKeyFile */
-
int gnt_color_pair(int pair)
{
return (hascolors ? COLOR_PAIR(pair) :
diff --git a/finch/libgnt/gntcolors.h b/finch/libgnt/gntcolors.h
--- a/finch/libgnt/gntcolors.h
+++ b/finch/libgnt/gntcolors.h
@@ -71,7 +71,6 @@ void gnt_init_colors(void);
*/
void gnt_uninit_colors(void);
-#if GLIB_CHECK_VERSION(2,6,0)
/**
* Parse color information from a file.
*
@@ -96,7 +95,6 @@ void gnt_color_pairs_parse(GKeyFile *kfi
* @since 2.4.0
*/
int gnt_colors_get_color(char *key);
-#endif
/**
* Return the appropriate character attribute for a specified color.
diff --git a/finch/libgnt/gntfilesel.c b/finch/libgnt/gntfilesel.c
--- a/finch/libgnt/gntfilesel.c
+++ b/finch/libgnt/gntfilesel.c
@@ -66,106 +66,6 @@ gnt_file_sel_destroy(GntWidget *widget)
}
}
-#if !GLIB_CHECK_VERSION(2,8,0)
-/* ripped from glib/gfileutils.c */
-static gchar *
-g_build_path_va (const gchar *separator,
- gchar **str_array)
-{
- GString *result;
- gint separator_len = strlen (separator);
- gboolean is_first = TRUE;
- gboolean have_leading = FALSE;
- const gchar *single_element = NULL;
- const gchar *next_element;
- const gchar *last_trailing = NULL;
- gint i = 0;
-
- result = g_string_new (NULL);
-
- next_element = str_array[i++];
-
- while (TRUE) {
- const gchar *element;
- const gchar *start;
- const gchar *end;
-
- if (next_element) {
- element = next_element;
- next_element = str_array[i++];
- } else
- break;
-
- /* Ignore empty elements */
- if (!*element)
- continue;
-
- start = element;
-
- if (separator_len) {
- while (start &&
- strncmp (start, separator, separator_len) == 0)
- start += separator_len;
- }
-
- end = start + strlen (start);
-
- if (separator_len) {
- while (end >= start + separator_len &&
- strncmp (end - separator_len, separator, separator_len) == 0)
- end -= separator_len;
-
- last_trailing = end;
- while (last_trailing >= element + separator_len &&
- strncmp (last_trailing - separator_len, separator, separator_len) == 0)
- last_trailing -= separator_len;
-
- if (!have_leading) {
- /* If the leading and trailing separator strings are in the
- * same element and overlap, the result is exactly that element
- */
- if (last_trailing <= start)
- single_element = element;
-
- g_string_append_len (result, element, start - element);
- have_leading = TRUE;
- } else
- single_element = NULL;
- }
-
- if (end == start)
- continue;
-
- if (!is_first)
- g_string_append (result, separator);
-
- g_string_append_len (result, start, end - start);
- is_first = FALSE;
- }
-
- if (single_element) {
- g_string_free (result, TRUE);
- return g_strdup (single_element);
- } else {
- if (last_trailing)
- g_string_append (result, last_trailing);
-
- return g_string_free (result, FALSE);
- }
-}
-
-static gchar *
-g_build_pathv (const gchar *separator,
- gchar **args)
-{
- if (!args)
- return NULL;
-
- return g_build_path_va (separator, args);
-}
-
-#endif
-
static char *
process_path(const char *path)
{
diff --git a/finch/libgnt/gntmain.c b/finch/libgnt/gntmain.c
--- a/finch/libgnt/gntmain.c
+++ b/finch/libgnt/gntmain.c
@@ -675,7 +675,6 @@ gchar *gnt_get_clipboard_string()
return gnt_clipboard_get_string(clipboard);
}
-#if GLIB_CHECK_VERSION(2,4,0)
typedef struct
{
void (*callback)(int status, gpointer data);
@@ -697,13 +696,11 @@ reap_child(GPid pid, gint status, gpoint
refresh();
refresh_screen();
}
-#endif
gboolean gnt_giveup_console(const char *wd, char **argv, char **envp,
gint *stin, gint *stout, gint *sterr,
void (*callback)(int status, gpointer data), gpointer data)
{
-#if GLIB_CHECK_VERSION(2,4,0)
GPid pid = 0;
ChildProcess *cp = NULL;
@@ -721,18 +718,11 @@ gboolean gnt_giveup_console(const char *
g_child_watch_add(pid, reap_child, cp);
return TRUE;
-#else
- return FALSE;
-#endif
}
gboolean gnt_is_refugee()
{
-#if GLIB_CHECK_VERSION(2,4,0)
return (wm && wm->mode == GNT_KP_MODE_WAIT_ON_CHILD);
-#else
- return FALSE;
-#endif
}
const char *C_(const char *x)
diff --git a/finch/libgnt/gntprogressbar.c b/finch/libgnt/gntprogressbar.c
--- a/finch/libgnt/gntprogressbar.c
+++ b/finch/libgnt/gntprogressbar.c
@@ -36,16 +36,9 @@ typedef struct _GntProgressBarPrivate
struct _GntProgressBar
{
GntWidget parent;
-#if !GLIB_CHECK_VERSION(2,4,0)
- GntProgressBarPrivate priv;
-#endif
};
-#if GLIB_CHECK_VERSION(2,4,0)
#define GNT_PROGRESS_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarPrivate))
-#else
-#define GNT_PROGRESS_BAR_GET_PRIVATE(o) &(GNT_PROGRESS_BAR(o)->priv)
-#endif
static GntWidgetClass *parent_class = NULL;
@@ -128,9 +121,7 @@ gnt_progress_bar_class_init (gpointer kl
parent_class = GNT_WIDGET_CLASS (klass);
-#if GLIB_CHECK_VERSION(2,4,0)
g_type_class_add_private (g_class, sizeof (GntProgressBarPrivate));
-#endif
parent_class->draw = gnt_progress_bar_draw;
parent_class->size_request = gnt_progress_bar_size_request;
diff --git a/finch/libgnt/gntstyle.c b/finch/libgnt/gntstyle.c
--- a/finch/libgnt/gntstyle.c
+++ b/finch/libgnt/gntstyle.c
@@ -35,9 +35,7 @@
#define MAX_WORKSPACES 99
-#if GLIB_CHECK_VERSION(2,6,0)
static GKeyFile *gkfile;
-#endif
static char * str_styles[GNT_STYLES];
static int int_styles[GNT_STYLES];
@@ -50,7 +48,6 @@ const char *gnt_style_get(GntStyle style
char *gnt_style_get_from_name(const char *group, const char *key)
{
-#if GLIB_CHECK_VERSION(2,6,0)
const char *prg = g_get_prgname();
if ((group == NULL || *group == '\0') && prg &&
g_key_file_has_group(gkfile, prg))
@@ -58,15 +55,11 @@ char *gnt_style_get_from_name(const char
if (!group)
group = "general";
return g_key_file_get_value(gkfile, group, key, NULL);
-#else
- return NULL;
-#endif
}
int
gnt_style_get_color(char *group, char *key)
{
-#if GLIB_CHECK_VERSION(2,6,0)
int fg = 0, bg = 0;
gsize n;
char **vals;
@@ -79,14 +72,10 @@ gnt_style_get_color(char *group, char *k
}
g_strfreev(vals);
return ret;
-#else
- return 0;
-#endif
}
char **gnt_style_get_string_list(const char *group, const char *key, gsize *length)
{
-#if GLIB_CHECK_VERSION(2,6,0)
const char *prg = g_get_prgname();
if ((group == NULL || *group == '\0') && prg &&
g_key_file_has_group(gkfile, prg))
@@ -94,9 +83,6 @@ char **gnt_style_get_string_list(const c
if (!group)
More information about the Commits
mailing list