Wed, 19 Jul 2023 23:29:37 -0500
Require GTK 4.10 and GLib 2.76
Due to the deprecations in GTK 4.10 we're moving to it immediately so that we
don't end up having to deal with deprecation warnings forever (again).
Also, we're taking this opportunity to require the last glib minor version as
well as if you have GTK 4.10, you most likely have GLib 2.76 as well.
Testing Done:
Compiled.
Reviewed at https://reviews.imfreedom.org/r/2526/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20113
diff
changeset
|
1 | /* pidgin |
| 5437 | 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 |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6381
diff
changeset
|
6 | * |
| 5437 | 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:
19832
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5437 | 20 | */ |
|
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
|
21 | |
|
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 | |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
24 | #include <gdk/gdkkeysyms.h> |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
25 | #include <talkatu.h> |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
26 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
27 | #include <purple.h> |
| 7455 | 28 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
29 | #include "gtkblist.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
30 | #include "gtknotify.h" |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
31 | #include "gtkutils.h" |
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40490
diff
changeset
|
32 | #include "pidgincore.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
33 | |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
34 | typedef struct |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
35 | { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
36 | GtkWidget *window; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
37 | int count; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
38 | } PidginUserInfo; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
39 | |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
40 | typedef struct |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
41 | { |
| 15884 | 42 | PurpleAccount *account; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
43 | GtkListStore *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
44 | GtkWidget *treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
45 | GtkWidget *window; |
| 13641 | 46 | gpointer user_data; |
| 15884 | 47 | PurpleNotifySearchResults *results; |
| 13641 | 48 | |
| 15882 | 49 | } PidginNotifySearchResultsData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
50 | |
| 11359 | 51 | typedef struct |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
52 | { |
| 15884 | 53 | PurpleNotifySearchButton *button; |
| 15882 | 54 | PidginNotifySearchResultsData *data; |
| 11359 | 55 | |
| 15882 | 56 | } PidginNotifySearchResultsButtonData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
57 | |
| 22999 | 58 | static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle); |
| 59 | ||
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
60 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
61 | message_response_cb(G_GNUC_UNUSED GtkDialog *dialog, G_GNUC_UNUSED gint id, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
62 | GtkWidget *widget) |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
63 | { |
| 15884 | 64 | purple_notify_close(PURPLE_NOTIFY_MESSAGE, widget); |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
65 | } |
|
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
66 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
67 | static void |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
68 | formatted_close_cb(GtkDialog *dialog, G_GNUC_UNUSED gint response, |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
69 | G_GNUC_UNUSED gpointer user_data) |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
70 | { |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
71 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, dialog); |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
72 | } |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
73 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
74 | static void |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
75 | searchresults_close_cb(G_GNUC_UNUSED GtkDialog *dialog, |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
76 | G_GNUC_UNUSED gint response, |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
77 | gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
78 | { |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
79 | PidginNotifySearchResultsData *data = user_data; |
| 15884 | 80 | purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, data); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
81 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
82 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
83 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
84 | searchresults_callback_wrapper_cb(G_GNUC_UNUSED GtkWidget *widget, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
85 | PidginNotifySearchResultsButtonData *bd) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
86 | { |
| 15882 | 87 | PidginNotifySearchResultsData *data = bd->data; |
| 11359 | 88 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
89 | GtkTreeSelection *selection; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
90 | GtkTreeModel *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
91 | GtkTreeIter iter; |
| 15884 | 92 | PurpleNotifySearchButton *button; |
| 11359 | 93 | GList *row = NULL; |
| 94 | gchar *str; | |
| 95 | int i; | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
96 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
97 | g_return_if_fail(data != NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
98 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
99 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->treeview)); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
100 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
101 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
102 | { |
| 11359 | 103 | for (i = 1; i < gtk_tree_model_get_n_columns(GTK_TREE_MODEL(model)); i++) { |
| 104 | gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, i, &str, -1); | |
| 105 | row = g_list_append(row, str); | |
| 106 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
107 | } |
| 11359 | 108 | |
| 109 | button = bd->button; | |
| 15884 | 110 | button->callback(purple_account_get_connection(data->account), row, data->user_data); |
|
39897
16b440d4ab36
Use g_list_free_full instead of g_list_foreach+g_list_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39556
diff
changeset
|
111 | g_list_free_full(row, g_free); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
112 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
113 | |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
114 | /* copy-paste from gtkrequest.c */ |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
115 | static void |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
116 | pidgin_widget_decorate_account(GtkWidget *cont, PurpleAccount *account) |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
117 | { |
|
41962
f802660eaef2
Update Pidgin to stop using deprecated account methods
Gary Kramlich <grim@reaperworld.com>
parents:
41947
diff
changeset
|
118 | PurpleContactInfo *info = NULL; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
119 | PurpleProtocol *protocol = NULL; |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
120 | GtkWidget *image; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
121 | const gchar *icon_name = NULL; |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
122 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
123 | if (!account) |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
124 | return; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
125 | |
|
41962
f802660eaef2
Update Pidgin to stop using deprecated account methods
Gary Kramlich <grim@reaperworld.com>
parents:
41947
diff
changeset
|
126 | info = PURPLE_CONTACT_INFO(account); |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
127 | protocol = purple_account_get_protocol(account); |
|
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
128 | icon_name = purple_protocol_get_icon_name(protocol); |
|
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
129 | |
|
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
130 | image = gtk_image_new_from_icon_name(icon_name); |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
131 | |
|
41962
f802660eaef2
Update Pidgin to stop using deprecated account methods
Gary Kramlich <grim@reaperworld.com>
parents:
41947
diff
changeset
|
132 | gtk_widget_set_tooltip_text(image, purple_contact_info_get_username(info)); |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
133 | |
|
40162
a8bdd1227991
Remove GtkDialog handling in pidgin_widget_decorate_account.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40150
diff
changeset
|
134 | if (GTK_IS_BOX(cont)) { |
|
37990
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
135 | gtk_widget_set_halign(image, GTK_ALIGN_START); |
|
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
136 | gtk_widget_set_valign(image, GTK_ALIGN_START); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
137 | gtk_widget_set_hexpand(image, TRUE); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
138 | gtk_box_append(GTK_BOX(cont), image); |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
139 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
140 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
141 | |
| 5437 | 142 | static void * |
|
37409
9dadde8529a8
Change enum name from PurpleNotifyMsgType to PurpleNotifyMessageType
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37144
diff
changeset
|
143 | pidgin_notify_message(PurpleNotifyMessageType type, const char *title, |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
144 | const char *primary, const char *secondary, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
145 | PurpleRequestCommonParameters *cpar) |
| 5437 | 146 | { |
| 14865 | 147 | GtkWidget *dialog; |
| 148 | GtkWidget *hbox; | |
| 149 | GtkWidget *label; | |
| 150 | GtkWidget *img = NULL; | |
| 151 | char label_text[2048]; | |
| 152 | const char *icon_name = NULL; | |
| 153 | char *primary_esc, *secondary_esc; | |
| 5437 | 154 | |
| 14865 | 155 | switch (type) |
| 156 | { | |
| 15884 | 157 | case PURPLE_NOTIFY_MSG_ERROR: |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
158 | icon_name = "dialog-error"; |
| 14865 | 159 | break; |
| 5437 | 160 | |
| 15884 | 161 | case PURPLE_NOTIFY_MSG_WARNING: |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
162 | icon_name = "dialog-warning"; |
| 14865 | 163 | break; |
| 5437 | 164 | |
| 15884 | 165 | case PURPLE_NOTIFY_MSG_INFO: |
|
39146
af0a3b8c0354
Replace remaining usage of PIDGIN_STOCK_DIALOG_* with literal icon names
Mike Ruprecht <cmaiku@gmail.com>
parents:
39144
diff
changeset
|
166 | icon_name = "dialog-information"; |
| 14865 | 167 | break; |
| 5437 | 168 | |
| 14865 | 169 | default: |
| 170 | icon_name = NULL; | |
| 171 | break; | |
| 172 | } | |
| 5437 | 173 | |
| 14865 | 174 | if (icon_name != NULL) |
| 175 | { | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
176 | img = gtk_image_new_from_icon_name(icon_name); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
177 | gtk_image_set_pixel_size(GTK_IMAGE(img), 48); |
|
37990
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
178 | gtk_widget_set_halign(img, GTK_ALIGN_START); |
|
710f725725a8
Replace the deprecated gtk_misc_set_alignment function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37422
diff
changeset
|
179 | gtk_widget_set_valign(img, GTK_ALIGN_START); |
| 14865 | 180 | } |
| 5437 | 181 | |
| 15882 | 182 | dialog = gtk_dialog_new_with_buttons(title ? title : PIDGIN_ALERT_TITLE, |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
183 | NULL, 0, _("Close"), |
| 14865 | 184 | GTK_RESPONSE_CLOSE, NULL); |
| 185 | ||
| 186 | g_signal_connect(G_OBJECT(dialog), "response", | |
| 187 | G_CALLBACK(message_response_cb), dialog); | |
| 188 | ||
| 189 | gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32394
diff
changeset
|
190 | gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), |
|
40490
fb6e46c4c63c
Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
191 | 12); |
| 14865 | 192 | |
|
40490
fb6e46c4c63c
Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
193 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
194 | gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
195 | hbox); |
| 5437 | 196 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
197 | if (img != NULL) { |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
198 | gtk_box_append(GTK_BOX(hbox), img); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
199 | } |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
200 | |
| 14865 | 201 | primary_esc = g_markup_escape_text(primary, -1); |
| 202 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
| 203 | g_snprintf(label_text, sizeof(label_text), | |
|
20869
e2db8ce46cda
If there is no secondary text in a notify, avoid adding "\n\n" and creating
Richard Laager <rlaager@pidgin.im>
parents:
20791
diff
changeset
|
204 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
e2db8ce46cda
If there is no secondary text in a notify, avoid adding "\n\n" and creating
Richard Laager <rlaager@pidgin.im>
parents:
20791
diff
changeset
|
205 | primary_esc, (secondary ? "\n\n" : ""), |
|
e2db8ce46cda
If there is no secondary text in a notify, avoid adding "\n\n" and creating
Richard Laager <rlaager@pidgin.im>
parents:
20791
diff
changeset
|
206 | (secondary ? secondary_esc : "")); |
| 14865 | 207 | g_free(primary_esc); |
| 208 | g_free(secondary_esc); | |
| 5437 | 209 | |
| 14865 | 210 | label = gtk_label_new(NULL); |
| 5437 | 211 | |
| 14865 | 212 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
213 | gtk_label_set_wrap(GTK_LABEL(label), TRUE); |
|
19222
f0fa371d6752
Allow notification labels to be selectable (for copy-and-paste purposes). Fixes #563.
Daniel Atallah <datallah@pidgin.im>
parents:
18802
diff
changeset
|
214 | gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
215 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
216 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
217 | gtk_box_append(GTK_BOX(hbox), label); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
218 | |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
219 | pidgin_widget_decorate_account(hbox, |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
220 | purple_request_cpar_get_account(cpar)); |
| 5437 | 221 | |
|
34451
b7165d4e1d73
Implement purple_*_is_valid_ui_handle, purple_request_cpar_*et_parent_from, pidgin_request_get_dialog_window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34450
diff
changeset
|
222 | g_object_set_data(G_OBJECT(dialog), "pidgin-parent-from", |
|
b7165d4e1d73
Implement purple_*_is_valid_ui_handle, purple_request_cpar_*et_parent_from, pidgin_request_get_dialog_window
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34450
diff
changeset
|
223 | purple_request_cpar_get_parent_from(cpar)); |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
224 | pidgin_auto_parent_window(dialog); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
225 | |
|
42202
2273647d24b0
Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents:
42094
diff
changeset
|
226 | gtk_widget_set_visible(dialog, TRUE); |
| 5437 | 227 | |
| 14865 | 228 | return dialog; |
| 5437 | 229 | } |
| 230 | ||
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
231 | static gboolean |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
232 | formatted_input_cb(GtkWidget *win, guint keyval, G_GNUC_UNUSED guint keycode, |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
233 | G_GNUC_UNUSED GdkModifierType state, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41720
diff
changeset
|
234 | G_GNUC_UNUSED gpointer data) |
| 7455 | 235 | { |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
236 | if (keyval == GDK_KEY_Escape) { |
| 15884 | 237 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
238 | |
| 7455 | 239 | return TRUE; |
| 240 | } | |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
241 | |
| 7455 | 242 | return FALSE; |
| 243 | } | |
| 244 | ||
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
245 | static void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
246 | pidgin_notify_formatted(const char *title, const char *primary, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
247 | const char *secondary, const char *text) |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
248 | { |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
249 | GtkWidget *window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
250 | GtkWidget *vbox; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
251 | GtkWidget *label; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
252 | GtkWidget *button; |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
253 | GtkEventController *event = NULL; |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
254 | GtkWidget *sw; |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
255 | GtkWidget *view; |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
256 | GtkTextBuffer *buffer; |
|
42094
2707c81648a0
Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents:
42014
diff
changeset
|
257 | GSimpleActionGroup *ag = NULL; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
258 | char label_text[2048]; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
259 | char *linked_text, *primary_esc, *secondary_esc; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
260 | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
261 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
262 | gtk_window_set_title(GTK_WINDOW(window), title); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
263 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
264 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
265 | g_signal_connect(window, "response", G_CALLBACK(formatted_close_cb), NULL); |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
266 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
267 | /* Setup the main vbox */ |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
268 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
269 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
270 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
271 | primary_esc = g_markup_escape_text(primary, -1); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
272 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
273 | g_snprintf(label_text, sizeof(label_text), |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
274 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
275 | primary_esc, |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
276 | (secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
277 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
278 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
279 | g_free(secondary_esc); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
280 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
281 | label = gtk_label_new(NULL); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
282 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
283 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
284 | gtk_label_set_wrap(GTK_LABEL(label), TRUE); |
|
19222
f0fa371d6752
Allow notification labels to be selectable (for copy-and-paste purposes). Fixes #563.
Daniel Atallah <datallah@pidgin.im>
parents:
18802
diff
changeset
|
285 | gtk_label_set_selectable(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
286 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
287 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
288 | gtk_box_append(GTK_BOX(vbox), label); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
289 | |
| 39214 | 290 | /* Add the view */ |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
291 | sw = gtk_scrolled_window_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
292 | gtk_box_append(GTK_BOX(vbox), sw); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
293 | gtk_widget_set_vexpand(sw, TRUE); |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
294 | |
|
42094
2707c81648a0
Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents:
42014
diff
changeset
|
295 | ag = talkatu_action_group_new(TALKATU_FORMAT_HTML); |
|
2707c81648a0
Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents:
42014
diff
changeset
|
296 | buffer = talkatu_buffer_new(ag); |
|
2707c81648a0
Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents:
42014
diff
changeset
|
297 | talkatu_action_group_set_buffer(TALKATU_ACTION_GROUP(ag), buffer); |
|
2707c81648a0
Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents:
42014
diff
changeset
|
298 | g_clear_object(&ag); |
|
2707c81648a0
Update to talkatu 0.2.0
Gary Kramlich <grim@reaperworld.com>
parents:
42014
diff
changeset
|
299 | |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
300 | view = talkatu_view_new_with_buffer(buffer); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
301 | gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
302 | gtk_widget_set_name(view, "pidgin_notify_view"); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
303 | gtk_widget_set_size_request(view, 300, 250); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
304 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
305 | /* Add the Close button. */ |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
306 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Close"), GTK_RESPONSE_CLOSE); |
|
19222
f0fa371d6752
Allow notification labels to be selectable (for copy-and-paste purposes). Fixes #563.
Daniel Atallah <datallah@pidgin.im>
parents:
18802
diff
changeset
|
307 | gtk_widget_grab_focus(button); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
308 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
309 | event = gtk_event_controller_key_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
310 | gtk_widget_add_controller(window, event); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
311 | g_signal_connect(G_OBJECT(event), "key-pressed", |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
312 | G_CALLBACK(formatted_input_cb), NULL); |
| 7455 | 313 | |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
314 | /* Make sure URLs are clickable */ |
| 15884 | 315 | linked_text = purple_markup_linkify(text); |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
316 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), linked_text, -1); |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
317 | g_free(linked_text); |
| 7078 | 318 | |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
319 | g_object_set_data(G_OBJECT(window), "view-widget", view); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
320 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
321 | /* Show the window */ |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
322 | pidgin_auto_parent_window(window); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
323 | |
|
42202
2273647d24b0
Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents:
42094
diff
changeset
|
324 | gtk_widget_set_visible(window, TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
325 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
326 | return window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
327 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
328 | |
| 11359 | 329 | static void |
| 15884 | 330 | pidgin_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchResults *results, |
| 13641 | 331 | void *data_) |
| 11359 | 332 | { |
| 15882 | 333 | PidginNotifySearchResultsData *data = data_; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
334 | PurpleProtocol *protocol = NULL; |
| 11359 | 335 | GtkListStore *model = data->model; |
| 336 | GtkTreeIter iter; | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
337 | GList *row, *column; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
338 | guint n; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
339 | const gchar *icon_name = NULL; |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
340 | |
| 11359 | 341 | gtk_list_store_clear(data->model); |
| 342 | ||
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
343 | protocol = purple_account_get_protocol(purple_connection_get_account(gc)); |
|
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
344 | icon_name = purple_protocol_get_icon_name(protocol); |
| 11359 | 345 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
346 | for (row = results->rows; row != NULL; row = row->next) { |
| 11359 | 347 | |
| 348 | gtk_list_store_append(model, &iter); | |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
349 | gtk_list_store_set(model, &iter, 0, icon_name, -1); |
| 11359 | 350 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
351 | n = 1; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
352 | for (column = row->data; column != NULL; column = column->next) { |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
353 | GValue v; |
| 11359 | 354 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
355 | v.g_type = 0; |
| 11359 | 356 | g_value_init(&v, G_TYPE_STRING); |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
357 | g_value_set_string(&v, column->data); |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
358 | gtk_list_store_set_value(model, &iter, n, &v); |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
359 | n++; |
| 11359 | 360 | } |
| 361 | } | |
| 362 | } | |
| 363 | ||
| 9797 | 364 | static void * |
| 15884 | 365 | pidgin_notify_searchresults(PurpleConnection *gc, const char *title, |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
366 | const char *primary, const char *secondary, |
| 15884 | 367 | PurpleNotifySearchResults *results, gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
368 | { |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
369 | GtkWidget *window; |
| 11359 | 370 | GtkWidget *treeview; |
| 371 | GType *col_types; | |
| 372 | GtkListStore *model; | |
| 373 | GtkCellRenderer *renderer; | |
| 12257 | 374 | guint col_num; |
|
20980
1599801ecbae
Fix pidgin_notify_searchresults to use the actual title for column headers,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20791
diff
changeset
|
375 | GList *columniter; |
| 12257 | 376 | guint i; |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24658
diff
changeset
|
377 | GList *l; |
| 11359 | 378 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
379 | GtkWidget *vbox; |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
380 | GtkWidget *sw; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
381 | GtkWidget *label; |
| 15882 | 382 | PidginNotifySearchResultsData *data; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
383 | char *label_text; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
384 | char *primary_esc, *secondary_esc; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
385 | |
| 12257 | 386 | g_return_val_if_fail(gc != NULL, NULL); |
| 387 | g_return_val_if_fail(results != NULL, NULL); | |
| 388 | ||
|
39922
113b93e2bd2a
Replace malloc(sizeof(...)) with g_new0(..., 1).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
389 | data = g_new0(PidginNotifySearchResultsData, 1); |
| 13641 | 390 | data->user_data = user_data; |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
391 | data->results = results; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
392 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
393 | /* Create the window */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
394 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
395 | gtk_window_set_title(GTK_WINDOW(window), title ? title :_("Search Results")); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
396 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
397 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
398 | g_signal_connect(window, "response", G_CALLBACK(searchresults_close_cb), |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
399 | data); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
400 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
401 | /* Setup the main vbox */ |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30812
diff
changeset
|
402 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
403 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
404 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
405 | primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
406 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
407 | label_text = g_strdup_printf( |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
408 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
409 | (primary ? primary_esc : ""), |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
410 | (primary && secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
411 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
412 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
413 | g_free(secondary_esc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
414 | label = gtk_label_new(NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
415 | gtk_label_set_markup(GTK_LABEL(label), label_text); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
416 | gtk_label_set_wrap(GTK_LABEL(label), TRUE); |
|
38007
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
417 | gtk_label_set_xalign(GTK_LABEL(label), 0); |
|
3b971d2ecae1
Simplify gtk_label_set_[xy]align calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
37994
diff
changeset
|
418 | gtk_label_set_yalign(GTK_LABEL(label), 0); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
419 | gtk_box_append(GTK_BOX(vbox), label); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
420 | g_free(label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
421 | |
| 11359 | 422 | /* +1 is for the automagically created Status column. */ |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
423 | col_num = g_list_length(results->columns) + 1; |
| 11359 | 424 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
425 | /* Setup the list model */ |
| 11359 | 426 | col_types = g_new0(GType, col_num); |
| 427 | ||
| 428 | /* There always is this first column. */ | |
| 429 | col_types[0] = GDK_TYPE_PIXBUF; | |
| 430 | for (i = 1; i < col_num; i++) { | |
| 431 | col_types[i] = G_TYPE_STRING; | |
| 432 | } | |
| 433 | model = gtk_list_store_newv(col_num, col_types); | |
| 22999 | 434 | g_free(col_types); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
435 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
436 | /* Setup the treeview */ |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
437 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
|
22214
e8a9916cb99e
It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
438 | g_object_unref(G_OBJECT(model)); |
| 11359 | 439 | gtk_widget_set_size_request(treeview, 500, 400); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
440 | gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
441 | GTK_SELECTION_SINGLE); |
| 11359 | 442 | gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
443 | sw = gtk_scrolled_window_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
444 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
445 | GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
446 | gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), treeview); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
447 | gtk_widget_set_vexpand(sw, TRUE); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
448 | gtk_box_append(GTK_BOX(vbox), sw); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
449 | |
| 11359 | 450 | renderer = gtk_cell_renderer_pixbuf_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
451 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
452 | -1, "", renderer, "icon-name", 0, NULL); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
453 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
454 | i = 1; |
|
20980
1599801ecbae
Fix pidgin_notify_searchresults to use the actual title for column headers,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20791
diff
changeset
|
455 | for (columniter = results->columns; columniter != NULL; columniter = columniter->next) { |
|
1599801ecbae
Fix pidgin_notify_searchresults to use the actual title for column headers,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20791
diff
changeset
|
456 | PurpleNotifySearchColumn *column = columniter->data; |
| 11359 | 457 | renderer = gtk_cell_renderer_text_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
458 | |
| 11359 | 459 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, |
|
32691
d6eb58903f8b
Hide struct PurpleNotifySearchColumn.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
460 | purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); |
| 31696 | 461 | |
| 462 | if (!purple_notify_searchresult_column_is_visible(column)) | |
| 463 | gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); | |
| 464 | ||
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
465 | i++; |
| 11359 | 466 | } |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
467 | |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24658
diff
changeset
|
468 | for (l = results->buttons; l; l = l->next) { |
|
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24658
diff
changeset
|
469 | PurpleNotifySearchButton *b = l->data; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
470 | GtkWidget *button = NULL; |
| 11359 | 471 | switch (b->type) { |
| 15884 | 472 | case PURPLE_NOTIFY_BUTTON_LABELED: |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
473 | if(b->label) { |
|
38789
ad3e9caa955b
Ensure labelled buttons are shown for search results in Pidgin.
Howard Chu <hyc@symas.com>
parents:
38737
diff
changeset
|
474 | button = gtk_dialog_add_button(GTK_DIALOG(window), b->label, GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
475 | } else { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19546
diff
changeset
|
476 | purple_debug_warning("gtknotify", "Missing button label\n"); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
477 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
478 | break; |
| 15884 | 479 | case PURPLE_NOTIFY_BUTTON_CONTINUE: |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
480 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Forward"), GTK_RESPONSE_NONE); |
| 11359 | 481 | break; |
| 15884 | 482 | case PURPLE_NOTIFY_BUTTON_ADD: |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
483 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Add"), GTK_RESPONSE_NONE); |
| 11359 | 484 | break; |
| 15884 | 485 | case PURPLE_NOTIFY_BUTTON_INFO: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
486 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("_Get Info"), GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
487 | break; |
| 15884 | 488 | case PURPLE_NOTIFY_BUTTON_IM: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
489 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("I_M"), GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
490 | break; |
| 15884 | 491 | case PURPLE_NOTIFY_BUTTON_JOIN: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
492 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("_Join"), GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
493 | break; |
| 15884 | 494 | case PURPLE_NOTIFY_BUTTON_INVITE: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
495 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("_Invite"), GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
496 | break; |
| 11359 | 497 | default: |
| 15884 | 498 | purple_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); |
| 11359 | 499 | } |
| 500 | if (button != NULL) { | |
| 15882 | 501 | PidginNotifySearchResultsButtonData *bd; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
502 | |
| 15882 | 503 | bd = g_new0(PidginNotifySearchResultsButtonData, 1); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
504 | bd->button = b; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
505 | bd->data = data; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
506 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
507 | g_signal_connect(G_OBJECT(button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
508 | G_CALLBACK(searchresults_callback_wrapper_cb), bd); |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
509 | g_signal_connect_swapped(G_OBJECT(button), "destroy", G_CALLBACK(g_free), bd); |
| 11359 | 510 | } |
| 511 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
512 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
513 | /* Add the Close button */ |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
514 | gtk_dialog_add_button(GTK_DIALOG(window), _("Close"), GTK_RESPONSE_CLOSE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
515 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32521
diff
changeset
|
516 | data->account = purple_connection_get_account(gc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
517 | data->model = model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
518 | data->treeview = treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
519 | data->window = window; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
520 | |
| 11359 | 521 | /* Insert rows. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
522 | pidgin_notify_searchresults_new_rows(gc, results, data); |
| 11359 | 523 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
524 | /* Show the window */ |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
525 | pidgin_auto_parent_window(window); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21213
diff
changeset
|
526 | |
|
42202
2273647d24b0
Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents:
42094
diff
changeset
|
527 | gtk_widget_set_visible(window, TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
528 | return data; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
529 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
530 | |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41231
diff
changeset
|
531 | /* Xerox'ed from Finch! How the tables have turned!! ;) */ |
|
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41231
diff
changeset
|
532 | /* User information. */ |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
533 | static GHashTable *userinfo; |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
534 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
535 | static char * |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
536 | userinfo_hash(PurpleAccount *account, const char *who) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
537 | { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
538 | char key[256]; |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40048
diff
changeset
|
539 | g_snprintf(key, sizeof(key), "%s - %s", |
|
41962
f802660eaef2
Update Pidgin to stop using deprecated account methods
Gary Kramlich <grim@reaperworld.com>
parents:
41947
diff
changeset
|
540 | purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)), |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40048
diff
changeset
|
541 | purple_normalize(account, who)); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
542 | return g_utf8_strup(key, -1); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
543 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
544 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
545 | static void |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
546 | remove_userinfo(GtkWidget *widget, gpointer key) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
547 | { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
548 | PidginUserInfo *pinfo = g_hash_table_lookup(userinfo, key); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
549 | |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
550 | while (pinfo->count--) |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
551 | purple_notify_close(PURPLE_NOTIFY_USERINFO, widget); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
552 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
553 | g_hash_table_remove(userinfo, key); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
554 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
555 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
556 | static void * |
| 15884 | 557 | pidgin_notify_userinfo(PurpleConnection *gc, const char *who, |
| 558 | PurpleNotifyUserInfo *user_info) | |
| 9797 | 559 | { |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
560 | char *info; |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
561 | void *ui_handle; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
562 | char *key = userinfo_hash(purple_connection_get_account(gc), who); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
563 | PidginUserInfo *pinfo = NULL; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
564 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
565 | if (!userinfo) { |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
566 | userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
567 | } |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
568 | |
| 15884 | 569 | info = purple_notify_user_info_get_text_with_newline(user_info, "<br />"); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
570 | pinfo = g_hash_table_lookup(userinfo, key); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
571 | if (pinfo != NULL) { |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
572 | GtkWidget *view = g_object_get_data(G_OBJECT(pinfo->window), "view-widget"); |
|
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
573 | GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
574 | char *linked_text = purple_markup_linkify(info); |
|
39213
be8cd7616e08
Remove webkit from gtknotify.c and replace it with talkatu. Having some issues with format rendering, but it's working otherwise
Gary Kramlich <grim@reaperworld.com>
parents:
39146
diff
changeset
|
575 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), linked_text, -1); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
576 | g_free(linked_text); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
577 | g_free(key); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
578 | ui_handle = pinfo->window; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
579 | pinfo->count++; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
580 | } else { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
581 | char *primary = g_strdup_printf(_("Info for %s"), who); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
582 | ui_handle = pidgin_notify_formatted(_("Buddy Information"), primary, NULL, info); |
|
42246
3230f1a1fb8f
Remove unnecessary casting from g_signal_handlers_disconnect
Gary Kramlich <grim@reaperworld.com>
parents:
42216
diff
changeset
|
583 | g_signal_handlers_disconnect_by_func(ui_handle, formatted_close_cb, |
|
3230f1a1fb8f
Remove unnecessary casting from g_signal_handlers_disconnect
Gary Kramlich <grim@reaperworld.com>
parents:
42216
diff
changeset
|
584 | NULL); |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
585 | g_signal_connect(ui_handle, "response", G_CALLBACK(remove_userinfo), |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
586 | key); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
587 | g_free(primary); |
|
17728
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
588 | pinfo = g_new0(PidginUserInfo, 1); |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
589 | pinfo->window = ui_handle; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
590 | pinfo->count = 1; |
|
323b1481c2bc
sadrul's fix for the userinfo notify crash on disconnect that was caused by
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17027
diff
changeset
|
591 | g_hash_table_insert(userinfo, key, pinfo); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
592 | } |
|
15206
70520a610969
[gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents:
14865
diff
changeset
|
593 | g_free(info); |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
594 | return ui_handle; |
| 9797 | 595 | } |
| 596 | ||
| 5437 | 597 | static void |
| 15884 | 598 | pidgin_close_notify(PurpleNotifyType type, void *ui_handle) |
| 5437 | 599 | { |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
600 | if (type == PURPLE_NOTIFY_SEARCHRESULTS) { |
| 15882 | 601 | PidginNotifySearchResultsData *data = (PidginNotifySearchResultsData *)ui_handle; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
602 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
603 | gtk_window_destroy(GTK_WINDOW(data->window)); |
| 15884 | 604 | purple_notify_searchresults_free(data->results); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
605 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
606 | g_free(data); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
607 | |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
608 | } else if (ui_handle != NULL) { |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
609 | gtk_window_destroy(GTK_WINDOW(ui_handle)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
610 | } |
| 5437 | 611 | } |
| 612 | ||
| 7136 | 613 | static void * |
|
40501
011cdaa64ecc
Replace the manual browser opening code with gtk_show_uri_on_window
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
614 | pidgin_notify_uri(const char *uri) { |
|
42216
76245ac5cf36
Fix gtk_show_uri deprecations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42202
diff
changeset
|
615 | GtkUriLauncher *launcher = NULL; |
|
76245ac5cf36
Fix gtk_show_uri deprecations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42202
diff
changeset
|
616 | launcher = gtk_uri_launcher_new(uri); |
|
76245ac5cf36
Fix gtk_show_uri deprecations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42202
diff
changeset
|
617 | gtk_uri_launcher_launch(launcher, NULL, NULL, NULL, NULL); |
|
76245ac5cf36
Fix gtk_show_uri deprecations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42202
diff
changeset
|
618 | g_object_unref(launcher); |
| 7136 | 619 | |
| 620 | return NULL; | |
| 621 | } | |
| 622 | ||
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
623 | static void* |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
624 | pidgin_notify_get_handle(void) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
625 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
626 | static int handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
627 | return &handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
628 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
629 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
630 | void pidgin_notify_init(void) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
631 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
632 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
633 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
634 | void pidgin_notify_uninit(void) |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
635 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
636 | purple_signals_disconnect_by_handle(pidgin_notify_get_handle()); |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
637 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
638 | |
|
41720
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
639 | static PurpleNotifyUiOps ops = { |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
640 | .notify_message = pidgin_notify_message, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
641 | .notify_formatted = pidgin_notify_formatted, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
642 | .notify_searchresults = pidgin_notify_searchresults, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
643 | .notify_searchresults_new_rows = pidgin_notify_searchresults_new_rows, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
644 | .notify_userinfo = pidgin_notify_userinfo, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
645 | .notify_uri = pidgin_notify_uri, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
646 | .close_notify = pidgin_close_notify, |
| 5437 | 647 | }; |
| 648 | ||
| 15884 | 649 | PurpleNotifyUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
650 | pidgin_notify_get_ui_ops(void) |
| 5437 | 651 | { |
| 652 | return &ops; | |
| 653 | } |