# HG changeset patch # User Richard Nelson # Date 1182382810 0 # Node ID af7b944374baddd0ddb8746a74393bc54109c70c # Parent 16bf31872b7a2575a6c5383082ef91337789a882 g_hash_table_find is glib 2.4 diff -r 16bf31872b7a -r af7b944374ba finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Wed Jun 20 23:33:32 2007 +0000 +++ b/finch/libgnt/gntwm.c Wed Jun 20 23:40:10 2007 +0000 @@ -1464,12 +1464,39 @@ return FALSE; } +#if !GLIB_CHECK_VERSION(2,4,0) +typedef struct +{ + GntWM *wm; + GntWS *ret; + gchar *title; +} title_search; + +static void match_title_search(gpointer key, gpointer value, gpointer search) +{ + title_search *s = search; + if (s->ret) + return; + if (match_title(key, NULL, s->title)) + s->ret = g_hash_table_lookup(s->wm->title_places, key); +} +#endif + static GntWS * new_widget_find_workspace(GntWM *wm, GntWidget *widget, gchar *wid_title) { GntWS *ret; const gchar *name; +#if GLIB_CHECK_VERSION(2,4,0) ret = g_hash_table_find(wm->title_places, match_title, wid_title); +#else + title_search *s = NULL; + s = g_new0(title_search, 1); + s->wm = wm; + s->title = wid_title; + g_hash_table_foreach(wm->title_places, match_title_search, s); + ret = s->ret; +#endif if (ret) return ret; name = gnt_widget_get_name(widget);