# HG changeset patch
# Node ID 620f58d65a66
# Parent  ab244bae3b82
diff --git a/pidgin/meson.build b/pidgin/meson.build
--- a/pidgin/meson.build
+++ b/pidgin/meson.build
@@ -34,7 +34,6 @@
 	'pidgindisplayitem.c',
 	'pidgindisplaywindow.c',
 	'pidginiconname.c',
-	'pidginimwindow.c',
 	'pidgininfopane.c',
 	'pidginkeypad.c',
 	'pidginnotificationaddcontact.c',
@@ -88,7 +87,6 @@
 	'pidgindisplaywindow.h',
 	'pidgindebug.h',
 	'pidginiconname.h',
-	'pidginimwindow.h',
 	'pidgininfopane.h',
 	'pidginkeypad.h',
 	'pidginnotificationaddcontact.h',
diff --git a/pidgin/pidginapplication.c b/pidgin/pidginapplication.c
--- a/pidgin/pidginapplication.c
+++ b/pidgin/pidginapplication.c
@@ -43,7 +43,6 @@
 #include "pidgincore.h"
 #include "pidgindebug.h"
 #include "pidgindisplaywindow.h"
-#include "pidginimwindow.h"
 #include "pidginpluginsdialog.h"
 #include "pidginpluginsmenu.h"
 #include "pidginprefs.h"
@@ -210,7 +209,6 @@
  * This list keeps track of which actions should only be enabled while online.
  */
 static const gchar *pidgin_application_online_actions[] = {
-	"new-message",
 };
 
 /**
@@ -437,23 +435,6 @@
 }
 
 static void
-pidgin_application_new_message(G_GNUC_UNUSED GSimpleAction *simple,
-                               G_GNUC_UNUSED GVariant *parameter,
-                               gpointer data)
-{
-	PidginApplication *application = data;
-	static GtkWidget *dialog = NULL;
-
-	if(!PIDGIN_IS_IM_WINDOW(dialog)) {
-		dialog = pidgin_im_window_new();
-		g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer)&dialog);
-	}
-
-	pidgin_application_present_transient_window(application,
-	                                            GTK_WINDOW(dialog));
-}
-
-static void
 pidgin_application_online_help(G_GNUC_UNUSED GSimpleAction *simple,
                                G_GNUC_UNUSED GVariant *parameter,
                                G_GNUC_UNUSED gpointer data)
@@ -560,9 +541,6 @@
 		.name = "manage-plugins",
 		.activate = pidgin_application_plugins,
 	}, {
-		.name = "new-message",
-		.activate = pidgin_application_new_message,
-	}, {
 		.name = "online-help",
 		.activate = pidgin_application_online_help,
 	}, {
diff --git a/pidgin/pidginimwindow.h b/pidgin/pidginimwindow.h
deleted file mode 100644
--- a/pidgin/pidginimwindow.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Pidgin - Internet Messenger
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_IM_WINDOW_H
-#define PIDGIN_IM_WINDOW_H
-
-#include <glib.h>
-
-#include <gtk/gtk.h>
-
-#include <adwaita.h>
-
-#include "pidginversion.h"
-
-G_BEGIN_DECLS
-
-/**
- * PidginIMWindow:
- *
- * A window used to start a new direct message.
- *
- * Since: 3.0
- */
-
-#define PIDGIN_TYPE_IM_WINDOW (pidgin_im_window_get_type())
-
-PIDGIN_AVAILABLE_IN_3_0
-G_DECLARE_FINAL_TYPE(PidginIMWindow, pidgin_im_window,
-                     PIDGIN, IM_WINDOW, AdwMessageDialog)
-
-/**
- * pidgin_im_window_new:
- *
- * Creates a new #PidginIMWindow instance.
- *
- * Returns: (transfer full): The new #PidginIMWindow instance.
- */
-GtkWidget *pidgin_im_window_new(void);
-
-G_END_DECLS
-
-#endif /* PIDGIN_IM_WINDOW_H */
diff --git a/pidgin/pidginimwindow.c b/pidgin/pidginimwindow.c
deleted file mode 100644
--- a/pidgin/pidginimwindow.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Pidgin - Internet Messenger
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#include <purple.h>
-
-#include "pidginimwindow.h"
-
-#include "pidginaccountrow.h"
-
-struct _PidginIMWindow {
-	AdwMessageDialog parent;
-
-	GtkCustomFilter *filter;
-
-	GtkWidget *account;
-	GtkWidget *username;
-};
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static gboolean
-pidgin_im_window_filter_accounts(gpointer item, G_GNUC_UNUSED gpointer data) {
-	if(PURPLE_IS_ACCOUNT(item)) {
-		PurpleAccount *account = PURPLE_ACCOUNT(item);
-		PurpleProtocol *protocol = purple_account_get_protocol(account);
-
-		if(PURPLE_IS_PROTOCOL(protocol)) {
-			return PURPLE_PROTOCOL_IMPLEMENTS(protocol, CONVERSATION,
-			                                  send_message_async);
-		}
-	}
-
-	return FALSE;
-
-}
-
-/******************************************************************************
- * Callbacks
- *****************************************************************************/
-static void
-pidgin_im_window_username_changed_cb(GtkEditable *self, gpointer data) {
-	const char *text = NULL;
-	gboolean enabled = FALSE;
-
-	text = gtk_editable_get_text(self);
-	enabled = !purple_strempty(text);
-
-	adw_message_dialog_set_response_enabled(data, "okay", enabled);
-}
-
-static void
-pidgin_im_window_response_cb(AdwMessageDialog *self,
-                             const char *response,
-                             G_GNUC_UNUSED gpointer data)
-{
-	PidginIMWindow *window = PIDGIN_IM_WINDOW(self);
-	PurpleAccount *account = NULL;
-	PurpleConversation *im = NULL;
-	PurpleConversationManager *manager = NULL;
-	const char *username = NULL;
-
-	if(!purple_strequal(response, "okay")) {
-		return;
-	}
-
-	account = pidgin_account_row_get_account(PIDGIN_ACCOUNT_ROW(window->account)) ;
-	username = gtk_editable_get_text(GTK_EDITABLE(window->username));
-
-	manager = purple_conversation_manager_get_default();
-	im = purple_conversation_manager_find_im(manager, account, username);
-
-	if(!PURPLE_IS_IM_CONVERSATION(im)) {
-		/* This constructor automagically registers the conversation with the
-		 * manager.
-		 */
-		purple_im_conversation_new(account, username);
-	}
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-G_DEFINE_FINAL_TYPE(PidginIMWindow, pidgin_im_window, ADW_TYPE_MESSAGE_DIALOG)
-
-static void
-pidgin_im_window_init(PidginIMWindow *window) {
-	gtk_widget_init_template(GTK_WIDGET(window));
-
-	gtk_custom_filter_set_filter_func(window->filter,
-	                                  pidgin_im_window_filter_accounts,
-	                                  NULL, NULL);
-}
-
-static void
-pidgin_im_window_class_init(PidginIMWindowClass *klass) {
-	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
-	gtk_widget_class_set_template_from_resource(
-		widget_class,
-		"/im/pidgin/Pidgin3/imwindow.ui"
-	);
-
-	gtk_widget_class_bind_template_child(widget_class, PidginIMWindow,
-	                                     filter);
-
-	gtk_widget_class_bind_template_child(widget_class, PidginIMWindow,
-	                                     account);
-	gtk_widget_class_bind_template_child(widget_class, PidginIMWindow,
-	                                     username);
-
-	gtk_widget_class_bind_template_callback(widget_class,
-	                                        pidgin_im_window_username_changed_cb);
-	gtk_widget_class_bind_template_callback(widget_class,
-	                                        pidgin_im_window_response_cb);
-}
-
-/******************************************************************************
- * Public API
- *****************************************************************************/
-GtkWidget *
-pidgin_im_window_new(void) {
-	return g_object_new(PIDGIN_TYPE_IM_WINDOW, NULL);
-}
diff --git a/pidgin/resources/gtk/menus.ui b/pidgin/resources/gtk/menus.ui
--- a/pidgin/resources/gtk/menus.ui
+++ b/pidgin/resources/gtk/menus.ui
@@ -29,10 +29,6 @@
 
       <section>
         <item>
-          <attribute name="label" translatable="yes">New Instant _Message</attribute>
-          <attribute name="action">app.new-message</attribute>
-        </item>
-        <item>
           <attribute name="label" translatable="yes">Join Channel</attribute>
           <attribute name="action">app.join-channel</attribute>
         </item>
diff --git a/pidgin/resources/imwindow.ui b/pidgin/resources/imwindow.ui
deleted file mode 100644
--- a/pidgin/resources/imwindow.ui
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Pidgin - Internet Messenger
-Copyright (C) Pidgin Developers <devel@pidgin.im>
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this library; if not, see <https://www.gnu.org/licenses/>.
--->
-<interface>
-  <requires lib="gtk" version="4.0"/>
-  <!-- interface-license-type gplv2 -->
-  <!-- interface-name Pidgin -->
-  <!-- interface-description Internet Messenger -->
-  <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
-  <template class="PidginIMWindow" parent="AdwMessageDialog">
-    <property name="heading" translatable="yes">New Instant Message</property>
-    <property name="body" translatable="yes">Please enter the username or alias of the person you would like to IM.</property>
-    <property name="extra-child">
-      <object class="AdwPreferencesGroup">
-        <property name="vexpand">true</property>
-        <property name="hexpand">true</property>
-        <child>
-          <object class="PidginAccountRow" id="account">
-            <property name="filter">
-              <object class="GtkEveryFilter">
-                <child>
-                  <object class="GtkCustomFilter" id="filter"/>
-                </child>
-                <child>
-                  <object class="PidginAccountFilterConnected"/>
-                </child>
-              </object>
-            </property>
-          </object>
-        </child>
-        <child>
-          <object class="AdwEntryRow" id="username">
-            <property name="focusable">no</property>
-            <property name="title" translatable="yes">_Username</property>
-            <property name="use-underline">yes</property>
-            <property name="activates-default">yes</property>
-            <signal name="changed" handler="pidgin_im_window_username_changed_cb"/>
-          </object>
-        </child>
-      </object>
-    </property>
-    <property name="default-response">okay</property>
-    <property name="close-response">cancel</property>
-    <responses>
-      <response id="cancel" translatable="yes">_Cancel</response>
-      <response id="okay" translatable="yes" appearance="suggested" enabled="false">_Okay</response>
-    </responses>
-    <signal name="response" handler="pidgin_im_window_response_cb"/>
-  </template>
-</interface>
diff --git a/pidgin/resources/pidgin.gresource.xml b/pidgin/resources/pidgin.gresource.xml
--- a/pidgin/resources/pidgin.gresource.xml
+++ b/pidgin/resources/pidgin.gresource.xml
@@ -38,7 +38,6 @@
     <file compressed="true" preprocess="xml-stripblanks">contactlist.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">contactlistitem.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">conversationmemberlistitem.ui</file>
-    <file compressed="true" preprocess="xml-stripblanks">imwindow.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">infopane.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">notificationlist.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">presenceicon.ui</file>
