Sun, 19 Feb 2023 17:57:16 -0600
Mark a number of unused parameters as such
Testing Done:
Compiled and Windows and verified the warnings were gone.
Reviewed at https://reviews.imfreedom.org/r/2247/
|
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 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
226 | gtk_widget_show(dialog); |
| 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; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
257 | char label_text[2048]; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
258 | char *linked_text, *primary_esc, *secondary_esc; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
259 | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
260 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
261 | 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
|
262 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
263 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
264 | 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
|
265 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
266 | /* 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
|
267 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
268 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
269 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
270 | primary_esc = g_markup_escape_text(primary, -1); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
271 | 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
|
272 | g_snprintf(label_text, sizeof(label_text), |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
273 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
274 | primary_esc, |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
275 | (secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
276 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
277 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
278 | g_free(secondary_esc); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
279 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
280 | label = gtk_label_new(NULL); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
281 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | 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
|
286 | 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
|
287 | gtk_box_append(GTK_BOX(vbox), label); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
288 | |
| 39214 | 289 | /* Add the view */ |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
290 | sw = gtk_scrolled_window_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
291 | gtk_box_append(GTK_BOX(vbox), sw); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
292 | 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
|
293 | |
|
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 | buffer = talkatu_html_buffer_new(); |
|
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
|
295 | 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
|
296 | 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
|
297 | 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
|
298 | gtk_widget_set_size_request(view, 300, 250); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
299 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
300 | /* Add the Close button. */ |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
301 | 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
|
302 | gtk_widget_grab_focus(button); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
303 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
304 | event = gtk_event_controller_key_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
305 | gtk_widget_add_controller(window, event); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
306 | 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
|
307 | G_CALLBACK(formatted_input_cb), NULL); |
| 7455 | 308 | |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
309 | /* Make sure URLs are clickable */ |
| 15884 | 310 | 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
|
311 | talkatu_markup_set_html(TALKATU_BUFFER(buffer), linked_text, -1); |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
312 | g_free(linked_text); |
| 7078 | 313 | |
|
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
|
314 | 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
|
315 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
316 | /* 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
|
317 | 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
|
318 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
319 | gtk_widget_show(window); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
320 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
321 | return window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
322 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
323 | |
| 11359 | 324 | static void |
| 15884 | 325 | pidgin_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchResults *results, |
| 13641 | 326 | void *data_) |
| 11359 | 327 | { |
| 15882 | 328 | 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
|
329 | PurpleProtocol *protocol = NULL; |
| 11359 | 330 | GtkListStore *model = data->model; |
| 331 | GtkTreeIter iter; | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
332 | GList *row, *column; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
333 | guint n; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
334 | const gchar *icon_name = NULL; |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
335 | |
| 11359 | 336 | gtk_list_store_clear(data->model); |
| 337 | ||
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
338 | 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
|
339 | icon_name = purple_protocol_get_icon_name(protocol); |
| 11359 | 340 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
341 | for (row = results->rows; row != NULL; row = row->next) { |
| 11359 | 342 | |
| 343 | 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
|
344 | gtk_list_store_set(model, &iter, 0, icon_name, -1); |
| 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 | n = 1; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
347 | for (column = row->data; column != NULL; column = column->next) { |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
348 | GValue v; |
| 11359 | 349 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
350 | v.g_type = 0; |
| 11359 | 351 | 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
|
352 | 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
|
353 | 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
|
354 | n++; |
| 11359 | 355 | } |
| 356 | } | |
| 357 | } | |
| 358 | ||
| 9797 | 359 | static void * |
| 15884 | 360 | pidgin_notify_searchresults(PurpleConnection *gc, const char *title, |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
361 | const char *primary, const char *secondary, |
| 15884 | 362 | PurpleNotifySearchResults *results, gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
363 | { |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
364 | GtkWidget *window; |
| 11359 | 365 | GtkWidget *treeview; |
| 366 | GType *col_types; | |
| 367 | GtkListStore *model; | |
| 368 | GtkCellRenderer *renderer; | |
| 12257 | 369 | 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
|
370 | GList *columniter; |
| 12257 | 371 | 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
|
372 | GList *l; |
| 11359 | 373 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
374 | GtkWidget *vbox; |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
375 | GtkWidget *sw; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
376 | GtkWidget *label; |
| 15882 | 377 | PidginNotifySearchResultsData *data; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
378 | char *label_text; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
379 | char *primary_esc, *secondary_esc; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
380 | |
| 12257 | 381 | g_return_val_if_fail(gc != NULL, NULL); |
| 382 | g_return_val_if_fail(results != NULL, NULL); | |
| 383 | ||
|
39922
113b93e2bd2a
Replace malloc(sizeof(...)) with g_new0(..., 1).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
384 | data = g_new0(PidginNotifySearchResultsData, 1); |
| 13641 | 385 | data->user_data = user_data; |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
386 | data->results = results; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
387 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
388 | /* Create the window */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
389 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
390 | 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
|
391 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
392 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
393 | 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
|
394 | data); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
395 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
396 | /* 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
|
397 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
398 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
399 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
400 | primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
401 | 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
|
402 | label_text = g_strdup_printf( |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
403 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
404 | (primary ? primary_esc : ""), |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
405 | (primary && secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
406 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
407 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
408 | g_free(secondary_esc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
409 | label = gtk_label_new(NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
410 | 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
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | gtk_box_append(GTK_BOX(vbox), label); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
415 | g_free(label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
416 | |
| 11359 | 417 | /* +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
|
418 | col_num = g_list_length(results->columns) + 1; |
| 11359 | 419 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
420 | /* Setup the list model */ |
| 11359 | 421 | col_types = g_new0(GType, col_num); |
| 422 | ||
| 423 | /* There always is this first column. */ | |
| 424 | col_types[0] = GDK_TYPE_PIXBUF; | |
| 425 | for (i = 1; i < col_num; i++) { | |
| 426 | col_types[i] = G_TYPE_STRING; | |
| 427 | } | |
| 428 | model = gtk_list_store_newv(col_num, col_types); | |
| 22999 | 429 | g_free(col_types); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
430 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
431 | /* Setup the treeview */ |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
432 | 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
|
433 | g_object_unref(G_OBJECT(model)); |
| 11359 | 434 | gtk_widget_set_size_request(treeview, 500, 400); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
435 | 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
|
436 | GTK_SELECTION_SINGLE); |
| 11359 | 437 | 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
|
438 | sw = gtk_scrolled_window_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
439 | 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
|
440 | GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
441 | 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
|
442 | gtk_widget_set_vexpand(sw, TRUE); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
443 | gtk_box_append(GTK_BOX(vbox), sw); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
444 | |
| 11359 | 445 | renderer = gtk_cell_renderer_pixbuf_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
446 | 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
|
447 | -1, "", renderer, "icon-name", 0, NULL); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
448 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
449 | 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
|
450 | 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
|
451 | PurpleNotifySearchColumn *column = columniter->data; |
| 11359 | 452 | renderer = gtk_cell_renderer_text_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
453 | |
| 11359 | 454 | 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
|
455 | purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); |
| 31696 | 456 | |
| 457 | if (!purple_notify_searchresult_column_is_visible(column)) | |
| 458 | gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); | |
| 459 | ||
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
460 | i++; |
| 11359 | 461 | } |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
462 | |
|
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
|
463 | 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
|
464 | PurpleNotifySearchButton *b = l->data; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
465 | GtkWidget *button = NULL; |
| 11359 | 466 | switch (b->type) { |
| 15884 | 467 | case PURPLE_NOTIFY_BUTTON_LABELED: |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
468 | if(b->label) { |
|
38789
ad3e9caa955b
Ensure labelled buttons are shown for search results in Pidgin.
Howard Chu <hyc@symas.com>
parents:
38737
diff
changeset
|
469 | 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
|
470 | } else { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19546
diff
changeset
|
471 | purple_debug_warning("gtknotify", "Missing button label\n"); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
472 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
473 | break; |
| 15884 | 474 | case PURPLE_NOTIFY_BUTTON_CONTINUE: |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
475 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Forward"), GTK_RESPONSE_NONE); |
| 11359 | 476 | break; |
| 15884 | 477 | case PURPLE_NOTIFY_BUTTON_ADD: |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
478 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Add"), GTK_RESPONSE_NONE); |
| 11359 | 479 | break; |
| 15884 | 480 | case PURPLE_NOTIFY_BUTTON_INFO: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
481 | 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
|
482 | break; |
| 15884 | 483 | case PURPLE_NOTIFY_BUTTON_IM: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
484 | 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
|
485 | break; |
| 15884 | 486 | case PURPLE_NOTIFY_BUTTON_JOIN: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
487 | 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
|
488 | break; |
| 15884 | 489 | case PURPLE_NOTIFY_BUTTON_INVITE: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
490 | 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
|
491 | break; |
| 11359 | 492 | default: |
| 15884 | 493 | purple_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); |
| 11359 | 494 | } |
| 495 | if (button != NULL) { | |
| 15882 | 496 | PidginNotifySearchResultsButtonData *bd; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
497 | |
| 15882 | 498 | bd = g_new0(PidginNotifySearchResultsButtonData, 1); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
499 | bd->button = b; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
500 | bd->data = data; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
501 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
502 | g_signal_connect(G_OBJECT(button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
503 | G_CALLBACK(searchresults_callback_wrapper_cb), bd); |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
504 | g_signal_connect_swapped(G_OBJECT(button), "destroy", G_CALLBACK(g_free), bd); |
| 11359 | 505 | } |
| 506 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
507 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
508 | /* Add the Close button */ |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
509 | 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
|
510 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32521
diff
changeset
|
511 | data->account = purple_connection_get_account(gc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
512 | data->model = model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
513 | data->treeview = treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
514 | data->window = window; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
515 | |
| 11359 | 516 | /* Insert rows. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
517 | pidgin_notify_searchresults_new_rows(gc, results, data); |
| 11359 | 518 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
519 | /* 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
|
520 | 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
|
521 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
522 | gtk_widget_show(window); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
523 | return data; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
524 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
525 | |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41231
diff
changeset
|
526 | /* 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
|
527 | /* User information. */ |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
528 | static GHashTable *userinfo; |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
529 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
530 | static char * |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
531 | userinfo_hash(PurpleAccount *account, const char *who) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
532 | { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
533 | 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
|
534 | 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
|
535 | 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
|
536 | purple_normalize(account, who)); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
537 | return g_utf8_strup(key, -1); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
538 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
539 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
540 | static void |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
541 | remove_userinfo(GtkWidget *widget, gpointer key) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
542 | { |
|
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
|
543 | 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
|
544 | |
|
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
|
545 | 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
|
546 | 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
|
547 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
548 | g_hash_table_remove(userinfo, key); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
549 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
550 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
551 | static void * |
| 15884 | 552 | pidgin_notify_userinfo(PurpleConnection *gc, const char *who, |
| 553 | PurpleNotifyUserInfo *user_info) | |
| 9797 | 554 | { |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
555 | char *info; |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
556 | void *ui_handle; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
557 | 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
|
558 | PidginUserInfo *pinfo = NULL; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
559 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
560 | 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
|
561 | 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
|
562 | } |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
563 | |
| 15884 | 564 | 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
|
565 | 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
|
566 | 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
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | 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
|
571 | g_free(linked_text); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
572 | 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
|
573 | 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
|
574 | pinfo->count++; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
575 | } else { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
576 | char *primary = g_strdup_printf(_("Info for %s"), who); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
577 | ui_handle = pidgin_notify_formatted(_("Buddy Information"), primary, NULL, info); |
|
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 | g_signal_handlers_disconnect_by_func(G_OBJECT(ui_handle), G_CALLBACK(formatted_close_cb), NULL); |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
579 | 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
|
580 | key); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | g_hash_table_insert(userinfo, key, pinfo); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
586 | } |
|
15206
70520a610969
[gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents:
14865
diff
changeset
|
587 | g_free(info); |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
588 | return ui_handle; |
| 9797 | 589 | } |
| 590 | ||
| 5437 | 591 | static void |
| 15884 | 592 | pidgin_close_notify(PurpleNotifyType type, void *ui_handle) |
| 5437 | 593 | { |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
594 | if (type == PURPLE_NOTIFY_SEARCHRESULTS) { |
| 15882 | 595 | PidginNotifySearchResultsData *data = (PidginNotifySearchResultsData *)ui_handle; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
596 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
597 | gtk_window_destroy(GTK_WINDOW(data->window)); |
| 15884 | 598 | purple_notify_searchresults_free(data->results); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
599 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
600 | g_free(data); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
601 | |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
602 | } else if (ui_handle != NULL) { |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
603 | gtk_window_destroy(GTK_WINDOW(ui_handle)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
604 | } |
| 5437 | 605 | } |
| 606 | ||
| 7136 | 607 | 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
|
608 | pidgin_notify_uri(const char *uri) { |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
609 | gtk_show_uri(NULL, uri, GDK_CURRENT_TIME); |
| 7136 | 610 | |
| 611 | return NULL; | |
| 612 | } | |
| 613 | ||
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
614 | static void* |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
615 | 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
|
616 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
617 | static int handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
618 | return &handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
619 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
620 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
621 | 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
|
622 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
623 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
624 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
625 | 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
|
626 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
627 | 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
|
628 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
629 | |
|
41720
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
630 | static PurpleNotifyUiOps ops = { |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
631 | .notify_message = pidgin_notify_message, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
632 | .notify_formatted = pidgin_notify_formatted, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
633 | .notify_searchresults = pidgin_notify_searchresults, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
634 | .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
|
635 | .notify_userinfo = pidgin_notify_userinfo, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
636 | .notify_uri = pidgin_notify_uri, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
637 | .close_notify = pidgin_close_notify, |
| 5437 | 638 | }; |
| 639 | ||
| 15884 | 640 | PurpleNotifyUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
641 | pidgin_notify_get_ui_ops(void) |
| 5437 | 642 | { |
| 643 | return &ops; | |
| 644 | } |