Thu, 27 Jun 2024 00:46:27 -0500
Update pidgin to use get id and username directly on PurpleAccount
This is part of making PurpleAccount have a PurpleContactInfo instead of being
one.
Testing Done:
Ran the turtles, connected some accounts, disabled one via the menu and re-enabled it.
Reviewed at https://reviews.imfreedom.org/r/3273/
|
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 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
26 | #include <purple.h> |
| 7455 | 27 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
28 | #include "gtknotify.h" |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
29 | #include "gtkutils.h" |
|
40496
6941fece679b
phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents:
40490
diff
changeset
|
30 | #include "pidgincore.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
31 | |
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
32 | typedef struct |
|
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
33 | { |
|
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
|
34 | 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
|
35 | 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
|
36 | } 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
|
37 | |
|
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 | 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
|
39 | { |
| 15884 | 40 | PurpleAccount *account; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
41 | GtkListStore *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
42 | GtkWidget *treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
43 | GtkWidget *window; |
| 13641 | 44 | gpointer user_data; |
| 15884 | 45 | PurpleNotifySearchResults *results; |
| 13641 | 46 | |
| 15882 | 47 | } PidginNotifySearchResultsData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
48 | |
| 11359 | 49 | typedef struct |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
50 | { |
| 15884 | 51 | PurpleNotifySearchButton *button; |
| 15882 | 52 | PidginNotifySearchResultsData *data; |
| 11359 | 53 | |
| 15882 | 54 | } PidginNotifySearchResultsButtonData; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
55 | |
| 22999 | 56 | static void pidgin_close_notify(PurpleNotifyType type, void *ui_handle); |
| 57 | ||
|
5519
5ac50d7f3689
[gaim-migrate @ 5919]
Christian Hammond <chipx86@chipx86.com>
parents:
5476
diff
changeset
|
58 | 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
|
59 | 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
|
60 | GtkWidget *widget) |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
61 | { |
| 15884 | 62 | purple_notify_close(PURPLE_NOTIFY_MESSAGE, widget); |
|
6104
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
63 | } |
|
cf3241926c4e
[gaim-migrate @ 6565]
Mark Doliner <markdoliner@pidgin.im>
parents:
5872
diff
changeset
|
64 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
65 | static void |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
66 | 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
|
67 | G_GNUC_UNUSED gpointer user_data) |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
68 | { |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
69 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, dialog); |
|
7007
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
70 | } |
|
b687feec58a2
[gaim-migrate @ 7564]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
71 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
72 | static void |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
73 | 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
|
74 | G_GNUC_UNUSED gint response, |
|
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
75 | gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
76 | { |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
77 | PidginNotifySearchResultsData *data = user_data; |
| 15884 | 78 | purple_notify_close(PURPLE_NOTIFY_SEARCHRESULTS, data); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
79 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
80 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
81 | 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
|
82 | 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
|
83 | PidginNotifySearchResultsButtonData *bd) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
84 | { |
| 15882 | 85 | PidginNotifySearchResultsData *data = bd->data; |
| 11359 | 86 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
87 | GtkTreeSelection *selection; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
88 | GtkTreeModel *model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
89 | GtkTreeIter iter; |
| 15884 | 90 | PurpleNotifySearchButton *button; |
| 11359 | 91 | GList *row = NULL; |
| 92 | gchar *str; | |
| 93 | int i; | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
94 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
95 | g_return_if_fail(data != NULL); |
|
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 | 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
|
98 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
99 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
100 | { |
| 11359 | 101 | for (i = 1; i < gtk_tree_model_get_n_columns(GTK_TREE_MODEL(model)); i++) { |
| 102 | gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, i, &str, -1); | |
| 103 | row = g_list_append(row, str); | |
| 104 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
105 | } |
| 11359 | 106 | |
| 107 | button = bd->button; | |
| 15884 | 108 | 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
|
109 | g_list_free_full(row, g_free); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
110 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
111 | |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
112 | /* 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
|
113 | static void |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
114 | 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
|
115 | { |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
116 | PurpleProtocol *protocol = NULL; |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
117 | GtkWidget *image; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
118 | 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
|
119 | |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
120 | if (!account) |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
121 | return; |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
122 | |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
123 | 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
|
124 | 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
|
125 | |
|
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
126 | 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
|
127 | |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42592
diff
changeset
|
128 | gtk_widget_set_tooltip_text(image, purple_account_get_username(account)); |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
129 | |
|
40162
a8bdd1227991
Remove GtkDialog handling in pidgin_widget_decorate_account.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40150
diff
changeset
|
130 | 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
|
131 | 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
|
132 | 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
|
133 | gtk_widget_set_hexpand(image, TRUE); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
134 | 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
|
135 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
136 | } |
|
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
137 | |
| 5437 | 138 | static void * |
|
37409
9dadde8529a8
Change enum name from PurpleNotifyMsgType to PurpleNotifyMessageType
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37144
diff
changeset
|
139 | 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
|
140 | const char *primary, const char *secondary, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34274
diff
changeset
|
141 | PurpleRequestCommonParameters *cpar) |
| 5437 | 142 | { |
| 14865 | 143 | GtkWidget *dialog; |
| 144 | GtkWidget *hbox; | |
| 145 | GtkWidget *label; | |
| 146 | GtkWidget *img = NULL; | |
| 147 | char label_text[2048]; | |
| 148 | const char *icon_name = NULL; | |
| 149 | char *primary_esc, *secondary_esc; | |
| 5437 | 150 | |
| 14865 | 151 | switch (type) |
| 152 | { | |
| 15884 | 153 | 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
|
154 | icon_name = "dialog-error"; |
| 14865 | 155 | break; |
| 5437 | 156 | |
| 15884 | 157 | 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
|
158 | icon_name = "dialog-warning"; |
| 14865 | 159 | break; |
| 5437 | 160 | |
| 15884 | 161 | 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
|
162 | icon_name = "dialog-information"; |
| 14865 | 163 | break; |
| 5437 | 164 | |
| 14865 | 165 | default: |
| 166 | icon_name = NULL; | |
| 167 | break; | |
| 168 | } | |
| 5437 | 169 | |
| 14865 | 170 | if (icon_name != NULL) |
| 171 | { | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
172 | 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
|
173 | 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
|
174 | 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
|
175 | gtk_widget_set_valign(img, GTK_ALIGN_START); |
| 14865 | 176 | } |
| 5437 | 177 | |
| 15882 | 178 | 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
|
179 | NULL, 0, _("Close"), |
| 14865 | 180 | GTK_RESPONSE_CLOSE, NULL); |
| 181 | ||
| 182 | g_signal_connect(G_OBJECT(dialog), "response", | |
| 183 | G_CALLBACK(message_response_cb), dialog); | |
| 184 | ||
| 185 | 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
|
186 | 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
|
187 | 12); |
| 14865 | 188 | |
|
40490
fb6e46c4c63c
Remove PIDGIN_HIG_* constants
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
189 | 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
|
190 | 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
|
191 | hbox); |
| 5437 | 192 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
193 | if (img != NULL) { |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
194 | gtk_box_append(GTK_BOX(hbox), img); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
195 | } |
|
34450
0145b9f2d77c
GTK Notify: decorete purple_notify_message windows with account icon
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
196 | |
| 14865 | 197 | primary_esc = g_markup_escape_text(primary, -1); |
| 198 | secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
| 199 | 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
|
200 | "<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
|
201 | 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
|
202 | (secondary ? secondary_esc : "")); |
| 14865 | 203 | g_free(primary_esc); |
| 204 | g_free(secondary_esc); | |
| 5437 | 205 | |
| 14865 | 206 | label = gtk_label_new(NULL); |
| 5437 | 207 | |
| 14865 | 208 | 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
|
209 | 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
|
210 | 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
|
211 | 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
|
212 | 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
|
213 | gtk_box_append(GTK_BOX(hbox), label); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
214 | |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
215 | pidgin_widget_decorate_account(hbox, |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
216 | purple_request_cpar_get_account(cpar)); |
| 5437 | 217 | |
|
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
|
218 | 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
|
219 | 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
|
220 | 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
|
221 | |
|
42202
2273647d24b0
Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents:
42094
diff
changeset
|
222 | gtk_widget_set_visible(dialog, TRUE); |
| 5437 | 223 | |
| 14865 | 224 | return dialog; |
| 5437 | 225 | } |
| 226 | ||
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
227 | static gboolean |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
228 | 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
|
229 | 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
|
230 | G_GNUC_UNUSED gpointer data) |
| 7455 | 231 | { |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
232 | if (keyval == GDK_KEY_Escape) { |
| 15884 | 233 | purple_notify_close(PURPLE_NOTIFY_FORMATTED, win); |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
234 | |
| 7455 | 235 | return TRUE; |
| 236 | } | |
|
8337
07da3cefb9d3
[gaim-migrate @ 9061]
Christian Hammond <chipx86@chipx86.com>
parents:
8284
diff
changeset
|
237 | |
| 7455 | 238 | return FALSE; |
| 239 | } | |
| 240 | ||
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
241 | static void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
242 | pidgin_notify_formatted(const char *title, const char *primary, |
|
12242
e7fc1748eb56
[gaim-migrate @ 14544]
Richard Laager <rlaager@pidgin.im>
parents:
12227
diff
changeset
|
243 | const char *secondary, const char *text) |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
244 | { |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
245 | GtkWidget *window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
246 | GtkWidget *vbox; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
247 | GtkWidget *label; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
248 | GtkWidget *button; |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
249 | 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
|
250 | 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
|
251 | 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
|
252 | GtkTextBuffer *buffer; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
253 | char label_text[2048]; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
254 | char *linked_text, *primary_esc, *secondary_esc; |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
255 | |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
256 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
257 | 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
|
258 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
259 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
260 | 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
|
261 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
262 | /* 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
|
263 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
264 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
265 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
266 | primary_esc = g_markup_escape_text(primary, -1); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
267 | 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
|
268 | g_snprintf(label_text, sizeof(label_text), |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
269 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
270 | primary_esc, |
|
8338
15352ef157f9
[gaim-migrate @ 9062]
Christian Hammond <chipx86@chipx86.com>
parents:
8337
diff
changeset
|
271 | (secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
272 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
273 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
274 | g_free(secondary_esc); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
275 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
276 | label = gtk_label_new(NULL); |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
277 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
278 | 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
|
279 | 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
|
280 | 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
|
281 | 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
|
282 | 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
|
283 | gtk_box_append(GTK_BOX(vbox), label); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
284 | |
| 39214 | 285 | /* Add the view */ |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
286 | sw = gtk_scrolled_window_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
287 | gtk_box_append(GTK_BOX(vbox), sw); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
288 | 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
|
289 | |
|
42480
8c296ed85b26
Replace Talkatu in the notify api
Gary Kramlich <grim@reaperworld.com>
parents:
42251
diff
changeset
|
290 | view = gtk_text_view_new(); |
|
8c296ed85b26
Replace Talkatu in the notify api
Gary Kramlich <grim@reaperworld.com>
parents:
42251
diff
changeset
|
291 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
292 | 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
|
293 | 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
|
294 | gtk_widget_set_size_request(view, 300, 250); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
295 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
296 | /* Add the Close button. */ |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
297 | 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
|
298 | gtk_widget_grab_focus(button); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
299 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
300 | event = gtk_event_controller_key_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
301 | gtk_widget_add_controller(window, event); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
302 | 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
|
303 | G_CALLBACK(formatted_input_cb), NULL); |
| 7455 | 304 | |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
305 | /* Make sure URLs are clickable */ |
| 15884 | 306 | linked_text = purple_markup_linkify(text); |
|
42480
8c296ed85b26
Replace Talkatu in the notify api
Gary Kramlich <grim@reaperworld.com>
parents:
42251
diff
changeset
|
307 | gtk_text_buffer_set_text(buffer, linked_text, -1); |
|
8882
e1f85917a765
[gaim-migrate @ 9651]
Mark Doliner <markdoliner@pidgin.im>
parents:
8523
diff
changeset
|
308 | g_free(linked_text); |
| 7078 | 309 | |
|
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
|
310 | 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
|
311 | |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
312 | /* 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
|
313 | 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
|
314 | |
|
42202
2273647d24b0
Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents:
42094
diff
changeset
|
315 | gtk_widget_set_visible(window, TRUE); |
|
6381
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
316 | |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
317 | return window; |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
318 | } |
|
53203c44c731
[gaim-migrate @ 6886]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
319 | |
| 11359 | 320 | static void |
| 15884 | 321 | pidgin_notify_searchresults_new_rows(PurpleConnection *gc, PurpleNotifySearchResults *results, |
| 13641 | 322 | void *data_) |
| 11359 | 323 | { |
| 15882 | 324 | 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
|
325 | PurpleProtocol *protocol = NULL; |
| 11359 | 326 | GtkListStore *model = data->model; |
| 327 | GtkTreeIter iter; | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
328 | GList *row, *column; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
329 | guint n; |
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
330 | const gchar *icon_name = NULL; |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
12911
diff
changeset
|
331 | |
| 11359 | 332 | gtk_list_store_clear(data->model); |
| 333 | ||
|
41575
d08b9a655b0e
Remove pidgin_create_icon_from_protocol and pidgin_create_protocol_icon
Gary Kramlich <grim@reaperworld.com>
parents:
41534
diff
changeset
|
334 | 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
|
335 | icon_name = purple_protocol_get_icon_name(protocol); |
| 11359 | 336 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
337 | for (row = results->rows; row != NULL; row = row->next) { |
| 11359 | 338 | |
| 339 | 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
|
340 | gtk_list_store_set(model, &iter, 0, icon_name, -1); |
| 11359 | 341 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
342 | n = 1; |
|
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
343 | for (column = row->data; column != NULL; column = column->next) { |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
344 | GValue v; |
| 11359 | 345 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12477
diff
changeset
|
346 | v.g_type = 0; |
| 11359 | 347 | 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
|
348 | 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
|
349 | 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
|
350 | n++; |
| 11359 | 351 | } |
| 352 | } | |
| 353 | } | |
| 354 | ||
| 9797 | 355 | static void * |
| 15884 | 356 | pidgin_notify_searchresults(PurpleConnection *gc, const char *title, |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
357 | const char *primary, const char *secondary, |
| 15884 | 358 | PurpleNotifySearchResults *results, gpointer user_data) |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
359 | { |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
360 | GtkWidget *window; |
| 11359 | 361 | GtkWidget *treeview; |
| 362 | GType *col_types; | |
| 363 | GtkListStore *model; | |
| 364 | GtkCellRenderer *renderer; | |
| 12257 | 365 | 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
|
366 | GList *columniter; |
| 12257 | 367 | 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
|
368 | GList *l; |
| 11359 | 369 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
370 | GtkWidget *vbox; |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
371 | GtkWidget *sw; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
372 | GtkWidget *label; |
| 15882 | 373 | PidginNotifySearchResultsData *data; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
374 | char *label_text; |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
375 | char *primary_esc, *secondary_esc; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
376 | |
| 12257 | 377 | g_return_val_if_fail(gc != NULL, NULL); |
| 378 | g_return_val_if_fail(results != NULL, NULL); | |
| 379 | ||
|
39922
113b93e2bd2a
Replace malloc(sizeof(...)) with g_new0(..., 1).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39913
diff
changeset
|
380 | data = g_new0(PidginNotifySearchResultsData, 1); |
| 13641 | 381 | data->user_data = user_data; |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
382 | data->results = results; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
383 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
384 | /* Create the window */ |
|
19546
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
385 | window = gtk_dialog_new(); |
|
b7a8a86af65a
Use GtkDialog more often. Thanks nix_nix. Fixes #2618
Sean Egan <seanegan@pidgin.im>
parents:
19431
diff
changeset
|
386 | 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
|
387 | gtk_window_set_resizable(GTK_WINDOW(window), TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
388 | |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
389 | 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
|
390 | data); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
391 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
392 | /* 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
|
393 | vbox = gtk_dialog_get_content_area(GTK_DIALOG(window)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
394 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
395 | /* Setup the descriptive label */ |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
396 | primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
397 | 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
|
398 | label_text = g_strdup_printf( |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
399 | "<span weight=\"bold\" size=\"larger\">%s</span>%s%s", |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
400 | (primary ? primary_esc : ""), |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
401 | (primary && secondary ? "\n" : ""), |
|
10774
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
402 | (secondary ? secondary_esc : "")); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
403 | g_free(primary_esc); |
|
f4238d6312ff
[gaim-migrate @ 12383]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10750
diff
changeset
|
404 | g_free(secondary_esc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
405 | label = gtk_label_new(NULL); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
406 | 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
|
407 | 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
|
408 | 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
|
409 | 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
|
410 | gtk_box_append(GTK_BOX(vbox), label); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
411 | g_free(label_text); |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
412 | |
| 11359 | 413 | /* +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
|
414 | col_num = g_list_length(results->columns) + 1; |
| 11359 | 415 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
416 | /* Setup the list model */ |
| 11359 | 417 | col_types = g_new0(GType, col_num); |
| 418 | ||
| 419 | /* There always is this first column. */ | |
| 420 | col_types[0] = GDK_TYPE_PIXBUF; | |
| 421 | for (i = 1; i < col_num; i++) { | |
| 422 | col_types[i] = G_TYPE_STRING; | |
| 423 | } | |
| 424 | model = gtk_list_store_newv(col_num, col_types); | |
| 22999 | 425 | g_free(col_types); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
426 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
427 | /* Setup the treeview */ |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
428 | treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42551
diff
changeset
|
429 | g_object_unref(model); |
| 11359 | 430 | gtk_widget_set_size_request(treeview, 500, 400); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
431 | 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
|
432 | GTK_SELECTION_SINGLE); |
| 11359 | 433 | 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
|
434 | sw = gtk_scrolled_window_new(); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
435 | 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
|
436 | GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
437 | 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
|
438 | gtk_widget_set_vexpand(sw, TRUE); |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
439 | gtk_box_append(GTK_BOX(vbox), sw); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
440 | |
| 11359 | 441 | renderer = gtk_cell_renderer_pixbuf_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
442 | 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
|
443 | -1, "", renderer, "icon-name", 0, NULL); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
444 | |
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
445 | 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
|
446 | 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
|
447 | PurpleNotifySearchColumn *column = columniter->data; |
| 11359 | 448 | renderer = gtk_cell_renderer_text_new(); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
449 | |
| 11359 | 450 | 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
|
451 | purple_notify_searchresult_column_get_title(column), renderer, "text", i, NULL); |
| 31696 | 452 | |
| 453 | if (!purple_notify_searchresult_column_is_visible(column)) | |
| 454 | gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); | |
| 455 | ||
|
20355
dacdf6087e16
Access search results directly instead of going through the API because
Mark Doliner <markdoliner@pidgin.im>
parents:
20330
diff
changeset
|
456 | i++; |
| 11359 | 457 | } |
|
14286
9ff15ceacd34
[gaim-migrate @ 16905]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
458 | |
|
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
|
459 | 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
|
460 | PurpleNotifySearchButton *b = l->data; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
461 | GtkWidget *button = NULL; |
| 11359 | 462 | switch (b->type) { |
| 15884 | 463 | case PURPLE_NOTIFY_BUTTON_LABELED: |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
464 | if(b->label) { |
|
38789
ad3e9caa955b
Ensure labelled buttons are shown for search results in Pidgin.
Howard Chu <hyc@symas.com>
parents:
38737
diff
changeset
|
465 | 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
|
466 | } else { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19546
diff
changeset
|
467 | purple_debug_warning("gtknotify", "Missing button label\n"); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
468 | } |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
469 | break; |
| 15884 | 470 | case PURPLE_NOTIFY_BUTTON_CONTINUE: |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
471 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Forward"), GTK_RESPONSE_NONE); |
| 11359 | 472 | break; |
| 15884 | 473 | case PURPLE_NOTIFY_BUTTON_ADD: |
|
40693
4d91fb883f4b
Replace stock items for dialog buttons with labels
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
474 | button = gtk_dialog_add_button(GTK_DIALOG(window), _("Add"), GTK_RESPONSE_NONE); |
| 11359 | 475 | break; |
| 15884 | 476 | case PURPLE_NOTIFY_BUTTON_INFO: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
477 | 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
|
478 | break; |
| 15884 | 479 | case PURPLE_NOTIFY_BUTTON_IM: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
480 | 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
|
481 | break; |
| 15884 | 482 | case PURPLE_NOTIFY_BUTTON_JOIN: |
|
41021
74367ae3c5c3
Remove the usage of GtkStock from gtknotify.c
Gary Kramlich <grim@reaperworld.com>
parents:
40693
diff
changeset
|
483 | 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
|
484 | break; |
| 15884 | 485 | case PURPLE_NOTIFY_BUTTON_INVITE: |
|
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), _("_Invite"), GTK_RESPONSE_NONE); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
487 | break; |
| 11359 | 488 | default: |
| 15884 | 489 | purple_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); |
| 11359 | 490 | } |
| 491 | if (button != NULL) { | |
| 15882 | 492 | PidginNotifySearchResultsButtonData *bd; |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
493 | |
| 15882 | 494 | bd = g_new0(PidginNotifySearchResultsButtonData, 1); |
|
12624
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
495 | bd->button = b; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
496 | bd->data = data; |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
497 | |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
498 | g_signal_connect(G_OBJECT(button), "clicked", |
|
c1c92f08976b
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
499 | G_CALLBACK(searchresults_callback_wrapper_cb), bd); |
|
14038
3b7740b778ad
[gaim-migrate @ 16534]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14037
diff
changeset
|
500 | g_signal_connect_swapped(G_OBJECT(button), "destroy", G_CALLBACK(g_free), bd); |
| 11359 | 501 | } |
| 502 | } | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
503 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
504 | /* Add the Close button */ |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
505 | 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
|
506 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32521
diff
changeset
|
507 | data->account = purple_connection_get_account(gc); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
508 | data->model = model; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
509 | data->treeview = treeview; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
510 | data->window = window; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
511 | |
| 11359 | 512 | /* Insert rows. */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
513 | pidgin_notify_searchresults_new_rows(gc, results, data); |
| 11359 | 514 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
515 | /* 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
|
516 | 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
|
517 | |
|
42202
2273647d24b0
Use gtk_widget_set_visible for everything
Gary Kramlich <grim@reaperworld.com>
parents:
42094
diff
changeset
|
518 | gtk_widget_set_visible(window, TRUE); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
519 | return data; |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
520 | } |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
521 | |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41231
diff
changeset
|
522 | /* 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
|
523 | /* User information. */ |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
524 | static GHashTable *userinfo; |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
525 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
526 | static char * |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
527 | userinfo_hash(PurpleAccount *account, const char *who) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
528 | { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
529 | 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
|
530 | g_snprintf(key, sizeof(key), "%s - %s", |
|
42804
be8c8b5471ca
Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents:
42592
diff
changeset
|
531 | purple_account_get_username(account), |
|
40094
8e6d91e4dd8f
Use g_(v)snprintf so we need less wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40048
diff
changeset
|
532 | purple_normalize(account, who)); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
533 | return g_utf8_strup(key, -1); |
|
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 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
536 | static void |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
537 | remove_userinfo(GtkWidget *widget, gpointer key) |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
538 | { |
|
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
|
539 | 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
|
540 | |
|
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
|
541 | 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
|
542 | 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
|
543 | |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
544 | g_hash_table_remove(userinfo, key); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
545 | } |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
546 | |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
547 | static void * |
| 15884 | 548 | pidgin_notify_userinfo(PurpleConnection *gc, const char *who, |
| 549 | PurpleNotifyUserInfo *user_info) | |
| 9797 | 550 | { |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
551 | char *info; |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
552 | void *ui_handle; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
553 | 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
|
554 | PidginUserInfo *pinfo = NULL; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
555 | |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
556 | 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
|
557 | 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
|
558 | } |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
559 | |
| 15884 | 560 | 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
|
561 | 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
|
562 | 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
|
563 | 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
|
564 | 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
|
565 | char *linked_text = purple_markup_linkify(info); |
|
42480
8c296ed85b26
Replace Talkatu in the notify api
Gary Kramlich <grim@reaperworld.com>
parents:
42251
diff
changeset
|
566 | |
|
8c296ed85b26
Replace Talkatu in the notify api
Gary Kramlich <grim@reaperworld.com>
parents:
42251
diff
changeset
|
567 | gtk_text_buffer_set_text(buffer, linked_text, -1); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
568 | g_free(linked_text); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
569 | 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
|
570 | 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
|
571 | pinfo->count++; |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
572 | } else { |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
573 | char *primary = g_strdup_printf(_("Info for %s"), who); |
|
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
574 | 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
|
575 | 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
|
576 | NULL); |
|
42014
b6a9fcf02157
Replace obsolete delete_event signals
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41962
diff
changeset
|
577 | 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
|
578 | key); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
579 | 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
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | g_hash_table_insert(userinfo, key, pinfo); |
|
17027
cad1dc392f1a
Fix ticket #387.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16752
diff
changeset
|
584 | } |
|
15206
70520a610969
[gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents:
14865
diff
changeset
|
585 | g_free(info); |
|
11533
f58436975d44
[gaim-migrate @ 13782]
Richard Laager <rlaager@pidgin.im>
parents:
11359
diff
changeset
|
586 | return ui_handle; |
| 9797 | 587 | } |
| 588 | ||
| 5437 | 589 | static void |
| 15884 | 590 | pidgin_close_notify(PurpleNotifyType type, void *ui_handle) |
| 5437 | 591 | { |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
592 | if (type == PURPLE_NOTIFY_SEARCHRESULTS) { |
| 15882 | 593 | PidginNotifySearchResultsData *data = (PidginNotifySearchResultsData *)ui_handle; |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
594 | |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
595 | gtk_window_destroy(GTK_WINDOW(data->window)); |
| 15884 | 596 | purple_notify_searchresults_free(data->results); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
597 | |
|
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
598 | g_free(data); |
|
41534
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
599 | |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
600 | } else if (ui_handle != NULL) { |
|
ed3a7cfa0b0c
Convert PidginNotify to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41526
diff
changeset
|
601 | gtk_window_destroy(GTK_WINDOW(ui_handle)); |
|
10439
5868d8f55fb1
[gaim-migrate @ 11697]
Alex Converse <alex.converse@gmail.com>
parents:
10297
diff
changeset
|
602 | } |
| 5437 | 603 | } |
| 604 | ||
| 7136 | 605 | 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
|
606 | 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
|
607 | GtkUriLauncher *launcher = NULL; |
|
76245ac5cf36
Fix gtk_show_uri deprecations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42202
diff
changeset
|
608 | launcher = gtk_uri_launcher_new(uri); |
|
76245ac5cf36
Fix gtk_show_uri deprecations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42202
diff
changeset
|
609 | 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
|
610 | g_object_unref(launcher); |
| 7136 | 611 | |
| 612 | return NULL; | |
| 613 | } | |
| 614 | ||
|
27476
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
615 | static void* |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
616 | 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
|
617 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
618 | static int handle; |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
619 | return &handle; |
|
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 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
622 | 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
|
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 | |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
626 | 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
|
627 | { |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
628 | 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
|
629 | } |
|
d44640cb5686
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <darkrain42@pidgin.im>
parents:
27470
diff
changeset
|
630 | |
|
41720
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
631 | static PurpleNotifyUiOps ops = { |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
632 | .notify_message = pidgin_notify_message, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
633 | .notify_formatted = pidgin_notify_formatted, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
634 | .notify_searchresults = pidgin_notify_searchresults, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
635 | .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
|
636 | .notify_userinfo = pidgin_notify_userinfo, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
637 | .notify_uri = pidgin_notify_uri, |
|
bcfc2c9e5213
Move all of the UiOps to use struct initializers
Gary Kramlich <grim@reaperworld.com>
parents:
41629
diff
changeset
|
638 | .close_notify = pidgin_close_notify, |
| 5437 | 639 | }; |
| 640 | ||
| 15884 | 641 | PurpleNotifyUiOps * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
642 | pidgin_notify_get_ui_ops(void) |
| 5437 | 643 | { |
| 644 | return &ops; | |
| 645 | } |