pidgin/pidgin

41b4d8fdde2e
Parents 6039c89f2f5c
Children 36610b5bd662
Remove PurpleChatConversation usage from Pidgin

PurpleChatConversation is on its way out, but this is blocking it's removal.

The invite dialog was also removed as it will need to be updated to be aware
of adding users to existing conversations that could be group dms or even
channels.

Testing Done:
Had the turtles run this on top of the branch from r/3106

Reviewed at https://reviews.imfreedom.org/r/3105/
--- a/pidgin/meson.build Sat Apr 13 18:05:52 2024 -0500
+++ b/pidgin/meson.build Sat Apr 13 18:50:42 2024 -0500
@@ -37,7 +37,6 @@
'pidginiconname.c',
'pidginimwindow.c',
'pidgininfopane.c',
- 'pidgininvitedialog.c',
'pidginkeypad.c',
'pidginnotificationaddcontact.c',
'pidginnotificationauthorizationrequest.c',
@@ -93,7 +92,6 @@
'pidginiconname.h',
'pidginimwindow.h',
'pidgininfopane.h',
- 'pidgininvitedialog.h',
'pidginkeypad.h',
'pidginnotificationaddcontact.h',
'pidginnotificationauthorizationrequest.h',
--- a/pidgin/pidgindisplaywindow.c Sat Apr 13 18:05:52 2024 -0500
+++ b/pidgin/pidgindisplaywindow.c Sat Apr 13 18:50:42 2024 -0500
@@ -33,7 +33,6 @@
#include "gtkutils.h"
#include "pidginconversation.h"
#include "pidgindisplayitem.h"
-#include "pidgininvitedialog.h"
enum {
SIG_CONVERSATION_SWITCHED,
@@ -190,11 +189,6 @@
NULL
};
-static const gchar *pidgin_display_window_chat_conversation_actions[] = {
- "invite",
- NULL
-};
-
/******************************************************************************
* Callbacks
*****************************************************************************/
@@ -255,7 +249,6 @@
GtkWidget *widget = NULL;
gboolean is_conversation = FALSE;
gboolean is_im_conversation = FALSE;
- gboolean is_chat_conversation = FALSE;
row = gtk_single_selection_get_selected_item(selection);
@@ -266,7 +259,6 @@
if(PURPLE_IS_CONVERSATION(conversation)) {
is_conversation = PURPLE_IS_CONVERSATION(conversation);
is_im_conversation = PURPLE_IS_IM_CONVERSATION(conversation);
- is_chat_conversation = PURPLE_IS_CHAT_CONVERSATION(conversation);
}
pidgin_display_window_actions_set_enabled(G_ACTION_MAP(window),
@@ -275,9 +267,6 @@
pidgin_display_window_actions_set_enabled(G_ACTION_MAP(window),
pidgin_display_window_im_conversation_actions,
is_im_conversation);
- pidgin_display_window_actions_set_enabled(G_ACTION_MAP(window),
- pidgin_display_window_chat_conversation_actions,
- is_chat_conversation);
widget = pidgin_display_item_get_widget(item);
if(GTK_IS_WIDGET(widget)) {
--- a/pidgin/pidgininvitedialog.c Sat Apr 13 18:05:52 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/* Purple 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "pidgininvitedialog.h"
-
-struct _PidginInviteDialog {
- GtkDialog parent;
-
- GtkWidget *contact;
- GtkWidget *message;
-
- PurpleChatConversation *conversation;
-};
-
-enum {
- PROP_0,
- PROP_CONTACT,
- PROP_MESSAGE,
- PROP_CONVERSATION,
- N_PROPERTIES,
-};
-
-static GParamSpec *properties[N_PROPERTIES] = {NULL, };
-
-G_DEFINE_FINAL_TYPE(PidginInviteDialog, pidgin_invite_dialog, GTK_TYPE_DIALOG)
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-pidgin_invite_dialog_set_conversation(PidginInviteDialog *dialog,
- PurpleChatConversation *conversation)
-{
- g_return_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog));
-
- dialog->conversation = g_object_ref(conversation);
-
- g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_CONVERSATION]);
-}
-
-/******************************************************************************
- * GObject Stuff
- *****************************************************************************/
-static void
-pidgin_invite_dialog_get_property(GObject *obj,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(obj);
-
- switch(param_id) {
- case PROP_CONTACT:
- g_value_set_string(value,
- pidgin_invite_dialog_get_contact(dialog));
- break;
- case PROP_MESSAGE:
- g_value_set_string(value,
- pidgin_invite_dialog_get_message(dialog));
- break;
- case PROP_CONVERSATION:
- g_value_set_object(value,
- pidgin_invite_dialog_get_conversation(dialog));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-pidgin_invite_dialog_set_property(GObject *obj,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(obj);
-
- switch(param_id) {
- case PROP_CONTACT:
- pidgin_invite_dialog_set_contact(dialog,
- g_value_get_string(value));
- break;
- case PROP_MESSAGE:
- pidgin_invite_dialog_set_message(dialog,
- g_value_get_string(value));
- break;
- case PROP_CONVERSATION:
- pidgin_invite_dialog_set_conversation(dialog,
- g_value_get_object(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-pidgin_invite_dialog_finalize(GObject *obj) {
- PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(obj);
-
- g_clear_pointer(&dialog->contact, g_free);
- g_clear_pointer(&dialog->message, g_free);
- g_clear_object(&dialog->conversation);
-
- G_OBJECT_CLASS(pidgin_invite_dialog_parent_class)->finalize(obj);
-}
-
-static void
-pidgin_invite_dialog_init(PidginInviteDialog *dialog) {
- gtk_widget_init_template(GTK_WIDGET(dialog));
-}
-
-static void
-pidgin_invite_dialog_class_init(PidginInviteDialogClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
- obj_class->get_property = pidgin_invite_dialog_get_property;
- obj_class->set_property = pidgin_invite_dialog_set_property;
- obj_class->finalize = pidgin_invite_dialog_finalize;
-
- gtk_widget_class_set_template_from_resource(
- widget_class,
- "/im/pidgin/Pidgin3/Conversations/invite_dialog.ui"
- );
-
- gtk_widget_class_bind_template_child(widget_class, PidginInviteDialog,
- contact);
- gtk_widget_class_bind_template_child(widget_class, PidginInviteDialog,
- message);
-
- /**
- * PidginInviteDialog:contact:
- *
- * The [class@Purple.Contact] that is being invited.
- *
- * Since: 3.0
- */
- properties[PROP_CONTACT] = g_param_spec_string(
- "contact",
- "contact",
- "The person that is being invited",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * PidginInviteDialog:message:
- *
- * A personalized message for the invite.
- *
- * Since: 3.0
- */
- properties[PROP_MESSAGE] = g_param_spec_string(
- "message",
- "message",
- "The invite message to send",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * PidginInviteDialog:conversation:
- *
- * The [class@Purple.Conversation] that the invite is for.
- *
- * Since: 3.0
- */
- properties[PROP_CONVERSATION] = g_param_spec_object(
- "conversation",
- "conversation",
- "The conversation that someone is being invited to",
- PURPLE_TYPE_CHAT_CONVERSATION,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
-}
-
-/******************************************************************************
- * Public API
- *****************************************************************************/
-GtkWidget *
-pidgin_invite_dialog_new(PurpleChatConversation *conversation) {
- return g_object_new(
- PIDGIN_TYPE_INVITE_DIALOG,
- "conversation", conversation,
- NULL);
-}
-
-const gchar *
-pidgin_invite_dialog_get_contact(PidginInviteDialog *dialog) {
- g_return_val_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog), NULL);
-
- return gtk_editable_get_text(GTK_EDITABLE(dialog->contact));
-}
-
-void
-pidgin_invite_dialog_set_contact(PidginInviteDialog *dialog,
- const gchar *contact)
-{
- g_return_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog));
-
- if(contact != NULL) {
- gtk_editable_set_text(GTK_EDITABLE(dialog->contact), contact);
-
- g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_CONTACT]);
- }
-}
-
-const gchar *
-pidgin_invite_dialog_get_message(PidginInviteDialog *dialog) {
- g_return_val_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog), NULL);
-
- return gtk_editable_get_text(GTK_EDITABLE(dialog->message));
-}
-
-void
-pidgin_invite_dialog_set_message(PidginInviteDialog *dialog,
- const gchar *message)
-{
- g_return_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog));
-
- if(message != NULL) {
- gtk_editable_set_text(GTK_EDITABLE(dialog->message), message);
-
- g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_MESSAGE]);
- }
-}
-
-PurpleChatConversation *
-pidgin_invite_dialog_get_conversation(PidginInviteDialog *dialog) {
- g_return_val_if_fail(PIDGIN_IS_INVITE_DIALOG(dialog), NULL);
-
- return dialog->conversation;
-}
--- a/pidgin/pidgininvitedialog.h Sat Apr 13 18:05:52 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/* pidgin
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_INVITE_DIALOG_H
-#define PIDGIN_INVITE_DIALOG_H
-
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-#include "pidginversion.h"
-
-G_BEGIN_DECLS
-
-/**
- * PidginInviteDialog:
- *
- * #PidginInviteDialog is a simple #GtkDialog that presents the user with an
- * interface to invite another user to a conversation. Name completion is
- * automatically setup as well.
- *
- * |[<!-- language="C" -->
- * static void
- * invite_response(GtkWidget *widget, int resp, gpointer data) {
- * PidginInviteDialog *dialog = PIDGIN_INVITE_DIALOG(widget);
- *
- * if(resp == GTK_RESPONSE_ACCEPT) {
- * g_message(
- * "user wants to invite %s with message %s",
- * pidgin_invite_dialog_get_contact(dialog),
- * pidgin_invite_dialog_get_message(dialog)
- * );
- * }
- * }
- *
- * static void
- * invite_prompt(PurpleChatConversation *conv) {
- * GtkWidget *dialog = pidgin_invite_dialog_new(conv);
- * g_signal_connect(G_OBJECT(dialog), "response",
- * G_CALLBACK(invite_response), NULL);
- *
- * }
- * ]|
- *
- * Since: 3.0
- */
-
-#define PIDGIN_TYPE_INVITE_DIALOG pidgin_invite_dialog_get_type()
-
-PIDGIN_AVAILABLE_IN_3_0
-G_DECLARE_FINAL_TYPE(PidginInviteDialog, pidgin_invite_dialog, PIDGIN,
- INVITE_DIALOG, GtkDialog)
-
-/**
- * pidgin_invite_dialog_new:
- * @conversation: The #PurpleChatConversation instance.
- *
- * Creates a new #PidginInviteDialog to invite someone to @conversation.
- *
- * Returns: (transfer full): The new #PidginInviteDialog instance.
- *
- * Since: 3.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-GtkWidget *pidgin_invite_dialog_new(PurpleChatConversation *conversation);
-
-/**
- * pidgin_invite_dialog_set_contact:
- * @dialog: The #PidginInviteDialog instance.
- * @contact: The contact to invite.
- *
- * Sets the contact that should be invited. This function is intended to be
- * used to prepopulate the dialog in cases where you just need to prompt the
- * user for an invite message.
- *
- * Since: 3.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-void pidgin_invite_dialog_set_contact(PidginInviteDialog *dialog, const gchar *contact);
-
-/**
- * pidgin_invite_dialog_get_contact:
- * @dialog: #PidginInviteDialog instance.
- *
- * Gets the contact that was entered in @dialog. This string is only valid as
- * long as @dialog exists.
- *
- * Returns: (transfer none): The contact that was entered.
- *
- * Since: 3.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-const gchar *pidgin_invite_dialog_get_contact(PidginInviteDialog *dialog);
-
-/**
- * pidgin_invite_dialog_set_message:
- * @dialog: The #PidginInviteDialog instance.
- * @message: The message that should be displayed.
- *
- * Sets the message to be displayed in @dialog. The main use case is to
- * prepopulate the message.
- *
- * Since: 3.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-void pidgin_invite_dialog_set_message(PidginInviteDialog *dialog, const gchar *message);
-
-/**
- * pidgin_invite_dialog_get_message:
- * @dialog: The #PidginInviteDialog instance.
- *
- * Gets the message that was entered in @dialog. The returned value is only
- * valid as long as @dialog exists.
- *
- * Returns: (transfer none): The message that was entered in @dialog.
- *
- * Since: 3.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-const gchar *pidgin_invite_dialog_get_message(PidginInviteDialog *dialog);
-
-/**
- * pidgin_invite_dialog_get_conversation:
- * @dialog: The #PidginInviteDialog instance.
- *
- * Gets the #PurpleChatConversation that @dialog was created for.
- *
- * Returns: (transfer none): The #PurpleChatConversation that @dialog was
- * created with.
- *
- * Since: 3.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-PurpleChatConversation *pidgin_invite_dialog_get_conversation(PidginInviteDialog *dialog);
-
-G_END_DECLS
-
-#endif /* PIDGIN_INVITE_DIALOG_H */
--- a/pidgin/resources/Conversations/invite_dialog.ui Sat Apr 13 18:05:52 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +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="PidginInviteDialog" parent="GtkDialog">
- <property name="title" translatable="1">Invite to conversation...</property>
- <property name="resizable">0</property>
- <child internal-child="content_area">
- <object class="GtkBox">
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkGrid">
- <property name="vexpand">1</property>
- <property name="margin-bottom">6</property>
- <property name="row-spacing">6</property>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">Please enter the name of the user you wish to invite, along with an optional invite message.</property>
- <property name="wrap">1</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="column-span">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="label_contact">
- <property name="label" translatable="1">Contact:</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">0</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="label_message">
- <property name="label" translatable="1">Message:</property>
- <property name="xalign">0</property>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkEntry" id="contact">
- <property name="focusable">1</property>
- <property name="activates-default">1</property>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
- <accessibility>
- <relation name="labelled-by">label_contact</relation>
- </accessibility>
- </object>
- </child>
- <child>
- <object class="GtkEntry" id="message">
- <property name="focusable">1</property>
- <property name="activates-default">1</property>
- <layout>
- <property name="column">1</property>
- <property name="row">2</property>
- </layout>
- <accessibility>
- <relation name="labelled-by">label_message</relation>
- </accessibility>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="action">
- <object class="GtkButton" id="button1">
- <property name="label" translatable="1">Cancel</property>
- <property name="focusable">1</property>
- <property name="receives-default">1</property>
- </object>
- </child>
- <child type="action">
- <object class="GtkButton" id="button2">
- <property name="label" translatable="1">Invite</property>
- <property name="focusable">1</property>
- <property name="receives-default">1</property>
- </object>
- </child>
- <action-widgets>
- <action-widget response="cancel">button1</action-widget>
- <action-widget response="accept">button2</action-widget>
- </action-widgets>
- </template>
-</interface>
--- a/pidgin/resources/pidgin.gresource.xml Sat Apr 13 18:05:52 2024 -0500
+++ b/pidgin/resources/pidgin.gresource.xml Sat Apr 13 18:50:42 2024 -0500
@@ -10,7 +10,6 @@
<file compressed="true" preprocess="xml-stripblanks">Accounts/manager-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">avatar.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Conversations/conversation.ui</file>
- <file compressed="true" preprocess="xml-stripblanks">Conversations/invite_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Conversations/message.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Debug/debug.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Display/window.ui</file>
--- a/po/POTFILES.in Sat Apr 13 18:05:52 2024 -0500
+++ b/po/POTFILES.in Sat Apr 13 18:50:42 2024 -0500
@@ -148,7 +148,6 @@
pidgin/pidgindisplaywindow.c
pidgin/pidginiconname.c
pidgin/pidgininfopane.c
-pidgin/pidgininvitedialog.c
pidgin/pidginkeypad.c
pidgin/pidginpluginsdialog.c
pidgin/pidginpluginsmenu.c
@@ -178,7 +177,6 @@
pidgin/resources/Accounts/manager.ui
pidgin/resources/Accounts/manager-row.ui
pidgin/resources/avatar.ui
-pidgin/resources/Conversations/invite_dialog.ui
pidgin/resources/Debug/debug.ui
pidgin/resources/Display/window.ui
pidgin/resources/Keypad/keypad.ui