pidgin/pidgin

f8b477a1b0b6
Parents ab1ca778ddb2
Children 071065dec713
Add an InfoPane to the Contacts widget and move search to it

Testing Done:
Consulted with the turtles.
Opened the contact list window and searched in many ways.

Reviewed at https://reviews.imfreedom.org/r/2918/
--- a/pidgin/pidgincontactlist.c Tue Jan 23 00:31:44 2024 -0600
+++ b/pidgin/pidgincontactlist.c Tue Jan 23 00:45:08 2024 -0600
@@ -115,13 +115,18 @@
* Callbacks
*****************************************************************************/
static void
-pidgin_contact_list_search_changed_cb(G_GNUC_UNUSED GtkSearchEntry *self,
- gpointer data)
-{
+pidgin_contact_list_search_changed_cb(GtkSearchEntry *self, gpointer data) {
PidginContactList *list = data;
gtk_filter_changed(GTK_FILTER(list->search_filter),
GTK_FILTER_CHANGE_DIFFERENT);
+
+ /* Make sure the search widget has focus, this allows the user to clear a
+ * search that has filtered out every item in the list via their keyboard.
+ */
+ if(!gtk_widget_has_focus(GTK_WIDGET(self))) {
+ gtk_widget_grab_focus(GTK_WIDGET(self));
+ }
}
static GdkTexture *
@@ -328,10 +333,13 @@
G_CALLBACK(pidgin_contact_list_account_disconnected_cb),
list, 0);
- /* Setup the search filter. */
+ /* Setup the search filter and forwarding widget. */
gtk_custom_filter_set_filter_func(list->search_filter,
(GtkCustomFilterFunc)pidgin_contact_list_search_filter,
list, NULL);
+
+ gtk_search_entry_set_key_capture_widget(GTK_SEARCH_ENTRY(list->search_entry),
+ GTK_WIDGET(list));
}
static void
@@ -340,7 +348,7 @@
gtk_widget_class_set_template_from_resource(
widget_class,
- "/im/pidgin/Pidgin3/ContactList/widget.ui"
+ "/im/pidgin/Pidgin3/contactlist.ui"
);
gtk_widget_class_bind_template_child(widget_class, PidginContactList,
--- a/pidgin/pidgininfopane.h Tue Jan 23 00:31:44 2024 -0600
+++ b/pidgin/pidgininfopane.h Tue Jan 23 00:45:08 2024 -0600
@@ -120,7 +120,8 @@
*
* Gets the widget that is being displayed at the end of @pane.
*
- * Returns: (nullable): The child widget or %NULL if one is not set.
+ * Returns: (transfer none) (nullable): The child widget or %NULL if one is not
+ * set.
*
* Since: 3.0
*/
--- a/pidgin/resources/ContactList/widget.ui Tue Jan 23 00:31:44 2024 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +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 domain="pidgin">
- <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="PidginContactList" parent="GtkBox">
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkSearchBar" id="search_bar">
- <property name="key-capture-widget">PidginContactList</property>
- <property name="show-close-button">1</property>
- <child>
- <object class="GtkSearchEntry" id="search_entry">
- <signal name="search-changed" handler="pidgin_contact_list_search_changed_cb"/>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkListView">
- <property name="hexpand">1</property>
- <property name="vexpand">1</property>
- <property name="factory">
- <object class="GtkBuilderListItemFactory">
- <property name="resource">/im/pidgin/Pidgin3/contactlistitem.ui</property>
- </object>
- </property>
- <property name="model">
- <object class="GtkSingleSelection">
- <property name="autoselect">1</property>
- <property name="model">
- <object class="GtkFilterListModel" id="filter_model">
- <property name="incremental">0</property>
- <property name="filter">
- <object class="GtkEveryFilter">
- <child>
- <object class="GtkCustomFilter" id="account_connected_filter"/>
- </child>
- <child>
- <object class="GtkCustomFilter" id="search_filter"/>
- </child>
- </object>
- </property>
- </object>
- </property>
- </object>
- </property>
- <signal name="activate" handler="pidgin_contact_list_activate_cb"/>
- </object>
- </child>
- </template>
-</interface>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/contactlist.ui Tue Jan 23 00:45:08 2024 -0600
@@ -0,0 +1,79 @@
+<?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 domain="pidgin">
+ <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="PidginContactList" parent="GtkBox">
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="PidginInfoPane">
+ <property name="title" translatable="yes">Contacts</property>
+ <property name="child">
+ <object class="GtkBox">
+ <property name="margin-end">6</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkSearchEntry" id="search_entry">
+ <property name="placeholder-text" translatable="yes">Search</property>
+ <signal name="search-changed" handler="pidgin_contact_list_search_changed_cb"/>
+ </object>
+ </child>
+ </object>
+ </property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListView">
+ <property name="hexpand">1</property>
+ <property name="vexpand">1</property>
+ <property name="factory">
+ <object class="GtkBuilderListItemFactory">
+ <property name="resource">/im/pidgin/Pidgin3/contactlistitem.ui</property>
+ </object>
+ </property>
+ <property name="model">
+ <object class="GtkSingleSelection">
+ <property name="autoselect">1</property>
+ <property name="model">
+ <object class="GtkFilterListModel" id="filter_model">
+ <property name="incremental">0</property>
+ <property name="filter">
+ <object class="GtkEveryFilter">
+ <child>
+ <object class="GtkCustomFilter" id="account_connected_filter"/>
+ </child>
+ <child>
+ <object class="GtkCustomFilter" id="search_filter"/>
+ </child>
+ </object>
+ </property>
+ </object>
+ </property>
+ </object>
+ </property>
+ <signal name="activate" handler="pidgin_contact_list_activate_cb"/>
+ </object>
+ </child>
+ </template>
+</interface>
--- a/pidgin/resources/pidgin.gresource.xml Tue Jan 23 00:31:44 2024 -0600
+++ b/pidgin/resources/pidgin.gresource.xml Tue Jan 23 00:45:08 2024 -0600
@@ -12,7 +12,6 @@
<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">ContactList/widget.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Debug/debug.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Display/window.ui</file>
<file compressed="true" preprocess="xml-stripblanks">Keypad/keypad.ui</file>
@@ -39,6 +38,7 @@
<file compressed="true" preprocess="xml-stripblanks">gtk/menus.ui</file>
<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">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>
--- a/po/POTFILES.in Tue Jan 23 00:31:44 2024 -0600
+++ b/po/POTFILES.in Tue Jan 23 00:45:08 2024 -0600
@@ -311,6 +311,7 @@
pidgin/resources/Xfer/xfer.ui
pidgin/resources/gtk/menus.ui
pidgin/resources/account-row.ui
+pidgin/resources/contactlist.ui
pidgin/resources/contactlistitem.ui
pidgin/resources/infopane.ui
pidgin/win32/gtkwin32dep.c