pidgin/pidgincontactlistwindow.c

Tue, 22 Feb 2022 19:38:45 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 22 Feb 2022 19:38:45 -0600
branch
gtk4
changeset 41527
4dff8cd4e9ea
parent 41497
00159335ff65
child 41582
4ee4a8ddc190
permissions
-rw-r--r--

Convert PidginConversationWindow to GTK4

Testing Done:
Compiled and verified all the warnings/errors for `pidginconversationwindow.c` were gone.

Reviewed at https://reviews.imfreedom.org/r/1310/

40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
23 #include "pidgincontactlistwindow.h"
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "pidginactiongroup.h"
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
27 struct _PidginContactListWindow {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 GtkApplicationWindow parent;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 GtkWidget *vbox;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 };
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
33 G_DEFINE_TYPE(PidginContactListWindow, pidgin_contact_list_window,
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 GTK_TYPE_APPLICATION_WINDOW)
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 /******************************************************************************
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 * GObject Implementation
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 *****************************************************************************/
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 static void
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
40 pidgin_contact_list_window_init(PidginContactListWindow *contact_list) {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 GSimpleActionGroup *group = NULL;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 gtk_widget_init_template(GTK_WIDGET(contact_list));
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 gtk_window_set_application(GTK_WINDOW(contact_list),
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 GTK_APPLICATION(g_application_get_default()));
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 group = pidgin_action_group_new();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 gtk_widget_insert_action_group(GTK_WIDGET(contact_list), "blist",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 G_ACTION_GROUP(group));
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 static void
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
54 pidgin_contact_list_window_class_init(PidginContactListWindowClass *klass) {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 gtk_widget_class_set_template_from_resource(
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40728
diff changeset
59 "/im/pidgin/Pidgin3/BuddyList/window.ui"
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 );
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
62 gtk_widget_class_bind_template_child(widget_class, PidginContactListWindow,
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
63 vbox);
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 /******************************************************************************
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 * Public API
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 *****************************************************************************/
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 GtkWidget *
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
70 pidgin_contact_list_window_new(void) {
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
71 return g_object_new(PIDGIN_TYPE_CONTACT_LIST_WINDOW, NULL);
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 GtkWidget *
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
75 pidgin_contact_list_window_get_vbox(PidginContactListWindow *window) {
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
76 g_return_val_if_fail(PIDGIN_IS_CONTACT_LIST_WINDOW(window), NULL);
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
41431
d0deb0cc4082 Rename PidginContactList to PidginContactListWindow.
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
78 return window->vbox;
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 }

mercurial