Fri, 23 Aug 2013 23:46:41 +0530
Merged soc.2013.gobjectification branch
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1 | /** |
|
14914
290eb2170f38
[gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14781
diff
changeset
|
2 | * @file gtkutils.c GTK+ utility functions |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
16123
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20036
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20036
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
20036
diff
changeset
|
6 | /* pidgin |
| 4359 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
7060
717cbeb22b6d
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
6846
diff
changeset
|
11 | * |
| 4359 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * 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:
19547
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 4359 | 25 | */ |
|
24569
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
23501
diff
changeset
|
26 | #define _PIDGIN_GTKUTILS_C_ |
|
5dbd0617a27d
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@pidgin.im>
parents:
23501
diff
changeset
|
27 | |
| 9791 | 28 | #include "internal.h" |
| 15577 | 29 | #include "pidgin.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
30 | |
|
33477
ed01a53b8afc
These changes were what I needed to be able to build on a Macbook Pro with OS
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
33359
diff
changeset
|
31 | #ifdef _WIN32 |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
32 | # ifdef small |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
33 | # undef small |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
34 | # endif |
| 4359 | 35 | #endif /*_WIN32*/ |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
36 | |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
37 | #ifdef USE_GTKSPELL |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
38 | # include <gtkspell/gtkspell.h> |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
39 | # ifdef _WIN32 |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
40 | # include "wspell.h" |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
41 | # endif |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
42 | #endif |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
43 | |
| 4359 | 44 | #include <gdk/gdkkeysyms.h> |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
45 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
46 | #include "conversation.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
47 | #include "debug.h" |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
48 | #include "desktopitem.h" |
| 7078 | 49 | #include "imgstore.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
50 | #include "notify.h" |
| 5548 | 51 | #include "prefs.h" |
|
36543
a8c3fecee2d3
Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents:
36539
diff
changeset
|
52 | #include "protocol.h" |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
53 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
54 | #include "signals.h" |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
55 | #include "sound.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
56 | #include "util.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
57 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
58 | #include "gtkaccount.h" |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
59 | #include "gtkprefs.h" |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
60 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
61 | #include "gtkconv.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9706
diff
changeset
|
62 | #include "gtkdialogs.h" |
|
15883
969b74a3e27a
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents:
15882
diff
changeset
|
63 | #include "pidginstock.h" |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
64 | #include "gtkthemes.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
65 | #include "gtkutils.h" |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
66 | #include "gtkwebview.h" |
|
32807
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
67 | #include "gtkwebviewtoolbar.h" |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
68 | #include "pidgin/minidialog.h" |
| 4359 | 69 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
70 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
71 | |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
72 | enum { |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
73 | AOP_ICON_COLUMN, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
74 | AOP_NAME_COLUMN, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
75 | AOP_DATA_COLUMN, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
76 | AOP_COLUMN_COUNT |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
77 | }; |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
78 | |
| 17118 | 79 | typedef struct { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
80 | GtkTreeModel *model; |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
81 | gint default_item; |
| 17375 | 82 | } AopMenu; |
| 17117 | 83 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10681
diff
changeset
|
84 | static guint accels_save_timer = 0; |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
85 | static GSList *registered_url_handlers = NULL; |
| 7420 | 86 | |
| 8913 | 87 | static gboolean |
| 88 | url_clicked_idle_cb(gpointer data) | |
| 89 | { | |
| 15884 | 90 | purple_notify_uri(NULL, data); |
| 8913 | 91 | g_free(data); |
| 92 | return FALSE; | |
| 93 | } | |
| 94 | ||
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
95 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
96 | url_clicked_cb(GtkWebView *unused, const char *uri) |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6430
diff
changeset
|
97 | { |
| 8913 | 98 | g_idle_add(url_clicked_idle_cb, g_strdup(uri)); |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
99 | return TRUE; |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6430
diff
changeset
|
100 | } |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6430
diff
changeset
|
101 | |
| 4359 | 102 | void |
|
32809
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
103 | pidgin_setup_webview(GtkWidget *webview) |
| 4359 | 104 | { |
|
32809
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
105 | g_return_if_fail(webview != NULL); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
106 | g_return_if_fail(GTK_IS_WEBVIEW(webview)); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
107 | |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
108 | pidgin_themes_smiley_themeize(webview); |
|
15506
03be1365a163
GNOME has a 'document font' setting that we should use when running on GNOME. This does the gconftool-2 spawning trick to get it
Sean Egan <seanegan@pidgin.im>
parents:
15497
diff
changeset
|
109 | |
|
28908
d8538334b167
I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28878
diff
changeset
|
110 | #ifdef _WIN32 |
|
17487
2d9c6631e922
Reluctantly, I've added a preference for overriding the GTK+ default theme in GtkIMHtml widgets. There is support for this feature in the GNOME HIG and in other GTK+ (including GNOME) applications. This fixes #494. This is a GTK+ 2.4-only feature. I don't update the fonts in existing gtkimhtml's yet, only in new ones. Someone else may want to take care of that
Sean Egan <seanegan@pidgin.im>
parents:
17385
diff
changeset
|
111 | if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) { |
|
32809
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
112 | WebKitWebSettings *settings = webkit_web_settings_new(); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
113 | g_object_set(G_OBJECT(settings), "default-font-size", |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
114 | purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/font_size"), |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
115 | NULL); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
116 | g_object_set(G_OBJECT(settings), "default-font-family", |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
117 | purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"), |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
118 | NULL); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
119 | |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
120 | webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), settings); |
|
33499
ba4d2f8a8025
Fix possible leak. The settings object is ref'd by set_settings.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33360
diff
changeset
|
121 | g_object_unref(settings); |
|
17487
2d9c6631e922
Reluctantly, I've added a preference for overriding the GTK+ default theme in GtkIMHtml widgets. There is support for this feature in the GNOME HIG and in other GTK+ (including GNOME) applications. This fixes #494. This is a GTK+ 2.4-only feature. I don't update the fonts in existing gtkimhtml's yet, only in new ones. Someone else may want to take care of that
Sean Egan <seanegan@pidgin.im>
parents:
17385
diff
changeset
|
122 | } |
|
28908
d8538334b167
I *think* this properly adds back the font preference stuff I axed earlier, but
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28878
diff
changeset
|
123 | #endif |
| 4359 | 124 | } |
| 125 | ||
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
126 | static |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
127 | void pidgin_window_init(GtkWindow *wnd, const char *title, guint border_width, const char *role, gboolean resizable) |
| 17213 | 128 | { |
| 129 | if (title) | |
| 130 | gtk_window_set_title(wnd, title); | |
|
18941
995cf072aa9b
Prevent some more window titles from being "pidgin.exe" on Windows. Fixes #1767
Daniel Atallah <datallah@pidgin.im>
parents:
18672
diff
changeset
|
131 | #ifdef _WIN32 |
|
995cf072aa9b
Prevent some more window titles from being "pidgin.exe" on Windows. Fixes #1767
Daniel Atallah <datallah@pidgin.im>
parents:
18672
diff
changeset
|
132 | else |
|
995cf072aa9b
Prevent some more window titles from being "pidgin.exe" on Windows. Fixes #1767
Daniel Atallah <datallah@pidgin.im>
parents:
18672
diff
changeset
|
133 | gtk_window_set_title(wnd, PIDGIN_ALERT_TITLE); |
|
995cf072aa9b
Prevent some more window titles from being "pidgin.exe" on Windows. Fixes #1767
Daniel Atallah <datallah@pidgin.im>
parents:
18672
diff
changeset
|
134 | #endif |
| 17213 | 135 | gtk_container_set_border_width(GTK_CONTAINER(wnd), border_width); |
| 136 | if (role) | |
| 137 | gtk_window_set_role(wnd, role); | |
| 138 | gtk_window_set_resizable(wnd, resizable); | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
139 | } |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
140 | |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
141 | GtkWidget * |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
142 | pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable) |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
143 | { |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
144 | GtkWindow *wnd = NULL; |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
145 | |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
146 | wnd = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
147 | pidgin_window_init(wnd, title, border_width, role, resizable); |
| 17213 | 148 | |
| 149 | return GTK_WIDGET(wnd); | |
| 150 | } | |
| 151 | ||
| 152 | GtkWidget * | |
|
29896
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
153 | pidgin_create_small_button(GtkWidget *image) |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
154 | { |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
155 | GtkWidget *button; |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
156 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
157 | button = gtk_button_new(); |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
158 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
159 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
160 | /* don't allow focus on the close button */ |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
161 | gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE); |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
162 | |
|
29898
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
163 | /* set style to make it as small as possible */ |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
164 | gtk_widget_set_name(button, "pidgin-small-close-button"); |
|
29896
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
165 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
166 | gtk_widget_show(image); |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
167 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
168 | gtk_container_add(GTK_CONTAINER(button), image); |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
169 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
170 | return button; |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
171 | } |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
172 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
173 | GtkWidget * |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
174 | pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable) |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
175 | { |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
176 | GtkWindow *wnd = NULL; |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
177 | |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
178 | wnd = GTK_WINDOW(gtk_dialog_new()); |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
179 | pidgin_window_init(wnd, title, border_width, role, resizable); |
| 17213 | 180 | |
| 181 | return GTK_WIDGET(wnd); | |
| 182 | } | |
| 183 | ||
| 184 | GtkWidget * | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
185 | pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing) |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
186 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
187 | GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
188 | gtk_box_set_homogeneous(vbox, homogeneous); |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
189 | gtk_box_set_spacing(vbox, spacing); |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
190 | return GTK_WIDGET(vbox); |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
191 | } |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
192 | |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
193 | GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog) |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
194 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
195 | return gtk_dialog_get_content_area(GTK_DIALOG(dialog)); |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
196 | } |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
197 | |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
198 | GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog) |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
199 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
200 | return gtk_dialog_get_action_area(GTK_DIALOG(dialog)); |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
201 | } |
|
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
202 | |
|
22005
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
203 | GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
204 | GCallback callback, gpointer callbackdata) |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
205 | { |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
206 | GtkWidget *button = gtk_button_new_from_stock(label); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
207 | GtkWidget *bbox = pidgin_dialog_get_action_area(dialog); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
208 | gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
209 | if (callback) |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
210 | g_signal_connect(G_OBJECT(button), "clicked", callback, callbackdata); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
211 | gtk_widget_show(button); |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
212 | return button; |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
213 | } |
|
0183020ba2cc
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22000
diff
changeset
|
214 | |
|
22000
5e7708f58d3d
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21630
diff
changeset
|
215 | GtkWidget * |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34208
diff
changeset
|
216 | pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **sw_ret) |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
217 | { |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
218 | GtkWidget *frame; |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
219 | GtkWidget *webview; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
220 | GtkWidget *sep; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
221 | GtkWidget *sw; |
|
10177
9471d38bd527
[gaim-migrate @ 11292]
Christian Hammond <chipx86@chipx86.com>
parents:
10175
diff
changeset
|
222 | GtkWidget *toolbar = NULL; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
223 | GtkWidget *vbox; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
224 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
225 | frame = gtk_frame_new(NULL); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
226 | gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
227 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
228 | vbox = gtk_vbox_new(FALSE, 0); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
229 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
230 | gtk_widget_show(vbox); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
231 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
232 | if (editable) { |
|
32807
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
233 | toolbar = gtk_webviewtoolbar_new(); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
234 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
235 | gtk_widget_show(toolbar); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
236 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
237 | sep = gtk_hseparator_new(); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
238 | gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); |
| 14607 | 239 | g_signal_connect_swapped(G_OBJECT(toolbar), "show", G_CALLBACK(gtk_widget_show), sep); |
| 240 | g_signal_connect_swapped(G_OBJECT(toolbar), "hide", G_CALLBACK(gtk_widget_hide), sep); | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
241 | gtk_widget_show(sep); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
242 | } |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
243 | |
|
34276
2b602f67f875
Make editable-ness a construct-only property of the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34274
diff
changeset
|
244 | webview = gtk_webview_new(editable); |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
245 | if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) |
|
33021
3dc4b2cdba7f
Enable spell checking in an editable webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32939
diff
changeset
|
246 | pidgin_webview_set_spellcheck(GTK_WEBVIEW(webview), TRUE); |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
247 | gtk_widget_show(webview); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
248 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
249 | if (editable) { |
|
32807
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
250 | gtk_webviewtoolbar_attach(GTK_WEBVIEWTOOLBAR(toolbar), webview); |
|
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
251 | gtk_webviewtoolbar_associate_smileys(GTK_WEBVIEWTOOLBAR(toolbar), "default"); |
|
34292
30107eb2ff81
Fix compiler warnings, make build even more silent
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34276
diff
changeset
|
252 | gtk_webview_set_toolbar(GTK_WEBVIEW(webview), toolbar); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
253 | } |
|
32809
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
254 | pidgin_setup_webview(webview); |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
255 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
256 | sw = pidgin_make_scrollable(webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
257 | gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
258 | |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
259 | gtk_webview_set_vadjustment(GTK_WEBVIEW(webview), |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
260 | gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw))); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
261 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
262 | if (webview_ret != NULL) |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
263 | *webview_ret = webview; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
264 | |
|
13281
3558cb15ebb9
[gaim-migrate @ 15646]
Richard Laager <rlaager@pidgin.im>
parents:
13203
diff
changeset
|
265 | if (sw_ret != NULL) |
|
3558cb15ebb9
[gaim-migrate @ 15646]
Richard Laager <rlaager@pidgin.im>
parents:
13203
diff
changeset
|
266 | *sw_ret = sw; |
|
3558cb15ebb9
[gaim-migrate @ 15646]
Richard Laager <rlaager@pidgin.im>
parents:
13203
diff
changeset
|
267 | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
268 | return frame; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
269 | } |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
270 | |
| 4359 | 271 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
272 | pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog) |
|
7751
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
273 | { |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
274 | const char *text = gtk_entry_get_text(GTK_ENTRY(entry)); |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
275 | gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK, |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
276 | (*text != '\0')); |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
277 | } |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
278 | |
| 4359 | 279 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
280 | pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) |
| 4359 | 281 | { |
| 282 | gboolean sensitivity; | |
| 283 | ||
| 284 | if (to_toggle == NULL) | |
| 285 | return; | |
| 286 | ||
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
287 | sensitivity = gtk_widget_get_sensitive(to_toggle); |
| 4359 | 288 | |
| 289 | gtk_widget_set_sensitive(to_toggle, !sensitivity); | |
| 290 | } | |
| 291 | ||
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
292 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
293 | pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) |
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
294 | { |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
295 | gboolean sensitivity; |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
296 | gpointer element; |
|
34308
cdb187c27360
Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34292
diff
changeset
|
297 | guint i; |
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
298 | |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
299 | for (i=0; i < data->len; i++) { |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
300 | element = g_ptr_array_index(data,i); |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
301 | if (element == NULL) |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
302 | continue; |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
303 | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
304 | sensitivity = gtk_widget_get_sensitive(element); |
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
305 | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
306 | gtk_widget_set_sensitive(element, !sensitivity); |
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
307 | } |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
308 | } |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
309 | |
|
8901
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
310 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
311 | pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle) |
|
8901
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
312 | { |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
313 | if (to_toggle == NULL) |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
314 | return; |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
315 | |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32900
diff
changeset
|
316 | if (gtk_widget_get_visible(to_toggle)) |
|
8901
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
317 | gtk_widget_hide(to_toggle); |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
318 | else |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
319 | gtk_widget_show(to_toggle); |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
320 | } |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
321 | |
|
17359
6dd3b7730470
Change pidgin_separator to return the separator added to the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
322 | GtkWidget *pidgin_separator(GtkWidget *menu) |
| 4687 | 323 | { |
| 324 | GtkWidget *menuitem; | |
| 325 | ||
| 326 | menuitem = gtk_separator_menu_item_new(); | |
| 327 | gtk_widget_show(menuitem); | |
| 328 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
|
17359
6dd3b7730470
Change pidgin_separator to return the separator added to the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
329 | return menuitem; |
| 4687 | 330 | } |
|
5160
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
331 | |
| 15568 | 332 | GtkWidget *pidgin_new_item(GtkWidget *menu, const char *str) |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
333 | { |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
334 | GtkWidget *menuitem; |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
335 | GtkWidget *label; |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
336 | |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
337 | menuitem = gtk_menu_item_new(); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
338 | if (menu) |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
339 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
340 | gtk_widget_show(menuitem); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
341 | |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
342 | label = gtk_label_new(str); |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6236
diff
changeset
|
343 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
344 | gtk_label_set_pattern(GTK_LABEL(label), "_"); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
345 | gtk_container_add(GTK_CONTAINER(menuitem), label); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
346 | gtk_widget_show(label); |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
347 | /* FIXME: Go back and fix this |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
348 | gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
349 | GDK_MOD1_MASK, GTK_ACCEL_LOCKED); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
350 | */ |
| 15568 | 351 | pidgin_set_accessible_label (menuitem, label); |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
352 | return menuitem; |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
353 | } |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
354 | |
| 15568 | 355 | GtkWidget *pidgin_new_check_item(GtkWidget *menu, const char *str, |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
356 | GCallback cb, gpointer data, gboolean checked) |
| 5906 | 357 | { |
| 358 | GtkWidget *menuitem; | |
| 359 | menuitem = gtk_check_menu_item_new_with_mnemonic(str); | |
| 360 | ||
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
361 | if (menu) |
| 5906 | 362 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
| 363 | ||
|
7299
4c804d9a52f1
[gaim-migrate @ 7883]
Christian Hammond <chipx86@chipx86.com>
parents:
7118
diff
changeset
|
364 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), checked); |
|
4c804d9a52f1
[gaim-migrate @ 7883]
Christian Hammond <chipx86@chipx86.com>
parents:
7118
diff
changeset
|
365 | |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
366 | if (cb) |
|
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
367 | g_signal_connect(G_OBJECT(menuitem), "activate", cb, data); |
| 5906 | 368 | |
| 369 | gtk_widget_show_all(menuitem); | |
| 370 | ||
| 371 | return menuitem; | |
| 372 | } | |
| 373 | ||
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
374 | GtkWidget * |
| 15568 | 375 | pidgin_pixbuf_toolbar_button_from_stock(const char *icon) |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
376 | { |
|
9706
d5b657fe9cff
[gaim-migrate @ 10567]
Mark Doliner <markdoliner@pidgin.im>
parents:
9534
diff
changeset
|
377 | GtkWidget *button, *image, *bbox; |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
378 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
379 | button = gtk_toggle_button_new(); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
380 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
381 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
382 | bbox = gtk_vbox_new(FALSE, 0); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
383 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
384 | gtk_container_add (GTK_CONTAINER(button), bbox); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
385 | |
|
15623
bf485c598199
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents:
15578
diff
changeset
|
386 | image = gtk_image_new_from_stock(icon, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
387 | gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
388 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
389 | gtk_widget_show_all(bbox); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
390 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
391 | return button; |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
392 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
393 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
394 | GtkWidget * |
| 15568 | 395 | pidgin_pixbuf_button_from_stock(const char *text, const char *icon, |
| 396 | PidginButtonOrientation style) | |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
397 | { |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
398 | GtkWidget *button, *image, *label, *bbox, *ibox, *lbox = NULL; |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
399 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
400 | button = gtk_button_new(); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
401 | |
| 15568 | 402 | if (style == PIDGIN_BUTTON_HORIZONTAL) { |
|
9750
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
403 | bbox = gtk_hbox_new(FALSE, 0); |
|
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
404 | ibox = gtk_hbox_new(FALSE, 0); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
405 | if (text) |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
406 | lbox = gtk_hbox_new(FALSE, 0); |
|
9750
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
407 | } else { |
|
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
408 | bbox = gtk_vbox_new(FALSE, 0); |
|
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
409 | ibox = gtk_vbox_new(FALSE, 0); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
410 | if (text) |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
411 | lbox = gtk_vbox_new(FALSE, 0); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
412 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
413 | |
|
9750
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
414 | gtk_container_add(GTK_CONTAINER(button), bbox); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
415 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
416 | if (icon) { |
|
29744
c1ae9f0f57ee
*** Plucked rev df5196ac4c45dfff9cad5768c27d4e1d46fbb2ab (qulogic@pidgin.im):
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29701
diff
changeset
|
417 | gtk_box_pack_start(GTK_BOX(bbox), ibox, TRUE, TRUE, 0); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
418 | image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON); |
|
9767
c68cfe03deec
[gaim-migrate @ 10635]
Mark Doliner <markdoliner@pidgin.im>
parents:
9750
diff
changeset
|
419 | gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, TRUE, 0); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
420 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
421 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
422 | if (text) { |
|
29744
c1ae9f0f57ee
*** Plucked rev df5196ac4c45dfff9cad5768c27d4e1d46fbb2ab (qulogic@pidgin.im):
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29701
diff
changeset
|
423 | gtk_box_pack_start(GTK_BOX(bbox), lbox, TRUE, TRUE, 0); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
424 | label = gtk_label_new(NULL); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
425 | gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
426 | gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); |
|
9767
c68cfe03deec
[gaim-migrate @ 10635]
Mark Doliner <markdoliner@pidgin.im>
parents:
9750
diff
changeset
|
427 | gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, TRUE, 0); |
| 15568 | 428 | pidgin_set_accessible_label (button, label); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
429 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
430 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
431 | gtk_widget_show_all(bbox); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
432 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
433 | return button; |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
434 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
435 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
436 | |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
437 | GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GCallback cb, gpointer data, guint accel_key, guint accel_mods, char *mod) |
|
5160
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
438 | { |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
439 | GtkWidget *menuitem; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
440 | /* |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
441 | GtkWidget *hbox; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
442 | GtkWidget *label; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
443 | */ |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
444 | GtkWidget *image; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
445 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
446 | if (icon == NULL) |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
447 | menuitem = gtk_menu_item_new_with_mnemonic(str); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
448 | else |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
449 | menuitem = gtk_image_menu_item_new_with_mnemonic(str); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
450 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
451 | if (menu) |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
452 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
453 | |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
454 | if (cb) |
|
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
455 | g_signal_connect(G_OBJECT(menuitem), "activate", cb, data); |
|
5160
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
456 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
457 | if (icon != NULL) { |
|
15623
bf485c598199
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents:
15578
diff
changeset
|
458 | image = gtk_image_new_from_stock(icon, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
|
5160
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
459 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
460 | } |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
461 | /* FIXME: this isn't right |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
462 | if (mod) { |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
463 | label = gtk_label_new(mod); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
464 | gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
465 | gtk_widget_show(label); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
466 | } |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
467 | */ |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
468 | /* |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
469 | if (accel_key) { |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
470 | gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key, |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
471 | accel_mods, GTK_ACCEL_LOCKED); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
472 | } |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
473 | */ |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
474 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
475 | gtk_widget_show_all(menuitem); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
476 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
477 | return menuitem; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
478 | } |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
479 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
480 | GtkWidget * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
481 | pidgin_make_frame(GtkWidget *parent, const char *title) |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
482 | { |
|
34186
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
483 | GtkWidget *vbox, *vbox2, *label, *hbox; |
|
13100
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
484 | char *labeltitle; |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
485 | |
| 15882 | 486 | vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
487 | gtk_box_pack_start(GTK_BOX(parent), vbox, FALSE, FALSE, 0); |
|
5641
a9d1f7917dd4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
488 | gtk_widget_show(vbox); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
489 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
490 | label = gtk_label_new(NULL); |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
491 | |
|
13100
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
492 | labeltitle = g_strdup_printf("<span weight=\"bold\">%s</span>", title); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
493 | gtk_label_set_markup(GTK_LABEL(label), labeltitle); |
|
13100
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
494 | g_free(labeltitle); |
|
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
495 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
496 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
497 | gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); |
|
5641
a9d1f7917dd4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
498 | gtk_widget_show(label); |
| 15568 | 499 | pidgin_set_accessible_label (vbox, label); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
500 | |
| 15882 | 501 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
502 | gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); |
|
5641
a9d1f7917dd4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
503 | gtk_widget_show(hbox); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
504 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
505 | label = gtk_label_new(" "); |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
506 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
|
5641
a9d1f7917dd4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
507 | gtk_widget_show(label); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
508 | |
|
34186
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
509 | vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
510 | gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0); |
|
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
511 | gtk_widget_show(vbox2); |
|
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
512 | |
|
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
513 | g_object_set_data(G_OBJECT(vbox2), "main-vbox", vbox); |
|
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
514 | |
|
1d9ea89d4934
Group and string support for keyring settings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
515 | return vbox2; |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
516 | } |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
517 | |
| 17117 | 518 | static gpointer |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
519 | aop_option_menu_get_selected(GtkWidget *optmenu) |
| 17117 | 520 | { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
521 | gpointer data = NULL; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
522 | GtkTreeIter iter; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
523 | |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
524 | g_return_val_if_fail(optmenu != NULL, NULL); |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
525 | |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
526 | if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(optmenu), &iter)) |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
527 | gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)), |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
528 | &iter, AOP_DATA_COLUMN, &data, -1); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
529 | |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
530 | return data; |
| 17117 | 531 | } |
| 532 | ||
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
533 | static void |
| 17117 | 534 | aop_menu_cb(GtkWidget *optmenu, GCallback cb) |
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
535 | { |
| 17375 | 536 | if (cb != NULL) { |
|
32389
3dcbfaba75f7
Supply something for the widget.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32388
diff
changeset
|
537 | ((void (*)(GtkWidget *, gpointer, gpointer))cb)(optmenu, |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
538 | aop_option_menu_get_selected(optmenu), |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
539 | g_object_get_data(G_OBJECT(optmenu), "user_data")); |
|
17237
77ee6a7263dc
Add some braces and clean up indentation.
Richard Laager <rlaager@pidgin.im>
parents:
17236
diff
changeset
|
540 | } |
| 17117 | 541 | } |
| 542 | ||
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
543 | static void |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
544 | aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu) |
| 17117 | 545 | { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
546 | gtk_combo_box_set_model(GTK_COMBO_BOX(optmenu), new_aop_menu->model); |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
547 | gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), new_aop_menu->default_item); |
|
32935
190f458c958b
It appears that no-one needs this AopMenu struct after the combo
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32934
diff
changeset
|
548 | g_free(new_aop_menu); |
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
549 | } |
|
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
550 | |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
551 | static GdkPixbuf * |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
552 | pidgin_create_protocol_icon_from_protocol(PurpleProtocol *protocol, PidginPrplIconSize size, PurpleAccount *account) |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
553 | { |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
554 | const char *protoname = NULL; |
|
18216
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
555 | char *tmp; |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
556 | char *filename = NULL; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
557 | GdkPixbuf *pixbuf; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
558 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
559 | if (protocol->list_icon == NULL) |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
560 | return NULL; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
561 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
562 | protoname = protocol->list_icon(account, NULL); |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
563 | if (protoname == NULL) |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
564 | return NULL; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
565 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
566 | /* |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
567 | * Status icons will be themeable too, and then it will look up |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
568 | * protoname from the theme |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
569 | */ |
|
18216
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
570 | tmp = g_strconcat(protoname, ".png", NULL); |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
571 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
572 | filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
573 | size == PIDGIN_PROTOCOL_ICON_SMALL ? "16" : |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
574 | size == PIDGIN_PROTOCOL_ICON_MEDIUM ? "22" : "48", |
|
18216
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
575 | tmp, NULL); |
|
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
576 | g_free(tmp); |
|
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
577 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
578 | pixbuf = pidgin_pixbuf_new_from_file(filename); |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
579 | g_free(filename); |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
580 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
581 | return pixbuf; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
582 | } |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
583 | |
|
17014
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
584 | static GtkWidget * |
| 17375 | 585 | aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data) |
| 17117 | 586 | { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
587 | GtkWidget *optmenu = NULL; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
588 | GtkCellRenderer *cr = NULL; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
589 | |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
590 | optmenu = gtk_combo_box_new(); |
| 17375 | 591 | gtk_widget_show(optmenu); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
592 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_pixbuf_new(), FALSE); |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
593 | gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "pixbuf", AOP_ICON_COLUMN); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
594 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_text_new(), TRUE); |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
595 | gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "text", AOP_NAME_COLUMN); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
596 | |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
597 | aop_option_menu_replace_menu(optmenu, aop_menu); |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
598 | g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
599 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
600 | g_signal_connect(G_OBJECT(optmenu), "changed", G_CALLBACK(aop_menu_cb), cb); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
601 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
602 | return optmenu; |
| 17117 | 603 | } |
| 604 | ||
| 605 | static void | |
| 17118 | 606 | aop_option_menu_select_by_data(GtkWidget *optmenu, gpointer data) |
|
17014
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
607 | { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
608 | GtkTreeModel *model; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
609 | GtkTreeIter iter; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
610 | gpointer iter_data; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
611 | model = gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)); |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
612 | if (gtk_tree_model_get_iter_first(model, &iter)) { |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
613 | do { |
|
32936
03b440305f19
Looks like I missed a number.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32935
diff
changeset
|
614 | gtk_tree_model_get(model, &iter, AOP_DATA_COLUMN, &iter_data, -1); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
615 | if (iter_data == data) { |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
616 | gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optmenu), &iter); |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
617 | return; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
618 | } |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
619 | } while (gtk_tree_model_iter_next(model, &iter)); |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
620 | } |
|
17014
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
621 | } |
|
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
622 | |
| 17375 | 623 | static AopMenu * |
| 624 | create_protocols_menu(const char *default_proto_id) | |
| 17117 | 625 | { |
| 17375 | 626 | AopMenu *aop_menu = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
627 | PurpleProtocol *protocol; |
| 17117 | 628 | GdkPixbuf *pixbuf = NULL; |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
629 | GtkTreeIter iter; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
630 | GtkListStore *ls; |
| 17117 | 631 | GList *p; |
| 632 | int i; | |
| 633 | ||
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
634 | ls = gtk_list_store_new(AOP_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
635 | |
| 17375 | 636 | aop_menu = g_malloc0(sizeof(AopMenu)); |
|
32934
9b08ef7651b2
Avoid calling gtk_combo_box_set_active twice in some cases.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32933
diff
changeset
|
637 | aop_menu->default_item = 0; |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
638 | aop_menu->model = GTK_TREE_MODEL(ls); |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
639 | |
|
36424
477889a0073c
Refactored gtkroomlist, gtkstatusbox, gtkthemes, gtkutils, gtkwebviewtoolbar, smileyparser to use the new API
Ankit Vani <a@nevitus.org>
parents:
36405
diff
changeset
|
640 | for (p = purple_protocols_get_all(), i = 0; |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
641 | p != NULL; |
| 17375 | 642 | p = p->next, i++) { |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
643 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
644 | protocol = (PurpleProtocol *)p->data; |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
645 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
646 | pixbuf = pidgin_create_protocol_icon_from_protocol(protocol, PIDGIN_PROTOCOL_ICON_SMALL, NULL); |
| 17117 | 647 | |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
648 | gtk_list_store_append(ls, &iter); |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
649 | gtk_list_store_set(ls, &iter, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
650 | AOP_ICON_COLUMN, pixbuf, |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
651 | AOP_NAME_COLUMN, protocol->name, |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
652 | AOP_DATA_COLUMN, protocol->id, |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
653 | -1); |
| 17375 | 654 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
655 | if (pixbuf) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
656 | g_object_unref(pixbuf); |
| 17117 | 657 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
658 | if (default_proto_id != NULL && !strcmp(protocol->id, default_proto_id)) |
| 17117 | 659 | aop_menu->default_item = i; |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
660 | } |
|
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
661 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
662 | return aop_menu; |
| 17117 | 663 | } |
| 664 | ||
| 665 | GtkWidget * | |
| 666 | pidgin_protocol_option_menu_new(const char *id, GCallback cb, | |
| 667 | gpointer user_data) | |
| 668 | { | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
669 | return aop_option_menu_new(create_protocols_menu(id), cb, user_data); |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
670 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
671 | |
|
18672
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
672 | const char * |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
673 | pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu) |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
674 | { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
675 | return (const char *)aop_option_menu_get_selected(optmenu); |
|
18672
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
676 | } |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
677 | |
| 15884 | 678 | PurpleAccount * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
679 | pidgin_account_option_menu_get_selected(GtkWidget *optmenu) |
|
8940
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8913
diff
changeset
|
680 | { |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
681 | return (PurpleAccount *)aop_option_menu_get_selected(optmenu); |
|
8940
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8913
diff
changeset
|
682 | } |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8913
diff
changeset
|
683 | |
| 17375 | 684 | static AopMenu * |
| 17117 | 685 | create_account_menu(PurpleAccount *default_account, |
| 15884 | 686 | PurpleFilterAccountFunc filter_func, gboolean show_all) |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
687 | { |
| 17375 | 688 | AopMenu *aop_menu = NULL; |
| 15884 | 689 | PurpleAccount *account; |
| 17117 | 690 | GdkPixbuf *pixbuf = NULL; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
691 | GList *list; |
|
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
692 | GList *p; |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
693 | GtkListStore *ls; |
|
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
694 | GtkTreeIter iter; |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
695 | int i; |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
696 | char buf[256]; |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
697 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
698 | if (show_all) |
| 15884 | 699 | list = purple_accounts_get_all(); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
700 | else |
| 15884 | 701 | list = purple_connections_get_all(); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
702 | |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
703 | ls = gtk_list_store_new(AOP_COLUMN_COUNT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
704 | |
| 17375 | 705 | aop_menu = g_malloc0(sizeof(AopMenu)); |
|
32934
9b08ef7651b2
Avoid calling gtk_combo_box_set_active twice in some cases.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32933
diff
changeset
|
706 | aop_menu->default_item = 0; |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
707 | aop_menu->model = GTK_TREE_MODEL(ls); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
708 | |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
709 | for (p = list, i = 0; p != NULL; p = p->next, i++) { |
|
5879
a2757f3f2dda
[gaim-migrate @ 6311]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
710 | if (show_all) |
| 15884 | 711 | account = (PurpleAccount *)p->data; |
|
5879
a2757f3f2dda
[gaim-migrate @ 6311]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
712 | else { |
| 15884 | 713 | PurpleConnection *gc = (PurpleConnection *)p->data; |
| 714 | ||
| 715 | account = purple_connection_get_account(gc); | |
|
5879
a2757f3f2dda
[gaim-migrate @ 6311]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
716 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
717 | |
|
8289
234429bac6b5
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8247
diff
changeset
|
718 | if (filter_func && !filter_func(account)) { |
| 8215 | 719 | i--; |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
720 | continue; |
| 8215 | 721 | } |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
722 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
723 | pixbuf = pidgin_create_protocol_icon(account, PIDGIN_PROTOCOL_ICON_SMALL); |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
724 | |
|
17386
f68ba6199d79
merge of 'de0c8e6287f1090343edb9c43e0d8d681e58df07'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
725 | if (pixbuf) { |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
726 | if (purple_account_is_disconnected(account) && show_all && |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
727 | purple_connections_get_all()) |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
728 | gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
729 | } |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
730 | |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34208
diff
changeset
|
731 | if (purple_account_get_private_alias(account)) { |
| 11017 | 732 | g_snprintf(buf, sizeof(buf), "%s (%s) (%s)", |
| 15884 | 733 | purple_account_get_username(account), |
|
34589
428e92c79631
Renamed purple_account_[get,set]_alias to purple_account[get,set]_private_alias.
Ankit Vani <a@nevitus.org>
parents:
34208
diff
changeset
|
734 | purple_account_get_private_alias(account), |
| 15884 | 735 | purple_account_get_protocol_name(account)); |
| 11017 | 736 | } else { |
| 737 | g_snprintf(buf, sizeof(buf), "%s (%s)", | |
| 15884 | 738 | purple_account_get_username(account), |
| 739 | purple_account_get_protocol_name(account)); | |
| 11017 | 740 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
741 | |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
742 | gtk_list_store_append(ls, &iter); |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
743 | gtk_list_store_set(ls, &iter, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
744 | AOP_ICON_COLUMN, pixbuf, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
745 | AOP_NAME_COLUMN, buf, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
746 | AOP_DATA_COLUMN, account, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
747 | -1); |
| 17117 | 748 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
749 | if (pixbuf) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
750 | g_object_unref(pixbuf); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
751 | |
| 17375 | 752 | if (default_account && account == default_account) |
| 17117 | 753 | aop_menu->default_item = i; |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
754 | } |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
755 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
756 | return aop_menu; |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
757 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
758 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
759 | static void |
| 8134 | 760 | regenerate_account_menu(GtkWidget *optmenu) |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
761 | { |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
762 | gboolean show_all; |
| 15884 | 763 | PurpleAccount *account; |
| 764 | PurpleFilterAccountFunc filter_func; | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
765 | |
|
32388
9fc7219b95cc
Apply final changes from nix_nix's patch.
Gabriel Schulhof <nix@go-nix.ca>
parents:
32386
diff
changeset
|
766 | account = (PurpleAccount *)aop_option_menu_get_selected(optmenu); |
| 17117 | 767 | show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), "show_all")); |
| 768 | filter_func = g_object_get_data(G_OBJECT(optmenu), "filter_func"); | |
| 769 | ||
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
770 | aop_option_menu_replace_menu(optmenu, create_account_menu(account, filter_func, show_all)); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
771 | } |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
772 | |
| 8134 | 773 | static void |
| 15884 | 774 | account_menu_sign_on_off_cb(PurpleConnection *gc, GtkWidget *optmenu) |
| 8134 | 775 | { |
| 776 | regenerate_account_menu(optmenu); | |
| 777 | } | |
| 778 | ||
| 779 | static void | |
| 15884 | 780 | account_menu_added_removed_cb(PurpleAccount *account, GtkWidget *optmenu) |
| 8134 | 781 | { |
| 782 | regenerate_account_menu(optmenu); | |
| 783 | } | |
| 784 | ||
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
785 | static gboolean |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
786 | account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event, |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
787 | void *user_data) |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
788 | { |
| 15884 | 789 | purple_signals_disconnect_by_handle(optmenu); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
790 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
791 | return FALSE; |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
792 | } |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
793 | |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
794 | void |
| 15884 | 795 | pidgin_account_option_menu_set_selected(GtkWidget *optmenu, PurpleAccount *account) |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
796 | { |
|
17385
bf46968ab031
Casting things to gpointer isn't useful, unless they were previously const.
Richard Laager <rlaager@pidgin.im>
parents:
17377
diff
changeset
|
797 | aop_option_menu_select_by_data(optmenu, account); |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
798 | } |
|
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
799 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
800 | GtkWidget * |
| 15884 | 801 | pidgin_account_option_menu_new(PurpleAccount *default_account, |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
802 | gboolean show_all, GCallback cb, |
| 15884 | 803 | PurpleFilterAccountFunc filter_func, |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
804 | gpointer user_data) |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
805 | { |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
806 | GtkWidget *optmenu; |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
807 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
808 | /* Create the option menu */ |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
809 | optmenu = aop_option_menu_new(create_account_menu(default_account, filter_func, show_all), cb, user_data); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
810 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
811 | g_signal_connect(G_OBJECT(optmenu), "destroy", |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
812 | G_CALLBACK(account_menu_destroyed_cb), NULL); |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
813 | |
| 15884 | 814 | /* Register the purple sign on/off event callbacks. */ |
| 815 | purple_signal_connect(purple_connections_get_handle(), "signed-on", | |
| 816 | optmenu, PURPLE_CALLBACK(account_menu_sign_on_off_cb), | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
817 | optmenu); |
| 15884 | 818 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
| 819 | optmenu, PURPLE_CALLBACK(account_menu_sign_on_off_cb), | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
820 | optmenu); |
| 15884 | 821 | purple_signal_connect(purple_accounts_get_handle(), "account-added", |
| 822 | optmenu, PURPLE_CALLBACK(account_menu_added_removed_cb), | |
| 8134 | 823 | optmenu); |
| 15884 | 824 | purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
| 825 | optmenu, PURPLE_CALLBACK(account_menu_added_removed_cb), | |
| 8134 | 826 | optmenu); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
827 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
828 | /* Set some data. */ |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
829 | g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
830 | g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); |
| 17375 | 831 | g_object_set_data(G_OBJECT(optmenu), "filter_func", filter_func); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
832 | |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
833 | return optmenu; |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
834 | } |
|
5943
8a052155157a
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
835 | |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
836 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
837 | pidgin_setup_gtkspell(GtkTextView *textview) |
| 12061 | 838 | { |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
839 | #ifdef USE_GTKSPELL |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
840 | GError *error = NULL; |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
841 | char *locale = NULL; |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
842 | |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
843 | g_return_if_fail(textview != NULL); |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
844 | g_return_if_fail(GTK_IS_TEXT_VIEW(textview)); |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
845 | |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
846 | if (gtkspell_new_attach(textview, locale, &error) == NULL && error) |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
847 | { |
| 15884 | 848 | purple_debug_warning("gtkspell", "Failed to setup GtkSpell: %s\n", |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
849 | error->message); |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
850 | g_error_free(error); |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
851 | } |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
852 | #endif /* USE_GTKSPELL */ |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
853 | } |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
854 | |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
855 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
856 | pidgin_save_accels_cb(GtkAccelGroup *accel_group, guint arg1, |
| 14781 | 857 | GdkModifierType arg2, GClosure *arg3, |
| 858 | gpointer data) | |
| 7420 | 859 | { |
| 15884 | 860 | purple_debug(PURPLE_DEBUG_MISC, "accels", |
| 14781 | 861 | "accel changed, scheduling save.\n"); |
| 7420 | 862 | |
| 863 | if (!accels_save_timer) | |
|
26753
a8dca8faae69
A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents:
26599
diff
changeset
|
864 | accels_save_timer = purple_timeout_add_seconds(5, pidgin_save_accels, |
| 14781 | 865 | NULL); |
| 7420 | 866 | } |
| 867 | ||
| 868 | gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
869 | pidgin_save_accels(gpointer data) |
| 7420 | 870 | { |
| 871 | char *filename = NULL; | |
| 872 | ||
| 15884 | 873 | filename = g_build_filename(purple_user_dir(), G_DIR_SEPARATOR_S, |
| 14781 | 874 | "accels", NULL); |
| 15884 | 875 | purple_debug(PURPLE_DEBUG_MISC, "accels", "saving accels to %s\n", filename); |
| 7420 | 876 | gtk_accel_map_save(filename); |
| 877 | g_free(filename); | |
| 878 | ||
| 879 | accels_save_timer = 0; | |
| 880 | return FALSE; | |
| 881 | } | |
| 882 | ||
| 883 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
884 | pidgin_load_accels() |
| 7420 | 885 | { |
| 886 | char *filename = NULL; | |
| 887 | ||
| 15884 | 888 | filename = g_build_filename(purple_user_dir(), G_DIR_SEPARATOR_S, |
| 14781 | 889 | "accels", NULL); |
| 7420 | 890 | gtk_accel_map_load(filename); |
| 891 | g_free(filename); | |
| 892 | } | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
893 | |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
894 | static void |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
895 | show_retrieveing_info(PurpleConnection *conn, const char *name) |
|
17387
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
896 | { |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
897 | PurpleNotifyUserInfo *info = purple_notify_user_info_new(); |
|
32188
cb9cad610bc6
I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents:
32149
diff
changeset
|
898 | purple_notify_user_info_add_pair_plaintext(info, _("Information"), _("Retrieving...")); |
|
17387
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
899 | purple_notify_userinfo(conn, name, info, NULL, NULL); |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
900 | purple_notify_user_info_destroy(info); |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
901 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
902 | |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
903 | void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name) |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
904 | { |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
905 | show_retrieveing_info(conn, name); |
|
17387
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
906 | serv_get_info(conn, name); |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
907 | } |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
908 | |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
909 | void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chat) |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
910 | { |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
911 | char *who = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
912 | PurpleProtocol *protocol = NULL; |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
913 | |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
914 | if (chat < 0) { |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
915 | pidgin_retrieve_user_info(conn, name); |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
916 | return; |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
917 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
918 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
919 | protocol = purple_connection_get_protocol_info(conn); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
920 | if (protocol != NULL && protocol->get_cb_real_name) |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
921 | who = protocol->get_cb_real_name(conn, chat, name); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
922 | if (protocol == NULL || protocol->get_cb_info == NULL) { |
|
23501
55185be28a1b
Pass the "real" chat username to the pidgin_retrieve_user_info function.
Daniel Atallah <datallah@pidgin.im>
parents:
23333
diff
changeset
|
923 | pidgin_retrieve_user_info(conn, who ? who : name); |
|
55185be28a1b
Pass the "real" chat username to the pidgin_retrieve_user_info function.
Daniel Atallah <datallah@pidgin.im>
parents:
23333
diff
changeset
|
924 | g_free(who); |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
925 | return; |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
926 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
927 | |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
928 | show_retrieveing_info(conn, who ? who : name); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
929 | protocol->get_cb_info(conn, chat, name); |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
930 | g_free(who); |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
931 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
932 | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
933 | gboolean |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
934 | pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, |
| 15884 | 935 | PurpleAccount **ret_account, char **ret_protocol, |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
936 | char **ret_username, char **ret_alias) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
937 | { |
| 36548 | 938 | char *protocol_id = NULL; |
| 939 | char *username = NULL; | |
| 940 | char *alias = NULL; | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
941 | char *str; |
|
30626
bec413ce77c7
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30054
diff
changeset
|
942 | char *s; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
943 | gboolean valid; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
944 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
945 | g_return_val_if_fail(msg != NULL, FALSE); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
946 | g_return_val_if_fail(ret_protocol != NULL, FALSE); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
947 | g_return_val_if_fail(ret_username != NULL, FALSE); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
948 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
949 | s = str = g_strdup(msg); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
950 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
951 | while (*s != '\r' && *s != '\n' && *s != '\0') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
952 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
953 | char *key, *value; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
954 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
955 | key = s; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
956 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
957 | /* Grab the key */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
958 | while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ' ') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
959 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
960 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
961 | if (*s == '\r') s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
962 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
963 | if (*s == '\n') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
964 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
965 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
966 | continue; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
967 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
968 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
969 | if (*s != '\0') *s++ = '\0'; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
970 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
971 | /* Clear past any whitespace */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
972 | while (*s != '\0' && *s == ' ') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
973 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
974 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
975 | /* Now let's grab until the end of the line. */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
976 | value = s; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
977 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
978 | while (*s != '\r' && *s != '\n' && *s != '\0') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
979 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
980 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
981 | if (*s == '\r') *s++ = '\0'; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
982 | if (*s == '\n') *s++ = '\0'; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
983 | |
|
30626
bec413ce77c7
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30054
diff
changeset
|
984 | if (strchr(key, ':') != NULL) |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
985 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
986 | if (!g_ascii_strcasecmp(key, "X-IM-Username:")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
987 | username = g_strdup(value); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
988 | else if (!g_ascii_strcasecmp(key, "X-IM-Protocol:")) |
| 36548 | 989 | protocol_id = g_strdup(value); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
990 | else if (!g_ascii_strcasecmp(key, "X-IM-Alias:")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
991 | alias = g_strdup(value); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
992 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
993 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
994 | |
| 36548 | 995 | if (username != NULL && protocol_id != NULL) |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
996 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
997 | valid = TRUE; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
998 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
999 | *ret_username = username; |
| 36548 | 1000 | *ret_protocol = protocol_id; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1001 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1002 | if (ret_alias != NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1003 | *ret_alias = alias; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1004 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1005 | /* Check for a compatible account. */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1006 | if (ret_account != NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1007 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1008 | GList *list; |
| 15884 | 1009 | PurpleAccount *account = NULL; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1010 | GList *l; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1011 | const char *protoname; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1012 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1013 | if (all_accounts) |
| 15884 | 1014 | list = purple_accounts_get_all(); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1015 | else |
| 15884 | 1016 | list = purple_connections_get_all(); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1017 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1018 | for (l = list; l != NULL; l = l->next) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1019 | { |
| 15884 | 1020 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1021 | PurpleProtocol *protocol = NULL; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1022 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1023 | if (all_accounts) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1024 | { |
| 15884 | 1025 | account = (PurpleAccount *)l->data; |
| 1026 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1027 | protocol = purple_find_protocol_info( |
| 15884 | 1028 | purple_account_get_protocol_id(account)); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1029 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1030 | if (protocol == NULL) |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1031 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1032 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1033 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1034 | continue; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1035 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1036 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1037 | else |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1038 | { |
| 15884 | 1039 | gc = (PurpleConnection *)l->data; |
| 1040 | account = purple_connection_get_account(gc); | |
| 1041 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1042 | protocol = purple_connection_get_protocol_info(gc); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1043 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1044 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1045 | protoname = protocol->list_icon(account, NULL); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1046 | |
| 36548 | 1047 | if (!strcmp(protoname, protocol_id)) |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1048 | break; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1049 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1050 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1051 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1052 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1053 | /* Special case for AIM and ICQ */ |
| 36548 | 1054 | if (account == NULL && (!strcmp(protocol_id, "aim") || |
| 1055 | !strcmp(protocol_id, "icq"))) | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1056 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1057 | for (l = list; l != NULL; l = l->next) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1058 | { |
| 15884 | 1059 | PurpleConnection *gc; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1060 | PurpleProtocol *protocol = NULL; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1061 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1062 | if (all_accounts) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1063 | { |
| 15884 | 1064 | account = (PurpleAccount *)l->data; |
| 1065 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1066 | protocol = purple_find_protocol_info( |
| 15884 | 1067 | purple_account_get_protocol_id(account)); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1068 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1069 | if (protocol == NULL) |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1070 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1071 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1072 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1073 | continue; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1074 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1075 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1076 | else |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1077 | { |
| 15884 | 1078 | gc = (PurpleConnection *)l->data; |
| 1079 | account = purple_connection_get_account(gc); | |
| 1080 | ||
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1081 | protocol = purple_connection_get_protocol_info(gc); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1082 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1083 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1084 | protoname = protocol->list_icon(account, NULL); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1085 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1086 | if (!strcmp(protoname, "aim") || !strcmp(protoname, "icq")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1087 | break; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1088 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1089 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1090 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1091 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1092 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1093 | *ret_account = account; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1094 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1095 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1096 | else |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1097 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1098 | valid = FALSE; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1099 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13783
diff
changeset
|
1100 | g_free(username); |
| 36548 | 1101 | g_free(protocol_id); |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13783
diff
changeset
|
1102 | g_free(alias); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1103 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1104 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1105 | g_free(str); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1106 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1107 | return valid; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1108 | } |
| 8137 | 1109 | |
| 1110 | void | |
| 15568 | 1111 | pidgin_set_accessible_label (GtkWidget *w, GtkWidget *l) |
| 8137 | 1112 | { |
|
19547
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1113 | AtkObject *acc; |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1114 | const gchar *label_text; |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1115 | const gchar *existing_name; |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1116 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1117 | acc = gtk_widget_get_accessible (w); |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1118 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1119 | /* If this object has no name, set it's name with the label text */ |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1120 | existing_name = atk_object_get_name (acc); |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1121 | if (!existing_name) { |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1122 | label_text = gtk_label_get_text (GTK_LABEL(l)); |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1123 | if (label_text) |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1124 | atk_object_set_name (acc, label_text); |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1125 | } |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1126 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1127 | pidgin_set_accessible_relations(w, l); |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1128 | } |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1129 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1130 | void |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1131 | pidgin_set_accessible_relations (GtkWidget *w, GtkWidget *l) |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1132 | { |
| 8137 | 1133 | AtkObject *acc, *label; |
| 1134 | AtkObject *rel_obj[1]; | |
| 1135 | AtkRelationSet *set; | |
| 1136 | AtkRelation *relation; | |
| 1137 | ||
| 1138 | acc = gtk_widget_get_accessible (w); | |
| 1139 | label = gtk_widget_get_accessible (l); | |
| 1140 | ||
|
18351
b881759cda28
Call gtk_label_set_mnemonic_widget() in pidgin_make_accessible_label. Closes #589
Sean Egan <seanegan@pidgin.im>
parents:
18281
diff
changeset
|
1141 | /* Make sure mnemonics work */ |
|
20241
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1142 | gtk_label_set_mnemonic_widget(GTK_LABEL(l), w); |
|
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1143 | |
| 8137 | 1144 | /* Create the labeled-by relation */ |
| 1145 | set = atk_object_ref_relation_set (acc); | |
| 1146 | rel_obj[0] = label; | |
| 1147 | relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABELLED_BY); | |
| 1148 | atk_relation_set_add (set, relation); | |
| 1149 | g_object_unref (relation); | |
|
20241
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1150 | g_object_unref(set); |
| 8137 | 1151 | |
| 1152 | /* Create the label-for relation */ | |
| 1153 | set = atk_object_ref_relation_set (label); | |
| 1154 | rel_obj[0] = acc; | |
| 1155 | relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABEL_FOR); | |
| 1156 | atk_relation_set_add (set, relation); | |
| 1157 | g_object_unref (relation); | |
|
20241
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1158 | g_object_unref(set); |
| 8137 | 1159 | } |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1160 | |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18216
diff
changeset
|
1161 | void |
|
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18216
diff
changeset
|
1162 | pidgin_menu_position_func_helper(GtkMenu *menu, |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1163 | gint *x, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1164 | gint *y, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1165 | gboolean *push_in, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1166 | gpointer data) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1167 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1168 | GtkWidget *widget; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1169 | GtkRequisition requisition; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1170 | GdkScreen *screen; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1171 | GdkRectangle monitor; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1172 | gint monitor_num; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1173 | gint space_left, space_right, space_above, space_below; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1174 | gint needed_width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1175 | gint needed_height; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1176 | gint xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1177 | gint ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1178 | gboolean rtl; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1179 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1180 | g_return_if_fail(GTK_IS_MENU(menu)); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1181 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1182 | widget = GTK_WIDGET(menu); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1183 | screen = gtk_widget_get_screen(widget); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1184 | xthickness = gtk_widget_get_style(widget)->xthickness; |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1185 | ythickness = gtk_widget_get_style(widget)->ythickness; |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1186 | rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1187 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1188 | /* |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1189 | * We need the requisition to figure out the right place to |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1190 | * popup the menu. In fact, we always need to ask here, since |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1191 | * if a size_request was queued while we weren't popped up, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1192 | * the requisition won't have been recomputed yet. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1193 | */ |
|
33277
d6229108ce71
Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33269
diff
changeset
|
1194 | gtk_widget_get_preferred_size(widget, NULL, &requisition); |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1195 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1196 | monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1197 | |
|
32212
53d06e21e630
It seems like there's a dereference missing here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32188
diff
changeset
|
1198 | *push_in = FALSE; |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1199 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1200 | /* |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1201 | * The placement of popup menus horizontally works like this (with |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1202 | * RTL in parentheses) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1203 | * |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1204 | * - If there is enough room to the right (left) of the mouse cursor, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1205 | * position the menu there. |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1206 | * |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1207 | * - Otherwise, if if there is enough room to the left (right) of the |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1208 | * mouse cursor, position the menu there. |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1209 | * |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1210 | * - Otherwise if the menu is smaller than the monitor, position it |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1211 | * on the side of the mouse cursor that has the most space available |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1212 | * |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1213 | * - Otherwise (if there is simply not enough room for the menu on the |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1214 | * monitor), position it as far left (right) as possible. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1215 | * |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1216 | * Positioning in the vertical direction is similar: first try below |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1217 | * mouse cursor, then above. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1218 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1219 | gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1220 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1221 | space_left = *x - monitor.x; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1222 | space_right = monitor.x + monitor.width - *x - 1; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1223 | space_above = *y - monitor.y; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1224 | space_below = monitor.y + monitor.height - *y - 1; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1225 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1226 | /* position horizontally */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1227 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1228 | /* the amount of space we need to position the menu. Note the |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1229 | * menu is offset "xthickness" pixels |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1230 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1231 | needed_width = requisition.width - xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1232 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1233 | if (needed_width <= space_left || |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1234 | needed_width <= space_right) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1235 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1236 | if ((rtl && needed_width <= space_left) || |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1237 | (!rtl && needed_width > space_right)) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1238 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1239 | /* position left */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1240 | *x = *x + xthickness - requisition.width + 1; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1241 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1242 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1243 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1244 | /* position right */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1245 | *x = *x - xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1246 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1247 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1248 | /* x is clamped on-screen further down */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1249 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1250 | else if (requisition.width <= monitor.width) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1251 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1252 | /* the menu is too big to fit on either side of the mouse |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1253 | * cursor, but smaller than the monitor. Position it on |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1254 | * the side that has the most space |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1255 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1256 | if (space_left > space_right) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1257 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1258 | /* left justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1259 | *x = monitor.x; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1260 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1261 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1262 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1263 | /* right justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1264 | *x = monitor.x + monitor.width - requisition.width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1265 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1266 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1267 | else /* menu is simply too big for the monitor */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1268 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1269 | if (rtl) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1270 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1271 | /* right justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1272 | *x = monitor.x + monitor.width - requisition.width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1273 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1274 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1275 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1276 | /* left justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1277 | *x = monitor.x; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1278 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1279 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1280 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1281 | /* Position vertically. The algorithm is the same as above, but |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1282 | * simpler because we don't have to take RTL into account. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1283 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1284 | needed_height = requisition.height - ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1285 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1286 | if (needed_height <= space_above || |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1287 | needed_height <= space_below) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1288 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1289 | if (needed_height <= space_below) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1290 | *y = *y - ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1291 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1292 | *y = *y + ythickness - requisition.height + 1; |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1293 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1294 | *y = CLAMP (*y, monitor.y, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1295 | monitor.y + monitor.height - requisition.height); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1296 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1297 | else if (needed_height > space_below && needed_height > space_above) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1298 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1299 | if (space_below >= space_above) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1300 | *y = monitor.y + monitor.height - requisition.height; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1301 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1302 | *y = monitor.y; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1303 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1304 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1305 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1306 | *y = monitor.y; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1307 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1308 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1309 | |
| 8247 | 1310 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1311 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1312 | pidgin_treeview_popup_menu_position_func(GtkMenu *menu, |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1313 | gint *x, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1314 | gint *y, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1315 | gboolean *push_in, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1316 | gpointer data) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1317 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1318 | GtkWidget *widget = GTK_WIDGET(data); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1319 | GtkTreeView *tv = GTK_TREE_VIEW(data); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1320 | GtkTreePath *path; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1321 | GtkTreeViewColumn *col; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1322 | GdkRectangle rect; |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1323 | gint ythickness = gtk_widget_get_style(GTK_WIDGET(menu))->ythickness; |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1324 | |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1325 | gdk_window_get_origin (gtk_widget_get_window(widget), x, y); |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1326 | gtk_tree_view_get_cursor (tv, &path, &col); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1327 | gtk_tree_view_get_cell_area (tv, path, col, &rect); |
|
8218
0ff223f56a67
[gaim-migrate @ 8941]
Christian Hammond <chipx86@chipx86.com>
parents:
8215
diff
changeset
|
1328 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1329 | *x += rect.x+rect.width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1330 | *y += rect.y+rect.height+ythickness; |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18216
diff
changeset
|
1331 | pidgin_menu_position_func_helper(menu, x, y, push_in, data); |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1332 | } |
|
10061
2833056ea11c
[gaim-migrate @ 11033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9910
diff
changeset
|
1333 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1334 | enum { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1335 | DND_FILE_TRANSFER, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1336 | DND_IM_IMAGE, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1337 | DND_BUDDY_ICON |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1338 | }; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1339 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1340 | typedef struct { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1341 | char *filename; |
| 15884 | 1342 | PurpleAccount *account; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1343 | char *who; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1344 | } _DndData; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1345 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10681
diff
changeset
|
1346 | static void dnd_image_ok_callback(_DndData *data, int choice) |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1347 | { |
|
31372
743be8e50f23
When drag-dropping an image into an IM window and sending as an inline
Mark Doliner <markdoliner@pidgin.im>
parents:
31217
diff
changeset
|
1348 | const gchar *shortname; |
|
23287
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1349 | gchar *filedata; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1350 | size_t size; |
|
33940
b44d15793c83
Use GStatBuf instead of struct stat
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
1351 | GStatBuf st; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1352 | GError *err = NULL; |
| 15884 | 1353 | PurpleConversation *conv; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1354 | PidginConversation *gtkconv; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1355 | int id; |
|
23287
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1356 | PurpleBuddy *buddy; |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1357 | PurpleContact *contact; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1358 | switch (choice) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1359 | case DND_BUDDY_ICON: |
|
14914
290eb2170f38
[gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14781
diff
changeset
|
1360 | if (g_stat(data->filename, &st)) { |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1361 | char *str; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1362 | |
|
14914
290eb2170f38
[gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14781
diff
changeset
|
1363 | str = g_strdup_printf(_("The following error has occurred loading %s: %s"), |
|
21975
721ddc236ce5
Use g_sterror instead of strerror in two more places.
Mark Doliner <markdoliner@pidgin.im>
parents:
21890
diff
changeset
|
1364 | data->filename, g_strerror(errno)); |
| 15884 | 1365 | purple_notify_error(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1366 | _("Failed to load image"), |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1367 | str); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1368 | g_free(str); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1369 | |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1370 | break; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1371 | } |
| 10335 | 1372 | |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
1373 | buddy = purple_blist_find_buddy(data->account, data->who); |
|
23287
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1374 | if (!buddy) { |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1375 | purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n"); |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1376 | break; |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1377 | } |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1378 | contact = purple_buddy_get_contact(buddy); |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1379 | purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, data->filename); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1380 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1381 | case DND_FILE_TRANSFER: |
| 15884 | 1382 | serv_send_file(purple_account_get_connection(data->account), data->who, data->filename); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1383 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1384 | case DND_IM_IMAGE: |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
1385 | conv = PURPLE_CONVERSATION(purple_im_conversation_new(data->account, data->who)); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1386 | gtkconv = PIDGIN_CONVERSATION(conv); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1387 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1388 | if (!g_file_get_contents(data->filename, &filedata, &size, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1389 | &err)) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1390 | char *str; |
| 10335 | 1391 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1392 | str = g_strdup_printf(_("The following error has occurred loading %s: %s"), data->filename, err->message); |
| 15884 | 1393 | purple_notify_error(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1394 | _("Failed to load image"), |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1395 | str); |
| 10335 | 1396 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1397 | g_error_free(err); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1398 | g_free(str); |
| 10335 | 1399 | |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1400 | break; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1401 | } |
|
31372
743be8e50f23
When drag-dropping an image into an IM window and sending as an inline
Mark Doliner <markdoliner@pidgin.im>
parents:
31217
diff
changeset
|
1402 | shortname = strrchr(data->filename, G_DIR_SEPARATOR); |
|
743be8e50f23
When drag-dropping an image into an IM window and sending as an inline
Mark Doliner <markdoliner@pidgin.im>
parents:
31217
diff
changeset
|
1403 | shortname = shortname ? shortname + 1 : data->filename; |
| 33661 | 1404 | id = purple_imgstore_new_with_id(filedata, size, shortname); |
| 10335 | 1405 | |
|
33269
1ea2edfac5e9
Convert some more util stuff to a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33232
diff
changeset
|
1406 | gtk_webview_insert_image(GTK_WEBVIEW(gtkconv->entry), id); |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16314
diff
changeset
|
1407 | purple_imgstore_unref_by_id(id); |
| 10335 | 1408 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1409 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1410 | } |
|
25152
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1411 | g_free(data->filename); |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1412 | g_free(data->who); |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1413 | g_free(data); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1414 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1415 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10681
diff
changeset
|
1416 | static void dnd_image_cancel_callback(_DndData *data, int choice) |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1417 | { |
|
25152
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1418 | g_free(data->filename); |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1419 | g_free(data->who); |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1420 | g_free(data); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1421 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1422 | |
|
11110
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1423 | static void dnd_set_icon_ok_cb(_DndData *data) |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1424 | { |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1425 | dnd_image_ok_callback(data, DND_BUDDY_ICON); |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1426 | } |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1427 | |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1428 | static void dnd_set_icon_cancel_cb(_DndData *data) |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1429 | { |
|
25152
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1430 | g_free(data->filename); |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1431 | g_free(data->who); |
|
128b99dfb286
Fix warnings where size_t/gsize was used for printf with the wrong format
Paul Aurich <darkrain42@pidgin.im>
parents:
24860
diff
changeset
|
1432 | g_free(data); |
|
11110
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1433 | } |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1434 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1435 | void |
| 15884 | 1436 | pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who) |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1437 | { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1438 | GdkPixbuf *pb; |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1439 | GList *files = purple_uri_list_extract_filenames((const gchar *) gtk_selection_data_get_data(sd)); |
| 15884 | 1440 | PurpleConnection *gc = purple_account_get_connection(account); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1441 | PurpleProtocol *protocol = NULL; |
| 10335 | 1442 | #ifndef _WIN32 |
| 15884 | 1443 | PurpleDesktopItem *item; |
| 10335 | 1444 | #endif |
|
28458
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1445 | gchar *filename = NULL; |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1446 | gchar *basename = NULL; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1447 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1448 | g_return_if_fail(account != NULL); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1449 | g_return_if_fail(who != NULL); |
| 10335 | 1450 | |
|
28458
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1451 | for ( ; files; files = g_list_delete_link(files, files)) { |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1452 | g_free(filename); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1453 | g_free(basename); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1454 | |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1455 | filename = files->data; |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1456 | basename = g_path_get_basename(filename); |
| 10335 | 1457 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1458 | /* XXX - Make ft API support creating a transfer with more than one file */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1459 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1460 | continue; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1461 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1462 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1463 | /* XXX - make ft api suupport sending a directory */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1464 | /* Are we dealing with a directory? */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1465 | if (g_file_test(filename, G_FILE_TEST_IS_DIR)) { |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
1466 | char *str, *str2; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1467 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1468 | str = g_strdup_printf(_("Cannot send folder %s."), basename); |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16692
diff
changeset
|
1469 | str2 = g_strdup_printf(_("%s cannot transfer a folder. You will need to send the files within individually."), PIDGIN_NAME); |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
1470 | |
| 15884 | 1471 | purple_notify_error(NULL, NULL, |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
1472 | str, str2); |
| 10335 | 1473 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1474 | g_free(str); |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
1475 | g_free(str2); |
| 10335 | 1476 | continue; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1477 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1478 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1479 | /* Are we dealing with an image? */ |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
1480 | pb = pidgin_pixbuf_new_from_file(filename); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1481 | if (pb) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1482 | _DndData *data = g_malloc(sizeof(_DndData)); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1483 | gboolean ft = FALSE, im = FALSE; |
| 10335 | 1484 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1485 | data->who = g_strdup(who); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1486 | data->filename = g_strdup(filename); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1487 | data->account = account; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1488 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1489 | if (gc) |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1490 | protocol = purple_connection_get_protocol_info(gc); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1491 | |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1492 | if (protocol && protocol->options & OPT_PROTO_IM_IMAGE) |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1493 | im = TRUE; |
| 10335 | 1494 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1495 | if (protocol && protocol->can_receive_file) |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1496 | ft = protocol->can_receive_file(gc, who); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1497 | else if (protocol && protocol->send_file) |
|
20976
c5cf79b99382
When drag-dropping an image onto a conversation, include 'Send image file' as
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20895
diff
changeset
|
1498 | ft = TRUE; |
| 10335 | 1499 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1500 | if (im && ft) |
| 15884 | 1501 | purple_request_choice(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1502 | _("You have dragged an image"), |
|
10951
a81bececc6f0
[gaim-migrate @ 12751]
Richard Laager <rlaager@pidgin.im>
parents:
10871
diff
changeset
|
1503 | _("You can send this image as a file transfer, " |
|
a81bececc6f0
[gaim-migrate @ 12751]
Richard Laager <rlaager@pidgin.im>
parents:
10871
diff
changeset
|
1504 | "embed it into this message, or use it as the buddy icon for this user."), |
| 29245 | 1505 | DND_FILE_TRANSFER, _("OK"), (GCallback)dnd_image_ok_callback, |
| 1506 | _("Cancel"), (GCallback)dnd_image_cancel_callback, | |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1507 | account, who, NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1508 | data, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1509 | _("Set as buddy icon"), DND_BUDDY_ICON, |
| 10335 | 1510 | _("Send image file"), DND_FILE_TRANSFER, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1511 | _("Insert in message"), DND_IM_IMAGE, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1512 | NULL); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1513 | else if (!(im || ft)) |
| 15884 | 1514 | purple_request_yes_no(NULL, NULL, _("You have dragged an image"), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1515 | _("Would you like to set it as the buddy icon for this user?"), |
|
22269
3fdf7b13f20a
A few more of those "default_action" fixes
Mark Doliner <markdoliner@pidgin.im>
parents:
22140
diff
changeset
|
1516 | PURPLE_DEFAULT_ACTION_NONE, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1517 | account, who, NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1518 | data, (GCallback)dnd_set_icon_ok_cb, (GCallback)dnd_set_icon_cancel_cb); |
| 10335 | 1519 | else |
| 15884 | 1520 | purple_request_choice(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1521 | _("You have dragged an image"), |
|
17497
6cbc2e55e878
Fix the "transfer file or embed image" message (it looks like it was copied and pasted incorrectly).
Daniel Atallah <datallah@pidgin.im>
parents:
17487
diff
changeset
|
1522 | (ft ? _("You can send this image as a file transfer, or use it as the buddy icon for this user.") : |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1523 | _("You can insert this image into this message, or use it as the buddy icon for this user")), |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1524 | (ft ? DND_FILE_TRANSFER : DND_IM_IMAGE), |
| 29245 | 1525 | _("OK"), (GCallback)dnd_image_ok_callback, |
| 1526 | _("Cancel"), (GCallback)dnd_image_cancel_callback, | |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1527 | account, who, NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1528 | data, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1529 | _("Set as buddy icon"), DND_BUDDY_ICON, |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1530 | (ft ? _("Send image file") : _("Insert in message")), (ft ? DND_FILE_TRANSFER : DND_IM_IMAGE), |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16314
diff
changeset
|
1531 | NULL); |
|
26820
76f90ca8f6f2
Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26753
diff
changeset
|
1532 | g_object_unref(G_OBJECT(pb)); |
|
28458
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1533 | |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1534 | g_free(basename); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1535 | while (files) { |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1536 | g_free(files->data); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1537 | files = g_list_delete_link(files, files); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1538 | } |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1539 | return; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1540 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1541 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1542 | #ifndef _WIN32 |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1543 | /* Are we trying to send a .desktop file? */ |
| 15884 | 1544 | else if (purple_str_has_suffix(basename, ".desktop") && (item = purple_desktop_item_new_from_file(filename))) { |
| 1545 | PurpleDesktopItemType dtype; | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1546 | char key[64]; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1547 | const char *itemname = NULL; |
| 10335 | 1548 | |
| 10679 | 1549 | const char * const *langs; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1550 | langs = g_get_language_names(); |
|
33794
716cbef8d1c6
Fix a number of additional trivial issues - unused variables, etc.
Daniel Atallah <datallah@pidgin.im>
parents:
33477
diff
changeset
|
1551 | if (langs[0]) { |
|
716cbef8d1c6
Fix a number of additional trivial issues - unused variables, etc.
Daniel Atallah <datallah@pidgin.im>
parents:
33477
diff
changeset
|
1552 | g_snprintf(key, sizeof(key), "Name[%s]", langs[0]); |
| 15884 | 1553 | itemname = purple_desktop_item_get_string(item, key); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1554 | } |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1555 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1556 | if (!itemname) |
| 15884 | 1557 | itemname = purple_desktop_item_get_string(item, "Name"); |
| 1558 | ||
| 1559 | dtype = purple_desktop_item_get_entry_type(item); | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1560 | switch (dtype) { |
| 15884 | 1561 | PurpleConversation *conv; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1562 | PidginConversation *gtkconv; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1563 | |
| 15884 | 1564 | case PURPLE_DESKTOP_ITEM_TYPE_LINK: |
|
34662
f14347f38e3b
Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34627
diff
changeset
|
1565 | conv = PURPLE_CONVERSATION(purple_im_conversation_new(account, who)); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1566 | gtkconv = PIDGIN_CONVERSATION(conv); |
|
33269
1ea2edfac5e9
Convert some more util stuff to a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33232
diff
changeset
|
1567 | gtk_webview_insert_link(GTK_WEBVIEW(gtkconv->entry), |
|
1ea2edfac5e9
Convert some more util stuff to a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33232
diff
changeset
|
1568 | purple_desktop_item_get_string(item, "URL"), |
|
1ea2edfac5e9
Convert some more util stuff to a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33232
diff
changeset
|
1569 | itemname); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1570 | break; |
| 10335 | 1571 | default: |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1572 | /* I don't know if we really want to do anything here. Most of |
|
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1573 | * the desktop item types are crap like "MIME Type" (I have no |
|
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1574 | * clue how that would be a desktop item) and "Comment"... |
|
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1575 | * nothing we can really send. The only logical one is |
|
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1576 | * "Application," but do we really want to send a binary and |
|
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1577 | * nothing else? Probably not. I'll just give an error and |
|
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1578 | * return. */ |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1579 | /* The original patch sent the icon used by the launcher. That's probably wrong */ |
|
27525
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27216
diff
changeset
|
1580 | purple_notify_error(NULL, NULL, _("Cannot send launcher"), |
|
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27216
diff
changeset
|
1581 | _("You dragged a desktop launcher. Most " |
|
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27216
diff
changeset
|
1582 | "likely you wanted to send the target " |
|
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27216
diff
changeset
|
1583 | "of this launcher instead of this " |
|
579b9d64b364
A semi-random collection of English spelling and grammatical changes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27216
diff
changeset
|
1584 | "launcher itself.")); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1585 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1586 | } |
| 15884 | 1587 | purple_desktop_item_unref(item); |
|
28458
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1588 | g_free(basename); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1589 | while (files) { |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1590 | g_free(files->data); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1591 | files = g_list_delete_link(files, files); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1592 | } |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1593 | return; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1594 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1595 | #endif /* _WIN32 */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1596 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1597 | /* Everything is fine, let's send */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1598 | serv_send_file(gc, who, filename); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1599 | } |
|
28458
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1600 | |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1601 | g_free(filename); |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1602 | g_free(basename); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1603 | } |
| 10483 | 1604 | |
| 15884 | 1605 | void pidgin_buddy_icon_get_scale_size(GdkPixbuf *buf, PurpleBuddyIconSpec *spec, PurpleIconScaleRules rules, int *width, int *height) |
| 10483 | 1606 | { |
| 1607 | *width = gdk_pixbuf_get_width(buf); | |
| 1608 | *height = gdk_pixbuf_get_height(buf); | |
| 1609 | ||
|
15301
26153c5f156a
[gaim-migrate @ 18029]
Mark Doliner <markdoliner@pidgin.im>
parents:
15289
diff
changeset
|
1610 | if ((spec == NULL) || !(spec->scale_rules & rules)) |
|
26153c5f156a
[gaim-migrate @ 18029]
Mark Doliner <markdoliner@pidgin.im>
parents:
15289
diff
changeset
|
1611 | return; |
|
26153c5f156a
[gaim-migrate @ 18029]
Mark Doliner <markdoliner@pidgin.im>
parents:
15289
diff
changeset
|
1612 | |
| 15884 | 1613 | purple_buddy_icon_get_scale_size(spec, width, height); |
| 10483 | 1614 | |
| 1615 | /* and now for some arbitrary sanity checks */ | |
| 1616 | if(*width > 100) | |
| 1617 | *width = 100; | |
| 1618 | if(*height > 100) | |
| 1619 | *height = 100; | |
| 1620 | } | |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1621 | |
| 15884 | 1622 | GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive prim, GtkWidget *w, const char *size) |
|
15799
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1623 | { |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1624 | GtkIconSize icon_size = gtk_icon_size_from_name(size); |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1625 | GdkPixbuf *pixbuf = NULL; |
|
26847
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1626 | const char *stock = pidgin_stock_id_from_status_primitive(prim); |
|
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1627 | |
|
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1628 | pixbuf = gtk_widget_render_icon (w, stock ? stock : PIDGIN_STOCK_STATUS_AVAILABLE, |
|
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1629 | icon_size, "GtkWidget"); |
|
15799
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1630 | return pixbuf; |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1631 | } |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1632 | |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1633 | static const char * |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1634 | stock_id_from_status_primitive_idle(PurpleStatusPrimitive prim, gboolean idle) |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1635 | { |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1636 | const char *stock = NULL; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1637 | switch (prim) { |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1638 | case PURPLE_STATUS_UNSET: |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1639 | stock = NULL; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1640 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1641 | case PURPLE_STATUS_UNAVAILABLE: |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1642 | stock = idle ? PIDGIN_STOCK_STATUS_BUSY_I : PIDGIN_STOCK_STATUS_BUSY; |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1643 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1644 | case PURPLE_STATUS_AWAY: |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1645 | stock = idle ? PIDGIN_STOCK_STATUS_AWAY_I : PIDGIN_STOCK_STATUS_AWAY; |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1646 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1647 | case PURPLE_STATUS_EXTENDED_AWAY: |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1648 | stock = idle ? PIDGIN_STOCK_STATUS_XA_I : PIDGIN_STOCK_STATUS_XA; |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1649 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1650 | case PURPLE_STATUS_INVISIBLE: |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1651 | stock = PIDGIN_STOCK_STATUS_INVISIBLE; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1652 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1653 | case PURPLE_STATUS_OFFLINE: |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1654 | stock = idle ? PIDGIN_STOCK_STATUS_OFFLINE_I : PIDGIN_STOCK_STATUS_OFFLINE; |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1655 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1656 | default: |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1657 | stock = idle ? PIDGIN_STOCK_STATUS_AVAILABLE_I : PIDGIN_STOCK_STATUS_AVAILABLE; |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1658 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1659 | } |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1660 | return stock; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1661 | } |
|
15799
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1662 | |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1663 | const char * |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1664 | pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim) |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1665 | { |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1666 | return stock_id_from_status_primitive_idle(prim, FALSE); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1667 | } |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1668 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1669 | const char * |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1670 | pidgin_stock_id_from_presence(PurplePresence *presence) |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1671 | { |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1672 | PurpleStatus *status; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1673 | PurpleStatusType *type; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1674 | PurpleStatusPrimitive prim; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1675 | gboolean idle; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1676 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1677 | g_return_val_if_fail(presence, NULL); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1678 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1679 | status = purple_presence_get_active_status(presence); |
|
34855
9c289149eed4
Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents:
34769
diff
changeset
|
1680 | type = purple_status_get_status_type(status); |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1681 | prim = purple_status_type_get_primitive(type); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1682 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1683 | idle = purple_presence_is_idle(presence); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1684 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1685 | return stock_id_from_status_primitive_idle(prim, idle); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1686 | } |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1687 | |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1688 | GdkPixbuf * |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1689 | pidgin_create_protocol_icon(PurpleAccount *account, PidginPrplIconSize size) |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1690 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1691 | PurpleProtocol *protocol; |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1692 | |
|
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1693 | g_return_val_if_fail(account != NULL, NULL); |
|
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1694 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1695 | protocol = purple_find_protocol_info(purple_account_get_protocol_id(account)); |
|
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1696 | if (protocol == NULL) |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1697 | return NULL; |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
1698 | return pidgin_create_protocol_icon_from_protocol(protocol, size, account); |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1699 | } |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1700 | |
| 12919 | 1701 | static void |
| 1702 | menu_action_cb(GtkMenuItem *item, gpointer object) | |
| 1703 | { | |
| 1704 | gpointer data; | |
| 1705 | void (*callback)(gpointer, gpointer); | |
| 1706 | ||
| 15884 | 1707 | callback = g_object_get_data(G_OBJECT(item), "purplecallback"); |
| 1708 | data = g_object_get_data(G_OBJECT(item), "purplecallbackdata"); | |
| 12919 | 1709 | |
| 1710 | if (callback) | |
| 1711 | callback(object, data); | |
| 1712 | } | |
| 1713 | ||
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1714 | GtkWidget * |
| 15884 | 1715 | pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, |
| 12919 | 1716 | gpointer object) |
| 1717 | { | |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1718 | GtkWidget *menuitem; |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1719 | GList *list; |
|
17386
f68ba6199d79
merge of 'de0c8e6287f1090343edb9c43e0d8d681e58df07'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
1720 | |
| 12919 | 1721 | if (act == NULL) { |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1722 | return pidgin_separator(menu); |
|
17386
f68ba6199d79
merge of 'de0c8e6287f1090343edb9c43e0d8d681e58df07'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
1723 | } |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1724 | |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1725 | list = purple_menu_action_get_children(act); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1726 | menuitem = gtk_menu_item_new_with_mnemonic(purple_menu_action_get_label(act)); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1727 | |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1728 | if (list == NULL) { |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1729 | PurpleCallback callback; |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1730 | |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1731 | callback = purple_menu_action_get_callback(act); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1732 | |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1733 | if (callback != NULL) { |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1734 | g_object_set_data(G_OBJECT(menuitem), |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1735 | "purplecallback", |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1736 | callback); |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1737 | g_object_set_data(G_OBJECT(menuitem), |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1738 | "purplecallbackdata", |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1739 | purple_menu_action_get_data(act)); |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1740 | g_signal_connect(G_OBJECT(menuitem), "activate", |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1741 | G_CALLBACK(menu_action_cb), |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1742 | object); |
| 12919 | 1743 | } else { |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1744 | gtk_widget_set_sensitive(menuitem, FALSE); |
| 12919 | 1745 | } |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1746 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1747 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1748 | } else { |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1749 | GList *l = NULL; |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1750 | GtkWidget *submenu = NULL; |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1751 | GtkAccelGroup *group; |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1752 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1753 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1754 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1755 | submenu = gtk_menu_new(); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1756 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1757 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1758 | group = gtk_menu_get_accel_group(GTK_MENU(menu)); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1759 | if (group) { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
1760 | char *path = g_strdup_printf("%s/%s", |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32415
diff
changeset
|
1761 | gtk_menu_item_get_accel_path(GTK_MENU_ITEM(menuitem)), |
|
33120
f6f1a27ade72
propagate from branch 'im.pidgin.pidgin' (head 681ca041d42bb5093590d0ac5495f1309e1472f2)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
1762 | purple_menu_action_get_label(act)); |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1763 | gtk_menu_set_accel_path(GTK_MENU(submenu), path); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1764 | g_free(path); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1765 | gtk_menu_set_accel_group(GTK_MENU(submenu), group); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1766 | } |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1767 | |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1768 | for (l = list; l; l = l->next) { |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1769 | PurpleMenuAction *act = (PurpleMenuAction *)l->data; |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1770 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1771 | pidgin_append_menu_action(submenu, act, object); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1772 | } |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1773 | g_list_free(list); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1774 | purple_menu_action_set_children(act, NULL); |
| 12919 | 1775 | } |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1776 | purple_menu_action_free(act); |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1777 | return menuitem; |
| 12919 | 1778 | } |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1779 | |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1780 | enum { |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1781 | COMPLETION_DISPLAYED_COLUMN, /* displayed completion value */ |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1782 | COMPLETION_BUDDY_COLUMN, /* buddy name */ |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1783 | COMPLETION_NORMALIZED_COLUMN, /* UTF-8 normalized & casefolded buddy name */ |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1784 | COMPLETION_COMPARISON_COLUMN, /* UTF-8 normalized & casefolded value for comparison */ |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1785 | COMPLETION_ACCOUNT_COLUMN, /* account */ |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1786 | COMPLETION_COLUMN_COUNT |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1787 | }; |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1788 | |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1789 | typedef struct |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1790 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1791 | GtkWidget *entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1792 | GtkWidget *accountopt; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1793 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1794 | PidginFilterBuddyCompletionEntryFunc filter_func; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1795 | gpointer filter_func_user_data; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1796 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1797 | GtkListStore *store; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1798 | } PidginCompletionData; |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1799 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1800 | static gboolean buddyname_completion_match_func(GtkEntryCompletion *completion, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1801 | const gchar *key, GtkTreeIter *iter, gpointer user_data) |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1802 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1803 | GtkTreeModel *model; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1804 | GValue val1; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1805 | GValue val2; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1806 | const char *tmp; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1807 | |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1808 | model = gtk_entry_completion_get_model(completion); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1809 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1810 | val1.g_type = 0; |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1811 | gtk_tree_model_get_value(model, iter, COMPLETION_NORMALIZED_COLUMN, &val1); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1812 | tmp = g_value_get_string(&val1); |
| 15884 | 1813 | if (tmp != NULL && purple_str_has_prefix(tmp, key)) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1814 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1815 | g_value_unset(&val1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1816 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1817 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1818 | g_value_unset(&val1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1819 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1820 | val2.g_type = 0; |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1821 | gtk_tree_model_get_value(model, iter, COMPLETION_COMPARISON_COLUMN, &val2); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1822 | tmp = g_value_get_string(&val2); |
| 15884 | 1823 | if (tmp != NULL && purple_str_has_prefix(tmp, key)) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1824 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1825 | g_value_unset(&val2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1826 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1827 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1828 | g_value_unset(&val2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1829 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1830 | return FALSE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1831 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1832 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1833 | static gboolean buddyname_completion_match_selected_cb(GtkEntryCompletion *completion, |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1834 | GtkTreeModel *model, GtkTreeIter *iter, PidginCompletionData *data) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1835 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1836 | GValue val; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1837 | GtkWidget *optmenu = data->accountopt; |
| 15884 | 1838 | PurpleAccount *account; |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1839 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1840 | val.g_type = 0; |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1841 | gtk_tree_model_get_value(model, iter, COMPLETION_BUDDY_COLUMN, &val); |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1842 | gtk_entry_set_text(GTK_ENTRY(data->entry), g_value_get_string(&val)); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1843 | g_value_unset(&val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1844 | |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1845 | gtk_tree_model_get_value(model, iter, COMPLETION_ACCOUNT_COLUMN, &val); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1846 | account = g_value_get_pointer(&val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1847 | g_value_unset(&val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1848 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1849 | if (account == NULL) |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1850 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1851 | |
| 17117 | 1852 | if (optmenu != NULL) |
|
17385
bf46968ab031
Casting things to gpointer isn't useful, unless they were previously const.
Richard Laager <rlaager@pidgin.im>
parents:
17377
diff
changeset
|
1853 | aop_option_menu_select_by_data(optmenu, account); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1854 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1855 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1856 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1857 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1858 | static void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1859 | add_buddyname_autocomplete_entry(GtkListStore *store, const char *buddy_alias, const char *contact_alias, |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1860 | const PurpleAccount *account, const char *buddyname) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1861 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1862 | GtkTreeIter iter; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1863 | gboolean completion_added = FALSE; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1864 | gchar *normalized_buddyname; |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1865 | gchar *tmp; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1866 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1867 | tmp = g_utf8_normalize(buddyname, -1, G_NORMALIZE_DEFAULT); |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1868 | normalized_buddyname = g_utf8_casefold(tmp, -1); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1869 | g_free(tmp); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1870 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1871 | /* There's no sense listing things like: 'xxx "xxx"' |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1872 | when the name and buddy alias match. */ |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1873 | if (buddy_alias && strcmp(buddy_alias, buddyname)) { |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1874 | char *completion_entry = g_strdup_printf("%s \"%s\"", buddyname, buddy_alias); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1875 | char *tmp2 = g_utf8_normalize(buddy_alias, -1, G_NORMALIZE_DEFAULT); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1876 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1877 | tmp = g_utf8_casefold(tmp2, -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1878 | g_free(tmp2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1879 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1880 | gtk_list_store_append(store, &iter); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1881 | gtk_list_store_set(store, &iter, |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1882 | COMPLETION_DISPLAYED_COLUMN, completion_entry, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1883 | COMPLETION_BUDDY_COLUMN, buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1884 | COMPLETION_NORMALIZED_COLUMN, normalized_buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1885 | COMPLETION_COMPARISON_COLUMN, tmp, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1886 | COMPLETION_ACCOUNT_COLUMN, account, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1887 | -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1888 | g_free(completion_entry); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1889 | g_free(tmp); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1890 | completion_added = TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1891 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1892 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1893 | /* There's no sense listing things like: 'xxx "xxx"' |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1894 | when the name and contact alias match. */ |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1895 | if (contact_alias && strcmp(contact_alias, buddyname)) { |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1896 | /* We don't want duplicates when the contact and buddy alias match. */ |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1897 | if (!buddy_alias || strcmp(contact_alias, buddy_alias)) { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1898 | char *completion_entry = g_strdup_printf("%s \"%s\"", |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1899 | buddyname, contact_alias); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1900 | char *tmp2 = g_utf8_normalize(contact_alias, -1, G_NORMALIZE_DEFAULT); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1901 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1902 | tmp = g_utf8_casefold(tmp2, -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1903 | g_free(tmp2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1904 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1905 | gtk_list_store_append(store, &iter); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1906 | gtk_list_store_set(store, &iter, |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1907 | COMPLETION_DISPLAYED_COLUMN, completion_entry, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1908 | COMPLETION_BUDDY_COLUMN, buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1909 | COMPLETION_NORMALIZED_COLUMN, normalized_buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1910 | COMPLETION_COMPARISON_COLUMN, tmp, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1911 | COMPLETION_ACCOUNT_COLUMN, account, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1912 | -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1913 | g_free(completion_entry); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1914 | g_free(tmp); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1915 | completion_added = TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1916 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1917 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1918 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1919 | if (completion_added == FALSE) { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1920 | /* Add the buddy's name. */ |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1921 | gtk_list_store_append(store, &iter); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1922 | gtk_list_store_set(store, &iter, |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1923 | COMPLETION_DISPLAYED_COLUMN, buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1924 | COMPLETION_BUDDY_COLUMN, buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1925 | COMPLETION_NORMALIZED_COLUMN, normalized_buddyname, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1926 | COMPLETION_COMPARISON_COLUMN, NULL, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
1927 | COMPLETION_ACCOUNT_COLUMN, account, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1928 | -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1929 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1930 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1931 | g_free(normalized_buddyname); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1932 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1933 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1934 | static void get_log_set_name(PurpleLogSet *set, gpointer value, PidginCompletionData *data) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1935 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1936 | PidginFilterBuddyCompletionEntryFunc filter_func = data->filter_func; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1937 | gpointer user_data = data->filter_func_user_data; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1938 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1939 | /* 1. Don't show buddies because we will have gotten them already. |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1940 | * 2. The boxes that use this autocomplete code handle only IMs. */ |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1941 | if (!set->buddy && set->type == PURPLE_LOG_IM) { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1942 | PidginBuddyCompletionEntry entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1943 | entry.is_buddy = FALSE; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1944 | entry.entry.logged_buddy = set; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1945 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1946 | if (filter_func(&entry, user_data)) { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1947 | add_buddyname_autocomplete_entry(data->store, |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1948 | NULL, NULL, set->account, set->name); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1949 | } |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1950 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1951 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1952 | |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1953 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1954 | add_completion_list(PidginCompletionData *data) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1955 | { |
| 15884 | 1956 | PurpleBlistNode *gnode, *cnode, *bnode; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1957 | PidginFilterBuddyCompletionEntryFunc filter_func = data->filter_func; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1958 | gpointer user_data = data->filter_func_user_data; |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1959 | GHashTable *sets; |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1960 | gchar *alias; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1961 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1962 | gtk_list_store_clear(data->store); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1963 | |
|
34726
af52ff6660c0
Replaced purple_get_blist() with purple_blist_get_buddy_list()
Ankit Vani <a@nevitus.org>
parents:
34699
diff
changeset
|
1964 | for (gnode = purple_blist_get_buddy_list()->root; gnode != NULL; gnode = gnode->next) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1965 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
1966 | if (!PURPLE_IS_GROUP(gnode)) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1967 | continue; |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1968 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1969 | for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1970 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
34662
diff
changeset
|
1971 | if (!PURPLE_IS_CONTACT(cnode)) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1972 | continue; |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1973 | |
|
34769
427725f8ed54
Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
1974 | g_object_get(cnode, "alias", &alias, NULL); |
|
427725f8ed54
Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
1975 | |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1976 | for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1977 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1978 | PidginBuddyCompletionEntry entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1979 | entry.is_buddy = TRUE; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1980 | entry.entry.buddy = (PurpleBuddy *) bnode; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1981 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1982 | if (filter_func(&entry, user_data)) { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1983 | add_buddyname_autocomplete_entry(data->store, |
|
34739
7d507b8b9f92
Refactored pidgin to use the GObject BList API
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
1984 | alias, |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1985 | purple_buddy_get_contact_alias(entry.entry.buddy), |
|
32709
0edad3ff7243
Use the PurpleBuddy accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1986 | purple_buddy_get_account(entry.entry.buddy), |
|
0edad3ff7243
Use the PurpleBuddy accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
1987 | purple_buddy_get_name(entry.entry.buddy) |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1988 | ); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1989 | } |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1990 | } |
|
34769
427725f8ed54
Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
1991 | |
|
427725f8ed54
Free strings received from g_object_get
Ankit Vani <a@nevitus.org>
parents:
34739
diff
changeset
|
1992 | g_free(alias); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1993 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1994 | } |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1995 | |
| 15884 | 1996 | sets = purple_log_get_log_sets(); |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1997 | g_hash_table_foreach(sets, (GHFunc)get_log_set_name, data); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
1998 | g_hash_table_destroy(sets); |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1999 | |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2000 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2001 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2002 | static void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2003 | buddyname_autocomplete_destroyed_cb(GtkWidget *widget, gpointer data) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2004 | { |
|
17707
b5f042209c68
Unleak a few bytes in the screenname completion code
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17605
diff
changeset
|
2005 | g_free(data); |
| 15884 | 2006 | purple_signals_disconnect_by_handle(widget); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2007 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2008 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2009 | static void |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2010 | repopulate_autocomplete(gpointer something, gpointer data) |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2011 | { |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2012 | add_completion_list(data); |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2013 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2014 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2015 | void |
|
33698
e730d1a5f058
Rename pidgin_setup_screenname_autocomplete_with_filter to pidgin_setup_screenname_autocomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33661
diff
changeset
|
2016 | pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *accountopt, PidginFilterBuddyCompletionEntryFunc filter_func, gpointer user_data) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2017 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2018 | PidginCompletionData *data; |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2019 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2020 | /* |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2021 | * Store the displayed completion value, the buddy name, the UTF-8 |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2022 | * normalized & casefolded buddy name, the UTF-8 normalized & |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2023 | * casefolded value for comparison, and the account. |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2024 | */ |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2025 | GtkListStore *store; |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2026 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2027 | GtkEntryCompletion *completion; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2028 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2029 | data = g_new0(PidginCompletionData, 1); |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
2030 | store = gtk_list_store_new(COMPLETION_COLUMN_COUNT, G_TYPE_STRING, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
2031 | G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
2032 | G_TYPE_POINTER); |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2033 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2034 | data->entry = entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2035 | data->accountopt = accountopt; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2036 | if (filter_func == NULL) { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2037 | data->filter_func = pidgin_screenname_autocomplete_default_filter; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2038 | data->filter_func_user_data = NULL; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2039 | } else { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2040 | data->filter_func = filter_func; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2041 | data->filter_func_user_data = user_data; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2042 | } |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2043 | data->store = store; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2044 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2045 | add_completion_list(data); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2046 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2047 | /* Sort the completion list by buddy name */ |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2048 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
2049 | COMPLETION_BUDDY_COLUMN, |
|
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
2050 | GTK_SORT_ASCENDING); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2051 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2052 | completion = gtk_entry_completion_new(); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2053 | gtk_entry_completion_set_match_func(completion, buddyname_completion_match_func, NULL, NULL); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2054 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2055 | g_signal_connect(G_OBJECT(completion), "match-selected", |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2056 | G_CALLBACK(buddyname_completion_match_selected_cb), data); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2057 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2058 | gtk_entry_set_completion(GTK_ENTRY(entry), completion); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2059 | g_object_unref(completion); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2060 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2061 | gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store)); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2062 | g_object_unref(store); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2063 | |
|
32933
956eb215f6c6
Make code a bit more verbose, and remove some "magic numbers".
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32927
diff
changeset
|
2064 | gtk_entry_completion_set_text_column(completion, COMPLETION_DISPLAYED_COLUMN); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2065 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2066 | purple_signal_connect(purple_connections_get_handle(), "signed-on", entry, |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2067 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2068 | purple_signal_connect(purple_connections_get_handle(), "signed-off", entry, |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2069 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
|
13366
e01cf252b407
[gaim-migrate @ 15738]
Richard Laager <rlaager@pidgin.im>
parents:
13365
diff
changeset
|
2070 | |
| 15884 | 2071 | purple_signal_connect(purple_accounts_get_handle(), "account-added", entry, |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2072 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
| 15884 | 2073 | purple_signal_connect(purple_accounts_get_handle(), "account-removed", entry, |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2074 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2075 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2076 | g_signal_connect(G_OBJECT(entry), "destroy", G_CALLBACK(buddyname_autocomplete_destroyed_cb), data); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2077 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2078 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2079 | gboolean |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2080 | pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry *completion_entry, gpointer all_accounts) { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2081 | gboolean all = GPOINTER_TO_INT(all_accounts); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2082 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2083 | if (completion_entry->is_buddy) { |
|
32709
0edad3ff7243
Use the PurpleBuddy accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2084 | return all || purple_account_is_connected(purple_buddy_get_account(completion_entry->entry.buddy)); |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2085 | } else { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2086 | return all || (completion_entry->entry.logged_buddy->account != NULL && purple_account_is_connected(completion_entry->entry.logged_buddy->account)); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2087 | } |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2088 | } |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2089 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2090 | void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2091 | { |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2092 | GdkCursor *cursor; |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2093 | |
|
13470
5550131ec50b
[gaim-migrate @ 15845]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
2094 | g_return_if_fail(widget != NULL); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2095 | if (gtk_widget_get_window(widget) == NULL) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2096 | return; |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2097 | |
|
22787
18842b6fda42
Use the desired cursor, instead of always using GDK_WATCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22702
diff
changeset
|
2098 | cursor = gdk_cursor_new(cursor_type); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2099 | gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2100 | gdk_cursor_unref(cursor); |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2101 | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2102 | gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget))); |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2103 | } |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2104 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2105 | void pidgin_clear_cursor(GtkWidget *widget) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2106 | { |
|
13470
5550131ec50b
[gaim-migrate @ 15845]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
2107 | g_return_if_fail(widget != NULL); |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2108 | if (gtk_widget_get_window(widget) == NULL) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2109 | return; |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2110 | |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2111 | gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2112 | } |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2113 | |
| 14195 | 2114 | struct _icon_chooser { |
| 2115 | GtkWidget *icon_filesel; | |
| 2116 | GtkWidget *icon_preview; | |
| 2117 | GtkWidget *icon_text; | |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15405
diff
changeset
|
2118 | |
| 14195 | 2119 | void (*callback)(const char*,gpointer); |
| 2120 | gpointer data; | |
| 2121 | }; | |
| 2122 | ||
| 2123 | static void | |
| 2124 | icon_filesel_choose_cb(GtkWidget *widget, gint response, struct _icon_chooser *dialog) | |
| 2125 | { | |
| 2126 | char *filename, *current_folder; | |
| 2127 | ||
| 2128 | if (response != GTK_RESPONSE_ACCEPT) { | |
| 2129 | if (response == GTK_RESPONSE_CANCEL) { | |
| 2130 | gtk_widget_destroy(dialog->icon_filesel); | |
| 2131 | } | |
| 2132 | dialog->icon_filesel = NULL; | |
| 2133 | if (dialog->callback) | |
| 2134 | dialog->callback(NULL, dialog->data); | |
| 2135 | g_free(dialog); | |
| 2136 | return; | |
| 2137 | } | |
| 2138 | ||
| 2139 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
| 2140 | current_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
| 2141 | if (current_folder != NULL) { | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
2142 | purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_icon_folder", current_folder); |
| 14195 | 2143 | g_free(current_folder); |
| 2144 | } | |
| 2145 | ||
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
2146 | |
| 14195 | 2147 | if (dialog->callback) |
| 2148 | dialog->callback(filename, dialog->data); | |
| 2149 | gtk_widget_destroy(dialog->icon_filesel); | |
| 2150 | g_free(filename); | |
| 2151 | g_free(dialog); | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32415
diff
changeset
|
2152 | } |
| 14195 | 2153 | |
| 2154 | ||
| 2155 | static void | |
| 2156 | icon_preview_change_cb(GtkFileChooser *widget, struct _icon_chooser *dialog) | |
| 2157 | { | |
|
33359
aba982dbb801
Fix sizing for the file-chooser image preview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32043
diff
changeset
|
2158 | GdkPixbuf *pixbuf; |
| 14195 | 2159 | int height, width; |
| 2160 | char *basename, *markup, *size; | |
|
33940
b44d15793c83
Use GStatBuf instead of struct stat
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33796
diff
changeset
|
2161 | GStatBuf st; |
| 14195 | 2162 | char *filename; |
| 2163 | ||
| 2164 | filename = gtk_file_chooser_get_preview_filename( | |
| 2165 | GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
| 2166 | ||
|
33359
aba982dbb801
Fix sizing for the file-chooser image preview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32043
diff
changeset
|
2167 | if (!filename || g_stat(filename, &st) || !(pixbuf = pidgin_pixbuf_new_from_file_at_size(filename, 128, 128))) |
| 14195 | 2168 | { |
| 2169 | gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), NULL); | |
| 2170 | gtk_label_set_markup(GTK_LABEL(dialog->icon_text), ""); | |
| 2171 | g_free(filename); | |
| 2172 | return; | |
| 2173 | } | |
| 2174 | ||
|
33359
aba982dbb801
Fix sizing for the file-chooser image preview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32043
diff
changeset
|
2175 | gdk_pixbuf_get_file_info(filename, &width, &height); |
| 14195 | 2176 | basename = g_path_get_basename(filename); |
| 15884 | 2177 | size = purple_str_size_to_units(st.st_size); |
| 14195 | 2178 | markup = g_strdup_printf(_("<b>File:</b> %s\n" |
| 2179 | "<b>File size:</b> %s\n" | |
| 2180 | "<b>Image size:</b> %dx%d"), | |
| 2181 | basename, size, width, height); | |
| 2182 | ||
|
33359
aba982dbb801
Fix sizing for the file-chooser image preview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32043
diff
changeset
|
2183 | gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), pixbuf); |
| 14195 | 2184 | gtk_label_set_markup(GTK_LABEL(dialog->icon_text), markup); |
| 2185 | ||
| 2186 | g_object_unref(G_OBJECT(pixbuf)); | |
| 2187 | g_free(filename); | |
| 2188 | g_free(basename); | |
| 2189 | g_free(size); | |
| 2190 | g_free(markup); | |
| 2191 | } | |
| 2192 | ||
| 2193 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2194 | GtkWidget *pidgin_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char *, gpointer), gpointer data) { |
| 14195 | 2195 | struct _icon_chooser *dialog = g_new0(struct _icon_chooser, 1); |
| 2196 | ||
|
17046
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2197 | GtkWidget *vbox; |
| 14195 | 2198 | const char *current_folder; |
| 2199 | ||
| 2200 | dialog->callback = callback; | |
| 2201 | dialog->data = data; | |
| 2202 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
2203 | current_folder = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/filelocations/last_icon_folder"); |
| 14195 | 2204 | |
| 2205 | dialog->icon_filesel = gtk_file_chooser_dialog_new(_("Buddy Icon"), | |
| 2206 | parent, | |
| 2207 | GTK_FILE_CHOOSER_ACTION_OPEN, | |
| 2208 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
| 2209 | GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, | |
| 2210 | NULL); | |
| 2211 | gtk_dialog_set_default_response(GTK_DIALOG(dialog->icon_filesel), GTK_RESPONSE_ACCEPT); | |
| 2212 | if ((current_folder != NULL) && (*current_folder != '\0')) | |
| 2213 | gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog->icon_filesel), | |
| 2214 | current_folder); | |
| 2215 | ||
| 2216 | dialog->icon_preview = gtk_image_new(); | |
| 2217 | dialog->icon_text = gtk_label_new(NULL); | |
|
17046
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2218 | |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2219 | vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2220 | gtk_widget_set_size_request(GTK_WIDGET(vbox), -1, 50); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2221 | gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(dialog->icon_preview), TRUE, FALSE, 0); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2222 | gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET(dialog->icon_text), FALSE, FALSE, 0); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2223 | gtk_widget_show_all(vbox); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2224 | |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2225 | gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(dialog->icon_filesel), vbox); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2226 | gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->icon_filesel), TRUE); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2227 | gtk_file_chooser_set_use_preview_label(GTK_FILE_CHOOSER(dialog->icon_filesel), FALSE); |
|
e1fcb4c68dab
Display the image info label in the icon chooser preview area. I'm not sure why this was only being displayed in the pre-GTK 2.4.0 chooser. Also, always use our preview widget - we don't need to fallback to the GTK default previewer, this fixes #458 and seems like the right thing to do in this case.
Daniel Atallah <datallah@pidgin.im>
parents:
17038
diff
changeset
|
2228 | |
| 14195 | 2229 | g_signal_connect(G_OBJECT(dialog->icon_filesel), "update-preview", |
| 2230 | G_CALLBACK(icon_preview_change_cb), dialog); | |
| 2231 | g_signal_connect(G_OBJECT(dialog->icon_filesel), "response", | |
| 2232 | G_CALLBACK(icon_filesel_choose_cb), dialog); | |
| 2233 | icon_preview_change_cb(NULL, dialog); | |
|
21729
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2234 | |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2235 | #ifdef _WIN32 |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2236 | g_signal_connect(G_OBJECT(dialog->icon_filesel), "show", |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2237 | G_CALLBACK(winpidgin_ensure_onscreen), dialog->icon_filesel); |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2238 | #endif |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2239 | |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2240 | return dialog->icon_filesel; |
| 14195 | 2241 | } |
| 2242 | ||
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2243 | /** |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2244 | * @return True if any string from array a exists in array b. |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2245 | */ |
| 14195 | 2246 | static gboolean |
| 2247 | str_array_match(char **a, char **b) | |
| 2248 | { | |
| 2249 | int i, j; | |
| 2250 | ||
| 2251 | if (!a || !b) | |
| 2252 | return FALSE; | |
| 2253 | for (i = 0; a[i] != NULL; i++) | |
| 2254 | for (j = 0; b[j] != NULL; j++) | |
| 2255 | if (!g_ascii_strcasecmp(a[i], b[j])) | |
| 2256 | return TRUE; | |
| 2257 | return FALSE; | |
| 2258 | } | |
| 2259 | ||
|
16446
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
2260 | gpointer |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
2261 | pidgin_convert_buddy_icon(PurpleProtocol *protocol, const char *path, size_t *len) |
| 14195 | 2262 | { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2263 | PurpleBuddyIconSpec *spec; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2264 | int orig_width, orig_height, new_width, new_height; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2265 | GdkPixbufFormat *format; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2266 | char **pixbuf_formats; |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2267 | char **protocol_formats; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2268 | GError *error = NULL; |
|
15284
98e8f9912107
[gaim-migrate @ 18012]
Mark Doliner <markdoliner@pidgin.im>
parents:
15254
diff
changeset
|
2269 | gchar *contents; |
|
98e8f9912107
[gaim-migrate @ 18012]
Mark Doliner <markdoliner@pidgin.im>
parents:
15254
diff
changeset
|
2270 | gsize length; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2271 | GdkPixbuf *pixbuf, *original; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2272 | float scale_factor; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2273 | int i; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2274 | gchar *tmp; |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14196
diff
changeset
|
2275 | |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
2276 | spec = &protocol->icon_spec; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2277 | g_return_val_if_fail(spec->format != NULL, NULL); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2278 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2279 | format = gdk_pixbuf_get_file_info(path, &orig_width, &orig_height); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2280 | if (format == NULL) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2281 | purple_debug_warning("buddyicon", "Could not get file info of %s\n", path); |
|
14206
5a17eb1a2c3e
[gaim-migrate @ 16786]
Mark Doliner <markdoliner@pidgin.im>
parents:
14203
diff
changeset
|
2282 | return NULL; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2283 | } |
|
15289
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2284 | |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2285 | pixbuf_formats = gdk_pixbuf_format_get_extensions(format); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2286 | protocol_formats = g_strsplit(spec->format, ",", 0); |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2287 | |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2288 | if (str_array_match(pixbuf_formats, protocol_formats) && /* This is an acceptable format AND */ |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2289 | (!(spec->scale_rules & PURPLE_ICON_SCALE_SEND) || /* The prpl doesn't scale before it sends OR */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2290 | (spec->min_width <= orig_width && spec->max_width >= orig_width && |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2291 | spec->min_height <= orig_height && spec->max_height >= orig_height))) /* The icon is the correct size */ |
| 14195 | 2292 | { |
| 2293 | g_strfreev(pixbuf_formats); | |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
2294 | |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2295 | if (!g_file_get_contents(path, &contents, &length, &error)) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2296 | purple_debug_warning("buddyicon", "Could not get file contents " |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2297 | "of %s: %s\n", path, error->message); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2298 | g_strfreev(protocol_formats); |
|
15289
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2299 | return NULL; |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2300 | } |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2301 | |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2302 | if (spec->max_filesize == 0 || length < spec->max_filesize) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2303 | /* The supplied image fits the file size, dimensions and type |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2304 | constraints. Great! Return it without making any changes. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2305 | if (len) |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2306 | *len = length; |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2307 | g_strfreev(protocol_formats); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2308 | return contents; |
| 14195 | 2309 | } |
| 2310 | ||
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2311 | /* The image was too big. Fall-through and try scaling it down. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2312 | g_free(contents); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2313 | } else { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2314 | g_strfreev(pixbuf_formats); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2315 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2316 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2317 | /* The original image wasn't compatible. Scale it or convert file type. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2318 | pixbuf = gdk_pixbuf_new_from_file(path, &error); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2319 | if (error) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2320 | purple_debug_warning("buddyicon", "Could not open icon '%s' for " |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2321 | "conversion: %s\n", path, error->message); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2322 | g_error_free(error); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2323 | g_strfreev(protocol_formats); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2324 | return NULL; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2325 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2326 | original = g_object_ref(G_OBJECT(pixbuf)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2327 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2328 | new_width = orig_width; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2329 | new_height = orig_height; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2330 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2331 | /* Make sure the image is the correct dimensions */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2332 | if (spec->scale_rules & PURPLE_ICON_SCALE_SEND && |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2333 | (orig_width < spec->min_width || orig_width > spec->max_width || |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2334 | orig_height < spec->min_height || orig_height > spec->max_height)) |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2335 | { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2336 | purple_buddy_icon_get_scale_size(spec, &new_width, &new_height); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2337 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2338 | g_object_unref(G_OBJECT(pixbuf)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2339 | pixbuf = gdk_pixbuf_scale_simple(original, new_width, new_height, GDK_INTERP_HYPER); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2340 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2341 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2342 | scale_factor = 1; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2343 | do { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2344 | for (i = 0; protocol_formats[i]; i++) { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2345 | int quality = 100; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2346 | do { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2347 | const char *key = NULL; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2348 | const char *value = NULL; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2349 | gchar tmp_buf[4]; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2350 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2351 | purple_debug_info("buddyicon", "Converting buddy icon to %s\n", protocol_formats[i]); |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2352 | |
|
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2353 | if (g_str_equal(protocol_formats[i], "png")) { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2354 | key = "compression"; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2355 | value = "9"; |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2356 | } else if (g_str_equal(protocol_formats[i], "jpeg")) { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2357 | sprintf(tmp_buf, "%u", quality); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2358 | key = "quality"; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2359 | value = tmp_buf; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2360 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2361 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2362 | if (!gdk_pixbuf_save_to_buffer(pixbuf, &contents, &length, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2363 | protocol_formats[i], &error, key, value, NULL)) |
|
29927
80855a5471ed
Use gdk_pixbuf_save_to_buffer() instead of gdk_pixbuf_save() to avoid saving
Mark Doliner <markdoliner@pidgin.im>
parents:
29898
diff
changeset
|
2364 | { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2365 | /* The NULL checking of error is necessary due to this bug: |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2366 | * http://bugzilla.gnome.org/show_bug.cgi?id=405539 */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2367 | purple_debug_warning("buddyicon", |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2368 | "Could not convert to %s: %s\n", protocol_formats[i], |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2369 | (error && error->message) ? error->message : "Unknown error"); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2370 | g_error_free(error); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2371 | error = NULL; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2372 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2373 | /* We couldn't convert to this image type. Try the next |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2374 | image type. */ |
|
15645
db8c01fc8637
Work around gdk-pixbuf brokenness when dealing with unrecognized parameters. Also, improve the error handling so we don't get a confusing error message.
Daniel Atallah <datallah@pidgin.im>
parents:
15635
diff
changeset
|
2375 | break; |
|
db8c01fc8637
Work around gdk-pixbuf brokenness when dealing with unrecognized parameters. Also, improve the error handling so we don't get a confusing error message.
Daniel Atallah <datallah@pidgin.im>
parents:
15635
diff
changeset
|
2376 | } |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2377 | |
|
30054
82871fde0aac
Allow icons to be exactly the max file size
Mark Doliner <markdoliner@pidgin.im>
parents:
30053
diff
changeset
|
2378 | if (spec->max_filesize == 0 || length <= spec->max_filesize) { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2379 | /* We were able to save the image as this image type and |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2380 | have it be within the size constraints. Great! Return |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2381 | the image. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2382 | purple_debug_info("buddyicon", "Converted image from " |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2383 | "%dx%d to %dx%d, format=%s, quality=%u, " |
|
32749
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
2384 | "filesize=%" G_GSIZE_FORMAT "\n", |
|
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
2385 | orig_width, orig_height, new_width, new_height, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2386 | protocol_formats[i], quality, length); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2387 | if (len) |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2388 | *len = length; |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2389 | g_strfreev(protocol_formats); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2390 | g_object_unref(G_OBJECT(pixbuf)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2391 | g_object_unref(G_OBJECT(original)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2392 | return contents; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2393 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2394 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2395 | g_free(contents); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2396 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2397 | if (!g_str_equal(protocol_formats[i], "jpeg")) { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2398 | /* File size was too big and we can't lower the quality, |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2399 | so skip to the next image type. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2400 | break; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2401 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2402 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2403 | /* File size was too big, but we're dealing with jpeg so try |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2404 | lowering the quality. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2405 | quality -= 5; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2406 | } while (quality >= 70); |
|
16446
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
2407 | } |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2408 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2409 | /* We couldn't save the image in any format that was below the max |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2410 | file size. Maybe we can reduce the image dimensions? */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2411 | scale_factor *= 0.8; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2412 | new_width = orig_width * scale_factor; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2413 | new_height = orig_height * scale_factor; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2414 | g_object_unref(G_OBJECT(pixbuf)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2415 | pixbuf = gdk_pixbuf_scale_simple(original, new_width, new_height, GDK_INTERP_HYPER); |
|
30053
223f898b44b2
Oh! When setting a buddy icon, when we reduce the dimension in order to
Mark Doliner <markdoliner@pidgin.im>
parents:
30002
diff
changeset
|
2416 | } while ((new_width > 10 || new_height > 10) && new_width > spec->min_width && new_height > spec->min_height); |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
2417 | g_strfreev(protocol_formats); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2418 | g_object_unref(G_OBJECT(pixbuf)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2419 | g_object_unref(G_OBJECT(original)); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2420 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2421 | tmp = g_strdup_printf(_("The file '%s' is too large for %s. Please try a smaller image.\n"), |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
2422 | path, protocol->name); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2423 | purple_notify_error(NULL, _("Icon Error"), _("Could not set icon"), tmp); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2424 | g_free(tmp); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2425 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2426 | return NULL; |
| 14195 | 2427 | } |
|
14290
f20819ff8d86
[gaim-migrate @ 16910]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14253
diff
changeset
|
2428 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2429 | char *pidgin_make_pretty_arrows(const char *str) |
| 15084 | 2430 | { |
| 2431 | char *ret; | |
| 2432 | char **split = g_strsplit(str, "->", -1); | |
| 2433 | ret = g_strjoinv("\342\207\250", split); | |
| 2434 | g_strfreev(split); | |
| 2435 | ||
| 2436 | split = g_strsplit(ret, "<-", -1); | |
| 2437 | g_free(ret); | |
| 2438 | ret = g_strjoinv("\342\207\246", split); | |
| 2439 | g_strfreev(split); | |
| 2440 | ||
| 2441 | return ret; | |
| 2442 | } | |
| 15094 | 2443 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2444 | void pidgin_set_urgent(GtkWindow *window, gboolean urgent) |
| 15403 | 2445 | { |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
2446 | #if defined _WIN32 |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15568
diff
changeset
|
2447 | winpidgin_window_flash(window, urgent); |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20241
diff
changeset
|
2448 | #else |
|
29497
4502da3fe427
I screwed up the logic here and didn't realize it earlier.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29496
diff
changeset
|
2449 | gtk_window_set_urgency_hint(window, urgent); |
| 15403 | 2450 | #endif |
| 2451 | } | |
| 2452 | ||
|
26865
c29554ceb409
Hide the list of minidialogs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26847
diff
changeset
|
2453 | static GSList *minidialogs = NULL; |
| 15094 | 2454 | |
| 2455 | static void * | |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
22013
diff
changeset
|
2456 | pidgin_utils_get_handle(void) |
| 15094 | 2457 | { |
| 2458 | static int handle; | |
| 2459 | ||
| 2460 | return &handle; | |
| 2461 | } | |
| 2462 | ||
| 15884 | 2463 | static void connection_signed_off_cb(PurpleConnection *gc) |
| 15094 | 2464 | { |
|
22702
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2465 | GSList *list, *l_next; |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2466 | for (list = minidialogs; list; list = l_next) { |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2467 | l_next = list->next; |
| 15094 | 2468 | if (g_object_get_data(G_OBJECT(list->data), "gc") == gc) { |
| 2469 | gtk_widget_destroy(GTK_WIDGET(list->data)); | |
| 2470 | } | |
| 2471 | } | |
| 2472 | } | |
| 2473 | ||
| 2474 | static void alert_killed_cb(GtkWidget *widget) | |
| 2475 | { | |
| 2476 | minidialogs = g_slist_remove(minidialogs, widget); | |
| 2477 | } | |
| 2478 | ||
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2479 | struct _old_button_clicked_cb_data |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2480 | { |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2481 | PidginUtilMiniDialogCallback cb; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2482 | gpointer data; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2483 | }; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2484 | |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2485 | static void |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2486 | old_mini_dialog_button_clicked_cb(PidginMiniDialog *mini_dialog, |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2487 | GtkButton *button, |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2488 | gpointer user_data) |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2489 | { |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2490 | struct _old_button_clicked_cb_data *data = user_data; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2491 | data->cb(data->data, button); |
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2492 | } |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2493 | |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2494 | static void |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2495 | old_mini_dialog_destroy_cb(GtkWidget *dialog, |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2496 | GList *cb_datas) |
| 15094 | 2497 | { |
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2498 | while (cb_datas != NULL) |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2499 | { |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2500 | g_free(cb_datas->data); |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2501 | cb_datas = g_list_delete_link(cb_datas, cb_datas); |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2502 | } |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2503 | } |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2504 | |
|
30635
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2505 | static void |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2506 | mini_dialog_init(PidginMiniDialog *mini_dialog, PurpleConnection *gc, void *user_data, va_list args) |
| 15094 | 2507 | { |
| 2508 | const char *button_text; | |
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2509 | GList *cb_datas = NULL; |
| 15094 | 2510 | static gboolean first_call = TRUE; |
| 2511 | ||
| 2512 | if (first_call) { | |
| 2513 | first_call = FALSE; | |
| 15884 | 2514 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2515 | pidgin_utils_get_handle(), |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2516 | PURPLE_CALLBACK(connection_signed_off_cb), NULL); |
| 15094 | 2517 | } |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15405
diff
changeset
|
2518 | |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2519 | g_object_set_data(G_OBJECT(mini_dialog), "gc" ,gc); |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2520 | g_signal_connect(G_OBJECT(mini_dialog), "destroy", |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2521 | G_CALLBACK(alert_killed_cb), NULL); |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15405
diff
changeset
|
2522 | |
| 15094 | 2523 | while ((button_text = va_arg(args, char*))) { |
|
22702
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2524 | struct _old_button_clicked_cb_data *data = NULL; |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2525 | PidginMiniDialogCallback wrapper_cb = NULL; |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2526 | PidginUtilMiniDialogCallback callback = |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2527 | va_arg(args, PidginUtilMiniDialogCallback); |
|
22702
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2528 | |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2529 | if (callback != NULL) { |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2530 | data = g_new0(struct _old_button_clicked_cb_data, 1); |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2531 | data->cb = callback; |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2532 | data->data = user_data; |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2533 | wrapper_cb = old_mini_dialog_button_clicked_cb; |
|
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2534 | } |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2535 | pidgin_mini_dialog_add_button(mini_dialog, button_text, |
|
22702
bccd324d76c5
Fix another scenario where a NULL callback can be called. I'm pretty confident this fixes #4901. There's also a fix in here to prevent freed memory from being accessed when removing minidialogs from a signed-off account that I've had sitting on my machine for a while.
Daniel Atallah <datallah@pidgin.im>
parents:
22639
diff
changeset
|
2536 | wrapper_cb, data); |
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2537 | cb_datas = g_list_append(cb_datas, data); |
| 15094 | 2538 | } |
| 2539 | ||
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2540 | g_signal_connect(G_OBJECT(mini_dialog), "destroy", |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2541 | G_CALLBACK(old_mini_dialog_destroy_cb), cb_datas); |
|
30635
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2542 | } |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2543 | |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2544 | #define INIT_AND_RETURN_MINI_DIALOG(mini_dialog) \ |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2545 | va_list args; \ |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2546 | va_start(args, user_data); \ |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2547 | mini_dialog_init(mini_dialog, gc, user_data, args); \ |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2548 | va_end(args); \ |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2549 | return GTK_WIDGET(mini_dialog); |
|
30635
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2550 | |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2551 | GtkWidget * |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2552 | pidgin_make_mini_dialog(PurpleConnection *gc, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2553 | const char *icon_name, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2554 | const char *primary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2555 | const char *secondary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2556 | void *user_data, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2557 | ...) |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2558 | { |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2559 | PidginMiniDialog *mini_dialog = pidgin_mini_dialog_new(primary, secondary, icon_name); |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2560 | INIT_AND_RETURN_MINI_DIALOG(mini_dialog); |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2561 | } |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2562 | |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2563 | GtkWidget * |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2564 | pidgin_make_mini_dialog_with_custom_icon(PurpleConnection *gc, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2565 | GdkPixbuf *custom_icon, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2566 | const char *primary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2567 | const char *secondary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2568 | void *user_data, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2569 | ...) |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2570 | { |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2571 | PidginMiniDialog *mini_dialog = pidgin_mini_dialog_new_with_custom_icon(primary, secondary, custom_icon); |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2572 | INIT_AND_RETURN_MINI_DIALOG(mini_dialog); |
| 15094 | 2573 | } |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2574 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2575 | /* |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2576 | * "This is so dead sexy." |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2577 | * "Two thumbs up." |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2578 | * "Best movie of the year." |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2579 | * |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2580 | * This is the function that handles CTRL+F searching in the buddy list. |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2581 | * It finds the top-most buddy/group/chat/whatever containing the |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2582 | * entered string. |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2583 | * |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2584 | * It's somewhat ineffecient, because we strip all the HTML from the |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2585 | * "name" column of the buddy list (because the GtkTreeModel does not |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2586 | * contain the screen name in a non-markedup format). But the alternative |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2587 | * is to add an extra column to the GtkTreeModel. And this function is |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2588 | * used rarely, so it shouldn't matter TOO much. |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2589 | */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2590 | gboolean pidgin_tree_view_search_equal_func(GtkTreeModel *model, gint column, |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2591 | const gchar *key, GtkTreeIter *iter, gpointer data) |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2592 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2593 | gchar *enteredstring; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2594 | gchar *tmp; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2595 | gchar *withmarkup; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2596 | gchar *nomarkup; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2597 | gchar *normalized; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2598 | gboolean result; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2599 | size_t i; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2600 | size_t len; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2601 | PangoLogAttr *log_attrs; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2602 | gchar *word; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2603 | |
|
17155
143ff2796376
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@pidgin.im>
parents:
17116
diff
changeset
|
2604 | if (g_ascii_strcasecmp(key, "Global Thermonuclear War") == 0) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2605 | { |
| 15884 | 2606 | purple_notify_info(NULL, "WOPR", |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2607 | "Wouldn't you prefer a nice game of chess?", NULL); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2608 | return FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2609 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2610 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2611 | gtk_tree_model_get(model, iter, column, &withmarkup, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2612 | if (withmarkup == NULL) /* This is probably a separator */ |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2613 | return TRUE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2614 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2615 | tmp = g_utf8_normalize(key, -1, G_NORMALIZE_DEFAULT); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2616 | enteredstring = g_utf8_casefold(tmp, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2617 | g_free(tmp); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2618 | |
| 15884 | 2619 | nomarkup = purple_markup_strip_html(withmarkup); |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2620 | tmp = g_utf8_normalize(nomarkup, -1, G_NORMALIZE_DEFAULT); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2621 | g_free(nomarkup); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2622 | normalized = g_utf8_casefold(tmp, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2623 | g_free(tmp); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2624 | |
| 15884 | 2625 | if (purple_str_has_prefix(normalized, enteredstring)) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2626 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2627 | g_free(withmarkup); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2628 | g_free(enteredstring); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2629 | g_free(normalized); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2630 | return FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2631 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2632 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2633 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2634 | /* Use Pango to separate by words. */ |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2635 | len = g_utf8_strlen(normalized, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2636 | log_attrs = g_new(PangoLogAttr, len + 1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2637 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2638 | pango_get_log_attrs(normalized, strlen(normalized), -1, NULL, log_attrs, len + 1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2639 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2640 | word = normalized; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2641 | result = TRUE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2642 | for (i = 0; i < (len - 1) ; i++) |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2643 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2644 | if (log_attrs[i].is_word_start && |
| 15884 | 2645 | purple_str_has_prefix(word, enteredstring)) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2646 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2647 | result = FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2648 | break; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2649 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2650 | word = g_utf8_next_char(word); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2651 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2652 | g_free(log_attrs); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2653 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2654 | /* The non-Pango version. */ |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2655 | #if 0 |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2656 | word = normalized; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2657 | result = TRUE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2658 | while (word[0] != '\0') |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2659 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2660 | gunichar c = g_utf8_get_char(word); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2661 | if (!g_unichar_isalnum(c)) |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2662 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2663 | word = g_utf8_find_next_char(word, NULL); |
| 15884 | 2664 | if (purple_str_has_prefix(word, enteredstring)) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2665 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2666 | result = FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2667 | break; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2668 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2669 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2670 | else |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2671 | word = g_utf8_find_next_char(word, NULL); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2672 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2673 | #endif |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2674 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2675 | g_free(withmarkup); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2676 | g_free(enteredstring); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2677 | g_free(normalized); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2678 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2679 | return result; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2680 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2681 | |
|
15320
c4eea0409712
[gaim-migrate @ 18048]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15302
diff
changeset
|
2682 | |
| 15568 | 2683 | gboolean pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf) { |
|
30706
612b36b49058
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30705
diff
changeset
|
2684 | int height, rowstride, i; |
|
30705
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2685 | unsigned char *pixels; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2686 | unsigned char *row; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2687 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2688 | if (!gdk_pixbuf_get_has_alpha(pixbuf)) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2689 | return TRUE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2690 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2691 | height = gdk_pixbuf_get_height (pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2692 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2693 | pixels = gdk_pixbuf_get_pixels (pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2694 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2695 | row = pixels; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2696 | for (i = 3; i < rowstride; i+=4) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2697 | if (row[i] < 0xfe) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2698 | return FALSE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2699 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2700 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2701 | for (i = 1; i < height - 1; i++) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2702 | row = pixels + (i * rowstride); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2703 | if (row[3] < 0xfe || row[rowstride - 1] < 0xfe) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2704 | return FALSE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2705 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2706 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2707 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2708 | row = pixels + ((height - 1) * rowstride); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2709 | for (i = 3; i < rowstride; i += 4) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2710 | if (row[i] < 0xfe) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2711 | return FALSE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2712 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2713 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2714 | return TRUE; |
| 15474 | 2715 | } |
| 2716 | ||
|
18275
b9633ef422b0
Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@pidgin.im>
parents:
18238
diff
changeset
|
2717 | void pidgin_gdk_pixbuf_make_round(GdkPixbuf *pixbuf) { |
|
b9633ef422b0
Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@pidgin.im>
parents:
18238
diff
changeset
|
2718 | int width, height, rowstride; |
|
30705
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2719 | guchar *pixels; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2720 | if (!gdk_pixbuf_get_has_alpha(pixbuf)) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2721 | return; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2722 | width = gdk_pixbuf_get_width(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2723 | height = gdk_pixbuf_get_height(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2724 | rowstride = gdk_pixbuf_get_rowstride(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2725 | pixels = gdk_pixbuf_get_pixels(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2726 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2727 | if (width < 6 || height < 6) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2728 | return; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2729 | /* Top left */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2730 | pixels[3] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2731 | pixels[7] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2732 | pixels[11] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2733 | pixels[rowstride + 3] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2734 | pixels[rowstride * 2 + 3] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2735 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2736 | /* Top right */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2737 | pixels[width * 4 - 1] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2738 | pixels[width * 4 - 5] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2739 | pixels[width * 4 - 9] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2740 | pixels[rowstride + (width * 4) - 1] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2741 | pixels[(2 * rowstride) + (width * 4) - 1] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2742 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2743 | /* Bottom left */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2744 | pixels[(height - 1) * rowstride + 3] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2745 | pixels[(height - 1) * rowstride + 7] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2746 | pixels[(height - 1) * rowstride + 11] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2747 | pixels[(height - 2) * rowstride + 3] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2748 | pixels[(height - 3) * rowstride + 3] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2749 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2750 | /* Bottom right */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2751 | pixels[height * rowstride - 1] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2752 | pixels[(height - 1) * rowstride - 1] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2753 | pixels[(height - 2) * rowstride - 1] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2754 | pixels[height * rowstride - 5] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2755 | pixels[height * rowstride - 9] = 0xC0; |
|
18275
b9633ef422b0
Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@pidgin.im>
parents:
18238
diff
changeset
|
2756 | } |
|
b9633ef422b0
Rounds icons in the infopane. Since gdk_pixbuf_animation_get_static_image seems to return pixbufs without alpha channels, this only rounds animated icons that aren't transparent.
Sean Egan <seanegan@pidgin.im>
parents:
18238
diff
changeset
|
2757 | |
|
18278
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2758 | const char *pidgin_get_dim_grey_string(GtkWidget *widget) { |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2759 | static char dim_grey_string[8] = ""; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2760 | GtkStyle *style; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2761 | |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2762 | if (!widget) |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2763 | return "dim grey"; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2764 | |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32415
diff
changeset
|
2765 | style = gtk_widget_get_style(widget); |
|
18278
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2766 | if (!style) |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2767 | return "dim grey"; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25173
diff
changeset
|
2768 | |
|
18278
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2769 | snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x", |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2770 | style->text_aa[GTK_STATE_NORMAL].red >> 8, |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2771 | style->text_aa[GTK_STATE_NORMAL].green >> 8, |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2772 | style->text_aa[GTK_STATE_NORMAL].blue >> 8); |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2773 | return dim_grey_string; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2774 | } |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2775 | |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2776 | static void |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2777 | combo_box_changed_cb(GtkComboBoxText *combo_box, GtkEntry *entry) |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2778 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2779 | char *text = gtk_combo_box_text_get_active_text(combo_box); |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2780 | gtk_entry_set_text(entry, text ? text : ""); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2781 | g_free(text); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2782 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2783 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2784 | static gboolean |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2785 | entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBoxText *combo) |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2786 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2787 | if (key->keyval == GDK_KEY_Down || key->keyval == GDK_KEY_Up) { |
|
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2788 | gtk_combo_box_popup(GTK_COMBO_BOX(combo)); |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2789 | return TRUE; |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2790 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2791 | return FALSE; |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2792 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2793 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2794 | GtkWidget * |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2795 | pidgin_text_combo_box_entry_new(const char *default_item, GList *items) |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2796 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2797 | GtkComboBoxText *ret = NULL; |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2798 | GtkWidget *the_entry = NULL; |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2799 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
2800 | #if GTK_CHECK_VERSION(2,24,0) |
|
32415
59d345017c9b
propagate from branch 'im.pidgin.pidgin' (head 8a277be95a4940cd20c64326a70624c4e0449cb7)
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
2801 | ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new_with_entry()); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
2802 | the_entry = gtk_bin_get_child(GTK_BIN(ret)); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
2803 | #else |
|
31398
00fa4297311a
Modify the editable comboboxes to be more friendly to GTK+ themes that don't
Hugo Pereira Da Costa <hugo@oxygen-icons.org>
parents:
31372
diff
changeset
|
2804 | ret = GTK_COMBO_BOX(gtk_combo_box_entry_new_text()); |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2805 | the_entry = gtk_entry_new(); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2806 | gtk_container_add(GTK_CONTAINER(ret), the_entry); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
2807 | #endif |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2808 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2809 | if (default_item) |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2810 | gtk_entry_set_text(GTK_ENTRY(the_entry), default_item); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2811 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2812 | for (; items != NULL ; items = items->next) { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2813 | char *text = items->data; |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2814 | if (text && *text) |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2815 | gtk_combo_box_text_append_text(ret, text); |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2816 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2817 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2818 | g_signal_connect(G_OBJECT(ret), "changed", (GCallback)combo_box_changed_cb, the_entry); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2819 | g_signal_connect_after(G_OBJECT(the_entry), "key-press-event", G_CALLBACK(entry_key_pressed_cb), ret); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2820 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2821 | return GTK_WIDGET(ret); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2822 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2823 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2824 | const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget) |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2825 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2826 | return gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget))))); |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2827 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2828 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2829 | void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text) |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2830 | { |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2831 | gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget)))), (text)); |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2832 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2833 | |
|
22131
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2834 | GtkWidget * |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2835 | pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label) |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2836 | { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2837 | GtkWidget *hbox; |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2838 | GtkWidget *label = NULL; |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2839 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2840 | if (widget_label) { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2841 | hbox = gtk_hbox_new(FALSE, 5); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2842 | gtk_widget_show(hbox); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2843 | gtk_box_pack_start(vbox, hbox, FALSE, FALSE, 0); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2844 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2845 | label = gtk_label_new_with_mnemonic(widget_label); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2846 | gtk_widget_show(label); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2847 | if (sg) { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2848 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2849 | gtk_size_group_add_widget(sg, label); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2850 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2851 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2852 | } else { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2853 | hbox = GTK_WIDGET(vbox); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2854 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2855 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2856 | gtk_widget_show(widget); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2857 | gtk_box_pack_start(GTK_BOX(hbox), widget, expand, TRUE, 0); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2858 | if (label) { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2859 | gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2860 | pidgin_set_accessible_label (widget, label); |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2861 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2862 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2863 | if (p_label) |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2864 | (*p_label) = label; |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2865 | return hbox; |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2866 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
2867 | |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2868 | gboolean pidgin_auto_parent_window(GtkWidget *widget) |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2869 | { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2870 | #if 0 |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2871 | /* This looks at the most recent window that received focus, and makes |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2872 | * that the parent window. */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2873 | #ifndef _WIN32 |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2874 | static GdkAtom _WindowTime = GDK_NONE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2875 | static GdkAtom _Cardinal = GDK_NONE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2876 | GList *windows = NULL; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2877 | GtkWidget *parent = NULL; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2878 | time_t window_time = 0; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2879 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2880 | windows = gtk_window_list_toplevels(); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2881 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2882 | if (_WindowTime == GDK_NONE) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2883 | _WindowTime = gdk_x11_xatom_to_atom(gdk_x11_get_xatom_by_name("_NET_WM_USER_TIME")); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2884 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2885 | if (_Cardinal == GDK_NONE) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2886 | _Cardinal = gdk_atom_intern("CARDINAL", FALSE); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2887 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2888 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2889 | while (windows) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2890 | GtkWidget *window = windows->data; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2891 | guchar *data = NULL; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2892 | int al = 0; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2893 | time_t value; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2894 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2895 | windows = g_list_delete_link(windows, windows); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2896 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2897 | if (window == widget || |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32900
diff
changeset
|
2898 | !gtk_widget_get_visible(window)) |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2899 | continue; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2900 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2901 | if (!gdk_property_get(window->window, _WindowTime, _Cardinal, 0, sizeof(time_t), FALSE, |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2902 | NULL, NULL, &al, &data)) |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2903 | continue; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2904 | value = *(time_t *)data; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2905 | if (window_time < value) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2906 | window_time = value; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2907 | parent = window; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2908 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2909 | g_free(data); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2910 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2911 | if (windows) |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2912 | g_list_free(windows); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2913 | if (parent) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2914 | if (!gtk_get_current_event() && gtk_window_has_toplevel_focus(GTK_WINDOW(parent))) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2915 | /* The window is in focus, and the new window was not triggered by a keypress/click |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2916 | * event. So do not set it transient, to avoid focus stealing and all that. |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2917 | */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2918 | return FALSE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2919 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2920 | gtk_window_set_transient_for(GTK_WINDOW(widget), GTK_WINDOW(parent)); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2921 | return TRUE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2922 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2923 | return FALSE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2924 | #endif |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2925 | #else |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2926 | /* This finds the currently active window and makes that the parent window. */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2927 | GList *windows = NULL; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2928 | GtkWidget *parent = NULL; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2929 | GdkEvent *event = gtk_get_current_event(); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2930 | GdkWindow *menu = NULL; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2931 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2932 | if (event == NULL) |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2933 | /* The window was not triggered by a user action. */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2934 | return FALSE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2935 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2936 | /* We need to special case events from a popup menu. */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2937 | if (event->type == GDK_BUTTON_RELEASE) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2938 | /* XXX: Neither of the following works: |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2939 | menu = event->button.window; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2940 | menu = gdk_window_get_parent(event->button.window); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2941 | menu = gdk_window_get_toplevel(event->button.window); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2942 | */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2943 | } else if (event->type == GDK_KEY_PRESS) |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2944 | menu = event->key.window; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2945 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2946 | windows = gtk_window_list_toplevels(); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2947 | while (windows) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2948 | GtkWidget *window = windows->data; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2949 | windows = g_list_delete_link(windows, windows); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2950 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2951 | if (window == widget || |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32900
diff
changeset
|
2952 | !gtk_widget_get_visible(window)) { |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2953 | continue; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2954 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2955 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2956 | if (gtk_window_has_toplevel_focus(GTK_WINDOW(window)) || |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
32391
diff
changeset
|
2957 | (menu && menu == gtk_widget_get_window(window))) { |
|
22007
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2958 | parent = window; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2959 | break; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2960 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2961 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2962 | if (windows) |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2963 | g_list_free(windows); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2964 | if (parent) { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2965 | gtk_window_set_transient_for(GTK_WINDOW(widget), GTK_WINDOW(parent)); |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2966 | return TRUE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2967 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2968 | return FALSE; |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2969 | #endif |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2970 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
2971 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2972 | static GObject *pidgin_pixbuf_from_data_helper(const guchar *buf, gsize count, gboolean animated) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2973 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2974 | GObject *pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2975 | GdkPixbufLoader *loader; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2976 | GError *error = NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2977 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2978 | loader = gdk_pixbuf_loader_new(); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2979 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2980 | if (!gdk_pixbuf_loader_write(loader, buf, count, &error) || error) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2981 | purple_debug_warning("gtkutils", "gdk_pixbuf_loader_write() " |
|
32749
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
2982 | "failed with size=%" G_GSIZE_FORMAT ": %s\n", count, |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2983 | error ? error->message : "(no error message)"); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2984 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2985 | g_error_free(error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2986 | g_object_unref(G_OBJECT(loader)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2987 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2988 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2989 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2990 | if (!gdk_pixbuf_loader_close(loader, &error) || error) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2991 | purple_debug_warning("gtkutils", "gdk_pixbuf_loader_close() " |
|
32749
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
2992 | "failed for image of size %" G_GSIZE_FORMAT ": %s\n", count, |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2993 | error ? error->message : "(no error message)"); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2994 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2995 | g_error_free(error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2996 | g_object_unref(G_OBJECT(loader)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2997 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2998 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2999 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3000 | if (animated) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3001 | pixbuf = G_OBJECT(gdk_pixbuf_loader_get_animation(loader)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3002 | else |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3003 | pixbuf = G_OBJECT(gdk_pixbuf_loader_get_pixbuf(loader)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3004 | if (!pixbuf) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3005 | purple_debug_warning("gtkutils", "%s() returned NULL for image " |
|
32749
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
3006 | "of size %" G_GSIZE_FORMAT "\n", |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3007 | animated ? "gdk_pixbuf_loader_get_animation" |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3008 | : "gdk_pixbuf_loader_get_pixbuf", count); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3009 | g_object_unref(G_OBJECT(loader)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3010 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3011 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3012 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3013 | g_object_ref(pixbuf); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3014 | g_object_unref(G_OBJECT(loader)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3015 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3016 | return pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3017 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3018 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3019 | GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3020 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3021 | return GDK_PIXBUF(pidgin_pixbuf_from_data_helper(buf, count, FALSE)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3022 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3023 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3024 | GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3025 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3026 | return GDK_PIXBUF_ANIMATION(pidgin_pixbuf_from_data_helper(buf, count, TRUE)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3027 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3028 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3029 | GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3030 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3031 | return pidgin_pixbuf_from_data(purple_imgstore_get_data(image), |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3032 | purple_imgstore_get_size(image)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3033 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3034 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3035 | GdkPixbuf *pidgin_pixbuf_new_from_file(const gchar *filename) |
|
22897
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3036 | { |
|
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3037 | GdkPixbuf *pixbuf; |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3038 | GError *error = NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3039 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3040 | pixbuf = gdk_pixbuf_new_from_file(filename, &error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3041 | if (!pixbuf || error) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3042 | purple_debug_warning("gtkutils", "gdk_pixbuf_new_from_file() " |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3043 | "returned %s for file %s: %s\n", |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3044 | pixbuf ? "something" : "nothing", |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3045 | filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3046 | error ? error->message : "(no error message)"); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3047 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3048 | g_error_free(error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3049 | if (pixbuf) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3050 | g_object_unref(G_OBJECT(pixbuf)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3051 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3052 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3053 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3054 | return pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3055 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3056 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3057 | GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3058 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3059 | GdkPixbuf *pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3060 | GError *error = NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3061 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3062 | pixbuf = gdk_pixbuf_new_from_file_at_size(filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3063 | width, height, &error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3064 | if (!pixbuf || error) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3065 | purple_debug_warning("gtkutils", "gdk_pixbuf_new_from_file_at_size() " |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3066 | "returned %s for file %s: %s\n", |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3067 | pixbuf ? "something" : "nothing", |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3068 | filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3069 | error ? error->message : "(no error message)"); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3070 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3071 | g_error_free(error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3072 | if (pixbuf) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3073 | g_object_unref(G_OBJECT(pixbuf)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3074 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3075 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3076 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3077 | return pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3078 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3079 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3080 | GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3081 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3082 | GdkPixbuf *pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3083 | GError *error = NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3084 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3085 | pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3086 | width, height, preserve_aspect_ratio, &error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3087 | if (!pixbuf || error) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3088 | purple_debug_warning("gtkutils", "gdk_pixbuf_new_from_file_at_scale() " |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3089 | "returned %s for file %s: %s\n", |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3090 | pixbuf ? "something" : "nothing", |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3091 | filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3092 | error ? error->message : "(no error message)"); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3093 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3094 | g_error_free(error); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3095 | if (pixbuf) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3096 | g_object_unref(G_OBJECT(pixbuf)); |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3097 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3098 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3099 | |
|
22897
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3100 | return pixbuf; |
|
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3101 | } |
|
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3102 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3103 | static void |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3104 | url_copy(GtkWidget *w, gchar *url) |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3105 | { |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3106 | GtkClipboard *clipboard; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3107 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3108 | clipboard = gtk_widget_get_clipboard(w, GDK_SELECTION_PRIMARY); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3109 | gtk_clipboard_set_text(clipboard, url, -1); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3110 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3111 | clipboard = gtk_widget_get_clipboard(w, GDK_SELECTION_CLIPBOARD); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3112 | gtk_clipboard_set_text(clipboard, url, -1); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3113 | } |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3114 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3115 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3116 | link_context_menu(GtkWebView *webview, WebKitDOMHTMLAnchorElement *link, GtkWidget *menu) |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3117 | { |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3118 | GtkWidget *img, *item; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3119 | char *url; |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3120 | |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3121 | url = webkit_dom_html_anchor_element_get_href(link); |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3122 | |
| 24992 | 3123 | /* Open Link */ |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3124 | img = gtk_image_new_from_stock(GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3125 | item = gtk_image_menu_item_new_with_mnemonic(_("_Open Link")); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3126 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3127 | g_signal_connect_swapped(G_OBJECT(item), "activate", |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3128 | G_CALLBACK(gtk_webview_activate_anchor), link); |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3129 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3130 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3131 | /* Copy Link Location */ |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3132 | img = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3133 | item = gtk_image_menu_item_new_with_mnemonic(_("_Copy Link Location")); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3134 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3135 | /* The signal owns url now: */ |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3136 | g_signal_connect_data(G_OBJECT(item), "activate", G_CALLBACK(url_copy), |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3137 | (gpointer)url, (GClosureNotify)g_free, 0); |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3138 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3139 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3140 | return TRUE; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3141 | } |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3142 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3143 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3144 | copy_email_address(GtkWebView *webview, WebKitDOMHTMLAnchorElement *link, GtkWidget *menu) |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3145 | { |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3146 | GtkWidget *img, *item; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3147 | char *text; |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3148 | char *address; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3149 | #define MAILTOSIZE (sizeof("mailto:") - 1) |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3150 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3151 | text = webkit_dom_html_anchor_element_get_href(link); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3152 | if (!text || strlen(text) <= MAILTOSIZE) { |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3153 | g_free(text); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3154 | return FALSE; |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3155 | } |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3156 | address = text + MAILTOSIZE; |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3157 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3158 | /* Copy Email Address */ |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3159 | img = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3160 | item = gtk_image_menu_item_new_with_mnemonic(_("_Copy Email Address")); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3161 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3162 | g_signal_connect_data(G_OBJECT(item), "activate", G_CALLBACK(url_copy), |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3163 | g_strdup(address), (GClosureNotify)g_free, 0); |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3164 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3165 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3166 | g_free(text); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3167 | |
|
24698
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3168 | return TRUE; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3169 | } |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3170 | |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3171 | static void |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3172 | file_open_uri(GtkWebView *webview, const char *uri) |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3173 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3174 | /* Copied from gtkft.c:open_button_cb */ |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3175 | #ifdef _WIN32 |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3176 | /* If using Win32... */ |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3177 | int code; |
|
32036
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3178 | if (purple_str_has_prefix(uri, "file://")) |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3179 | { |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3180 | gchar *escaped = g_shell_quote(uri); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3181 | gchar *param = g_strconcat("/select,\"", uri, "\"", NULL); |
|
32043
73c3b1db2364
Fix parameter types passed to ShellExecuteW(). One of these is just a warning
Daniel Atallah <datallah@pidgin.im>
parents:
32036
diff
changeset
|
3182 | wchar_t *wc_param = g_utf8_to_utf16(param, -1, NULL, NULL, NULL); |
|
73c3b1db2364
Fix parameter types passed to ShellExecuteW(). One of these is just a warning
Daniel Atallah <datallah@pidgin.im>
parents:
32036
diff
changeset
|
3183 | |
|
73c3b1db2364
Fix parameter types passed to ShellExecuteW(). One of these is just a warning
Daniel Atallah <datallah@pidgin.im>
parents:
32036
diff
changeset
|
3184 | code = (int)ShellExecuteW(NULL, L"OPEN", L"explorer.exe", wc_param, NULL, SW_NORMAL); |
|
32036
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3185 | |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3186 | g_free(wc_param); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3187 | g_free(param); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3188 | g_free(escaped); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3189 | } else { |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3190 | wchar_t *wc_filename = g_utf8_to_utf16( |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3191 | uri, -1, NULL, NULL, NULL); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3192 | |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3193 | code = (int)ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL, |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3194 | SW_SHOW); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3195 | |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3196 | g_free(wc_filename); |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3197 | } |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3198 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3199 | if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3200 | { |
|
33269
1ea2edfac5e9
Convert some more util stuff to a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33232
diff
changeset
|
3201 | purple_notify_error(webview, NULL, |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3202 | _("There is no application configured to open this type of file."), NULL); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3203 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3204 | else if (code < 32) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3205 | { |
|
33269
1ea2edfac5e9
Convert some more util stuff to a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33232
diff
changeset
|
3206 | purple_notify_error(webview, NULL, |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3207 | _("An error occurred while opening the file."), NULL); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3208 | purple_debug_warning("gtkutils", "filename: %s; code: %d\n", uri, code); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3209 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3210 | #else |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3211 | char *command = NULL; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3212 | char *tmp = NULL; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3213 | GError *error = NULL; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3214 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3215 | if (purple_running_gnome()) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3216 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3217 | char *escaped = g_shell_quote(uri); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3218 | command = g_strdup_printf("gnome-open %s", escaped); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3219 | g_free(escaped); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3220 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3221 | else if (purple_running_kde()) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3222 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3223 | char *escaped = g_shell_quote(uri); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3224 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3225 | if (purple_str_has_suffix(uri, ".desktop")) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3226 | command = g_strdup_printf("kfmclient openURL %s 'text/plain'", escaped); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3227 | else |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3228 | command = g_strdup_printf("kfmclient openURL %s", escaped); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3229 | g_free(escaped); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3230 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3231 | else |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3232 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3233 | purple_notify_uri(NULL, uri); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3234 | return; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3235 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3236 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3237 | if (purple_program_is_valid(command)) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3238 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3239 | gint exit_status; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3240 | if (!g_spawn_command_line_sync(command, NULL, NULL, &exit_status, &error)) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3241 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3242 | tmp = g_strdup_printf(_("Error launching %s: %s"), |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3243 | uri, error->message); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3244 | purple_notify_error(webview, NULL, _("Unable to open file."), tmp); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3245 | g_free(tmp); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3246 | g_error_free(error); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3247 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3248 | if (exit_status != 0) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3249 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3250 | char *primary = g_strdup_printf(_("Error running %s"), command); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3251 | char *secondary = g_strdup_printf(_("Process returned error code %d"), |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3252 | exit_status); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3253 | purple_notify_error(webview, NULL, primary, secondary); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3254 | g_free(tmp); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3255 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3256 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3257 | #endif |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3258 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3259 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3260 | #define FILELINKSIZE (sizeof("file://") - 1) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3261 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3262 | file_clicked_cb(GtkWebView *webview, const char *uri) |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3263 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3264 | file_open_uri(webview, uri + FILELINKSIZE); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3265 | return TRUE; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3266 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3267 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3268 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3269 | open_containing_cb(GtkWebView *webview, const char *uri) |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3270 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3271 | char *dir = g_path_get_dirname(uri + FILELINKSIZE); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3272 | file_open_uri(webview, dir); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3273 | g_free(dir); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3274 | return TRUE; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3275 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3276 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3277 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3278 | file_context_menu(GtkWebView *webview, WebKitDOMHTMLAnchorElement *link, GtkWidget *menu) |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3279 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3280 | GtkWidget *img, *item; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3281 | char *url; |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3282 | |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3283 | url = webkit_dom_html_anchor_element_get_href(link); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3284 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3285 | /* Open File */ |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3286 | img = gtk_image_new_from_stock(GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3287 | item = gtk_image_menu_item_new_with_mnemonic(_("_Open File")); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3288 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3289 | g_signal_connect_swapped(G_OBJECT(item), "activate", |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3290 | G_CALLBACK(gtk_webview_activate_anchor), link); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3291 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3292 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3293 | /* Open Containing Directory */ |
|
27676
a1991c15288f
Set the "Open Containing Directory" icon to the "directory" stock icon
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27656
diff
changeset
|
3294 | img = gtk_image_new_from_stock(GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3295 | item = gtk_image_menu_item_new_with_mnemonic(_("Open _Containing Directory")); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3296 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3297 | /* The signal owns url now: */ |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3298 | g_signal_connect_data(G_OBJECT(item), "activate", |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3299 | G_CALLBACK(open_containing_cb), (gpointer)url, |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3300 | (GClosureNotify)g_free, 0); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3301 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3302 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3303 | return TRUE; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3304 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3305 | |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3306 | #define AUDIOLINKSIZE (sizeof("audio://") - 1) |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3307 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3308 | audio_clicked_cb(GtkWebView *webview, const char *uri) |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3309 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3310 | PidginConversation *conv = g_object_get_data(G_OBJECT(webview), "gtkconv"); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3311 | if (!conv) /* no playback in debug window */ |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3312 | return TRUE; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3313 | purple_sound_play_file(uri + AUDIOLINKSIZE, NULL); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3314 | return TRUE; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3315 | } |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3316 | |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3317 | static void |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3318 | savefile_write_cb(gpointer user_data, char *file) |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3319 | { |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3320 | char *temp_file = user_data; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3321 | gchar *contents; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3322 | gsize length; |
|
28470
37b23d2e9484
GError needs to be initialized to NULL. I can't help but think that this
Mark Doliner <markdoliner@pidgin.im>
parents:
28458
diff
changeset
|
3323 | GError *error = NULL; |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3324 | |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3325 | if (!g_file_get_contents(temp_file, &contents, &length, &error)) { |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3326 | purple_debug_error("gtkutils", "Unable to read contents of %s: %s\n", |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3327 | temp_file, error->message); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3328 | g_error_free(error); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3329 | g_free(temp_file); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3330 | return; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3331 | } |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3332 | g_free(temp_file); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3333 | |
|
27820
dbce81931c2b
Use purple_util_write_data_to_file_absolute. Closes #9688.
Paul Aurich <darkrain42@pidgin.im>
parents:
27695
diff
changeset
|
3334 | if (!purple_util_write_data_to_file_absolute(file, contents, length)) { |
|
dbce81931c2b
Use purple_util_write_data_to_file_absolute. Closes #9688.
Paul Aurich <darkrain42@pidgin.im>
parents:
27695
diff
changeset
|
3335 | purple_debug_error("gtkutils", "Unable to write contents to %s\n", |
|
dbce81931c2b
Use purple_util_write_data_to_file_absolute. Closes #9688.
Paul Aurich <darkrain42@pidgin.im>
parents:
27695
diff
changeset
|
3336 | file); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3337 | } |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3338 | } |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3339 | |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3340 | static gboolean |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3341 | save_file_cb(GtkWidget *item, const char *url) |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3342 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3343 | PidginConversation *gtkconv = g_object_get_data(G_OBJECT(item), "gtkconv"); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3344 | PurpleConversation *conv; |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3345 | if (!gtkconv) |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3346 | return TRUE; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3347 | conv = gtkconv->active_conv; |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3348 | purple_request_file(conv, _("Save File"), NULL, TRUE, |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3349 | G_CALLBACK(savefile_write_cb), G_CALLBACK(g_free), |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3350 | purple_conversation_get_account(conv), NULL, conv, |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3351 | (gpointer)g_strdup(url)); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3352 | return TRUE; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3353 | } |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3354 | |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3355 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3356 | audio_context_menu(GtkWebView *webview, WebKitDOMHTMLAnchorElement *link, GtkWidget *menu) |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3357 | { |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3358 | GtkWidget *img, *item; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3359 | char *url; |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3360 | PidginConversation *conv = g_object_get_data(G_OBJECT(webview), "gtkconv"); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3361 | if (!conv) /* No menu in debug window */ |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3362 | return TRUE; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3363 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3364 | url = webkit_dom_html_anchor_element_get_href(link); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3365 | |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3366 | /* Play Sound */ |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3367 | img = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_MENU); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3368 | item = gtk_image_menu_item_new_with_mnemonic(_("_Play Sound")); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3369 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3370 | g_signal_connect_swapped(G_OBJECT(item), "activate", |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3371 | G_CALLBACK(gtk_webview_activate_anchor), link); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3372 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3373 | |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3374 | /* Save File */ |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3375 | img = gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3376 | item = gtk_image_menu_item_new_with_mnemonic(_("_Save File")); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3377 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3378 | g_signal_connect_data(G_OBJECT(item), "activate", |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3379 | G_CALLBACK(save_file_cb), g_strdup(url+AUDIOLINKSIZE), |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3380 | (GClosureNotify)g_free, 0); |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3381 | g_object_set_data(G_OBJECT(item), "gtkconv", conv); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3382 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3383 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3384 | g_free(url); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3385 | |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3386 | return TRUE; |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3387 | } |
|
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3388 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3389 | /* XXX: The following two functions are for demonstration purposes only! */ |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3390 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3391 | open_dialog(GtkWebView *webview, const char *url) |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3392 | { |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3393 | const char *str; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3394 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3395 | if (!url || strlen(url) < sizeof("open://")) { |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3396 | return FALSE; |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3397 | } |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3398 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3399 | str = url + sizeof("open://") - 1; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3400 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3401 | if (strcmp(str, "accounts") == 0) |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3402 | pidgin_accounts_window_show(); |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3403 | else if (strcmp(str, "prefs") == 0) |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3404 | pidgin_prefs_show(); |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3405 | else |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3406 | return FALSE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3407 | return TRUE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3408 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3409 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3410 | static gboolean |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3411 | dummy(GtkWebView *webview, WebKitDOMHTMLAnchorElement *link, GtkWidget *menu) |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3412 | { |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3413 | return TRUE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3414 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3415 | |
|
25007
ef8bc1f4a6ba
Pass only the URL scheme to gtkimhtml and let it add the colon automatically.
Richard Laager <rlaager@pidgin.im>
parents:
24998
diff
changeset
|
3416 | static gboolean |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3417 | register_gnome_url_handlers(void) |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3418 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3419 | char *tmp; |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3420 | char *err; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3421 | char *c; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3422 | char *start; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3423 | |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3424 | tmp = g_find_program_in_path("gconftool-2"); |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3425 | if (tmp == NULL) |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3426 | return FALSE; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3427 | |
|
26599
191be70922b2
Apply Paul's second patch to fix some memory leaks found in valgrind.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26572
diff
changeset
|
3428 | g_free(tmp); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3429 | tmp = NULL; |
|
26599
191be70922b2
Apply Paul's second patch to fix some memory leaks found in valgrind.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26572
diff
changeset
|
3430 | |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3431 | if (!g_spawn_command_line_sync("gconftool-2 --all-dirs /desktop/gnome/url-handlers", |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3432 | &tmp, &err, NULL, NULL)) |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3433 | { |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3434 | g_free(tmp); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3435 | g_free(err); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3436 | g_return_val_if_reached(FALSE); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3437 | } |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3438 | g_free(err); |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3439 | err = NULL; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3440 | |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3441 | for (c = start = tmp ; *c ; c++) |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3442 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3443 | /* Skip leading spaces. */ |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3444 | if (c == start && *c == ' ') |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3445 | start = c + 1; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3446 | else if (*c == '\n') |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3447 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3448 | *c = '\0'; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3449 | if (g_str_has_prefix(start, "/desktop/gnome/url-handlers/")) |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3450 | { |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3451 | char *cmd; |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3452 | char *tmp2 = NULL; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3453 | char *protocol; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3454 | |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3455 | /* If there is an enabled boolean, honor it. */ |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3456 | cmd = g_strdup_printf("gconftool-2 -g %s/enabled", start); |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3457 | if (g_spawn_command_line_sync(cmd, &tmp2, &err, NULL, NULL)) |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3458 | { |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3459 | g_free(err); |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3460 | err = NULL; |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3461 | if (!strcmp(tmp2, "false\n")) |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3462 | { |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3463 | g_free(tmp2); |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3464 | g_free(cmd); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3465 | start = c + 1; |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3466 | continue; |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3467 | } |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3468 | } |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3469 | g_free(cmd); |
|
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3470 | g_free(tmp2); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3471 | |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3472 | start += sizeof("/desktop/gnome/url-handlers/") - 1; |
|
25009
2a52153c3e86
In the GNOME URL registration, ftp, gopher, http, and https are now
Richard Laager <rlaager@pidgin.im>
parents:
25008
diff
changeset
|
3473 | |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3474 | protocol = g_strdup_printf("%s:", start); |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3475 | registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol); |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3476 | gtk_webview_class_register_protocol(protocol, url_clicked_cb, link_context_menu); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3477 | } |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3478 | start = c + 1; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3479 | } |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3480 | } |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3481 | g_free(tmp); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3482 | |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3483 | return (registered_url_handlers != NULL); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3484 | } |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3485 | |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3486 | #ifdef _WIN32 |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3487 | static void |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3488 | winpidgin_register_win32_url_handlers(void) |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3489 | { |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3490 | int idx = 0; |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3491 | LONG ret = ERROR_SUCCESS; |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3492 | |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3493 | do { |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3494 | DWORD nameSize = 256; |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3495 | wchar_t start[256]; |
|
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3496 | ret = RegEnumKeyExW(HKEY_CLASSES_ROOT, idx++, start, &nameSize, |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3497 | NULL, NULL, NULL, NULL); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3498 | if (ret == ERROR_SUCCESS) { |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3499 | HKEY reg_key = NULL; |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3500 | ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, start, 0, KEY_READ, ®_key); |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3501 | if (ret == ERROR_SUCCESS) { |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3502 | ret = RegQueryValueExW(reg_key, L"URL Protocol", NULL, NULL, NULL, NULL); |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3503 | if (ret == ERROR_SUCCESS) { |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3504 | gchar *utf8 = g_utf16_to_utf8(start, -1, NULL, NULL, NULL); |
|
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3505 | gchar *protocol = g_strdup_printf("%s:", utf8); |
|
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3506 | g_free(utf8); |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3507 | registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol); |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3508 | /* We still pass everything to the "http" "open" handler for security reasons */ |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3509 | gtk_webview_class_register_protocol(protocol, url_clicked_cb, link_context_menu); |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3510 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3511 | RegCloseKey(reg_key); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3512 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3513 | ret = ERROR_SUCCESS; |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3514 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3515 | } while (ret == ERROR_SUCCESS); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3516 | |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3517 | if (ret != ERROR_NO_MORE_ITEMS) |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3518 | purple_debug_error("winpidgin", "Error iterating HKEY_CLASSES_ROOT subkeys: %ld\n", |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3519 | ret); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3520 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3521 | #endif |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3522 | |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3523 | GtkWidget * |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3524 | pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, GtkShadowType shadow_type, int width, int height) |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3525 | { |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3526 | GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3527 | |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3528 | if (G_LIKELY(sw)) { |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3529 | gtk_widget_show(sw); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3530 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), hscrollbar_policy, vscrollbar_policy); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3531 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), shadow_type); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3532 | if (width != -1 || height != -1) |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3533 | gtk_widget_set_size_request(sw, width, height); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3534 | if (child) { |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
3535 | #if GTK_CHECK_VERSION(3,0,0) |
|
32425
24aa67208304
Fix some changes for the scrollable stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32424
diff
changeset
|
3536 | if (GTK_IS_SCROLLABLE(child)) |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
3537 | #else |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3538 | if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal) |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33149
diff
changeset
|
3539 | #endif |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3540 | gtk_container_add(GTK_CONTAINER(sw), child); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3541 | else |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3542 | gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child); |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3543 | } |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3544 | return sw; |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3545 | } |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3546 | |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3547 | return child; |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3548 | } |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
31217
diff
changeset
|
3549 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3550 | void pidgin_utils_init(void) |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3551 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3552 | gtk_webview_class_register_protocol("http://", url_clicked_cb, link_context_menu); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3553 | gtk_webview_class_register_protocol("https://", url_clicked_cb, link_context_menu); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3554 | gtk_webview_class_register_protocol("ftp://", url_clicked_cb, link_context_menu); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3555 | gtk_webview_class_register_protocol("gopher://", url_clicked_cb, link_context_menu); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3556 | gtk_webview_class_register_protocol("mailto:", url_clicked_cb, copy_email_address); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3557 | |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3558 | gtk_webview_class_register_protocol("file://", file_clicked_cb, file_context_menu); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3559 | gtk_webview_class_register_protocol("audio://", audio_clicked_cb, audio_context_menu); |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3560 | |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3561 | /* Example custom URL handler. */ |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3562 | gtk_webview_class_register_protocol("open://", open_dialog, dummy); |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3563 | |
|
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3564 | /* If we're under GNOME, try registering the system URL handlers. */ |
|
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3565 | if (purple_running_gnome()) |
|
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3566 | register_gnome_url_handlers(); |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3567 | |
|
29898
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3568 | /* Used to make small buttons */ |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3569 | gtk_rc_parse_string("style \"pidgin-small-close-button\"\n" |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3570 | "{\n" |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3571 | "GtkWidget::focus-padding = 0\n" |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3572 | "GtkWidget::focus-line-width = 0\n" |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3573 | "xthickness = 0\n" |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3574 | "ythickness = 0\n" |
|
30002
cab5e4b11ed2
Use cute little "×" on the close buttons in conversation tabs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29931
diff
changeset
|
3575 | "GtkContainer::border-width = 0\n" |
|
cab5e4b11ed2
Use cute little "×" on the close buttons in conversation tabs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29931
diff
changeset
|
3576 | "GtkButton::inner-border = {0, 0, 0, 0}\n" |
|
cab5e4b11ed2
Use cute little "×" on the close buttons in conversation tabs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29931
diff
changeset
|
3577 | "GtkButton::default-border = {0, 0, 0, 0}\n" |
|
29898
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3578 | "}\n" |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3579 | "widget \"*.pidgin-small-close-button\" style \"pidgin-small-close-button\""); |
|
c883238ac60f
Use an inline RC style to get rid of some other padding to make the small
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29896
diff
changeset
|
3580 | |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3581 | #ifdef _WIN32 |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3582 | winpidgin_register_win32_url_handlers(); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3583 | #endif |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3584 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3585 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3586 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3587 | void pidgin_utils_uninit(void) |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3588 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3589 | gtk_webview_class_register_protocol("open://", NULL, NULL); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3590 | |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3591 | /* If we have GNOME handlers registered, unregister them. */ |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3592 | if (registered_url_handlers) |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3593 | { |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3594 | GSList *l; |
|
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3595 | for (l = registered_url_handlers; l; l = l->next) |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3596 | { |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3597 | gtk_webview_class_register_protocol((char *)l->data, NULL, NULL); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3598 | g_free(l->data); |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3599 | } |
|
28711
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3600 | g_slist_free(registered_url_handlers); |
|
cd5b5427ae6f
Fix the win32 URIs to only linkify if the protocol is followed by a colon.
Daniel Atallah <datallah@pidgin.im>
parents:
28673
diff
changeset
|
3601 | registered_url_handlers = NULL; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3602 | return; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3603 | } |
|
27695
c56aeb9f715a
Add support in Pidgin for playing back audio:// links. Also include a "Save
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27676
diff
changeset
|
3604 | |
|
33232
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3605 | gtk_webview_class_register_protocol("audio://", NULL, NULL); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3606 | gtk_webview_class_register_protocol("file://", NULL, NULL); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3607 | |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3608 | gtk_webview_class_register_protocol("http://", NULL, NULL); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3609 | gtk_webview_class_register_protocol("https://", NULL, NULL); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3610 | gtk_webview_class_register_protocol("ftp://", NULL, NULL); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3611 | gtk_webview_class_register_protocol("mailto:", NULL, NULL); |
|
a572083f80ef
Register protocols with GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
3612 | gtk_webview_class_register_protocol("gopher://", NULL, NULL); |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3613 | } |