Fri, 04 Nov 2022 23:41:10 -0500
Take advantage of f-strings in Meson
They were added in 0.58, which is our minimum version
https://mesonbuild.com/Syntax.html#format-strings
Testing Done:
Reconfigured, ran tests, and checked a few generated files to be sure they looked okay.
Reviewed at https://reviews.imfreedom.org/r/2033/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 8113 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
8146
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8143
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8143
diff
changeset
|
5 | * source distribution. |
| 8113 | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18122
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8113 | 20 | */ |
| 21 | ||
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
22 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
23 | |
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
24 | #include <gtk/gtk.h> |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
25 | |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
26 | #include <purple.h> |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
27 | |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
28 | #include "gtkroomlist.h" |
|
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
29 | |
|
39785
aa7e3b71802d
Split pidgin_account_option_menu into its own files.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
30 | #include "pidginaccountchooser.h" |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
31 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
32 | #define PIDGIN_TYPE_ROOMLIST_DIALOG (pidgin_roomlist_dialog_get_type()) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
33 | G_DECLARE_FINAL_TYPE(PidginRoomlistDialog, pidgin_roomlist_dialog, PIDGIN, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
34 | ROOMLIST_DIALOG, GtkDialog) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
35 | |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
36 | #define PIDGIN_ROOMLIST_UI_DATA "pidgin-ui" |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
37 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
38 | enum { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
39 | RESPONSE_STOP = 0, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
40 | RESPONSE_LIST, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
41 | RESPONSE_ADD, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
42 | RESPONSE_JOIN, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
43 | }; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
44 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
45 | struct _PidginRoomlistDialog { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
46 | GtkDialog parent; |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
47 | |
| 8113 | 48 | GtkWidget *account_widget; |
| 49 | GtkWidget *progress; | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
50 | GtkWidget *tree; |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
51 | GtkTreeSelection *tree_selection; |
| 8113 | 52 | |
| 8199 | 53 | GtkWidget *stop_button; |
| 8113 | 54 | GtkWidget *list_button; |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
55 | GtkWidget *add_button; |
| 8199 | 56 | GtkWidget *join_button; |
| 8113 | 57 | GtkWidget *close_button; |
| 58 | ||
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
59 | GtkWidget *popover; |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
60 | |
| 15884 | 61 | PurpleAccount *account; |
| 62 | PurpleRoomlist *roomlist; | |
| 8230 | 63 | |
| 64 | gboolean pg_needs_pulse; | |
| 65 | guint pg_update_to; | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
66 | }; |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
67 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
68 | G_DEFINE_TYPE(PidginRoomlistDialog, pidgin_roomlist_dialog, GTK_TYPE_DIALOG) |
| 14649 | 69 | |
|
39556
622bf98df0ac
Remove unnecessary struct tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
70 | typedef struct { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
71 | PidginRoomlistDialog *dialog; |
| 14649 | 72 | GtkTreeStore *model; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
73 | } PidginRoomlist; |
| 8113 | 74 | |
| 75 | enum { | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
76 | ROOM_COLUMN = 0, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
77 | NAME_COLUMN, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
78 | DESCRIPTION_COLUMN, |
| 8113 | 79 | NUM_OF_COLUMNS, |
| 80 | }; | |
| 81 | ||
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
82 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
83 | /****************************************************************************** |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
84 | * Helpers |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
85 | *****************************************************************************/ |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
86 | static PurpleRoomlistRoom * |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
87 | pidgin_roomlist_get_selected(PidginRoomlistDialog *dialog) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
88 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
89 | GtkTreeIter iter; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
90 | GtkTreeModel *model = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
91 | PurpleRoomlistRoom *room = NULL; |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
92 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
93 | if(gtk_tree_selection_get_selected(dialog->tree_selection, &model, &iter)) { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
94 | gtk_tree_model_get(model, &iter, ROOM_COLUMN, &room, -1); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
95 | } |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
96 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
97 | return room; |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
98 | } |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
99 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
100 | static void |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
101 | pidgin_roomlist_close(PidginRoomlistDialog *dialog) |
| 8113 | 102 | { |
| 15884 | 103 | if (dialog->roomlist && purple_roomlist_get_in_progress(dialog->roomlist)) |
| 104 | purple_roomlist_cancel_get_list(dialog->roomlist); | |
| 8199 | 105 | |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
106 | if (dialog->pg_update_to > 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37879
diff
changeset
|
107 | g_source_remove(dialog->pg_update_to); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
108 | |
| 8230 | 109 | if (dialog->roomlist) { |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
110 | PidginRoomlist *rl = NULL; |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
111 | |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
112 | rl = g_object_get_data(G_OBJECT(dialog->roomlist), |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
113 | PIDGIN_ROOMLIST_UI_DATA); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
114 | |
|
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
115 | if (dialog->pg_update_to > 0) |
| 8230 | 116 | /* yes, that's right, unref it twice. */ |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
117 | g_object_unref(dialog->roomlist); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
118 | |
|
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
119 | if (rl) |
|
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
120 | rl->dialog = NULL; |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
121 | g_object_unref(dialog->roomlist); |
| 8230 | 122 | } |
| 123 | ||
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
124 | dialog->progress = NULL; |
| 8113 | 125 | } |
| 126 | ||
|
39787
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
127 | static void |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
128 | pidgin_roomlist_start_listing(PidginRoomlistDialog *dialog) |
| 8113 | 129 | { |
| 15884 | 130 | PurpleConnection *gc; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
131 | PidginRoomlist *rl; |
| 8113 | 132 | |
| 15884 | 133 | gc = purple_account_get_connection(dialog->account); |
| 8113 | 134 | if (!gc) |
| 135 | return; | |
| 136 | ||
| 8199 | 137 | if (dialog->roomlist != NULL) { |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
138 | rl = g_object_get_data(G_OBJECT(dialog->roomlist), |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
139 | PIDGIN_ROOMLIST_UI_DATA); |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
140 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
141 | g_clear_object(&rl->model); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
142 | g_object_unref(dialog->roomlist); |
| 8199 | 143 | } |
| 144 | ||
| 15884 | 145 | dialog->roomlist = purple_roomlist_get_list(gc); |
| 9159 | 146 | if (!dialog->roomlist) |
| 147 | return; | |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
148 | g_object_ref(dialog->roomlist); |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
149 | |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
150 | rl = g_object_get_data(G_OBJECT(dialog->roomlist), |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
151 | PIDGIN_ROOMLIST_UI_DATA); |
| 8113 | 152 | rl->dialog = dialog; |
| 8199 | 153 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
154 | gtk_widget_set_sensitive(dialog->account_widget, FALSE); |
| 8199 | 155 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
156 | gtk_tree_view_set_model(GTK_TREE_VIEW(dialog->tree), |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
157 | GTK_TREE_MODEL(rl->model)); |
| 8199 | 158 | |
| 15884 | 159 | /* some protocols (not bundled with libpurple) finish getting their |
| 15350 | 160 | * room list immediately */ |
| 15884 | 161 | if(purple_roomlist_get_in_progress(dialog->roomlist)) { |
| 15350 | 162 | gtk_widget_set_sensitive(dialog->stop_button, TRUE); |
| 163 | gtk_widget_set_sensitive(dialog->list_button, FALSE); | |
| 164 | } else { | |
| 165 | gtk_widget_set_sensitive(dialog->stop_button, FALSE); | |
| 166 | gtk_widget_set_sensitive(dialog->list_button, TRUE); | |
| 167 | } | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
168 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
| 8199 | 169 | gtk_widget_set_sensitive(dialog->join_button, FALSE); |
| 8113 | 170 | } |
| 171 | ||
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
172 | static void |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
173 | pidgin_roomlist_stop_listing(PidginRoomlistDialog *dialog) |
| 8113 | 174 | { |
| 15884 | 175 | purple_roomlist_cancel_get_list(dialog->roomlist); |
| 8199 | 176 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
177 | gtk_widget_set_sensitive(dialog->account_widget, TRUE); |
| 8199 | 178 | |
| 179 | gtk_widget_set_sensitive(dialog->stop_button, FALSE); | |
| 180 | gtk_widget_set_sensitive(dialog->list_button, TRUE); | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
181 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
| 8199 | 182 | gtk_widget_set_sensitive(dialog->join_button, FALSE); |
| 8113 | 183 | } |
| 184 | ||
| 8199 | 185 | static void |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
186 | pidgin_roomlist_add_to_blist(PidginRoomlistDialog *dialog) |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
187 | { |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
188 | char *name = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
189 | PurpleAccount *account = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
190 | PurpleConnection *gc = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
191 | PurpleProtocol *protocol = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
192 | PurpleRoomlistRoom *room = NULL; |
| 8199 | 193 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
194 | account = purple_roomlist_get_account(dialog->roomlist); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
195 | gc = purple_account_get_connection(account); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
196 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
197 | room = pidgin_roomlist_get_selected(dialog); |
| 8199 | 198 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
199 | g_return_if_fail(room != NULL); |
| 15185 | 200 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
41012
diff
changeset
|
201 | if(gc != NULL) { |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
202 | protocol = purple_connection_get_protocol(gc); |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
41012
diff
changeset
|
203 | } |
| 15185 | 204 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
41012
diff
changeset
|
205 | if(protocol != NULL && PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, room_serialize)) { |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
41012
diff
changeset
|
206 | name = purple_protocol_roomlist_room_serialize(PURPLE_PROTOCOL_ROOMLIST(protocol), |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
207 | room); |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
41012
diff
changeset
|
208 | } else { |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
209 | name = g_strdup(purple_roomlist_room_get_name(room)); |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
41012
diff
changeset
|
210 | } |
| 15185 | 211 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
212 | purple_blist_request_add_chat(account, NULL, NULL, name); |
| 15185 | 213 | |
| 214 | g_free(name); | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
215 | } |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
216 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
217 | static gboolean |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
218 | _search_func(GtkTreeModel *model, gint column, const gchar *key, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
219 | GtkTreeIter *iter, gpointer search_data) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
220 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
221 | gboolean result; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
222 | gchar *name, *fold, *fkey; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
223 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
224 | gtk_tree_model_get(model, iter, column, &name, -1); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
225 | fold = g_utf8_casefold(name, -1); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
226 | fkey = g_utf8_casefold(key, -1); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
227 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
228 | result = (g_strstr_len(fold, strlen(fold), fkey) == NULL); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
229 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
230 | g_free(fold); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
231 | g_free(fkey); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
232 | g_free(name); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
233 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
234 | return result; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
235 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
236 | |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
237 | static void |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
238 | pidgin_roomlist_join(PidginRoomlistDialog *dialog) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
239 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
240 | PurpleRoomlistRoom *room = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
241 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
242 | room = pidgin_roomlist_get_selected(dialog); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
243 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
244 | if(room != NULL) { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
245 | purple_roomlist_join_room(dialog->roomlist, room); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
246 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
247 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
248 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
249 | /****************************************************************************** |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
250 | * Actions |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
251 | *****************************************************************************/ |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
252 | static void |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
253 | pidgin_roomlist_add_to_blist_cb(G_GNUC_UNUSED GSimpleAction *action, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
254 | G_GNUC_UNUSED GVariant *parameter, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
255 | gpointer data) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
256 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
257 | pidgin_roomlist_add_to_blist(data); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
258 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
259 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
260 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
261 | static void |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
262 | pidgin_roomlist_join_cb(GSimpleAction *action, GVariant *parameter, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
263 | gpointer data) |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
264 | { |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
265 | pidgin_roomlist_join(data); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
266 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
267 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
268 | static GActionEntry actions[] = { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
269 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
270 | .name = "add", |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
271 | .activate = pidgin_roomlist_add_to_blist_cb, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
272 | }, { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
273 | .name = "join", |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
274 | .activate = pidgin_roomlist_join_cb, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
275 | }, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
276 | }; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
277 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
278 | /****************************************************************************** |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
279 | * Callbacks |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
280 | *****************************************************************************/ |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
281 | static void |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
282 | pidgin_roomlist_response_cb(GtkDialog *gtk_dialog, gint response_id, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
283 | gpointer data) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
284 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
285 | PidginRoomlistDialog *dialog = PIDGIN_ROOMLIST_DIALOG(gtk_dialog); |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
286 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
287 | switch(response_id) { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
288 | case RESPONSE_STOP: |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
289 | pidgin_roomlist_stop_listing(dialog); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
290 | break; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
291 | case RESPONSE_LIST: |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
292 | pidgin_roomlist_start_listing(dialog); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
293 | break; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
294 | case RESPONSE_ADD: |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
295 | pidgin_roomlist_add_to_blist(dialog); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
296 | break; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
297 | case RESPONSE_JOIN: |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
298 | pidgin_roomlist_join(dialog); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
299 | break; |
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
300 | case GTK_RESPONSE_CLOSE: |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
301 | case GTK_RESPONSE_DELETE_EVENT: |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
302 | gtk_window_destroy(GTK_WINDOW(gtk_dialog)); |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
303 | break; |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
304 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
305 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
306 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
307 | static gboolean |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
308 | close_request_cb(GtkWidget *w, G_GNUC_UNUSED gpointer d) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
309 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
310 | pidgin_roomlist_close(PIDGIN_ROOMLIST_DIALOG(w)); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
311 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
312 | gtk_window_destroy(GTK_WINDOW(w)); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
313 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
314 | return TRUE; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
315 | } |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
316 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
317 | static void |
|
41854
c1d7e7445b0f
Avoid GtkComboBox-isms with PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41840
diff
changeset
|
318 | dialog_select_account_cb(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, |
|
c1d7e7445b0f
Avoid GtkComboBox-isms with PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41840
diff
changeset
|
319 | gpointer data) |
|
c1d7e7445b0f
Avoid GtkComboBox-isms with PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41840
diff
changeset
|
320 | { |
|
c1d7e7445b0f
Avoid GtkComboBox-isms with PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41840
diff
changeset
|
321 | PidginRoomlistDialog *dialog = data; |
|
c1d7e7445b0f
Avoid GtkComboBox-isms with PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41840
diff
changeset
|
322 | PidginAccountChooser *chooser = PIDGIN_ACCOUNT_CHOOSER(obj); |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
323 | PurpleAccount *account = pidgin_account_chooser_get_selected(chooser); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
324 | gboolean change = (account != dialog->account); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
325 | dialog->account = account; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
326 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
327 | if (change && dialog->roomlist) { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
328 | PidginRoomlist *rl = NULL; |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
329 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
330 | rl = g_object_get_data(G_OBJECT(dialog->roomlist), |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
331 | PIDGIN_ROOMLIST_UI_DATA); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
332 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
333 | g_clear_object(&rl->model); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
334 | g_object_unref(dialog->roomlist); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
335 | dialog->roomlist = NULL; |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
336 | } |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
337 | } |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
338 | |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
339 | static void |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
340 | selection_changed_cb(GtkTreeSelection *selection, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
341 | PidginRoomlistDialog *dialog) |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
342 | { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
343 | gboolean found = FALSE; |
| 8113 | 344 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
345 | found = gtk_tree_selection_get_selected(selection, NULL, NULL); |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
346 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
347 | gtk_widget_set_sensitive(dialog->add_button, found); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
348 | gtk_widget_set_sensitive(dialog->join_button, found); |
| 8113 | 349 | } |
| 350 | ||
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
351 | static void |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
352 | row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
353 | gpointer data) |
| 8113 | 354 | { |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
355 | PidginRoomlistDialog *dialog = data; |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
356 | PidginRoomlist *grl = NULL; |
| 8113 | 357 | GtkTreeIter iter; |
| 15884 | 358 | PurpleRoomlistRoom *room; |
| 8113 | 359 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
360 | grl = g_object_get_data(G_OBJECT(dialog->roomlist), PIDGIN_ROOMLIST_UI_DATA); |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
361 | |
| 8113 | 362 | gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
363 | gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &room, -1); |
| 8113 | 364 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
365 | if(PURPLE_IS_ROOMLIST_ROOM(room)) { |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
366 | purple_roomlist_join_room(dialog->roomlist, room); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
367 | } |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
368 | |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
369 | g_clear_object(&room); |
| 8113 | 370 | } |
| 371 | ||
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
372 | static void |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
373 | room_click_cb(G_GNUC_UNUSED GtkGestureClick *self, gint n_press, gdouble x, |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
374 | gdouble y, gpointer data) |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
375 | { |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
376 | PidginRoomlistDialog *dialog = data; |
| 8113 | 377 | |
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
378 | if(n_press != 1) { |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
379 | return; |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
380 | } |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
381 | |
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
382 | if(!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(dialog->tree), (gint)x, |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
383 | (gint)y, NULL, NULL, NULL, NULL)) |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
384 | { |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
385 | return; |
|
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
386 | } |
| 8113 | 387 | |
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
388 | gtk_popover_set_pointing_to(GTK_POPOVER(dialog->popover), |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
389 | &(const GdkRectangle){(int)x, (int)y, 0, 0}); |
|
40943
5ba96262ca35
Drop icons from Room List popup menu.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40942
diff
changeset
|
390 | |
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
391 | gtk_popover_popup(GTK_POPOVER(dialog->popover)); |
| 8113 | 392 | } |
| 393 | ||
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
394 | static gboolean |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
395 | pidgin_roomlist_query_tooltip(GtkWidget *widget, int x, int y, |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
396 | gboolean keyboard_mode, GtkTooltip *tooltip, |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
397 | gpointer data) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
398 | { |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
399 | PidginRoomlistDialog *dialog = data; |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
400 | PidginRoomlist *grl = NULL; |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
401 | GtkTreePath *path = NULL; |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
402 | GtkTreeIter iter; |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
403 | gchar *name, *tmp; |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
404 | GString *tooltip_text = NULL; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
405 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
406 | grl = g_object_get_data(G_OBJECT(dialog->roomlist), PIDGIN_ROOMLIST_UI_DATA); |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
407 | |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
408 | if (keyboard_mode) { |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
409 | if (!gtk_tree_selection_get_selected(dialog->tree_selection, NULL, &iter)) { |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
410 | return FALSE; |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
411 | } |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
412 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(grl->model), &iter); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
413 | } else { |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
414 | gint bx, by; |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
415 | |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
416 | gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(widget), |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
417 | x, y, &bx, &by); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
418 | gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bx, by, &path, |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
419 | NULL, NULL, NULL); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
420 | if (path == NULL) { |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
421 | return FALSE; |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
422 | } |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
423 | |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
424 | if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path)) { |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
425 | gtk_tree_path_free(path); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
426 | return FALSE; |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
427 | } |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
428 | } |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
429 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
430 | tooltip_text = g_string_new(""); |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
431 | |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
432 | gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1); |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
433 | tmp = g_markup_escape_text(name, -1); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
434 | g_free(name); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
435 | g_string_append_printf( |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
436 | tooltip_text, "<span size='x-large' weight='bold'>%s</span>\n", tmp); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
437 | g_free(tmp); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
438 | |
|
40942
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
439 | gtk_tooltip_set_markup(tooltip, tooltip_text->str); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
440 | gtk_tree_view_set_tooltip_row(GTK_TREE_VIEW(widget), tooltip, path); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
441 | g_string_free(tooltip_text, TRUE); |
|
ff8ec7c55f5f
Use standard GTK tooltips for room list.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
442 | gtk_tree_path_free(path); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
443 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
444 | return TRUE; |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
445 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
446 | |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
447 | static gboolean |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
448 | account_filter_func(gpointer item, G_GNUC_UNUSED gpointer data) { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36424
diff
changeset
|
449 | PurpleProtocol *protocol = NULL; |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
450 | |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
451 | if(PURPLE_IS_ACCOUNT(item)) { |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
452 | PurpleAccount *account = PURPLE_ACCOUNT(item); |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
453 | PurpleConnection *conn = purple_account_get_connection(account); |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
454 | if(conn && PURPLE_CONNECTION_IS_CONNECTED(conn)) { |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
455 | protocol = purple_connection_get_protocol(conn); |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
456 | } |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
457 | } |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
458 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39556
diff
changeset
|
459 | return (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list)); |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
460 | } |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
461 | |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
462 | gboolean |
|
41840
fe350460fb1c
Remove C99-obsoleted constructs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
463 | pidgin_roomlist_is_showable(void) |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
464 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
465 | GList *c; |
| 15884 | 466 | PurpleConnection *gc; |
| 8113 | 467 | |
| 15884 | 468 | for (c = purple_connections_get_all(); c != NULL; c = c->next) { |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
469 | gc = c->data; |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
470 | |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
471 | if(account_filter_func(purple_connection_get_account(gc), NULL)) { |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
472 | return TRUE; |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
473 | } |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
474 | } |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
475 | |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
476 | return FALSE; |
| 8113 | 477 | } |
| 478 | ||
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
479 | static void |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
480 | pidgin_roomlist_dialog_class_init(PidginRoomlistDialogClass *klass) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
481 | { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
482 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
483 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
484 | gtk_widget_class_set_template_from_resource( |
|
41030
ec8b76f3bf0a
Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents:
41028
diff
changeset
|
485 | widget_class, "/im/pidgin/Pidgin3/Roomlist/roomlist.ui"); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
486 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
487 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
488 | account_widget); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
489 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
490 | tree); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
491 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
492 | tree_selection); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
493 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
494 | add_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
495 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
496 | close_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
497 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
498 | join_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
499 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
500 | list_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
501 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
502 | progress); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
503 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
504 | stop_button); |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
505 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
41599
450080e4726a
Fix up the roomlist to work in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41554
diff
changeset
|
506 | popover); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
507 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
508 | gtk_widget_class_bind_template_callback(widget_class, close_request_cb); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
509 | gtk_widget_class_bind_template_callback(widget_class, row_activated_cb); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
510 | gtk_widget_class_bind_template_callback(widget_class, room_click_cb); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
511 | gtk_widget_class_bind_template_callback(widget_class, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
512 | dialog_select_account_cb); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
513 | gtk_widget_class_bind_template_callback(widget_class, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
514 | selection_changed_cb); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
515 | gtk_widget_class_bind_template_callback(widget_class, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
516 | pidgin_roomlist_query_tooltip); |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
517 | gtk_widget_class_bind_template_callback(widget_class, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
518 | pidgin_roomlist_response_cb); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
519 | } |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
520 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
521 | static void |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
522 | pidgin_roomlist_dialog_init(PidginRoomlistDialog *self) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
523 | { |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
524 | GSimpleActionGroup *group = NULL; |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
525 | GtkCustomFilter *filter = NULL; |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
526 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
527 | gtk_widget_init_template(GTK_WIDGET(self)); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
528 | |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
529 | filter = gtk_custom_filter_new(account_filter_func, NULL, NULL); |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
530 | pidgin_account_chooser_set_filter( |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
531 | PIDGIN_ACCOUNT_CHOOSER(self->account_widget), |
|
41857
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
532 | GTK_FILTER(filter)); |
|
ff94f8ff8a70
Add a filter property to PidginAccountChooser
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41854
diff
changeset
|
533 | g_object_unref(filter); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
534 | |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
535 | gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(self->tree), |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
536 | _search_func, NULL, NULL); |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
537 | |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
538 | /* Now setup our actions. */ |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
539 | group = g_simple_action_group_new(); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
540 | g_action_map_add_action_entries(G_ACTION_MAP(group), actions, |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
541 | G_N_ELEMENTS(actions), self); |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
542 | gtk_widget_insert_action_group(GTK_WIDGET(self), "roomlist", |
|
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
543 | G_ACTION_GROUP(group)); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
544 | } |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
545 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
546 | static PidginRoomlistDialog * |
| 15884 | 547 | pidgin_roomlist_dialog_new_with_account(PurpleAccount *account) |
| 8113 | 548 | { |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
549 | PidginRoomlistDialog *dialog = NULL; |
|
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
550 | PidginAccountChooser *chooser = NULL; |
| 8113 | 551 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
552 | dialog = g_object_new(PIDGIN_TYPE_ROOMLIST_DIALOG, NULL); |
|
8937
b436e9cbd701
[gaim-migrate @ 9707]
Mark Doliner <markdoliner@pidgin.im>
parents:
8584
diff
changeset
|
553 | dialog->account = account; |
| 8113 | 554 | |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
555 | chooser = PIDGIN_ACCOUNT_CHOOSER(dialog->account_widget); |
|
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
556 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
557 | if (!account) { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
558 | /* This is normally NULL, and we normally don't care what the |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
559 | * first selected item is */ |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
560 | dialog->account = pidgin_account_chooser_get_selected(chooser); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
561 | } else { |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
562 | pidgin_account_chooser_set_selected(chooser, account); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
563 | } |
| 8199 | 564 | |
| 565 | /* show the dialog window and return the dialog */ | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
566 | gtk_widget_show(GTK_WIDGET(dialog)); |
| 8199 | 567 | |
| 8113 | 568 | return dialog; |
| 569 | } | |
| 570 | ||
| 15884 | 571 | void pidgin_roomlist_dialog_show_with_account(PurpleAccount *account) |
| 8352 | 572 | { |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
573 | PidginRoomlistDialog *dialog = pidgin_roomlist_dialog_new_with_account(account); |
| 8352 | 574 | |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
575 | pidgin_roomlist_start_listing(dialog); |
| 8352 | 576 | } |
| 577 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
578 | void pidgin_roomlist_dialog_show(void) |
| 8113 | 579 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
580 | pidgin_roomlist_dialog_new_with_account(NULL); |
| 8113 | 581 | } |
| 582 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
583 | static gboolean pidgin_progress_bar_pulse(gpointer data) |
| 8230 | 584 | { |
| 15884 | 585 | PurpleRoomlist *list = data; |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
586 | PidginRoomlist *rl = NULL; |
| 8230 | 587 | |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
588 | rl = g_object_get_data(G_OBJECT(list), PIDGIN_ROOMLIST_UI_DATA); |
| 8230 | 589 | if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) { |
|
13448
27832a91b988
[gaim-migrate @ 15822]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12896
diff
changeset
|
590 | if (rl && rl->dialog) |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
591 | rl->dialog->pg_update_to = 0; |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
592 | g_object_unref(list); |
| 8230 | 593 | return FALSE; |
| 594 | } | |
| 595 | ||
| 596 | gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress)); | |
| 597 | rl->dialog->pg_needs_pulse = FALSE; | |
| 598 | return TRUE; | |
| 599 | } | |
| 600 | ||
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
601 | static void |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
602 | pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) { |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
603 | PidginRoomlist *rl = NULL; |
| 8113 | 604 | GtkTreePath *path; |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
605 | GtkTreeIter iter; |
| 8113 | 606 | |
|
40898
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
607 | rl = g_object_get_data(G_OBJECT(list), PIDGIN_ROOMLIST_UI_DATA); |
|
06e5a2a8f49a
Replace purple_roomlist_[gs]et_ui_data with g_object_[gs]et_data
Gary Kramlich <grim@reaperworld.com>
parents:
40534
diff
changeset
|
608 | |
| 8113 | 609 | if (rl->dialog) { |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
610 | if (rl->dialog->pg_update_to == 0) { |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
611 | g_object_ref(list); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
612 | rl->dialog->pg_update_to = g_timeout_add(100, pidgin_progress_bar_pulse, list); |
| 8230 | 613 | gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress)); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
614 | } else |
| 8230 | 615 | rl->dialog->pg_needs_pulse = TRUE; |
| 8113 | 616 | } |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
617 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
618 | gtk_tree_store_append(rl->model, &iter, NULL); |
| 8113 | 619 | |
| 620 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter); | |
| 621 | ||
| 622 | gtk_tree_path_free(path); | |
| 623 | ||
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
624 | gtk_tree_store_set( |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
625 | rl->model, &iter, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
626 | ROOM_COLUMN, room, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
627 | NAME_COLUMN, purple_roomlist_room_get_name(room), |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
628 | DESCRIPTION_COLUMN, purple_roomlist_room_get_description(room), |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
629 | -1); |
| 8113 | 630 | } |
| 631 | ||
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
632 | static void |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
633 | pidgin_roomlist_in_progress(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
634 | gpointer data) |
| 8113 | 635 | { |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
636 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
637 | PidginRoomlist *rl = data; |
| 8113 | 638 | |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
639 | if (purple_roomlist_get_in_progress(list)) { |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
640 | if (rl->dialog->account_widget) { |
| 8199 | 641 | gtk_widget_set_sensitive(rl->dialog->account_widget, FALSE); |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
642 | } |
| 8199 | 643 | gtk_widget_set_sensitive(rl->dialog->stop_button, TRUE); |
| 644 | gtk_widget_set_sensitive(rl->dialog->list_button, FALSE); | |
| 8113 | 645 | } else { |
| 8230 | 646 | rl->dialog->pg_needs_pulse = FALSE; |
| 8113 | 647 | gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(rl->dialog->progress), 0.0); |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
648 | if (rl->dialog->account_widget) { |
| 8199 | 649 | gtk_widget_set_sensitive(rl->dialog->account_widget, TRUE); |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
650 | } |
| 8199 | 651 | gtk_widget_set_sensitive(rl->dialog->stop_button, FALSE); |
| 652 | gtk_widget_set_sensitive(rl->dialog->list_button, TRUE); | |
| 8113 | 653 | } |
| 654 | } | |
| 655 | ||
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
656 | static void |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
657 | pidgin_roomlist_new(PurpleRoomlist *list) |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
658 | { |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
659 | PidginRoomlist *rl = g_new0(PidginRoomlist, 1); |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
660 | |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
661 | g_object_set_data_full(G_OBJECT(list), PIDGIN_ROOMLIST_UI_DATA, rl, |
|
41554
49216e79a56b
Port PidginRoomlistDialog to GTK4
Belgin Știrbu <belginstirbu@hotmail.com>
parents:
41349
diff
changeset
|
662 | (GDestroyNotify)g_free); |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
663 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
664 | rl->model = gtk_tree_store_new(3, G_TYPE_OBJECT, G_TYPE_STRING, |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41030
diff
changeset
|
665 | G_TYPE_STRING); |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
666 | |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
667 | g_signal_connect(list, "notify::in-progress", |
|
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40956
diff
changeset
|
668 | G_CALLBACK(pidgin_roomlist_in_progress), rl); |
| 8113 | 669 | } |
| 670 | ||
| 15884 | 671 | static PurpleRoomlistUiOps ops = { |
|
41720
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41599
diff
changeset
|
672 | .show_with_account = pidgin_roomlist_dialog_show_with_account, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41599
diff
changeset
|
673 | .create = pidgin_roomlist_new, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41599
diff
changeset
|
674 | .add_room = pidgin_roomlist_add_room, |
| 8113 | 675 | }; |
| 676 | ||
| 677 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
678 | void pidgin_roomlist_init(void) |
| 8113 | 679 | { |
| 15884 | 680 | purple_roomlist_set_ui_ops(&ops); |
| 8113 | 681 | } |