qulogic/pidgin

1954265c38f0
Parents c73c0cf2b554
Children 6aaf9a66f9d9
Implement the member list in PidginConversation

Testing Done:
Joined my twitch channel to get some names in the members list and verified the context menu worked for everyone.

However, the account that's automatically added has some issues, but that's a different problem we need to tackle.

Reviewed at https://reviews.imfreedom.org/r/2842/
--- a/pidgin/pidginconversation.c Thu Nov 30 21:33:32 2023 -0600
+++ b/pidgin/pidginconversation.c Thu Nov 30 21:35:10 2023 -0600
@@ -26,6 +26,7 @@
#include "pidginautoadjustment.h"
#include "pidgincolor.h"
+#include "pidgincontactinfomenu.h"
#include "pidginconversation.h"
#include "pidgininfopane.h"
@@ -283,6 +284,37 @@
return g_markup_escape_text(contents, -1);
}
+static void
+pidgin_conversation_member_list_context_cb(GtkGestureSingle *self,
+ G_GNUC_UNUSED gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer data)
+{
+ PurpleAccount *account = NULL;
+ PurpleContactInfo *info = NULL;
+ PurpleConversationMember *member = NULL;
+ GtkWidget *parent = NULL;
+ GtkListItem *item = data;
+
+ parent = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(self));
+
+ member = gtk_list_item_get_item(item);
+ info = purple_conversation_member_get_contact_info(member);
+
+ /* ConversationMembers are a PurpleAccount for the libpurple user, or in
+ * most cases are PurpleContact for all the other users. Because of this,
+ * we have to do a runtime check to determine which one they are.
+ */
+ if(PURPLE_IS_ACCOUNT(info)) {
+ account = PURPLE_ACCOUNT(info);
+ } else if(PURPLE_IS_CONTACT(info)) {
+ account = purple_contact_get_account(PURPLE_CONTACT(info));
+ }
+
+ pidgin_contact_info_menu_popup(info, account, parent, x, y);
+}
+
/******************************************************************************
* GObject Implementation
*****************************************************************************/
@@ -387,6 +419,8 @@
pidgin_conversation_query_tooltip_edited_cb);
gtk_widget_class_bind_template_callback(widget_class,
pidgin_conversation_process_message_contents_cb);
+ gtk_widget_class_bind_template_callback(widget_class,
+ pidgin_conversation_member_list_context_cb);
}
/******************************************************************************
--- a/pidgin/resources/Conversations/conversation.ui Thu Nov 30 21:33:32 2023 -0600
+++ b/pidgin/resources/Conversations/conversation.ui Thu Nov 30 21:35:10 2023 -0600
@@ -83,10 +83,36 @@
</object>
</child>
<child type="flap">
- <object class="AdwStatusPage">
- <property name="description">This is a placeholder for now</property>
- <property name="title">Placeholder</property>
- <property name="icon-name">starred-symbolic</property>
+ <object class="GtkScrolledWindow">
+ <property name="hscrollbar-policy">never</property>
+ <property name="margin-bottom">6</property>
+ <property name="margin-end">6</property>
+ <property name="margin-start">6</property>
+ <property name="margin-top">6</property>
+ <property name="vscrollbar-policy">automatic</property>
+ <style>
+ <class name="sidebar"/>
+ </style>
+ <child>
+ <object class="GtkListView">
+ <property name="vexpand">1</property>
+ <property name="factory">
+ <object class="GtkBuilderListItemFactory">
+ <property name="resource">/im/pidgin/Pidgin3/conversationmemberlistitem.ui</property>
+ </object>
+ </property>
+ <property name="model">
+ <object class="GtkSingleSelection">
+ <property name="autoselect">false</property>
+ <binding name="model">
+ <lookup name="members" type="PurpleConversation">
+ <lookup name="conversation">PidginConversation</lookup>
+ </lookup>
+ </binding>
+ </object>
+ </property>
+ </object>
+ </child>
</object>
</child>
</object>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/conversationmemberlistitem.ui Thu Nov 30 21:35:10 2023 -0600
@@ -0,0 +1,52 @@
+<?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>
+ <template class="GtkListItem">
+ <property name="child">
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkGestureClick">
+ <property name="button">3</property>
+ <signal name="released" handler="pidgin_conversation_member_list_context_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="xalign">0</property>
+ <property name="use-markup">1</property>
+ <binding name="label">
+ <lookup name="name-for-display" type="PurpleContactInfo">
+ <lookup name="contact-info" type="PurpleConversationMember">
+ <lookup name="item">GtkListItem</lookup>
+ </lookup>
+ </lookup>
+ </binding>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </property>
+ </template>
+</interface>
--- a/pidgin/resources/pidgin.gresource.xml Thu Nov 30 21:33:32 2023 -0600
+++ b/pidgin/resources/pidgin.gresource.xml Thu Nov 30 21:35:10 2023 -0600
@@ -42,6 +42,7 @@
<file compressed="true" preprocess="xml-stripblanks">account-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">channeljoindialog.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">presenceicon.ui</file>
<file>icons/16x16/status/pidgin-user-available.png</file>
<file>icons/16x16/status/pidgin-user-away.png</file>