changeset 18230:d1f28d545d96

merge of '9885adf2e546b1bb744a839860822cfd0e36b8ec' and 'ef1256895f6c7dbbd0e3dba93cb4de8c8554ca15'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 22 Jun 2007 22:39:16 +0000
parents 5cfa2e63d2fd (current diff) 73ea3328b0d1 (diff)
children 5d937308f57f 2b1af79e768f
files
diffstat 6 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntconv.c	Fri Jun 22 17:26:16 2007 +0000
+++ b/finch/gntconv.c	Fri Jun 22 22:39:16 2007 +0000
@@ -554,7 +554,8 @@
 	
 	if (ggc->list == NULL) {
 		g_free(ggc->u.chat);
-		gnt_widget_destroy(ggc->window);
+		if (ggc->window)
+			gnt_widget_destroy(ggc->window);
 		g_free(ggc);
 	}
 }
--- a/finch/gntplugin.c	Fri Jun 22 17:26:16 2007 +0000
+++ b/finch/gntplugin.c	Fri Jun 22 22:39:16 2007 +0000
@@ -47,7 +47,7 @@
 
 static GHashTable *confwins;
 
-static void process_pref_frame(PurplePluginPrefFrame *frame);
+static GntWidget *process_pref_frame(PurplePluginPrefFrame *frame);
 
 static void
 decide_conf_button(PurplePlugin *plugin)
@@ -84,7 +84,7 @@
 			gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE);
 		}
 
-		if ((win = g_hash_table_lookup(confwins, plugin)) != NULL)
+		if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL)
 		{
 			gnt_widget_destroy(win);
 		}
@@ -221,7 +221,11 @@
 	else if (plugin->info->prefs_info &&
 			plugin->info->prefs_info->get_plugin_pref_frame)
 	{
-		process_pref_frame(plugin->info->prefs_info->get_plugin_pref_frame(plugin));
+		GntWidget *win = process_pref_frame(plugin->info->prefs_info->get_plugin_pref_frame(plugin));
+		if (confwins == NULL)
+			confwin_init();
+		g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(remove_confwin), plugin);
+		g_hash_table_insert(confwins, plugin, win);
 		return;
 	}
 	else
@@ -308,7 +312,7 @@
 	decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree)));
 }
 
-static void
+static GntWidget*
 process_pref_frame(PurplePluginPrefFrame *frame)
 {
 	PurpleRequestField *field;
@@ -360,7 +364,7 @@
 		}
 	}
 
-	purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
+	return purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
 			_("Save"), G_CALLBACK(finch_request_save_in_prefs), _("Cancel"), NULL,
 			NULL, NULL, NULL,
 			NULL);
--- a/finch/gntrequest.c	Fri Jun 22 17:26:16 2007 +0000
+++ b/finch/gntrequest.c	Fri Jun 22 22:39:16 2007 +0000
@@ -399,7 +399,7 @@
 							purple_request_field_string_get_default_value(field));
 				gnt_entry_set_masked(GNT_ENTRY(entry),
 						purple_request_field_string_is_masked(field));
-				if (purple_str_has_prefix(hint, "screenname")) {
+				if (hint && purple_str_has_prefix(hint, "screenname")) {
 					PurpleBlistNode *node = purple_blist_get_root();
 					gboolean offline = purple_str_has_suffix(hint, "all");
 					for (; node; node = purple_blist_node_next(node, offline)) {
@@ -673,7 +673,7 @@
 			switch (pt) {
 				case PURPLE_PREF_INT:
 				{
-					long int tmp;
+					long int tmp = GPOINTER_TO_INT(val);
 					if (type == PURPLE_REQUEST_FIELD_LIST) /* Lists always return string */
 						sscanf(val, "%ld", &tmp);
 					purple_prefs_set_int(id, (gint)tmp);
--- a/finch/libgnt/gntwidget.c	Fri Jun 22 17:26:16 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Fri Jun 22 22:39:16 2007 +0000
@@ -576,7 +576,7 @@
 		GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
 		g_signal_emit(widget, signals[SIG_GIVE_FOCUS], 0);
 	}
-	else if (!set)
+	else if (!set && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_HAS_FOCUS))
 	{
 		GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
 		g_signal_emit(widget, signals[SIG_LOST_FOCUS], 0);
--- a/finch/libgnt/gntws.c	Fri Jun 22 17:26:16 2007 +0000
+++ b/finch/libgnt/gntws.c	Fri Jun 22 22:39:16 2007 +0000
@@ -87,8 +87,12 @@
 
 void gnt_ws_add_widget(GntWS *ws, GntWidget* wid)
 {
+	GntWidget *oldfocus;
+	oldfocus = ws->ordered ? ws->ordered->data : NULL;
 	ws->list = g_list_append(ws->list, wid);
 	ws->ordered = g_list_prepend(ws->ordered, wid);
+	if (oldfocus)
+		gnt_widget_set_focus(oldfocus, FALSE);
 }
 
 void gnt_ws_remove_widget(GntWS *ws, GntWidget* wid)
--- a/libpurple/core.c	Fri Jun 22 17:26:16 2007 +0000
+++ b/libpurple/core.c	Fri Jun 22 22:39:16 2007 +0000
@@ -222,11 +222,10 @@
 	purple_sound_uninit();
 
 	purple_plugins_uninit();
-	purple_signals_uninit();
-
 #ifdef HAVE_DBUS
 	purple_dbus_uninit();
 #endif
+	purple_signals_uninit();
 
 	g_free(core->ui);
 	g_free(core);