changeset 19854:e12bf2df9507

Back to square[0]
author Gabriel Schulhof <nix@go-nix.ca>
date Sat, 28 Jul 2007 11:05:22 +0000
parents 970b886f57dd
children e12fb409262f
files pidgin/gtkblist.c pidgin/gtkdialogs.c pidgin/gtkplugin.c pidgin/gtkpounce.c pidgin/gtkrequest.c pidgin/gtkutils.c pidgin/gtkutils.h
diffstat 7 files changed, 25 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkblist.c	Sat Jul 28 11:05:22 2007 +0000
@@ -522,6 +522,11 @@
 	}
 }
 
+static void gtk_blist_show_systemlog_cb()
+{
+	pidgin_syslog_show();
+}
+
 static void gtk_blist_show_onlinehelp_cb()
 {
 	purple_notify_uri(NULL, PURPLE_WEBSITE "documentation");
@@ -2819,34 +2824,22 @@
 static void
 toggle_debug(void)
 {
-	gboolean current_setting = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled");
-
-	if (!current_setting)
-		pidgin_set_toplevel(GTK_WINDOW(gtkblist->window));
 	purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled",
-			!current_setting);
-}
-
-static void
-pidgin_blist_show_no_param_dialog(gpointer p1, GCallback p2, gpointer p3)
-{
-	g_print("pidgin_blist_show_no_param_dialog: Entering\n");
-	pidgin_set_toplevel(GTK_WINDOW(gtkblist->window));
-	p2();
-}
+			!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"));
+}
+
 
 /***************************************************
  *            Crap                                 *
  ***************************************************/
-
 static GtkItemFactoryEntry blist_menu[] =
 {
 	/* Buddies menu */
 	{ N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL },
-	{ N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgin_blist_show_no_param_dialog, (guint)pidgin_dialogs_im, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
-	{ N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_show_no_param_dialog, (guint)pidgin_blist_joinchat_show, "<Item>", NULL },
-	{ N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_blist_show_no_param_dialog, (guint)pidgin_dialogs_info, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
-	{ N_("/Buddies/View User _Log..."), "<CTL>L", pidgin_blist_show_no_param_dialog, (guint)pidgin_dialogs_log, "<Item>", NULL },
+	{ N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgin_dialogs_im, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
+	{ N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_joinchat_show, 0, "<Item>", NULL },
+	{ N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_dialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
+	{ N_("/Buddies/View User _Log..."), "<CTL>L", pidgin_dialogs_log, 0, "<Item>", NULL },
 	{ "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL },
 	{ N_("/Buddies/Show _Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "<CheckItem>", NULL },
 	{ N_("/Buddies/Show _Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL },
@@ -2854,26 +2847,26 @@
 	{ N_("/Buddies/Show Idle _Times"), NULL, pidgin_blist_show_idle_time_cb, 1, "<CheckItem>", NULL },
 	{ N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "<Branch>", NULL },
 	{ "/Buddies/sep2", NULL, NULL, 0, "<Separator>", NULL },
-	{ N_("/Buddies/_Add Buddy..."), "<CTL>B", pidgin_blist_show_no_param_dialog, (guint)pidgin_blist_add_buddy_cb, "<StockItem>", GTK_STOCK_ADD },
-	{ N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_blist_add_chat_cb, "<StockItem>", GTK_STOCK_ADD },
-	{ N_("/Buddies/Add _Group..."), NULL, pidgin_blist_show_no_param_dialog, (guint)purple_blist_request_add_group, "<StockItem>", GTK_STOCK_ADD },
+	{ N_("/Buddies/_Add Buddy..."), "<CTL>B", pidgin_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD },
+	{ N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD },
+	{ N_("/Buddies/Add _Group..."), NULL, purple_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
 	{ "/Buddies/sep3", NULL, NULL, 0, "<Separator>", NULL },
 	{ N_("/Buddies/_Quit"), "<CTL>Q", purple_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
 
 	/* Accounts menu */
 	{ N_("/_Accounts"), NULL, NULL, 0, "<Branch>", NULL },
-	{ N_("/Accounts/Add\\/Edit"), "<CTL>A", pidgin_blist_show_no_param_dialog, (guint)pidgin_accounts_window_show, "<Item>", NULL },
+	{ N_("/Accounts/Add\\/Edit"), "<CTL>A", pidgin_accounts_window_show, 0, "<Item>", NULL },
 
 	/* Tools */
 	{ N_("/_Tools"), NULL, NULL, 0, "<Branch>", NULL },
-	{ N_("/Tools/Buddy _Pounces"), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_pounces_manager_show, "<Item>", NULL },
-	{ N_("/Tools/Plu_gins"), "<CTL>U", pidgin_blist_show_no_param_dialog, (guint)pidgin_plugin_dialog_show, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS },
-	{ N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_blist_show_no_param_dialog, (guint)pidgin_prefs_show, "<StockItem>", GTK_STOCK_PREFERENCES },
-	{ N_("/Tools/Pr_ivacy"), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_privacy_dialog_show, "<Item>", NULL },
+	{ N_("/Tools/Buddy _Pounces"), NULL, pidgin_pounces_manager_show, 0, "<Item>", NULL },
+	{ N_("/Tools/Plu_gins"), "<CTL>U", pidgin_plugin_dialog_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS },
+	{ N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
+	{ N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "<Item>", NULL },
 	{ "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL },
 	{ N_("/Tools/_File Transfers"), "<CTL>T", pidgin_xfer_dialog_show, 0, "<Item>", NULL },
-	{ N_("/Tools/R_oom List"), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_roomlist_dialog_show, "<Item>", NULL },
-	{ N_("/Tools/System _Log"), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_syslog_show, "<Item>", NULL },
+	{ N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL },
+	{ N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<Item>", NULL },
 	{ "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL },
 	{ N_("/Tools/Mute _Sounds"), "<CTL>S", pidgin_blist_mute_sounds_cb, 0, "<CheckItem>", NULL },
 	/* Help */
@@ -2881,9 +2874,9 @@
 	{ N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
 	{ N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL },
 #if GTK_CHECK_VERSION(2,6,0)	
-	{ N_("/Help/_About"), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_dialogs_about, "<StockItem>", GTK_STOCK_ABOUT },
+	{ N_("/Help/_About"), NULL, pidgin_dialogs_about, 0,  "<StockItem>", GTK_STOCK_ABOUT },
 #else
-	{ N_("/Help/_About"), NULL, pidgin_blist_show_no_param_dialog, (guint)pidgin_dialogs_about, "<Item>", NULL },
+	{ N_("/Help/_About"), NULL, pidgin_dialogs_about, 0,  "<Item>", NULL },
 #endif
 };
 
--- a/pidgin/gtkdialogs.c	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkdialogs.c	Sat Jul 28 11:05:22 2007 +0000
@@ -337,7 +337,6 @@
 	gtk_window_set_role(GTK_WINDOW(about), "about");
 	gtk_window_set_resizable(GTK_WINDOW(about), TRUE);
 	gtk_window_set_default_size(GTK_WINDOW(about), 340, 450);
-	gtk_window_set_transient_for(GTK_WINDOW(about), pidgin_get_toplevel());
 
 	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
 	gtk_container_set_border_width(GTK_CONTAINER(hbox), PIDGIN_HIG_BORDER);
--- a/pidgin/gtkplugin.c	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkplugin.c	Sat Jul 28 11:05:22 2007 +0000
@@ -528,10 +528,9 @@
 	}
 
 	plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"),
-						    pidgin_get_toplevel(),
+						    NULL,
 						    GTK_DIALOG_NO_SEPARATOR,
 						    NULL);
-
 	pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
 						_("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE);
 	gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
--- a/pidgin/gtkpounce.c	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkpounce.c	Sat Jul 28 11:05:22 2007 +0000
@@ -516,7 +516,6 @@
 	dialog->window = window = pidgin_create_window((cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce")),
 		PIDGIN_HIG_BORDER, "buddy_pounce", FALSE) ;
 	gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
-	gtk_window_set_transient_for(GTK_WINDOW(window), pidgin_get_toplevel());
 
 	g_signal_connect(G_OBJECT(window), "delete_event",
 					 G_CALLBACK(delete_win_cb), dialog);
@@ -1058,7 +1057,6 @@
 static void
 pounces_manager_add_cb(GtkButton *button, gpointer user_data)
 {
-	pidgin_set_toplevel(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button))));
 	pidgin_pounce_editor_show(NULL, NULL, NULL);
 }
 
--- a/pidgin/gtkrequest.c	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkrequest.c	Sat Jul 28 11:05:22 2007 +0000
@@ -327,7 +327,6 @@
 		gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
 	gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
 	gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0);
-	gtk_window_set_transient_for(GTK_WINDOW(dialog), pidgin_get_toplevel());
 	gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), PIDGIN_HIG_BORDER);
 
 	/* Setup the main horizontal box */
@@ -471,7 +470,6 @@
 
 	/* Create the dialog. */
 	data->dialog = dialog = gtk_dialog_new();
-	gtk_window_set_transient_for(GTK_WINDOW(dialog), pidgin_get_toplevel());
 
 	if (title != NULL)
 		gtk_window_set_title(GTK_WINDOW(dialog), title);
--- a/pidgin/gtkutils.c	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkutils.c	Sat Jul 28 11:05:22 2007 +0000
@@ -61,8 +61,6 @@
 #include "gtkthemes.h"
 #include "gtkutils.h"
 
-#define PIDGIN_TOPLEVEL_REFFED_FLAG "pidgin-toplevel-is-weakly-reffed"
-
 typedef struct {
 	GtkWidget *menu;
 	gint default_item;
@@ -70,38 +68,6 @@
 
 static guint accels_save_timer = 0;
 
-static GtkWindow *toplevel = NULL;
-
-static void
-toplevel_weak_notify(gpointer null, GtkWindow *window)
-{
-	if (toplevel == window)
-		toplevel = NULL;
-}
-
-void
-pidgin_set_toplevel(GtkWindow *new_toplevel)
-{
-	/* If new_toplevel is not NULL, then it better be a GtkWindow */
-	g_return_if_fail(!(new_toplevel && !GTK_IS_WINDOW(new_toplevel)));
-
-	if (toplevel) {
-		g_object_weak_unref(G_OBJECT(toplevel), (GWeakNotify)toplevel_weak_notify, NULL);
-		toplevel = NULL;
-	}
-
-	if (new_toplevel) {
-		g_object_weak_ref(G_OBJECT(new_toplevel), (GWeakNotify)toplevel_weak_notify, NULL);
-		toplevel = new_toplevel;
-	}
-}
-
-GtkWindow *
-pidgin_get_toplevel()
-{
-	return toplevel;
-}
-
 static gboolean
 url_clicked_idle_cb(gpointer data)
 {
--- a/pidgin/gtkutils.h	Sat Jul 28 09:38:24 2007 +0000
+++ b/pidgin/gtkutils.h	Sat Jul 28 11:05:22 2007 +0000
@@ -65,24 +65,6 @@
 #endif /* _WIN32 */
 
 /**
- * Designate new_toplevel as the preferred window for ensuring proper
- * transience relationships for subsequent dialogs.
- *
- * @param new_toplevel The GtkWindow to be used for transience.
- */
-void pidgin_set_toplevel(GtkWindow *new_toplevel);
-
-/**
- * Retrieve the currently preferred toplevel window (set by a previous
- * call top pidgin_set_toplevel()) and *not* since destroyed.
- *
- * @return The GtkWindow most recently given to pidgin_set_toplevel(), or #NULL.
- *         #NULL will be returned either if no toplevel has been set, or if the
- *         most recently set toplevel has since been destroyed.
- */
-GtkWindow *pidgin_get_toplevel();
-
-/**
  * Sets up a gtkimhtml widget, loads it with smileys, and sets the
  * default signal handlers.
  *