# HG changeset patch # User Eric Polino # Date 1182550839 0 # Node ID 60c6090c0e290c19a6db1b4d54d69c9ccc26b56b # Parent 1cb69ea47a6ec5328ace3a26db00350e04cd157a Workspace window placement now supports substring checking in window-names diff -r 1cb69ea47a6e -r 60c6090c0e29 finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Thu Jun 21 20:37:57 2007 +0000 +++ b/finch/libgnt/gntwm.c Fri Jun 22 22:20:39 2007 +0000 @@ -1517,7 +1517,7 @@ #if !GLIB_CHECK_VERSION(2,4,0) typedef struct { - GntWM *wm; + GHashTable *table; GntWS *ret; gchar *title; } title_search; @@ -1528,10 +1528,26 @@ if (s->ret) return; if (match_title(key, NULL, s->title)) - s->ret = g_hash_table_lookup(s->wm->title_places, key); + s->ret = g_hash_table_lookup(s->table, key); +} + +static GntWS * +gnt_hash_table_find(GHashTable * table, gchar *wid_title) +{ + GntWS * ret; + title_search *s = NULL; + s = g_new0(title_search, 1); + s->table = table; + s->title = wid_title; + g_hash_table_foreach(table, match_title_search, s); + ret = s->ret; + + return ret; + } #endif + static GntWS * new_widget_find_workspace(GntWM *wm, GntWidget *widget, gchar *wid_title) { @@ -1540,18 +1556,19 @@ #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; + ret = gnt_hash_table_find(wm->title_places, wid_title); #endif if (ret) return ret; name = gnt_widget_get_name(widget); - if (name) - ret = g_hash_table_lookup(wm->name_places, name); + if (name){ +#if GLIB_CHECK_VERSION(2,4,0) + ret = g_hash_table_find(wm->name_places, match_title, (gchar *)name); +#else + ret = gnt_hash_table_find(wm->name_places, (gchar *)name); + +#endif + } return ret ? ret : wm->cws; }