changeset 19151:700fe77a79b3

disapproval of revision '28530bc53fbe271f49ca1baa55938a067f20aed8'
author Eric Polino <aluink@pidgin.im>
date Wed, 11 Jul 2007 19:51:48 +0000
parents 9ba4c42926bd
children 58743fae0db2
files finch/gntsound.c finch/libgnt/gntwm.c
diffstat 2 files changed, 24 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntsound.c	Wed Jul 11 19:40:49 2007 +0000
+++ b/finch/gntsound.c	Wed Jul 11 19:51:48 2007 +0000
@@ -691,15 +691,19 @@
 }
 
 static void
-prof_del_cb(GntWidget *button, gpointer null)
+pref_load_cb(GntWidget *button, gpointer null)
 {
-	const gchar * value = gnt_entry_get_text(GNT_ENTRY(pref_dialog->profiles));
-	gchar * pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s",value);
+
+	const gchar * value = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->profiles));
+
+	purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile",value);
 
-	if(purple_prefs_exists(pref))
-		purple_prefs_remove(pref);
+}
 
-	g_free(pref);
+static void
+pref_save_cb(GntWidget *button, gpointer null)
+{
+
 }
 
 static void
@@ -745,7 +749,7 @@
 }
 
 static void
-reload_pref_window(const char * newkey)
+reload_pref_window(GntComboBox *box, gpointer oldkey, gpointer newkey, gpointer null)
 {
 	gint i;
 	purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile",(gchar *)newkey);
@@ -776,22 +780,6 @@
 	}
 }
 
-static void
-profile_text_load(GntEntry *entry, gpointer null)
-{
-	const char * profile = gnt_entry_get_text(entry);
-	gchar * pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s",profile);
-	if(purple_prefs_exists(pref))
-		reload_pref_window(profile);
-	g_free(pref);
-}
-
-static void
-profile_text_completion(GntEntry *entry, gpointer val1, gpointer val2, gpointer null)
-{
-	profile_text_load(entry,null);
-}
-
 void
 finch_sounds_show_all(void)
 {
@@ -915,21 +903,23 @@
 
 	gnt_box_add_widget(GNT_BOX(win),gnt_label_new_with_format(_("Profiles"),GNT_TEXT_FLAG_BOLD));
 	box = gnt_hbox_new(FALSE);
-	pref_dialog->profiles = entry = gnt_entry_new("");
+	pref_dialog->profiles = cmbox = gnt_combo_box_new();
 	list = itr = finch_sound_get_profiles();
 	for(;itr;itr = itr->next){
-		gnt_entry_add_suggest(GNT_ENTRY(entry),itr->data);
+		gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),itr->data,itr->data);
 	}
+	g_signal_connect(G_OBJECT(cmbox),"selection-changed",G_CALLBACK(reload_pref_window),NULL);
 	g_list_free(list);
-	g_signal_connect(G_OBJECT(entry),"text_changed",G_CALLBACK(profile_text_load),NULL);
-	g_signal_connect(G_OBJECT(entry),"completion",G_CALLBACK(profile_text_completion),NULL);
-	g_signal_connect(G_OBJECT(entry),"activate",G_CALLBACK(profile_text_load),NULL);
-	gnt_box_add_widget(GNT_BOX(box),entry);
-	button = gnt_button_new("Delete");
-	g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(prof_del_cb),NULL);
+	gnt_box_add_widget(GNT_BOX(box),cmbox);
+	button = gnt_button_new("Load");
+	g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(pref_load_cb),NULL);
+	gnt_box_add_widget(GNT_BOX(box),button);
+	button = gnt_button_new("Save");
+	g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(pref_save_cb),NULL);
 	gnt_box_add_widget(GNT_BOX(box),button);
 	gnt_box_add_widget(GNT_BOX(win),box);
 
+
 	/* Add new stuff before this */
 	box = gnt_hbox_new(FALSE);
 	gnt_box_set_pad(GNT_BOX(box),0);
@@ -944,7 +934,7 @@
 
 	g_signal_connect(G_OBJECT(win),"destroy",G_CALLBACK(release_pref_dialog),NULL);
 
-	reload_pref_window(finch_sound_get_active_profile());
+	reload_pref_window(NULL,NULL,(gchar *)finch_sound_get_active_profile(),NULL);
 
 	gnt_widget_show(win);
 
--- a/finch/libgnt/gntwm.c	Wed Jul 11 19:40:49 2007 +0000
+++ b/finch/libgnt/gntwm.c	Wed Jul 11 19:51:48 2007 +0000
@@ -735,7 +735,6 @@
 			print = ch;
 #ifndef NO_WIDECHAR
 			if (wch.chars[0] > 255) {
-				/* XXX This lines throws a warning, can we quiet it? */
 				snprintf(unicode, sizeof(unicode), "&#x%x;", wch.chars[0]);
 				print = unicode;
 			}
@@ -804,9 +803,6 @@
 	if (wm->_list.window)
 		return TRUE;
 
-	if(!wm->cws->ordered)
-		return FALSE;
-
 	shift_window(wm, wm->cws->ordered->data, -1);
 	return TRUE;
 }
@@ -815,13 +811,9 @@
 shift_right(GntBindable *bindable, GList *null)
 {
 	GntWM *wm = GNT_WM(bindable);
-	
 	if (wm->_list.window)
 		return TRUE;
 
-	if(!wm->cws->ordered)
-		return FALSE;
-
 	shift_window(wm, wm->cws->ordered->data, 1);
 	return TRUE;
 }
@@ -1154,13 +1146,7 @@
 help_for_window(GntBindable *bindable, GList *null)
 {
 	GntWM *wm = GNT_WM(bindable);
-	GntWidget *widget;
-	
-	
-	if(!wm->cws->ordered)
-		return FALSE;
-	
-	widget = wm->cws->ordered->data;
+	GntWidget *widget = wm->cws->ordered->data;
 
 	return help_for_bindable(wm,GNT_BINDABLE(widget));
 }
@@ -1961,8 +1947,7 @@
 
 	if (!node)
 		return;
-
-	/* XXX Should there be a check before access to 'data' to make sure 'ordered' isn't NULL? */
+	
 	if (widget != wm->_list.window && !GNT_IS_MENU(widget) &&
 				wm->cws->ordered->data != widget) {
 		GntWidget *w = wm->cws->ordered->data;
@@ -2024,7 +2009,6 @@
 	GntWS *ws = gnt_wm_widget_find_workspace(wm, widget);
 	if (wm->cws != ws)
 		gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
-	/* XXX Should there be a check before access to 'data' to make sure 'ordered' isn't NULL? */
 	if (widget != wm->cws->ordered->data) {
 		GntWidget *wid = wm->cws->ordered->data;
 		wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget);