# HG changeset patch
# Node ID fbbdcddc5b6ddc33bc8f29bb34a0368f5d2c19c7
# Parent  a92aa5a5192cd4fd51ff2f48f3d6803574ab5353
diff --git a/pidgin/pidginabout.c b/pidgin/pidginabout.c
--- a/pidgin/pidginabout.c
+++ b/pidgin/pidginabout.c
@@ -697,10 +697,11 @@ pidgin_about_dialog_init(PidginAboutDial
  * Public API
  *****************************************************************************/
 GtkWidget *
-pidgin_about_dialog_new(void) {
+pidgin_about_dialog_new(GtkApplication *application) {
 	return g_object_new(
 		PIDGIN_TYPE_ABOUT_DIALOG,
 		"title", "About Pidgin",
+		"application", application,
 		NULL
 	);
 }
diff --git a/pidgin/pidginabout.h b/pidgin/pidginabout.h
--- a/pidgin/pidginabout.h
+++ b/pidgin/pidginabout.h
@@ -49,6 +49,7 @@ G_DECLARE_FINAL_TYPE(PidginAboutDialog, 
 
 /**
  * pidgin_about_dialog_new:
+ * @application: (nullable): A #GtkApplication to associate with this dialog.
  *
  * Creates a new about window.
  *
@@ -57,7 +58,7 @@ G_DECLARE_FINAL_TYPE(PidginAboutDialog, 
  * Since: 3.0
  */
 PIDGIN_AVAILABLE_IN_3_0
-GtkWidget *pidgin_about_dialog_new(void);
+GtkWidget *pidgin_about_dialog_new(GtkApplication *application);
 
 G_END_DECLS
 
diff --git a/pidgin/pidginaccountmanager.c b/pidgin/pidginaccountmanager.c
--- a/pidgin/pidginaccountmanager.c
+++ b/pidgin/pidginaccountmanager.c
@@ -271,8 +271,11 @@ pidgin_account_manager_class_init(Pidgin
  * Public API
  *****************************************************************************/
 GtkWidget *
-pidgin_account_manager_new(void) {
-	return g_object_new(PIDGIN_TYPE_ACCOUNT_MANAGER, NULL);
+pidgin_account_manager_new(GtkApplication *application) {
+	return g_object_new(
+		PIDGIN_TYPE_ACCOUNT_MANAGER,
+		"application", application,
+		NULL);
 }
 
 void
diff --git a/pidgin/pidginaccountmanager.h b/pidgin/pidginaccountmanager.h
--- a/pidgin/pidginaccountmanager.h
+++ b/pidgin/pidginaccountmanager.h
@@ -51,6 +51,7 @@ G_DECLARE_FINAL_TYPE(PidginAccountManage
 
 /**
  * pidgin_account_manager_new:
+ * @application: (nullable): A #GtkApplication to associate with this window.
  *
  * Creates a new account manager dialog.
  *
@@ -59,7 +60,7 @@ G_DECLARE_FINAL_TYPE(PidginAccountManage
  * Since: 3.0
  */
 PIDGIN_AVAILABLE_IN_3_0
-GtkWidget *pidgin_account_manager_new(void);
+GtkWidget *pidgin_account_manager_new(GtkApplication *application);
 
 /**
  * pidgin_account_manager_show_overview:
diff --git a/pidgin/pidginapplication.c b/pidgin/pidginapplication.c
--- a/pidgin/pidginapplication.c
+++ b/pidgin/pidginapplication.c
@@ -105,11 +105,11 @@ G_DEFINE_FINAL_TYPE(PidginApplication, p
  * Since: 3.0
  */
 static GtkWidget *
-pidgin_application_get_account_manager(void) {
+pidgin_application_get_account_manager(PidginApplication *application) {
 	static GtkWidget *manager = NULL;
 
 	if(!PIDGIN_IS_ACCOUNT_MANAGER(manager)) {
-		manager = pidgin_account_manager_new();
+		manager = pidgin_account_manager_new(GTK_APPLICATION(application));
 		g_object_add_weak_pointer(G_OBJECT(manager), (gpointer)&manager);
 	}
 
@@ -303,7 +303,7 @@ pidgin_application_about(G_GNUC_UNUSED G
 	static GtkWidget *about = NULL;
 
 	if(!GTK_IS_WIDGET(about)) {
-		about = pidgin_about_dialog_new();
+		about = pidgin_about_dialog_new(GTK_APPLICATION(application));
 		g_object_add_weak_pointer(G_OBJECT(about), (gpointer)&about);
 	}
 
@@ -315,7 +315,7 @@ pidgin_application_accounts(G_GNUC_UNUSE
                             G_GNUC_UNUSED GVariant *parameter, gpointer data)
 {
 	PidginApplication *application = data;
-	GtkWidget *manager = pidgin_application_get_account_manager();
+	GtkWidget *manager = pidgin_application_get_account_manager(application);
 
 	pidgin_account_manager_show_overview(PIDGIN_ACCOUNT_MANAGER(manager));
 
@@ -415,7 +415,9 @@ pidgin_application_edit_account(G_GNUC_U
 
 	account = purple_account_manager_find_by_id(manager, id);
 	if(PURPLE_IS_ACCOUNT(account)) {
-		GtkWidget *account_manager = pidgin_application_get_account_manager();
+		GtkWidget *account_manager = NULL;
+
+		account_manager = pidgin_application_get_account_manager(application);
 
 		pidgin_account_manager_edit_account(PIDGIN_ACCOUNT_MANAGER(account_manager),
 		                                    account);
@@ -467,7 +469,7 @@ pidgin_application_join_channel(G_GNUC_U
 	static GtkWidget *dialog = NULL;
 
 	if(!GTK_IS_WIDGET(dialog)) {
-		dialog = pidgin_channel_join_dialog_new();
+		dialog = pidgin_channel_join_dialog_new(GTK_APPLICATION(application));
 		g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer)&dialog);
 	}
 
@@ -495,7 +497,10 @@ pidgin_application_preferences(G_GNUC_UN
 	static GtkWidget *preferences = NULL;
 
 	if(!GTK_IS_WIDGET(preferences)) {
-		preferences = g_object_new(PIDGIN_TYPE_PREFS_WINDOW, NULL);
+		preferences = g_object_new(
+			PIDGIN_TYPE_PREFS_WINDOW,
+			"application", application,
+			NULL);
 		g_object_add_weak_pointer(G_OBJECT(preferences), (gpointer)&preferences);
 	}
 
@@ -851,11 +856,11 @@ pidgin_application_startup(GApplication 
 }
 
 static void
-pidgin_application_activate(G_GNUC_UNUSED GApplication *application) {
+pidgin_application_activate(GApplication *application) {
 	static GtkWidget *default_window = NULL;
 
 	if(!GTK_IS_WIDGET(default_window)) {
-		default_window = pidgin_display_window_new();
+		default_window = pidgin_display_window_new(GTK_APPLICATION(application));
 		g_object_add_weak_pointer(G_OBJECT(default_window),
 		                          (gpointer)&default_window);
 	}
diff --git a/pidgin/pidginchanneljoindialog.c b/pidgin/pidginchanneljoindialog.c
--- a/pidgin/pidginchanneljoindialog.c
+++ b/pidgin/pidginchanneljoindialog.c
@@ -367,6 +367,9 @@ pidgin_channel_join_dialog_class_init(Pi
  * Public API
  *****************************************************************************/
 GtkWidget *
-pidgin_channel_join_dialog_new(void) {
-	return g_object_new(PIDGIN_TYPE_CHANNEL_JOIN_DIALOG, NULL);
+pidgin_channel_join_dialog_new(GtkApplication *application) {
+	return g_object_new(
+		PIDGIN_TYPE_CHANNEL_JOIN_DIALOG,
+		"application", application,
+		NULL);
 }
diff --git a/pidgin/pidginchanneljoindialog.h b/pidgin/pidginchanneljoindialog.h
--- a/pidgin/pidginchanneljoindialog.h
+++ b/pidgin/pidginchanneljoindialog.h
@@ -49,6 +49,7 @@ G_DECLARE_FINAL_TYPE(PidginChannelJoinDi
 
 /**
  * pidgin_channel_join_dialog_new:
+ * @application: (nullable): A #GtkApplication to associate with this dialog.
  *
  * Creates a new channel join dialog.
  *
@@ -57,7 +58,7 @@ G_DECLARE_FINAL_TYPE(PidginChannelJoinDi
  * Since: 3.0
  */
 PIDGIN_AVAILABLE_IN_3_0
-GtkWidget *pidgin_channel_join_dialog_new(void);
+GtkWidget *pidgin_channel_join_dialog_new(GtkApplication *application);
 
 G_END_DECLS
 
diff --git a/pidgin/pidgindisplaywindow.c b/pidgin/pidgindisplaywindow.c
--- a/pidgin/pidgindisplaywindow.c
+++ b/pidgin/pidgindisplaywindow.c
@@ -376,10 +376,7 @@ pidgin_display_window_init(PidginDisplay
 	                               G_LIST_MODEL(tree_model));
 	g_clear_object(&tree_model);
 
-	/* Set the application and add all of our actions. */
-	gtk_window_set_application(GTK_WINDOW(window),
-	                           GTK_APPLICATION(g_application_get_default()));
-
+	/* Add all of our actions. */
 	conversation_actions = g_simple_action_group_new();
 	g_action_map_add_action_entries(G_ACTION_MAP(conversation_actions),
 	                                conversation_entries,
@@ -478,9 +475,10 @@ pidgin_display_window_class_init(PidginD
  * API
  *****************************************************************************/
 GtkWidget *
-pidgin_display_window_new(void) {
+pidgin_display_window_new(GtkApplication *application) {
 	return g_object_new(
 		PIDGIN_TYPE_DISPLAY_WINDOW,
+		"application", application,
 		"show-menubar", TRUE,
 		NULL);
 }
diff --git a/pidgin/pidgindisplaywindow.h b/pidgin/pidgindisplaywindow.h
--- a/pidgin/pidgindisplaywindow.h
+++ b/pidgin/pidgindisplaywindow.h
@@ -53,6 +53,7 @@ G_DECLARE_FINAL_TYPE(PidginDisplayWindow
 
 /**
  * pidgin_display_window_new:
+ * @application: (nullable): A #GtkApplication to associate with this window.
  *
  * Creates a new #PidginDisplayWindow instance.
  *
@@ -61,7 +62,7 @@ G_DECLARE_FINAL_TYPE(PidginDisplayWindow
  * Since: 3.0
  */
 PIDGIN_AVAILABLE_IN_3_0
-GtkWidget *pidgin_display_window_new(void);
+GtkWidget *pidgin_display_window_new(GtkApplication *application);
 
 /**
  * pidgin_display_window_add:
