changeset 28284:7983230cc1c0

Add support for setting the multiple instances flag in the Windows Preferences plugin.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 22 Sep 2009 02:12:42 +0000
parents 46cf492641d4
children dab0d17dc6c1
files pidgin/plugins/win32/winprefs/winprefs.c
diffstat 1 files changed, 17 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/win32/winprefs/winprefs.c	Tue Sep 22 02:07:26 2009 +0000
+++ b/pidgin/plugins/win32/winprefs/winprefs.c	Tue Sep 22 02:12:42 2009 +0000
@@ -101,10 +101,7 @@
 			blist_set_ontop(TRUE);
 	} else {
 		purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking...\n");
-		if(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
-			blist_set_ontop(TRUE);
-		else
-			blist_set_ontop(FALSE);
+		blist_set_ontop(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS);
 	}
 }
 
@@ -120,10 +117,7 @@
 			blist_ab = NULL;
 		}
 
-		if(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
-			blist_set_ontop(TRUE);
-		else
-			blist_set_ontop(FALSE);
+		blist_set_ontop(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS);
 	}
 }
 
@@ -210,6 +204,12 @@
 }
 
 static void
+winprefs_set_multiple_instances(GtkWidget *w) {
+	wpurple_write_reg_string(HKEY_CURRENT_USER, "Environment", "PIDGIN_MULTI_INST",
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)) ? "1" : NULL);
+}
+
+static void
 winprefs_set_blist_dockable(const char *pref, PurplePrefType type,
 		gconstpointer value, gpointer user_data)
 {
@@ -270,34 +270,18 @@
 	GtkWidget *ret;
 	GtkWidget *vbox;
 	GtkWidget *button;
-	char *gtk_version = NULL;
 	char *run_key_val;
 	char *tmp;
 
 	ret = gtk_vbox_new(FALSE, 18);
 	gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
 
-	gtk_version = g_strdup_printf("GTK+\t%u.%u.%u\nGlib\t%u.%u.%u",
-		gtk_major_version, gtk_minor_version, gtk_micro_version,
-		glib_major_version, glib_minor_version, glib_micro_version);
-
-	/* Display Installed GTK+ Runtime Version */
-	if(gtk_version) {
-		GtkWidget *label;
-		vbox = pidgin_make_frame(ret, _("GTK+ Runtime Version"));
-		label = gtk_label_new(gtk_version);
-		gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-		gtk_widget_show(label);
-		g_free(gtk_version);
-	}
-
 	/* Autostart */
 	vbox = pidgin_make_frame(ret, _("Startup"));
 	tmp = g_strdup_printf(_("_Start %s on Windows startup"), PIDGIN_NAME);
 	button = gtk_check_button_new_with_mnemonic(tmp);
 	g_free(tmp);
 	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
-
 	if ((run_key_val = wpurple_read_reg_string(HKEY_CURRENT_USER, RUNKEY, "Pidgin"))
 			|| (run_key_val = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, RUNKEY, "Pidgin"))) {
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
@@ -306,6 +290,15 @@
 	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(winprefs_set_autostart), NULL);
 	gtk_widget_show(button);
 
+	button = gtk_check_button_new_with_mnemonic(_("Allow multiple instances"));
+	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+	if ((run_key_val = wpurple_read_reg_string(HKEY_CURRENT_USER, "Environment", "PIDGIN_MULTI_INST"))) {
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+		g_free(run_key_val);
+	}
+	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(winprefs_set_multiple_instances), NULL);
+	gtk_widget_show(button);
+
 	/* Buddy List */
 	vbox = pidgin_make_frame(ret, _("Buddy List"));
 	pidgin_prefs_checkbox(_("_Dockable Buddy List"),