changeset 19110:60c6090c0e29

Workspace window placement now supports substring checking in window-names
author Eric Polino <aluink@pidgin.im>
date Fri, 22 Jun 2007 22:20:39 +0000
parents 1cb69ea47a6e
children c0abe71ac1ff ebc2288d9253
files finch/libgnt/gntwm.c
diffstat 1 files changed, 27 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }