Fri, 10 Jun 2022 03:37:33 -0500
Rename PidginContactList to PidginContactListWindow.
This is necessary as we want to use PidginContactList as the widget name of the
actual contact list widget.
Testing Done:
Verified that the contact list displayed properly.
Bugs closed: PIDGIN-17629
Reviewed at https://reviews.imfreedom.org/r/1498/
| pidgin/gtkblist.c | file | annotate | diff | comparison | revisions | |
| pidgin/meson.build | file | annotate | diff | comparison | revisions | |
| pidgin/pidgincontactlist.c | file | annotate | diff | comparison | revisions | |
| pidgin/pidgincontactlist.h | file | annotate | diff | comparison | revisions | |
| pidgin/pidgincontactlistwindow.c | file | annotate | diff | comparison | revisions | |
| pidgin/pidgincontactlistwindow.h | file | annotate | diff | comparison | revisions | |
| pidgin/resources/BuddyList/window.ui | file | annotate | diff | comparison | revisions | |
| po/POTFILES.in | file | annotate | diff | comparison | revisions |
--- a/pidgin/gtkblist.c Thu Jun 09 03:12:46 2022 -0500 +++ b/pidgin/gtkblist.c Fri Jun 10 03:37:33 2022 -0500 @@ -42,7 +42,7 @@ #include "pidgin/pidginactiongroup.h" #include "pidgin/pidgincellrendererexpander.h" #include "pidgin/pidginclosebutton.h" -#include "pidgin/pidgincontactlist.h" +#include "pidgin/pidgincontactlistwindow.h" #include "pidgin/pidgincore.h" #include "pidgin/pidgindebug.h" #include "pidgin/pidginmooddialog.h" @@ -3739,7 +3739,7 @@ gtkblist = PIDGIN_BUDDY_LIST(list); priv = pidgin_buddy_list_get_instance_private(gtkblist); - gtkblist->window = pidgin_contact_list_new(); + gtkblist->window = pidgin_contact_list_window_new(); g_signal_connect(G_OBJECT(gtkblist->window), "focus-in-event", G_CALLBACK(blist_focus_cb), gtkblist); g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event", @@ -3748,7 +3748,7 @@ /* the main vbox is already packed and shown via glade, we just need a * reference to it to pack the rest of our widgets here. */ - gtkblist->vbox = pidgin_contact_list_get_vbox(PIDGIN_CONTACT_LIST(gtkblist->window)); + gtkblist->vbox = pidgin_contact_list_window_get_vbox(PIDGIN_CONTACT_LIST_WINDOW(gtkblist->window)); g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL); g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL); @@ -5258,7 +5258,7 @@ GMenu *menu = NULL; GList *l; - if(gtkblist == NULL || !PIDGIN_IS_CONTACT_LIST(gtkblist->window)) { + if(gtkblist == NULL || !PIDGIN_IS_CONTACT_LIST_WINDOW(gtkblist->window)) { return; } @@ -5286,7 +5286,7 @@ } /* replace the old submenu with a new one */ - sort_item = pidgin_contact_list_get_menu_sort_item(PIDGIN_CONTACT_LIST(gtkblist->window)); + sort_item = pidgin_contact_list_window_get_menu_sort_item(PIDGIN_CONTACT_LIST_WINDOW(gtkblist->window)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(sort_item), gtk_menu_new_from_model(G_MENU_MODEL(menu))); g_object_unref(menu);
--- a/pidgin/meson.build Thu Jun 09 03:12:46 2022 -0500 +++ b/pidgin/meson.build Fri Jun 10 03:37:33 2022 -0500 @@ -35,7 +35,7 @@ 'pidgincolor.c', 'pidgincommands.c', 'pidginconversationwindow.c', - 'pidgincontactlist.c', + 'pidgincontactlistwindow.c', 'pidgindebug.c', 'pidgindialog.c', 'pidginiconname.c', @@ -108,7 +108,7 @@ 'pidginclosebutton.h', 'pidgincolor.h', 'pidginconversationwindow.h', - 'pidgincontactlist.h', + 'pidgincontactlistwindow.h', 'pidgincore.h', 'pidgindialog.h', 'pidgindebug.h',
--- a/pidgin/pidgincontactlist.c Thu Jun 09 03:12:46 2022 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +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 "pidgincontactlist.h" - -#include "pidginactiongroup.h" - -struct _PidginContactList { - GtkApplicationWindow parent; - - GtkWidget *vbox; - - GtkWidget *menu_bar; - GtkWidget *sort_buddies; - - GtkWidget *accounts; - GtkWidget *accounts_menu; -}; - -G_DEFINE_TYPE(PidginContactList, pidgin_contact_list, - GTK_TYPE_APPLICATION_WINDOW) - -/****************************************************************************** - * GObject Implementation - *****************************************************************************/ -static void -pidgin_contact_list_init(PidginContactList *contact_list) { - GSimpleActionGroup *group = NULL; - - gtk_widget_init_template(GTK_WIDGET(contact_list)); - - gtk_window_set_application(GTK_WINDOW(contact_list), - GTK_APPLICATION(g_application_get_default())); - - group = pidgin_action_group_new(); - gtk_widget_insert_action_group(GTK_WIDGET(contact_list), "blist", - G_ACTION_GROUP(group)); - - gtk_menu_item_set_submenu(GTK_MENU_ITEM(contact_list->accounts), - contact_list->accounts_menu); -} - -static void -pidgin_contact_list_class_init(PidginContactListClass *klass) { - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); - - gtk_widget_class_set_template_from_resource( - widget_class, - "/im/pidgin/Pidgin3/BuddyList/window.ui" - ); - - gtk_widget_class_bind_template_child(widget_class, PidginContactList, vbox); - - gtk_widget_class_bind_template_child(widget_class, PidginContactList, - menu_bar); - gtk_widget_class_bind_template_child(widget_class, PidginContactList, - sort_buddies); - gtk_widget_class_bind_template_child(widget_class, PidginContactList, - accounts); - gtk_widget_class_bind_template_child(widget_class, PidginContactList, - accounts_menu); -} - -/****************************************************************************** - * Public API - *****************************************************************************/ -GtkWidget * -pidgin_contact_list_new(void) { - return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CONTACT_LIST, NULL)); -} - -GtkWidget * -pidgin_contact_list_get_vbox(PidginContactList *contact_list) { - g_return_val_if_fail(PIDGIN_IS_CONTACT_LIST(contact_list), NULL); - - return contact_list->vbox; -} - -GtkWidget * -pidgin_contact_list_get_menu_sort_item(PidginContactList *contact_list) { - g_return_val_if_fail(PIDGIN_IS_CONTACT_LIST(contact_list), NULL); - - return contact_list->sort_buddies; -}
--- a/pidgin/pidgincontactlist.h Thu Jun 09 03:12:46 2022 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +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_CONTACT_LIST_H -#define PIDGIN_CONTACT_LIST_H - -#include <glib.h> - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - - -/** - * PidginContactList: - * - * #PidginContactList is a transitional widget as we slowly migrate it into the - * conversation window to make a single window application. - * - * Since: 3.0.0 - */ - -#define PIDGIN_TYPE_CONTACT_LIST (pidgin_contact_list_get_type()) -G_DECLARE_FINAL_TYPE(PidginContactList, pidgin_contact_list, PIDGIN, - CONTACT_LIST, GtkApplicationWindow) - -/** - * pidgin_contact_list_new: - * - * Creates a new #PidginContactList instance. - * - * Returns: (transfer full): The new #PidginContactList instance. - * - * Since: 3.0.0 - */ -GtkWidget *pidgin_contact_list_new(void); - -/** - * pidgin_contact_list_get_vbox: - * @contact_list: The #PidginContactList instance. - * - * Gets the main vbox for @contact_list. - * - * Returns: (transfer none): The main vbox of @contact_list. - * - * Since: 3.0.0 - */ -GtkWidget *pidgin_contact_list_get_vbox(PidginContactList *contact_list); - -/** - * pidgin_contact_list_get_menu_sort_item: - * @contact_list: The #PidginContactList instance. - * - * Returns the sort menu item from the menu of @contact_list. - * - * Returns: (transfer none): The sort menu item from the menu of @contact_list. - * - * Since: 3.0.0 - */ -GtkWidget *pidgin_contact_list_get_menu_sort_item(PidginContactList *contact_list); - -/** - * pidgin_contact_list_get_menu_tray: - * @contact_list: The #PidginContactList instance. - * - * Gets the #PidginMenuTray instance from the menu of @contact_list. - * - * Returns: (transfer none): The #PidginMenuTray from the menu of - * @contact_list. - * - * Since: 3.0.0 - */ -GtkWidget *pidgin_contact_list_get_menu_tray(PidginContactList *contact_list); - -G_END_DECLS - -#endif /* PIDGIN_CONTACT_LIST_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/pidgincontactlistwindow.c Fri Jun 10 03:37:33 2022 -0500 @@ -0,0 +1,103 @@ +/* + * 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 "pidgincontactlistwindow.h" + +#include "pidginactiongroup.h" + +struct _PidginContactListWindow { + GtkApplicationWindow parent; + + GtkWidget *vbox; + + GtkWidget *menu_bar; + GtkWidget *sort_buddies; + + GtkWidget *accounts; + GtkWidget *accounts_menu; +}; + +G_DEFINE_TYPE(PidginContactListWindow, pidgin_contact_list_window, + GTK_TYPE_APPLICATION_WINDOW) + +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ +static void +pidgin_contact_list_window_init(PidginContactListWindow *contact_list) { + GSimpleActionGroup *group = NULL; + + gtk_widget_init_template(GTK_WIDGET(contact_list)); + + gtk_window_set_application(GTK_WINDOW(contact_list), + GTK_APPLICATION(g_application_get_default())); + + group = pidgin_action_group_new(); + gtk_widget_insert_action_group(GTK_WIDGET(contact_list), "blist", + G_ACTION_GROUP(group)); + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(contact_list->accounts), + contact_list->accounts_menu); +} + +static void +pidgin_contact_list_window_class_init(PidginContactListWindowClass *klass) { + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + + gtk_widget_class_set_template_from_resource( + widget_class, + "/im/pidgin/Pidgin3/BuddyList/window.ui" + ); + + gtk_widget_class_bind_template_child(widget_class, PidginContactListWindow, + vbox); + gtk_widget_class_bind_template_child(widget_class, PidginContactListWindow, + menu_bar); + gtk_widget_class_bind_template_child(widget_class, PidginContactListWindow, + sort_buddies); + gtk_widget_class_bind_template_child(widget_class, PidginContactListWindow, + accounts); + gtk_widget_class_bind_template_child(widget_class, PidginContactListWindow, + accounts_menu); +} + +/****************************************************************************** + * Public API + *****************************************************************************/ +GtkWidget * +pidgin_contact_list_window_new(void) { + return g_object_new(PIDGIN_TYPE_CONTACT_LIST_WINDOW, NULL); +} + +GtkWidget * +pidgin_contact_list_window_get_vbox(PidginContactListWindow *window) { + g_return_val_if_fail(PIDGIN_IS_CONTACT_LIST_WINDOW(window), NULL); + + return window->vbox; +} + +GtkWidget * +pidgin_contact_list_window_get_menu_sort_item(PidginContactListWindow *window) { + g_return_val_if_fail(PIDGIN_IS_CONTACT_LIST_WINDOW(window), NULL); + + return window->sort_buddies; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/pidgincontactlistwindow.h Fri Jun 10 03:37:33 2022 -0500 @@ -0,0 +1,99 @@ +/* + * 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_CONTACT_LIST_WINDOW_H +#define PIDGIN_CONTACT_LIST_WINDOW_H + +#include <glib.h> + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + + +/** + * PidginContactListWindow: + * + * #PidginContactListWindow is a transitional widget as we slowly migrate it + * into the conversation window to make a single window application. + * + * Since: 3.0.0 + */ + +#define PIDGIN_TYPE_CONTACT_LIST_WINDOW (pidgin_contact_list_window_get_type()) +G_DECLARE_FINAL_TYPE(PidginContactListWindow, pidgin_contact_list_window, + PIDGIN, CONTACT_LIST_WINDOW, GtkApplicationWindow) + +/** + * pidgin_contact_list_window_new: + * + * Creates a new #PidginContactListWindow instance. + * + * Returns: (transfer full): The new #PidginContactListWindow instance. + * + * Since: 3.0.0 + */ +GtkWidget *pidgin_contact_list_window_new(void); + +/** + * pidgin_contact_list_window_get_vbox: + * @window: The #PidginContactListWindow instance. + * + * Gets the main vbox for @contact_list. + * + * Returns: (transfer none): The main vbox of @window. + * + * Since: 3.0.0 + */ +GtkWidget *pidgin_contact_list_window_get_vbox(PidginContactListWindow *window); + +/** + * pidgin_contact_list_window_get_menu_sort_item: + * @window: The #PidginContactListWindow instance. + * + * Returns the sort menu item from the menu of @window. + * + * Returns: (transfer none): The sort menu item from the menu of @window. + * + * Since: 3.0.0 + */ +GtkWidget *pidgin_contact_list_window_get_menu_sort_item(PidginContactListWindow *window); + +/** + * pidgin_contact_list_window_get_menu_tray: + * @window: The #PidginContactListWindow instance. + * + * Gets the #PidginMenuTray instance from the menu of @window. + * + * Returns: (transfer none): The #PidginMenuTray from the menu of @window. + * + * Since: 3.0.0 + */ +GtkWidget *pidgin_contact_list_window_get_menu_tray(PidginContactListWindow *window); + +G_END_DECLS + +#endif /* PIDGIN_CONTACT_LIST_WINDOW_H */
--- a/pidgin/resources/BuddyList/window.ui Thu Jun 09 03:12:46 2022 -0500 +++ b/pidgin/resources/BuddyList/window.ui Fri Jun 10 03:37:33 2022 -0500 @@ -26,7 +26,7 @@ <!-- interface-name Pidgin --> <!-- interface-description Internet Messenger --> <!-- interface-copyright Pidgin Developers <devel@pidgin.im> --> - <template class="PidginContactList" parent="GtkApplicationWindow"> + <template class="PidginContactListWindow" parent="GtkApplicationWindow"> <property name="can-focus">False</property> <property name="title" translatable="yes">Contact List</property> <property name="role">contact_list</property>
--- a/po/POTFILES.in Thu Jun 09 03:12:46 2022 -0500 +++ b/po/POTFILES.in Fri Jun 10 03:37:33 2022 -0500 @@ -349,7 +349,7 @@ pidgin/pidginclosebutton.c pidgin/pidgincolor.c pidgin/pidgincommands.c -pidgin/pidgincontactlist.c +pidgin/pidgincontactlistwindow.c pidgin/pidginconversationwindow.c pidgin/pidgindebug.c pidgin/pidgindialog.c