qulogic/libgnt

Remove old GLib version checks.

2013-01-20, Elliott Sales de Andrade
5cd5edb5a7ff
Parents b96b88e2a173
Children 82b581ba5822
Remove old GLib version checks.
  • +0 -13
    gnt.h
  • +0 -3
    gntcolors.c
  • +0 -2
    gntcolors.h
  • +0 -100
    gntfilesel.c
  • +0 -10
    gntmain.c
  • +0 -9
    gntprogressbar.c
  • +1 -31
    gntstyle.c
  • +1 -35
    gntwm.c
  • --- a/gnt.h Fri Aug 17 00:28:50 2012 -0400
    +++ b/gnt.h Sun Jan 20 20:31:16 2013 -0500
    @@ -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);
    --- a/gntcolors.c Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntcolors.c Sun Jan 20 20:31:16 2013 -0500
    @@ -142,7 +142,6 @@
    restore_colors();
    }
    -#if GLIB_CHECK_VERSION(2,6,0)
    int
    gnt_colors_get_color(char *key)
    {
    @@ -293,8 +292,6 @@
    g_strfreev(keys);
    }
    -#endif /* GKeyFile */
    -
    int gnt_color_pair(int pair)
    {
    return (hascolors ? COLOR_PAIR(pair) :
    --- a/gntcolors.h Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntcolors.h Sun Jan 20 20:31:16 2013 -0500
    @@ -71,7 +71,6 @@
    */
    void gnt_uninit_colors(void);
    -#if GLIB_CHECK_VERSION(2,6,0)
    /**
    * Parse color information from a file.
    *
    @@ -96,7 +95,6 @@
    * @since 2.4.0
    */
    int gnt_colors_get_color(char *key);
    -#endif
    /**
    * Return the appropriate character attribute for a specified color.
    --- a/gntfilesel.c Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntfilesel.c Sun Jan 20 20:31:16 2013 -0500
    @@ -66,106 +66,6 @@
    }
    }
    -#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)
    {
    --- a/gntmain.c Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntmain.c Sun Jan 20 20:31:16 2013 -0500
    @@ -675,7 +675,6 @@
    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 @@
    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 @@
    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)
    --- a/gntprogressbar.c Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntprogressbar.c Sun Jan 20 20:31:16 2013 -0500
    @@ -36,16 +36,9 @@
    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 @@
    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;
    --- a/gntstyle.c Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntstyle.c Sun Jan 20 20:31:16 2013 -0500
    @@ -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 @@
    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 @@
    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 @@
    }
    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 @@
    if (!group)
    group = "general";
    return g_key_file_get_string_list(gkfile, group, key, length, NULL);
    -#else
    - return NULL;
    -#endif
    }
    gboolean gnt_style_get_bool(GntStyle style, gboolean def)
    @@ -134,7 +120,6 @@
    return def;
    }
    -#if GLIB_CHECK_VERSION(2,6,0)
    static void
    refine(char *text)
    {
    @@ -175,11 +160,9 @@
    {
    return (char *)gnt_key_translate(key);
    }
    -#endif
    void gnt_style_read_workspaces(GntWM *wm)
    {
    -#if GLIB_CHECK_VERSION(2,6,0)
    int i;
    gchar *name;
    gsize c;
    @@ -212,11 +195,10 @@
    g_strfreev(titles);
    }
    }
    -#endif
    }
    +
    void gnt_style_read_actions(GType type, GntBindableClass *klass)
    {
    -#if GLIB_CHECK_VERSION(2,6,0)
    char *name;
    GError *error = NULL;
    @@ -264,12 +246,10 @@
    g_strfreev(keys);
    }
    g_free(name);
    -#endif
    }
    gboolean gnt_style_read_menu_accels(const char *name, GHashTable *table)
    {
    -#if GLIB_CHECK_VERSION(2,6,0)
    char *kname;
    GError *error = NULL;
    gboolean ret = FALSE;
    @@ -322,13 +302,10 @@
    g_free(kname);
    return ret;
    -#endif
    - return FALSE;
    }
    void gnt_styles_get_keyremaps(GType type, GHashTable *hash)
    {
    -#if GLIB_CHECK_VERSION(2,6,0)
    char *name;
    GError *error = NULL;
    @@ -373,10 +350,8 @@
    }
    g_free(name);
    -#endif
    }
    -#if GLIB_CHECK_VERSION(2,6,0)
    static void
    read_general_style(GKeyFile *kfile)
    {
    @@ -419,11 +394,9 @@
    }
    g_strfreev(keys);
    }
    -#endif
    void gnt_style_read_configure_file(const char *filename)
    {
    -#if GLIB_CHECK_VERSION(2,6,0)
    GError *error = NULL;
    gkfile = g_key_file_new();
    @@ -436,7 +409,6 @@
    }
    gnt_colors_parse(gkfile);
    read_general_style(gkfile);
    -#endif
    }
    void gnt_init_styles()
    @@ -458,9 +430,7 @@
    str_styles[i] = NULL;
    }
    -#if GLIB_CHECK_VERSION(2,6,0)
    g_key_file_free(gkfile);
    gkfile = NULL;
    -#endif
    }
    --- a/gntwm.c Fri Aug 17 00:28:50 2012 -0400
    +++ b/gntwm.c Sun Jan 20 20:31:16 2013 -0500
    @@ -37,14 +37,7 @@
    #endif
    #include <glib.h>
    -#if GLIB_CHECK_VERSION(2,6,0)
    -# include <glib/gstdio.h>
    -#else
    -# include <sys/types.h>
    -# include <sys/stat.h>
    -# include <fcntl.h>
    -# define g_fopen open
    -#endif
    +#include <glib/gstdio.h>
    #include <ctype.h>
    #include <gmodule.h>
    #include <stdlib.h>
    @@ -337,7 +330,6 @@
    static void
    read_window_positions(GntWM *wm)
    {
    -#if GLIB_CHECK_VERSION(2,6,0)
    GKeyFile *gfile = g_key_file_new();
    char *filename = g_build_filename(g_get_home_dir(), ".gntpositions", NULL);
    GError *error = NULL;
    @@ -379,7 +371,6 @@
    g_free(filename);
    g_key_file_free(gfile);
    -#endif
    }
    static gboolean check_idle(gpointer n)
    @@ -1753,31 +1744,6 @@
    return FALSE;
    }
    -#if !GLIB_CHECK_VERSION(2,4,0)
    -struct
    -{
    - gpointer data;
    - gpointer value;
    -} table_find_data;
    -
    -static void
    -table_find_helper(gpointer key, gpointer value, gpointer data)
    -{
    - GHRFunc func = data;
    - if (func(key, value, table_find_data.data))
    - table_find_data.value = value;
    -}
    -
    -static gpointer
    -g_hash_table_find(GHashTable * table, GHRFunc func, gpointer data)
    -{
    - table_find_data.data = data;
    - table_find_data.value = NULL;
    - g_hash_table_foreach(table, table_find_helper, func);
    - return table_find_data.value;
    -}
    -#endif
    -
    static GntWS *
    new_widget_find_workspace(GntWM *wm, GntWidget *widget)
    {