Wed, 04 Jan 2012 23:56:07 +0000
Add a WebView setup function.
|
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 | |
| 4359 | 31 | #ifndef _WIN32 |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
32 | # include <X11/Xlib.h> |
| 4359 | 33 | #else |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
34 | # ifdef small |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
35 | # undef small |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
36 | # endif |
| 4359 | 37 | #endif /*_WIN32*/ |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
38 | |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
39 | #ifdef USE_GTKSPELL |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
40 | # include <gtkspell/gtkspell.h> |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
41 | # ifdef _WIN32 |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
42 | # include "wspell.h" |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
43 | # endif |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
44 | #endif |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
45 | |
| 4359 | 46 | #include <gdk/gdkkeysyms.h> |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
47 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
48 | #include "conversation.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
49 | #include "debug.h" |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
50 | #include "desktopitem.h" |
| 7078 | 51 | #include "imgstore.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
52 | #include "notify.h" |
| 5548 | 53 | #include "prefs.h" |
| 4359 | 54 | #include "prpl.h" |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
55 | #include "request.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
56 | #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
|
57 | #include "sound.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
58 | #include "util.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
59 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
60 | #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
|
61 | #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
|
62 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
63 | #include "gtkconv.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9706
diff
changeset
|
64 | #include "gtkdialogs.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
65 | #include "gtkimhtml.h" |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
66 | #include "gtkimhtmltoolbar.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
|
67 | #include "pidginstock.h" |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
68 | #include "gtkthemes.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
69 | #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
|
70 | #include "gtkwebview.h" |
|
32807
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
71 | #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
|
72 | #include "pidgin/minidialog.h" |
| 4359 | 73 | |
| 17118 | 74 | typedef struct { |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
75 | GtkWidget *menu; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
76 | gint default_item; |
| 17375 | 77 | } AopMenu; |
| 17117 | 78 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10681
diff
changeset
|
79 | 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
|
80 | static GSList *registered_url_handlers = NULL; |
| 7420 | 81 | |
| 8913 | 82 | static gboolean |
| 83 | url_clicked_idle_cb(gpointer data) | |
| 84 | { | |
| 15884 | 85 | purple_notify_uri(NULL, data); |
| 8913 | 86 | g_free(data); |
| 87 | return FALSE; | |
| 88 | } | |
| 89 | ||
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
90 | static gboolean |
|
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
|
91 | url_clicked_cb(GtkIMHtml *unused, GtkIMHtmlLink *link) |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6430
diff
changeset
|
92 | { |
|
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
|
93 | const char *uri = gtk_imhtml_link_get_url(link); |
| 8913 | 94 | 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
|
95 | return TRUE; |
|
6465
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6430
diff
changeset
|
96 | } |
|
bd201d637ff4
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6430
diff
changeset
|
97 | |
|
10871
c0282a4f2250
[gaim-migrate @ 12558]
Mark Doliner <markdoliner@pidgin.im>
parents:
10850
diff
changeset
|
98 | static GtkIMHtmlFuncs gtkimhtml_cbs = { |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16314
diff
changeset
|
99 | (GtkIMHtmlGetImageFunc)purple_imgstore_find_by_id, |
| 15884 | 100 | (GtkIMHtmlGetImageDataFunc)purple_imgstore_get_data, |
| 101 | (GtkIMHtmlGetImageSizeFunc)purple_imgstore_get_size, | |
| 102 | (GtkIMHtmlGetImageFilenameFunc)purple_imgstore_get_filename, | |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16314
diff
changeset
|
103 | purple_imgstore_ref_by_id, |
|
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16314
diff
changeset
|
104 | purple_imgstore_unref_by_id, |
| 8962 | 105 | }; |
| 106 | ||
| 4359 | 107 | void |
| 15568 | 108 | pidgin_setup_imhtml(GtkWidget *imhtml) |
| 4359 | 109 | { |
| 110 | g_return_if_fail(imhtml != NULL); | |
| 111 | g_return_if_fail(GTK_IS_IMHTML(imhtml)); | |
| 112 | ||
|
16263
27e0ef0f38e6
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents:
16254
diff
changeset
|
113 | pidgin_themes_smiley_themeize(imhtml); |
| 8962 | 114 | |
| 115 | gtk_imhtml_set_funcs(GTK_IMHTML(imhtml), >kimhtml_cbs); | |
|
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
|
116 | |
|
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
|
117 | #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
|
118 | if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) { |
|
29361
c73b60e914bb
Make the conversation text preview section dynamically update as the win32-only font override changes. Fixes #11168
Daniel Atallah <datallah@pidgin.im>
parents:
29245
diff
changeset
|
119 | PangoFontDescription *desc; |
|
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
|
120 | const char *font = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"); |
|
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
|
121 | desc = pango_font_description_from_string(font); |
|
29361
c73b60e914bb
Make the conversation text preview section dynamically update as the win32-only font override changes. Fixes #11168
Daniel Atallah <datallah@pidgin.im>
parents:
29245
diff
changeset
|
122 | if (desc) { |
|
c73b60e914bb
Make the conversation text preview section dynamically update as the win32-only font override changes. Fixes #11168
Daniel Atallah <datallah@pidgin.im>
parents:
29245
diff
changeset
|
123 | gtk_widget_modify_font(imhtml, desc); |
|
c73b60e914bb
Make the conversation text preview section dynamically update as the win32-only font override changes. Fixes #11168
Daniel Atallah <datallah@pidgin.im>
parents:
29245
diff
changeset
|
124 | pango_font_description_free(desc); |
|
c73b60e914bb
Make the conversation text preview section dynamically update as the win32-only font override changes. Fixes #11168
Daniel Atallah <datallah@pidgin.im>
parents:
29245
diff
changeset
|
125 | } |
|
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
|
126 | } |
|
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
|
127 | #endif |
| 20895 | 128 | |
| 4359 | 129 | } |
| 130 | ||
|
32809
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
131 | void |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
132 | pidgin_setup_webview(GtkWidget *webview) |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
133 | { |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
134 | g_return_if_fail(webview != NULL); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
135 | 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
|
136 | |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
137 | #if 0 |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
138 | /* TODO: WebKit this stuff... */ |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
139 | pidgin_themes_smiley_themeize(webview); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
140 | #endif |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
141 | |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
142 | #ifdef _WIN32 |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
143 | if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/use_theme_font")) { |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
144 | WebKitWebSettings *settings = webkit_web_settings_new(); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
145 | 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
|
146 | 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
|
147 | NULL); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
148 | 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
|
149 | 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
|
150 | NULL); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
151 | |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
152 | webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), settings); |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
153 | } |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
154 | #endif |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
155 | } |
|
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
156 | |
|
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
|
157 | 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
|
158 | void pidgin_window_init(GtkWindow *wnd, const char *title, guint border_width, const char *role, gboolean resizable) |
| 17213 | 159 | { |
| 160 | if (title) | |
| 161 | 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
|
162 | #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
|
163 | else |
|
995cf072aa9b
Prevent some more window titles from being "pidgin.exe" on Windows. Fixes #1767
Daniel Atallah <datallah@pidgin.im>
parents:
18672
diff
changeset
|
164 | 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
|
165 | #endif |
| 17213 | 166 | gtk_container_set_border_width(GTK_CONTAINER(wnd), border_width); |
| 167 | if (role) | |
| 168 | gtk_window_set_role(wnd, role); | |
| 169 | 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
|
170 | } |
|
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
|
171 | |
|
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
|
172 | 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
|
173 | 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
|
174 | { |
|
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 | 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
|
176 | |
|
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 | 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
|
178 | pidgin_window_init(wnd, title, border_width, role, resizable); |
| 17213 | 179 | |
| 180 | return GTK_WIDGET(wnd); | |
| 181 | } | |
| 182 | ||
| 183 | 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
|
184 | 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
|
185 | { |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
186 | 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
|
187 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
188 | 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
|
189 | 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
|
190 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
191 | /* 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
|
192 | 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
|
193 | |
|
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
|
194 | /* 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
|
195 | 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
|
196 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
197 | 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
|
198 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
199 | 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
|
200 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
201 | 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
|
202 | } |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
203 | |
|
fd9614c33141
Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents:
29744
diff
changeset
|
204 | 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
|
205 | 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
|
206 | { |
|
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
|
207 | 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
|
208 | |
|
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
|
209 | 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
|
210 | pidgin_window_init(wnd, title, border_width, role, 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
|
211 | g_object_set(G_OBJECT(wnd), "has-separator", FALSE, NULL); |
| 17213 | 212 | |
| 213 | return GTK_WIDGET(wnd); | |
| 214 | } | |
| 215 | ||
| 216 | 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
|
217 | 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
|
218 | { |
|
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
|
219 | GtkBox *vbox = GTK_BOX(GTK_DIALOG(dialog)->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
|
220 | 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
|
221 | 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
|
222 | 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
|
223 | } |
|
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
|
224 | |
|
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
|
225 | 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
|
226 | { |
|
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
|
227 | return GTK_DIALOG(dialog)->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
|
228 | } |
|
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
|
229 | |
|
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
|
230 | 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
|
231 | { |
|
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
|
232 | return GTK_DIALOG(dialog)->action_area; |
|
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
|
233 | } |
|
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
|
234 | |
|
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
|
235 | 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
|
236 | 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
|
237 | { |
|
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
|
238 | 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
|
239 | 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
|
240 | 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
|
241 | 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
|
242 | 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
|
243 | 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
|
244 | 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
|
245 | } |
|
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
|
246 | |
|
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
|
247 | GtkWidget * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
248 | pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret) |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
249 | { |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
250 | GtkWidget *frame; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
251 | GtkWidget *imhtml; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
252 | GtkWidget *sep; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
253 | GtkWidget *sw; |
|
10177
9471d38bd527
[gaim-migrate @ 11292]
Christian Hammond <chipx86@chipx86.com>
parents:
10175
diff
changeset
|
254 | GtkWidget *toolbar = NULL; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
255 | GtkWidget *vbox; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
256 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
257 | frame = gtk_frame_new(NULL); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
258 | gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
259 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
260 | vbox = gtk_vbox_new(FALSE, 0); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
261 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
262 | gtk_widget_show(vbox); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
263 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
264 | if (editable) { |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
265 | toolbar = gtk_imhtmltoolbar_new(); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
266 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
267 | gtk_widget_show(toolbar); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
268 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
269 | sep = gtk_hseparator_new(); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
270 | gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); |
| 14607 | 271 | g_signal_connect_swapped(G_OBJECT(toolbar), "show", G_CALLBACK(gtk_widget_show), sep); |
| 272 | 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
|
273 | gtk_widget_show(sep); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
274 | } |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
275 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
276 | imhtml = gtk_imhtml_new(NULL, NULL); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
277 | gtk_imhtml_set_editable(GTK_IMHTML(imhtml), editable); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
278 | gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_IMAGE); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
279 | gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD_CHAR); |
|
12651
be8208c28eaa
[gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents:
12595
diff
changeset
|
280 | #ifdef USE_GTKSPELL |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
281 | if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
282 | pidgin_setup_gtkspell(GTK_TEXT_VIEW(imhtml)); |
|
12651
be8208c28eaa
[gaim-migrate @ 14992]
Mark Doliner <markdoliner@pidgin.im>
parents:
12595
diff
changeset
|
283 | #endif |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
284 | gtk_widget_show(imhtml); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
285 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
286 | if (editable) { |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
287 | gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(toolbar), imhtml); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
288 | gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(toolbar), "default"); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
289 | } |
| 15568 | 290 | pidgin_setup_imhtml(imhtml); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
291 | |
|
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
|
292 | sw = pidgin_make_scrollable(imhtml, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -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
|
293 | 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
|
294 | |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
295 | if (imhtml_ret != NULL) |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
296 | *imhtml_ret = imhtml; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
297 | |
|
10181
2425c3773266
[gaim-migrate @ 11296]
Mark Doliner <markdoliner@pidgin.im>
parents:
10177
diff
changeset
|
298 | if (editable && (toolbar_ret != NULL)) |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
299 | *toolbar_ret = toolbar; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
300 | |
|
13281
3558cb15ebb9
[gaim-migrate @ 15646]
Richard Laager <rlaager@pidgin.im>
parents:
13203
diff
changeset
|
301 | if (sw_ret != NULL) |
|
3558cb15ebb9
[gaim-migrate @ 15646]
Richard Laager <rlaager@pidgin.im>
parents:
13203
diff
changeset
|
302 | *sw_ret = sw; |
|
3558cb15ebb9
[gaim-migrate @ 15646]
Richard Laager <rlaager@pidgin.im>
parents:
13203
diff
changeset
|
303 | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
304 | return frame; |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
305 | } |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
306 | |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
307 | GtkWidget * |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
308 | pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret) |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
309 | { |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
310 | GtkWidget *frame; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
311 | GtkWidget *webview; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
312 | GtkWidget *sep; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
313 | GtkWidget *sw; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
314 | GtkWidget *toolbar = NULL; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
315 | GtkWidget *vbox; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
316 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
317 | frame = gtk_frame_new(NULL); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
318 | gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
319 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
320 | vbox = gtk_vbox_new(FALSE, 0); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
321 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
322 | gtk_widget_show(vbox); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
323 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
324 | if (editable) { |
|
32807
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
325 | toolbar = gtk_webviewtoolbar_new(); |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
326 | gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
327 | gtk_widget_show(toolbar); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
328 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
329 | sep = gtk_hseparator_new(); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
330 | gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
331 | g_signal_connect_swapped(G_OBJECT(toolbar), "show", G_CALLBACK(gtk_widget_show), sep); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
332 | g_signal_connect_swapped(G_OBJECT(toolbar), "hide", G_CALLBACK(gtk_widget_hide), sep); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
333 | gtk_widget_show(sep); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
334 | } |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
335 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
336 | webview = gtk_webview_new(); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
337 | gtk_webview_set_editable(GTK_WEBVIEW(webview), editable); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
338 | #ifdef USE_GTKSPELL |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
339 | if (editable && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck")) |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
340 | pidgin_setup_gtkspell(GTK_TEXT_VIEW(webview)); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
341 | #endif |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
342 | gtk_widget_show(webview); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
343 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
344 | if (editable) { |
|
32807
fd1e8f1449a5
Use a GtkWebViewToolbar when creating an editable GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32749
diff
changeset
|
345 | 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
|
346 | gtk_webviewtoolbar_associate_smileys(GTK_WEBVIEWTOOLBAR(toolbar), "default"); |
|
32518
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
347 | } |
|
32809
5f024465ef89
Add a WebView setup function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32807
diff
changeset
|
348 | 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
|
349 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
350 | sw = pidgin_make_scrollable(webview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
351 | gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
352 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
353 | 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
|
354 | 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
|
355 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
356 | 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
|
357 | *webview_ret = webview; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
358 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
359 | if (editable && (toolbar_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
|
360 | *toolbar_ret = toolbar; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
361 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
362 | if (sw_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
|
363 | *sw_ret = sw; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
364 | |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
365 | return frame; |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
366 | } |
|
f3ed9129c573
Add a pidgin_create_webview utility function, which acts similarly to
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32287
diff
changeset
|
367 | |
| 4359 | 368 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
369 | pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog) |
|
7751
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
370 | { |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
371 | const char *text = gtk_entry_get_text(GTK_ENTRY(entry)); |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
372 | gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK, |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
373 | (*text != '\0')); |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
374 | } |
|
e0dc18b50181
[gaim-migrate @ 8396]
Mark Doliner <markdoliner@pidgin.im>
parents:
7717
diff
changeset
|
375 | |
| 4359 | 376 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
377 | pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle) |
| 4359 | 378 | { |
| 379 | gboolean sensitivity; | |
| 380 | ||
| 381 | if (to_toggle == NULL) | |
| 382 | return; | |
| 383 | ||
| 384 | sensitivity = GTK_WIDGET_IS_SENSITIVE(to_toggle); | |
| 385 | ||
| 386 | gtk_widget_set_sensitive(to_toggle, !sensitivity); | |
| 387 | } | |
| 388 | ||
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
389 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
390 | pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data) |
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
391 | { |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
392 | gboolean sensitivity; |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
393 | gpointer element; |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
394 | int i; |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
395 | |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
396 | for (i=0; i < data->len; i++) { |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
397 | element = g_ptr_array_index(data,i); |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
398 | if (element == NULL) |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
399 | continue; |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
400 | |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
401 | sensitivity = GTK_WIDGET_IS_SENSITIVE(element); |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
402 | |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10061
diff
changeset
|
403 | gtk_widget_set_sensitive(element, !sensitivity); |
|
5314
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
404 | } |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
405 | } |
|
56ef6a09fb99
[gaim-migrate @ 5686]
Christian Hammond <chipx86@chipx86.com>
parents:
5162
diff
changeset
|
406 | |
|
8901
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
407 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
408 | pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle) |
|
8901
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
409 | { |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
410 | if (to_toggle == NULL) |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
411 | return; |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
412 | |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
413 | if (GTK_WIDGET_VISIBLE(to_toggle)) |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
414 | gtk_widget_hide(to_toggle); |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
415 | else |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
416 | gtk_widget_show(to_toggle); |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
417 | } |
|
0a8334a14c2d
[gaim-migrate @ 9670]
Mark Doliner <markdoliner@pidgin.im>
parents:
8881
diff
changeset
|
418 | |
|
17359
6dd3b7730470
Change pidgin_separator to return the separator added to the menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17155
diff
changeset
|
419 | GtkWidget *pidgin_separator(GtkWidget *menu) |
| 4687 | 420 | { |
| 421 | GtkWidget *menuitem; | |
| 422 | ||
| 423 | menuitem = gtk_separator_menu_item_new(); | |
| 424 | gtk_widget_show(menuitem); | |
| 425 | 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
|
426 | return menuitem; |
| 4687 | 427 | } |
|
5160
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
428 | |
| 15568 | 429 | GtkWidget *pidgin_new_item(GtkWidget *menu, const char *str) |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
430 | { |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
431 | GtkWidget *menuitem; |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
432 | GtkWidget *label; |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
433 | |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
434 | menuitem = gtk_menu_item_new(); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
435 | if (menu) |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
436 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
437 | gtk_widget_show(menuitem); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
438 | |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
439 | label = gtk_label_new(str); |
|
6371
e92b66ee5518
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6236
diff
changeset
|
440 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
441 | gtk_label_set_pattern(GTK_LABEL(label), "_"); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
442 | gtk_container_add(GTK_CONTAINER(menuitem), label); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
443 | gtk_widget_show(label); |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
444 | /* FIXME: Go back and fix this |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
445 | gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
446 | GDK_MOD1_MASK, GTK_ACCEL_LOCKED); |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
447 | */ |
| 15568 | 448 | pidgin_set_accessible_label (menuitem, label); |
|
5162
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
449 | return menuitem; |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
450 | } |
|
f8293b913629
[gaim-migrate @ 5526]
Mark Doliner <markdoliner@pidgin.im>
parents:
5160
diff
changeset
|
451 | |
| 15568 | 452 | 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
|
453 | GCallback cb, gpointer data, gboolean checked) |
| 5906 | 454 | { |
| 455 | GtkWidget *menuitem; | |
| 456 | menuitem = gtk_check_menu_item_new_with_mnemonic(str); | |
| 457 | ||
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
458 | if (menu) |
| 5906 | 459 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
| 460 | ||
|
7299
4c804d9a52f1
[gaim-migrate @ 7883]
Christian Hammond <chipx86@chipx86.com>
parents:
7118
diff
changeset
|
461 | 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
|
462 | |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
463 | 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
|
464 | g_signal_connect(G_OBJECT(menuitem), "activate", cb, data); |
| 5906 | 465 | |
| 466 | gtk_widget_show_all(menuitem); | |
| 467 | ||
| 468 | return menuitem; | |
| 469 | } | |
| 470 | ||
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
471 | GtkWidget * |
| 15568 | 472 | pidgin_pixbuf_toolbar_button_from_stock(const char *icon) |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
473 | { |
|
9706
d5b657fe9cff
[gaim-migrate @ 10567]
Mark Doliner <markdoliner@pidgin.im>
parents:
9534
diff
changeset
|
474 | GtkWidget *button, *image, *bbox; |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
475 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
476 | button = gtk_toggle_button_new(); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
477 | gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
478 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
479 | bbox = gtk_vbox_new(FALSE, 0); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
480 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
481 | gtk_container_add (GTK_CONTAINER(button), bbox); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
482 | |
|
15623
bf485c598199
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents:
15578
diff
changeset
|
483 | 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
|
484 | gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
485 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
486 | gtk_widget_show_all(bbox); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
487 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
488 | return button; |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
489 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
490 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
491 | GtkWidget * |
| 15568 | 492 | pidgin_pixbuf_button_from_stock(const char *text, const char *icon, |
| 493 | PidginButtonOrientation style) | |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
494 | { |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
495 | GtkWidget *button, *image, *label, *bbox, *ibox, *lbox = NULL; |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
496 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
497 | button = gtk_button_new(); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
498 | |
| 15568 | 499 | if (style == PIDGIN_BUTTON_HORIZONTAL) { |
|
9750
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
500 | bbox = gtk_hbox_new(FALSE, 0); |
|
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
501 | ibox = gtk_hbox_new(FALSE, 0); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
502 | if (text) |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
503 | lbox = gtk_hbox_new(FALSE, 0); |
|
9750
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
504 | } else { |
|
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
505 | bbox = gtk_vbox_new(FALSE, 0); |
|
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
506 | ibox = gtk_vbox_new(FALSE, 0); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
507 | if (text) |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10483
diff
changeset
|
508 | lbox = gtk_vbox_new(FALSE, 0); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
509 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
510 | |
|
9750
dfb5cf70295f
[gaim-migrate @ 10617]
Mark Doliner <markdoliner@pidgin.im>
parents:
9749
diff
changeset
|
511 | gtk_container_add(GTK_CONTAINER(button), bbox); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
512 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
513 | if (icon) { |
|
29744
c1ae9f0f57ee
*** Plucked rev df5196ac4c45dfff9cad5768c27d4e1d46fbb2ab (qulogic@pidgin.im):
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29701
diff
changeset
|
514 | 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
|
515 | 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
|
516 | 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
|
517 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
518 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
519 | if (text) { |
|
29744
c1ae9f0f57ee
*** Plucked rev df5196ac4c45dfff9cad5768c27d4e1d46fbb2ab (qulogic@pidgin.im):
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29701
diff
changeset
|
520 | 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
|
521 | label = gtk_label_new(NULL); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
522 | gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
523 | gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); |
|
9767
c68cfe03deec
[gaim-migrate @ 10635]
Mark Doliner <markdoliner@pidgin.im>
parents:
9750
diff
changeset
|
524 | gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, TRUE, 0); |
| 15568 | 525 | pidgin_set_accessible_label (button, label); |
|
6372
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
526 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
527 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
528 | gtk_widget_show_all(bbox); |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
529 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
530 | return button; |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
531 | } |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
532 | |
|
27c3152351ce
[gaim-migrate @ 6877]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
533 | |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
534 | 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
|
535 | { |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
536 | GtkWidget *menuitem; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
537 | /* |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
538 | GtkWidget *hbox; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
539 | GtkWidget *label; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
540 | */ |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
541 | GtkWidget *image; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
542 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
543 | if (icon == NULL) |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
544 | menuitem = gtk_menu_item_new_with_mnemonic(str); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
545 | else |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
546 | menuitem = gtk_image_menu_item_new_with_mnemonic(str); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
547 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
548 | if (menu) |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
549 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
550 | |
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
551 | 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
|
552 | g_signal_connect(G_OBJECT(menuitem), "activate", cb, data); |
|
5160
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
553 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
554 | if (icon != NULL) { |
|
15623
bf485c598199
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents:
15578
diff
changeset
|
555 | 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
|
556 | 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
|
557 | } |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
558 | /* FIXME: this isn't right |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
559 | if (mod) { |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
560 | label = gtk_label_new(mod); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
561 | gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
562 | gtk_widget_show(label); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
563 | } |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
564 | */ |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
565 | /* |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
566 | if (accel_key) { |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
567 | gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key, |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
568 | accel_mods, GTK_ACCEL_LOCKED); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
569 | } |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
570 | */ |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
571 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
572 | gtk_widget_show_all(menuitem); |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
573 | |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
574 | return menuitem; |
|
bcc3e2b2ed56
[gaim-migrate @ 5524]
Mark Doliner <markdoliner@pidgin.im>
parents:
4859
diff
changeset
|
575 | } |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
576 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
577 | GtkWidget * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
578 | pidgin_make_frame(GtkWidget *parent, const char *title) |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
579 | { |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
580 | GtkWidget *vbox, *label, *hbox; |
|
13100
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
581 | char *labeltitle; |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
582 | |
| 15882 | 583 | vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
584 | 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
|
585 | gtk_widget_show(vbox); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
586 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
587 | label = gtk_label_new(NULL); |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
588 | |
|
13100
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
589 | labeltitle = g_strdup_printf("<span weight=\"bold\">%s</span>", title); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
590 | gtk_label_set_markup(GTK_LABEL(label), labeltitle); |
|
13100
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
591 | g_free(labeltitle); |
|
56bf8002ddc6
[gaim-migrate @ 15461]
Richard Laager <rlaager@pidgin.im>
parents:
13092
diff
changeset
|
592 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
593 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
594 | 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
|
595 | gtk_widget_show(label); |
| 15568 | 596 | pidgin_set_accessible_label (vbox, label); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
597 | |
| 15882 | 598 | hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
599 | 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
|
600 | gtk_widget_show(hbox); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
601 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
602 | label = gtk_label_new(" "); |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
603 | 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
|
604 | gtk_widget_show(label); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
605 | |
| 15882 | 606 | vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
607 | gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); |
|
5641
a9d1f7917dd4
[gaim-migrate @ 6054]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
608 | gtk_widget_show(vbox); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
609 | |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
610 | return vbox; |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
611 | } |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
612 | |
| 17117 | 613 | static gpointer |
| 17118 | 614 | aop_option_menu_get_selected(GtkWidget *optmenu, GtkWidget **p_item) |
| 17117 | 615 | { |
| 616 | GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)); | |
| 617 | GtkWidget *item = gtk_menu_get_active(GTK_MENU(menu)); | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
618 | if (p_item) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
619 | (*p_item) = item; |
|
27216
b131337574d5
Avoid an assertion when nothing in dropdown is selected.
Paul Aurich <darkrain42@pidgin.im>
parents:
26894
diff
changeset
|
620 | return item ? g_object_get_data(G_OBJECT(item), "aop_per_item_data") : NULL; |
| 17117 | 621 | } |
| 622 | ||
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
623 | static void |
| 17117 | 624 | aop_menu_cb(GtkWidget *optmenu, GCallback cb) |
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
625 | { |
|
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
626 | GtkWidget *item; |
| 17117 | 627 | gpointer per_item_data; |
| 628 | ||
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
629 | per_item_data = aop_option_menu_get_selected(optmenu, &item); |
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
630 | |
| 17375 | 631 | if (cb != NULL) { |
| 632 | ((void (*)(GtkWidget *, gpointer, gpointer))cb)(item, per_item_data, 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
|
633 | } |
| 17117 | 634 | } |
| 635 | ||
| 636 | static GtkWidget * | |
|
17851
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
637 | aop_menu_item_new(GtkSizeGroup *sg, GdkPixbuf *pixbuf, const char *lbl, gpointer per_item_data, const char *data) |
| 17117 | 638 | { |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
639 | GtkWidget *item; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
640 | GtkWidget *hbox; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
641 | GtkWidget *image; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
642 | GtkWidget *label; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
643 | |
| 17375 | 644 | item = gtk_menu_item_new(); |
| 645 | gtk_widget_show(item); | |
| 646 | ||
| 647 | hbox = gtk_hbox_new(FALSE, 4); | |
| 648 | gtk_widget_show(hbox); | |
| 17117 | 649 | |
| 650 | /* Create the image */ | |
|
17238
22c1b67b96d4
Fix a logic mistake I introduced during a cleanup.
Richard Laager <rlaager@pidgin.im>
parents:
17237
diff
changeset
|
651 | if (pixbuf == NULL) |
| 17375 | 652 | image = gtk_image_new(); |
| 17117 | 653 | else |
| 17375 | 654 | image = gtk_image_new_from_pixbuf(pixbuf); |
| 655 | gtk_widget_show(image); | |
| 17117 | 656 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
657 | if (sg) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
658 | gtk_size_group_add_widget(sg, image); |
| 17117 | 659 | |
| 660 | /* Create the label */ | |
| 17375 | 661 | label = gtk_label_new (lbl); |
|
17377
136e8a8b76da
Forgot an instance of g_object_new and some other changes are necessary, too.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17375
diff
changeset
|
662 | gtk_widget_show (label); |
| 17375 | 663 | gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
|
17377
136e8a8b76da
Forgot an instance of g_object_new and some other changes are necessary, too.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17375
diff
changeset
|
664 | gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25173
diff
changeset
|
665 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
666 | gtk_container_add(GTK_CONTAINER(item), hbox); |
| 17375 | 667 | gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); |
| 668 | gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
669 | |
|
17851
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
670 | g_object_set_data(G_OBJECT (item), data, per_item_data); |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
671 | g_object_set_data(G_OBJECT (item), "aop_per_item_data", per_item_data); |
| 17118 | 672 | |
| 673 | pidgin_set_accessible_label(item, label); | |
| 17117 | 674 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
675 | return item; |
|
5647
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
676 | } |
|
7ffa3264c9be
[gaim-migrate @ 6061]
Christian Hammond <chipx86@chipx86.com>
parents:
5646
diff
changeset
|
677 | |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
678 | static GdkPixbuf * |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
679 | pidgin_create_prpl_icon_from_prpl(PurplePlugin *prpl, PidginPrplIconSize size, PurpleAccount *account) |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
680 | { |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
681 | PurplePluginProtocolInfo *prpl_info; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
682 | 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
|
683 | char *tmp; |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
684 | char *filename = NULL; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
685 | GdkPixbuf *pixbuf; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
686 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
687 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
688 | if (prpl_info->list_icon == NULL) |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
689 | return NULL; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
690 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
691 | protoname = prpl_info->list_icon(account, NULL); |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
692 | if (protoname == NULL) |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
693 | return NULL; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
694 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
695 | /* |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
696 | * 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
|
697 | * protoname from the theme |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
698 | */ |
|
18216
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
699 | 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
|
700 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
701 | filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
702 | size == PIDGIN_PRPL_ICON_SMALL ? "16" : |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
703 | size == PIDGIN_PRPL_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
|
704 | tmp, NULL); |
|
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
705 | g_free(tmp); |
|
f34603f4631e
Use dynamic string manipulation to get rid of a MAXPATHLEN.
Richard Laager <rlaager@pidgin.im>
parents:
18193
diff
changeset
|
706 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
707 | 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
|
708 | g_free(filename); |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
709 | |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
710 | return pixbuf; |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
711 | } |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
712 | |
|
17014
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
713 | static GtkWidget * |
| 17375 | 714 | aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data) |
| 17117 | 715 | { |
| 716 | GtkWidget *optmenu; | |
| 717 | ||
| 17375 | 718 | optmenu = gtk_option_menu_new(); |
| 719 | gtk_widget_show(optmenu); | |
| 720 | gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), aop_menu->menu); | |
| 721 | ||
| 17117 | 722 | if (aop_menu->default_item != -1) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
723 | gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), aop_menu->default_item); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
724 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
725 | g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", aop_menu, (GDestroyNotify)g_free); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
726 | 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
|
727 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
728 | 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
|
729 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
730 | return optmenu; |
| 17117 | 731 | } |
| 732 | ||
| 733 | static void | |
| 17375 | 734 | aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu) |
| 17117 | 735 | { |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
736 | if (gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu))) |
| 17117 | 737 | gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); |
| 17375 | 738 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
739 | gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), new_aop_menu->menu); |
| 17375 | 740 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
741 | if (new_aop_menu->default_item != -1) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
742 | gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), new_aop_menu->default_item); |
| 17375 | 743 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
744 | g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", new_aop_menu, (GDestroyNotify)g_free); |
| 17117 | 745 | } |
| 746 | ||
| 747 | static void | |
| 17118 | 748 | 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
|
749 | { |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
750 | guint idx; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
751 | GList *llItr = NULL; |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
752 | |
| 17375 | 753 | for (idx = 0, llItr = GTK_MENU_SHELL(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)))->children; |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
754 | llItr != NULL; |
| 17375 | 755 | llItr = llItr->next, idx++) { |
| 756 | if (data == g_object_get_data(G_OBJECT(llItr->data), "aop_per_item_data")) { | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
757 | gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), idx); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
758 | break; |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
759 | } |
|
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
760 | } |
|
17014
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
761 | } |
|
1e90cfae53dd
disapproval of revision '41be962a27d1633445fef2055c4a0db183f104dc'
Richard Laager <rlaager@pidgin.im>
parents:
17013
diff
changeset
|
762 | |
| 17375 | 763 | static AopMenu * |
| 764 | create_protocols_menu(const char *default_proto_id) | |
| 17117 | 765 | { |
| 17375 | 766 | AopMenu *aop_menu = NULL; |
| 15884 | 767 | PurplePlugin *plugin; |
| 17117 | 768 | GdkPixbuf *pixbuf = NULL; |
|
5649
e31ce53da5a0
[gaim-migrate @ 6063]
Christian Hammond <chipx86@chipx86.com>
parents:
5647
diff
changeset
|
769 | GtkSizeGroup *sg; |
| 17117 | 770 | GList *p; |
|
31217
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
771 | const char *gtalk_name = NULL, *facebook_name = NULL; |
| 17117 | 772 | int i; |
| 773 | ||
| 17375 | 774 | aop_menu = g_malloc0(sizeof(AopMenu)); |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
775 | aop_menu->default_item = -1; |
| 17375 | 776 | aop_menu->menu = gtk_menu_new(); |
| 777 | gtk_widget_show(aop_menu->menu); | |
| 778 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
|
17098
3e4159d270d3
Only include Google Talk if we have XMPP.
Richard Laager <rlaager@pidgin.im>
parents:
17092
diff
changeset
|
779 | |
|
31217
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
780 | if (purple_find_prpl("prpl-jabber")) { |
|
17116
122d4dcce40e
Patch from Gabriel Schulhof to fix the Google-Talk selection.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17098
diff
changeset
|
781 | gtalk_name = _("Google Talk"); |
|
31217
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
782 | facebook_name = _("Facebook (XMPP)"); |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
783 | } |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
784 | |
| 15884 | 785 | for (p = purple_plugins_get_protocols(), i = 0; |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
786 | p != NULL; |
| 17375 | 787 | p = p->next, i++) { |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
788 | |
| 15884 | 789 | plugin = (PurplePlugin *)p->data; |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
790 | |
| 17375 | 791 | if (gtalk_name && strcmp(gtalk_name, plugin->info->name) < 0) { |
| 17117 | 792 | char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
793 | "16", "google-talk.png", NULL); |
|
17851
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
794 | GtkWidget *item; |
|
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
795 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
796 | pixbuf = pidgin_pixbuf_new_from_file(filename); |
|
17092
11d23a81eabd
Sort Google Talk appropriately.
Richard Laager <rlaager@pidgin.im>
parents:
17046
diff
changeset
|
797 | g_free(filename); |
|
11d23a81eabd
Sort Google Talk appropriately.
Richard Laager <rlaager@pidgin.im>
parents:
17046
diff
changeset
|
798 | |
| 17117 | 799 | gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), |
|
17851
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
800 | item = aop_menu_item_new(sg, pixbuf, gtalk_name, "prpl-jabber", "protocol")); |
|
31217
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
801 | g_object_set_data(G_OBJECT(item), "fakegoogle", GINT_TO_POINTER(1)); |
| 17117 | 802 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
803 | if (pixbuf) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
804 | g_object_unref(pixbuf); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
805 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
806 | gtalk_name = NULL; |
|
17527
52201c2338cf
Fix for the protocol type being off by one in modify account dialog
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17497
diff
changeset
|
807 | i++; |
|
17092
11d23a81eabd
Sort Google Talk appropriately.
Richard Laager <rlaager@pidgin.im>
parents:
17046
diff
changeset
|
808 | } |
|
11d23a81eabd
Sort Google Talk appropriately.
Richard Laager <rlaager@pidgin.im>
parents:
17046
diff
changeset
|
809 | |
|
31217
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
810 | if (facebook_name && strcmp(facebook_name, plugin->info->name) < 0) { |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
811 | char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
812 | "16", "facebook.png", NULL); |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
813 | GtkWidget *item; |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
814 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
815 | pixbuf = pidgin_pixbuf_new_from_file(filename); |
|
31217
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
816 | g_free(filename); |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
817 | |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
818 | gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
819 | item = aop_menu_item_new(sg, pixbuf, facebook_name, "prpl-jabber", "protocol")); |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
820 | g_object_set_data(G_OBJECT(item), "fakefacebook", GINT_TO_POINTER(1)); |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
821 | |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
822 | if (pixbuf) |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
823 | g_object_unref(pixbuf); |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
824 | |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
825 | facebook_name = NULL; |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
826 | i++; |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
827 | } |
|
d9b13102a21c
UI hack ala Google Talk for Facebook.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
30706
diff
changeset
|
828 | |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
829 | pixbuf = pidgin_create_prpl_icon_from_prpl(plugin, PIDGIN_PRPL_ICON_SMALL, NULL); |
| 17117 | 830 | |
| 831 | gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), | |
|
17851
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
832 | aop_menu_item_new(sg, pixbuf, plugin->info->name, plugin->info->id, "protocol")); |
| 17375 | 833 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
834 | if (pixbuf) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
835 | g_object_unref(pixbuf); |
| 17117 | 836 | |
| 837 | if (default_proto_id != NULL && !strcmp(plugin->info->id, default_proto_id)) | |
| 838 | aop_menu->default_item = i; | |
|
5644
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
839 | } |
|
bc4c2f9f2bf8
[gaim-migrate @ 6058]
Christian Hammond <chipx86@chipx86.com>
parents:
5641
diff
changeset
|
840 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
841 | g_object_unref(sg); |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
842 | |
|
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
843 | return aop_menu; |
| 17117 | 844 | } |
| 845 | ||
| 846 | GtkWidget * | |
| 847 | pidgin_protocol_option_menu_new(const char *id, GCallback cb, | |
| 848 | gpointer user_data) | |
| 849 | { | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
850 | 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
|
851 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
852 | |
|
18672
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
853 | const char * |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
854 | 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
|
855 | { |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
856 | return (const char *)aop_option_menu_get_selected(optmenu, NULL); |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
857 | } |
|
da4db1be5d98
Patch from nix_nix, adds 'get prpl name from account menu' API
Sean Egan <seanegan@pidgin.im>
parents:
18417
diff
changeset
|
858 | |
| 15884 | 859 | PurpleAccount * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
860 | pidgin_account_option_menu_get_selected(GtkWidget *optmenu) |
|
8940
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8913
diff
changeset
|
861 | { |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
862 | return (PurpleAccount *)aop_option_menu_get_selected(optmenu, NULL); |
|
8940
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8913
diff
changeset
|
863 | } |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8913
diff
changeset
|
864 | |
| 17375 | 865 | static AopMenu * |
| 17117 | 866 | create_account_menu(PurpleAccount *default_account, |
| 15884 | 867 | PurpleFilterAccountFunc filter_func, gboolean show_all) |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
868 | { |
| 17375 | 869 | AopMenu *aop_menu = NULL; |
| 15884 | 870 | PurpleAccount *account; |
| 17117 | 871 | GdkPixbuf *pixbuf = NULL; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
872 | GList *list; |
|
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
873 | GList *p; |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
874 | GtkSizeGroup *sg; |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
875 | int i; |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
876 | char buf[256]; |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
877 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
878 | if (show_all) |
| 15884 | 879 | list = purple_accounts_get_all(); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
880 | else |
| 15884 | 881 | list = purple_connections_get_all(); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
882 | |
| 17375 | 883 | aop_menu = g_malloc0(sizeof(AopMenu)); |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
884 | aop_menu->default_item = -1; |
|
17377
136e8a8b76da
Forgot an instance of g_object_new and some other changes are necessary, too.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17375
diff
changeset
|
885 | aop_menu->menu = gtk_menu_new(); |
|
136e8a8b76da
Forgot an instance of g_object_new and some other changes are necessary, too.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17375
diff
changeset
|
886 | gtk_widget_show(aop_menu->menu); |
|
5880
f5335e81bb6c
[gaim-migrate @ 6312]
Christian Hammond <chipx86@chipx86.com>
parents:
5879
diff
changeset
|
887 | sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
888 | |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
889 | 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
|
890 | if (show_all) |
| 15884 | 891 | account = (PurpleAccount *)p->data; |
|
5879
a2757f3f2dda
[gaim-migrate @ 6311]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
892 | else { |
| 15884 | 893 | PurpleConnection *gc = (PurpleConnection *)p->data; |
| 894 | ||
| 895 | account = purple_connection_get_account(gc); | |
|
5879
a2757f3f2dda
[gaim-migrate @ 6311]
Christian Hammond <chipx86@chipx86.com>
parents:
5877
diff
changeset
|
896 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
897 | |
|
8289
234429bac6b5
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8247
diff
changeset
|
898 | if (filter_func && !filter_func(account)) { |
| 8215 | 899 | i--; |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
900 | continue; |
| 8215 | 901 | } |
|
6646
b9a0b5eb74e6
[gaim-migrate @ 7171]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
902 | |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
903 | pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
904 | |
|
17386
f68ba6199d79
merge of 'de0c8e6287f1090343edb9c43e0d8d681e58df07'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
905 | if (pixbuf) { |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
906 | 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
|
907 | purple_connections_get_all()) |
|
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
908 | gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
909 | } |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
910 | |
| 15884 | 911 | if (purple_account_get_alias(account)) { |
| 11017 | 912 | g_snprintf(buf, sizeof(buf), "%s (%s) (%s)", |
| 15884 | 913 | purple_account_get_username(account), |
| 914 | purple_account_get_alias(account), | |
| 915 | purple_account_get_protocol_name(account)); | |
| 11017 | 916 | } else { |
| 917 | g_snprintf(buf, sizeof(buf), "%s (%s)", | |
| 15884 | 918 | purple_account_get_username(account), |
| 919 | purple_account_get_protocol_name(account)); | |
| 11017 | 920 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
921 | |
| 17117 | 922 | gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu), |
|
17851
02fbbecd95f5
Make sure if some plugin used pidgin_protocol_option_menu_new, they continue
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17387
diff
changeset
|
923 | aop_menu_item_new(sg, pixbuf, buf, account, "account")); |
| 17117 | 924 | |
|
17235
f04fc9bbb90b
Style changes in if statements.
Richard Laager <rlaager@pidgin.im>
parents:
17234
diff
changeset
|
925 | if (pixbuf) |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
926 | g_object_unref(pixbuf); |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
927 | |
| 17375 | 928 | if (default_account && account == default_account) |
| 17117 | 929 | aop_menu->default_item = i; |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
930 | } |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
931 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
932 | g_object_unref(sg); |
|
5880
f5335e81bb6c
[gaim-migrate @ 6312]
Christian Hammond <chipx86@chipx86.com>
parents:
5879
diff
changeset
|
933 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
934 | return aop_menu; |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
935 | } |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
936 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
937 | static void |
| 8134 | 938 | regenerate_account_menu(GtkWidget *optmenu) |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
939 | { |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
940 | gboolean show_all; |
| 15884 | 941 | PurpleAccount *account; |
| 942 | PurpleFilterAccountFunc filter_func; | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
943 | |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
944 | account = (PurpleAccount *)aop_option_menu_get_selected(optmenu, NULL); |
| 17117 | 945 | show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), "show_all")); |
| 946 | filter_func = g_object_get_data(G_OBJECT(optmenu), "filter_func"); | |
| 947 | ||
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
948 | 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
|
949 | } |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
950 | |
| 8134 | 951 | static void |
| 15884 | 952 | account_menu_sign_on_off_cb(PurpleConnection *gc, GtkWidget *optmenu) |
| 8134 | 953 | { |
| 954 | regenerate_account_menu(optmenu); | |
| 955 | } | |
| 956 | ||
| 957 | static void | |
| 15884 | 958 | account_menu_added_removed_cb(PurpleAccount *account, GtkWidget *optmenu) |
| 8134 | 959 | { |
| 960 | regenerate_account_menu(optmenu); | |
| 961 | } | |
| 962 | ||
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
963 | static gboolean |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
964 | account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event, |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
965 | void *user_data) |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
966 | { |
| 15884 | 967 | purple_signals_disconnect_by_handle(optmenu); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
968 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
969 | return FALSE; |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
970 | } |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
971 | |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
972 | void |
| 15884 | 973 | pidgin_account_option_menu_set_selected(GtkWidget *optmenu, PurpleAccount *account) |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
974 | { |
|
17385
bf46968ab031
Casting things to gpointer isn't useful, unless they were previously const.
Richard Laager <rlaager@pidgin.im>
parents:
17377
diff
changeset
|
975 | aop_option_menu_select_by_data(optmenu, account); |
|
9910
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
976 | } |
|
7b4465b92411
[gaim-migrate @ 10802]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9899
diff
changeset
|
977 | |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
978 | GtkWidget * |
| 15884 | 979 | pidgin_account_option_menu_new(PurpleAccount *default_account, |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
980 | gboolean show_all, GCallback cb, |
| 15884 | 981 | PurpleFilterAccountFunc filter_func, |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
982 | gpointer user_data) |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
983 | { |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
984 | GtkWidget *optmenu; |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
985 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
986 | /* Create the option menu */ |
|
17234
6e430db9b926
Style change: death to spaces before semi-colons.
Richard Laager <rlaager@pidgin.im>
parents:
17233
diff
changeset
|
987 | 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
|
988 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
989 | g_signal_connect(G_OBJECT(optmenu), "destroy", |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
990 | G_CALLBACK(account_menu_destroyed_cb), NULL); |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
991 | |
| 15884 | 992 | /* Register the purple sign on/off event callbacks. */ |
| 993 | purple_signal_connect(purple_connections_get_handle(), "signed-on", | |
| 994 | optmenu, PURPLE_CALLBACK(account_menu_sign_on_off_cb), | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
995 | optmenu); |
| 15884 | 996 | purple_signal_connect(purple_connections_get_handle(), "signed-off", |
| 997 | optmenu, PURPLE_CALLBACK(account_menu_sign_on_off_cb), | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
998 | optmenu); |
| 15884 | 999 | purple_signal_connect(purple_accounts_get_handle(), "account-added", |
| 1000 | optmenu, PURPLE_CALLBACK(account_menu_added_removed_cb), | |
| 8134 | 1001 | optmenu); |
| 15884 | 1002 | purple_signal_connect(purple_accounts_get_handle(), "account-removed", |
| 1003 | optmenu, PURPLE_CALLBACK(account_menu_added_removed_cb), | |
| 8134 | 1004 | optmenu); |
|
6391
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
1005 | |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
1006 | /* Set some data. */ |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
1007 | g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
|
bd5914d9837c
[gaim-migrate @ 6896]
Christian Hammond <chipx86@chipx86.com>
parents:
6372
diff
changeset
|
1008 | g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); |
| 17375 | 1009 | 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
|
1010 | |
|
5877
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1011 | return optmenu; |
|
37695b88b248
[gaim-migrate @ 6309]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1012 | } |
|
5943
8a052155157a
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
1013 | |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
1014 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1015 | pidgin_setup_gtkspell(GtkTextView *textview) |
| 12061 | 1016 | { |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
1017 | #ifdef USE_GTKSPELL |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1018 | GError *error = NULL; |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1019 | char *locale = NULL; |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1020 | |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1021 | g_return_if_fail(textview != NULL); |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1022 | g_return_if_fail(GTK_IS_TEXT_VIEW(textview)); |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1023 | |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
1024 | if (gtkspell_new_attach(textview, locale, &error) == NULL && error) |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1025 | { |
| 15884 | 1026 | purple_debug_warning("gtkspell", "Failed to setup GtkSpell: %s\n", |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
1027 | error->message); |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1028 | g_error_free(error); |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1029 | } |
|
12067
11fb53722956
[gaim-migrate @ 14362]
Richard Laager <rlaager@pidgin.im>
parents:
12063
diff
changeset
|
1030 | #endif /* USE_GTKSPELL */ |
|
7538
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1031 | } |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1032 | |
|
b20dbe9222e2
[gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents:
7420
diff
changeset
|
1033 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1034 | pidgin_save_accels_cb(GtkAccelGroup *accel_group, guint arg1, |
| 14781 | 1035 | GdkModifierType arg2, GClosure *arg3, |
| 1036 | gpointer data) | |
| 7420 | 1037 | { |
| 15884 | 1038 | purple_debug(PURPLE_DEBUG_MISC, "accels", |
| 14781 | 1039 | "accel changed, scheduling save.\n"); |
| 7420 | 1040 | |
| 1041 | 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
|
1042 | accels_save_timer = purple_timeout_add_seconds(5, pidgin_save_accels, |
| 14781 | 1043 | NULL); |
| 7420 | 1044 | } |
| 1045 | ||
| 1046 | gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1047 | pidgin_save_accels(gpointer data) |
| 7420 | 1048 | { |
| 1049 | char *filename = NULL; | |
| 1050 | ||
| 15884 | 1051 | filename = g_build_filename(purple_user_dir(), G_DIR_SEPARATOR_S, |
| 14781 | 1052 | "accels", NULL); |
| 15884 | 1053 | purple_debug(PURPLE_DEBUG_MISC, "accels", "saving accels to %s\n", filename); |
| 7420 | 1054 | gtk_accel_map_save(filename); |
| 1055 | g_free(filename); | |
| 1056 | ||
| 1057 | accels_save_timer = 0; | |
| 1058 | return FALSE; | |
| 1059 | } | |
| 1060 | ||
| 1061 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1062 | pidgin_load_accels() |
| 7420 | 1063 | { |
| 1064 | char *filename = NULL; | |
| 1065 | ||
| 15884 | 1066 | filename = g_build_filename(purple_user_dir(), G_DIR_SEPARATOR_S, |
| 14781 | 1067 | "accels", NULL); |
| 7420 | 1068 | gtk_accel_map_load(filename); |
| 1069 | g_free(filename); | |
| 1070 | } | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1071 | |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1072 | static void |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1073 | show_retrieveing_info(PurpleConnection *conn, const char *name) |
|
17387
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
1074 | { |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
1075 | 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
|
1076 | 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
|
1077 | purple_notify_userinfo(conn, name, info, NULL, NULL); |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
1078 | 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
|
1079 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1080 | |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1081 | 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
|
1082 | { |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1083 | show_retrieveing_info(conn, name); |
|
17387
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
1084 | serv_get_info(conn, name); |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
1085 | } |
|
db83104d06f2
Fix the last merge.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17386
diff
changeset
|
1086 | |
|
18281
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1087 | 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
|
1088 | { |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1089 | char *who = NULL; |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1090 | PurplePluginProtocolInfo *prpl_info = NULL; |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1091 | |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1092 | 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
|
1093 | 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
|
1094 | return; |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1095 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1096 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32620
diff
changeset
|
1097 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(conn)); |
|
23501
55185be28a1b
Pass the "real" chat username to the pidgin_retrieve_user_info function.
Daniel Atallah <datallah@pidgin.im>
parents:
23333
diff
changeset
|
1098 | if (prpl_info != NULL && prpl_info->get_cb_real_name) |
|
55185be28a1b
Pass the "real" chat username to the pidgin_retrieve_user_info function.
Daniel Atallah <datallah@pidgin.im>
parents:
23333
diff
changeset
|
1099 | who = prpl_info->get_cb_real_name(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
|
1100 | if (prpl_info == NULL || prpl_info->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
|
1101 | 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
|
1102 | 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
|
1103 | return; |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1104 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1105 | |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1106 | show_retrieveing_info(conn, who ? who : name); |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1107 | prpl_info->get_cb_info(conn, chat, name); |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1108 | 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
|
1109 | } |
|
f7dd07e1e434
Show immediate feedback when getting information about someone in a chat.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18278
diff
changeset
|
1110 | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1111 | gboolean |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1112 | pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts, |
| 15884 | 1113 | PurpleAccount **ret_account, char **ret_protocol, |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1114 | char **ret_username, char **ret_alias) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1115 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1116 | char *protocol = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1117 | char *username = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1118 | char *alias = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1119 | 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
|
1120 | char *s; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1121 | gboolean valid; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1122 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1123 | g_return_val_if_fail(msg != NULL, FALSE); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1124 | g_return_val_if_fail(ret_protocol != NULL, FALSE); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1125 | g_return_val_if_fail(ret_username != NULL, FALSE); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1126 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1127 | s = str = g_strdup(msg); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1128 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1129 | while (*s != '\r' && *s != '\n' && *s != '\0') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1130 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1131 | char *key, *value; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1132 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1133 | key = s; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1134 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1135 | /* Grab the key */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1136 | while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ' ') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1137 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1138 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1139 | if (*s == '\r') s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1140 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1141 | if (*s == '\n') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1142 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1143 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1144 | continue; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1145 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1146 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1147 | if (*s != '\0') *s++ = '\0'; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1148 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1149 | /* Clear past any whitespace */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1150 | while (*s != '\0' && *s == ' ') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1151 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1152 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1153 | /* Now let's grab until the end of the line. */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1154 | value = s; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1155 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1156 | while (*s != '\r' && *s != '\n' && *s != '\0') |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1157 | s++; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1158 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1159 | if (*s == '\r') *s++ = '\0'; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1160 | if (*s == '\n') *s++ = '\0'; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1161 | |
|
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
|
1162 | if (strchr(key, ':') != NULL) |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1163 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1164 | if (!g_ascii_strcasecmp(key, "X-IM-Username:")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1165 | username = g_strdup(value); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1166 | else if (!g_ascii_strcasecmp(key, "X-IM-Protocol:")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1167 | protocol = g_strdup(value); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1168 | else if (!g_ascii_strcasecmp(key, "X-IM-Alias:")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1169 | alias = g_strdup(value); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1170 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1171 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1172 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1173 | if (username != NULL && protocol != NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1174 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1175 | valid = TRUE; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1176 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1177 | *ret_username = username; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1178 | *ret_protocol = protocol; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1179 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1180 | if (ret_alias != NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1181 | *ret_alias = alias; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1182 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1183 | /* Check for a compatible account. */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1184 | if (ret_account != NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1185 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1186 | GList *list; |
| 15884 | 1187 | PurpleAccount *account = NULL; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
1188 | GList *l; |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1189 | const char *protoname; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1190 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1191 | if (all_accounts) |
| 15884 | 1192 | list = purple_accounts_get_all(); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1193 | else |
| 15884 | 1194 | list = purple_connections_get_all(); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1195 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1196 | for (l = list; l != NULL; l = l->next) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1197 | { |
| 15884 | 1198 | PurpleConnection *gc; |
| 1199 | PurplePluginProtocolInfo *prpl_info = NULL; | |
| 1200 | PurplePlugin *plugin; | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1201 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1202 | if (all_accounts) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1203 | { |
| 15884 | 1204 | account = (PurpleAccount *)l->data; |
| 1205 | ||
| 1206 | plugin = purple_plugins_find_with_id( | |
| 1207 | purple_account_get_protocol_id(account)); | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1208 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1209 | if (plugin == NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1210 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1211 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1212 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1213 | continue; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1214 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1215 | |
| 15884 | 1216 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1217 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1218 | else |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1219 | { |
| 15884 | 1220 | gc = (PurpleConnection *)l->data; |
| 1221 | account = purple_connection_get_account(gc); | |
| 1222 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32620
diff
changeset
|
1223 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1224 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1225 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1226 | protoname = prpl_info->list_icon(account, NULL); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1227 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1228 | if (!strcmp(protoname, protocol)) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1229 | break; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1230 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1231 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1232 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1233 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1234 | /* Special case for AIM and ICQ */ |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1235 | if (account == NULL && (!strcmp(protocol, "aim") || |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1236 | !strcmp(protocol, "icq"))) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1237 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1238 | for (l = list; l != NULL; l = l->next) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1239 | { |
| 15884 | 1240 | PurpleConnection *gc; |
| 1241 | PurplePluginProtocolInfo *prpl_info = NULL; | |
| 1242 | PurplePlugin *plugin; | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1243 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1244 | if (all_accounts) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1245 | { |
| 15884 | 1246 | account = (PurpleAccount *)l->data; |
| 1247 | ||
| 1248 | plugin = purple_plugins_find_with_id( | |
| 1249 | purple_account_get_protocol_id(account)); | |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1250 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1251 | if (plugin == NULL) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1252 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1253 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1254 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1255 | continue; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1256 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1257 | |
| 15884 | 1258 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1259 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1260 | else |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1261 | { |
| 15884 | 1262 | gc = (PurpleConnection *)l->data; |
| 1263 | account = purple_connection_get_account(gc); | |
| 1264 | ||
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32620
diff
changeset
|
1265 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1266 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1267 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1268 | protoname = prpl_info->list_icon(account, NULL); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1269 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1270 | if (!strcmp(protoname, "aim") || !strcmp(protoname, "icq")) |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1271 | break; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1272 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1273 | account = NULL; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1274 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1275 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1276 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1277 | *ret_account = account; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1278 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1279 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1280 | else |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1281 | { |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1282 | valid = FALSE; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1283 | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13783
diff
changeset
|
1284 | g_free(username); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13783
diff
changeset
|
1285 | g_free(protocol); |
|
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13783
diff
changeset
|
1286 | g_free(alias); |
|
7712
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1287 | } |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1288 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1289 | g_free(str); |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1290 | |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1291 | return valid; |
|
74af9358b808
[gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents:
7538
diff
changeset
|
1292 | } |
| 8137 | 1293 | |
| 1294 | void | |
| 15568 | 1295 | pidgin_set_accessible_label (GtkWidget *w, GtkWidget *l) |
| 8137 | 1296 | { |
|
19547
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1297 | AtkObject *acc; |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1298 | 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
|
1299 | 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
|
1300 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1301 | 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
|
1302 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1303 | /* 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
|
1304 | 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
|
1305 | 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
|
1306 | 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
|
1307 | 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
|
1308 | 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
|
1309 | } |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1310 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1311 | 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
|
1312 | } |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1313 | |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1314 | void |
|
0c3fcdc6a025
Separate out setting up the labelled-by and label-for ATK relationships
Casey Harkins <charkins@pidgin.im>
parents:
19123
diff
changeset
|
1315 | 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
|
1316 | { |
| 8137 | 1317 | AtkObject *acc, *label; |
| 1318 | AtkObject *rel_obj[1]; | |
| 1319 | AtkRelationSet *set; | |
| 1320 | AtkRelation *relation; | |
| 1321 | ||
| 1322 | acc = gtk_widget_get_accessible (w); | |
| 1323 | label = gtk_widget_get_accessible (l); | |
| 1324 | ||
|
18351
b881759cda28
Call gtk_label_set_mnemonic_widget() in pidgin_make_accessible_label. Closes #589
Sean Egan <seanegan@pidgin.im>
parents:
18281
diff
changeset
|
1325 | /* Make sure mnemonics work */ |
|
20241
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1326 | gtk_label_set_mnemonic_widget(GTK_LABEL(l), w); |
|
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1327 | |
| 8137 | 1328 | /* Create the labeled-by relation */ |
| 1329 | set = atk_object_ref_relation_set (acc); | |
| 1330 | rel_obj[0] = label; | |
| 1331 | relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABELLED_BY); | |
| 1332 | atk_relation_set_add (set, relation); | |
| 1333 | g_object_unref (relation); | |
|
20241
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1334 | g_object_unref(set); |
| 8137 | 1335 | |
| 1336 | /* Create the label-for relation */ | |
| 1337 | set = atk_object_ref_relation_set (label); | |
| 1338 | rel_obj[0] = acc; | |
| 1339 | relation = atk_relation_new (rel_obj, 1, ATK_RELATION_LABEL_FOR); | |
| 1340 | atk_relation_set_add (set, relation); | |
| 1341 | g_object_unref (relation); | |
|
20241
36b8b9235ff3
applied changes from 29b2fc4762e2c5d03a7100c78f2a7b49237c5e80
Luke Schierer <lschiere@pidgin.im>
parents:
20234
diff
changeset
|
1342 | g_object_unref(set); |
| 8137 | 1343 | } |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1344 | |
|
18238
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18216
diff
changeset
|
1345 | void |
|
b38c33d2d71e
Reduce code duplication and keep gtk 2.0 compatibility by making
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
18216
diff
changeset
|
1346 | pidgin_menu_position_func_helper(GtkMenu *menu, |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1347 | gint *x, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1348 | gint *y, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1349 | gboolean *push_in, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1350 | gpointer data) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1351 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1352 | GtkWidget *widget; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1353 | GtkRequisition requisition; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1354 | GdkScreen *screen; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1355 | GdkRectangle monitor; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1356 | gint monitor_num; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1357 | gint space_left, space_right, space_above, space_below; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1358 | gint needed_width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1359 | gint needed_height; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1360 | gint xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1361 | gint ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1362 | gboolean rtl; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1363 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1364 | g_return_if_fail(GTK_IS_MENU(menu)); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1365 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1366 | widget = GTK_WIDGET(menu); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1367 | screen = gtk_widget_get_screen(widget); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1368 | xthickness = widget->style->xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1369 | ythickness = widget->style->ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1370 | rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1371 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1372 | /* |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1373 | * We need the requisition to figure out the right place to |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1374 | * 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
|
1375 | * 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
|
1376 | * the requisition won't have been recomputed yet. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1377 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1378 | gtk_widget_size_request (widget, &requisition); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1379 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1380 | monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1381 | |
|
32212
53d06e21e630
It seems like there's a dereference missing here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32188
diff
changeset
|
1382 | *push_in = FALSE; |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1383 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1384 | /* |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1385 | * The placement of popup menus horizontally works like this (with |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1386 | * RTL in parentheses) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1387 | * |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1388 | * - 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
|
1389 | * position the menu there. |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1390 | * |
|
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1391 | * - 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
|
1392 | * mouse cursor, position the menu there. |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1393 | * |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1394 | * - Otherwise if the menu is smaller than the monitor, position it |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1395 | * 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
|
1396 | * |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1397 | * - 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
|
1398 | * monitor), position it as far left (right) as possible. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1399 | * |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1400 | * Positioning in the vertical direction is similar: first try below |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1401 | * mouse cursor, then above. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1402 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1403 | gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1404 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1405 | space_left = *x - monitor.x; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1406 | space_right = monitor.x + monitor.width - *x - 1; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1407 | space_above = *y - monitor.y; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1408 | space_below = monitor.y + monitor.height - *y - 1; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1409 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1410 | /* position horizontally */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1411 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1412 | /* 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
|
1413 | * menu is offset "xthickness" pixels |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1414 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1415 | needed_width = requisition.width - xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1416 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1417 | if (needed_width <= space_left || |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1418 | needed_width <= space_right) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1419 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1420 | if ((rtl && needed_width <= space_left) || |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1421 | (!rtl && needed_width > space_right)) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1422 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1423 | /* position left */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1424 | *x = *x + xthickness - requisition.width + 1; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1425 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1426 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1427 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1428 | /* position right */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1429 | *x = *x - xthickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1430 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1431 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1432 | /* x is clamped on-screen further down */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1433 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1434 | else if (requisition.width <= monitor.width) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1435 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1436 | /* 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
|
1437 | * cursor, but smaller than the monitor. Position it on |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1438 | * the side that has the most space |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1439 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1440 | if (space_left > space_right) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1441 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1442 | /* left justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1443 | *x = monitor.x; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1444 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1445 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1446 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1447 | /* right justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1448 | *x = monitor.x + monitor.width - requisition.width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1449 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1450 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1451 | else /* menu is simply too big for the monitor */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1452 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1453 | if (rtl) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1454 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1455 | /* right justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1456 | *x = monitor.x + monitor.width - requisition.width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1457 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1458 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1459 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1460 | /* left justify */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1461 | *x = monitor.x; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1462 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1463 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1464 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1465 | /* Position vertically. The algorithm is the same as above, but |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1466 | * simpler because we don't have to take RTL into account. |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1467 | */ |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1468 | needed_height = requisition.height - ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1469 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1470 | if (needed_height <= space_above || |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1471 | needed_height <= space_below) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1472 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1473 | if (needed_height <= space_below) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1474 | *y = *y - ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1475 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1476 | *y = *y + ythickness - requisition.height + 1; |
|
11525
1d06283bdcc9
[gaim-migrate @ 13773]
Francesco Fracassi <ffracassi@users.sourceforge.net>
parents:
11338
diff
changeset
|
1477 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1478 | *y = CLAMP (*y, monitor.y, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1479 | monitor.y + monitor.height - requisition.height); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1480 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1481 | else if (needed_height > space_below && needed_height > space_above) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1482 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1483 | if (space_below >= space_above) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1484 | *y = monitor.y + monitor.height - requisition.height; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1485 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1486 | *y = monitor.y; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1487 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1488 | else |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1489 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1490 | *y = monitor.y; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1491 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1492 | } |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1493 | |
| 8247 | 1494 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1495 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1496 | pidgin_treeview_popup_menu_position_func(GtkMenu *menu, |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1497 | gint *x, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1498 | gint *y, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1499 | gboolean *push_in, |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1500 | gpointer data) |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1501 | { |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1502 | GtkWidget *widget = GTK_WIDGET(data); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1503 | GtkTreeView *tv = GTK_TREE_VIEW(data); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1504 | GtkTreePath *path; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1505 | GtkTreeViewColumn *col; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1506 | GdkRectangle rect; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1507 | gint ythickness = GTK_WIDGET(menu)->style->ythickness; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1508 | |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1509 | gdk_window_get_origin (widget->window, x, y); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1510 | gtk_tree_view_get_cursor (tv, &path, &col); |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1511 | gtk_tree_view_get_cell_area (tv, path, col, &rect); |
|
8218
0ff223f56a67
[gaim-migrate @ 8941]
Christian Hammond <chipx86@chipx86.com>
parents:
8215
diff
changeset
|
1512 | |
|
8143
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1513 | *x += rect.x+rect.width; |
|
ce4b6383777b
[gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents:
8137
diff
changeset
|
1514 | *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
|
1515 | 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
|
1516 | } |
|
10061
2833056ea11c
[gaim-migrate @ 11033]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9910
diff
changeset
|
1517 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1518 | enum { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1519 | DND_FILE_TRANSFER, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1520 | DND_IM_IMAGE, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1521 | DND_BUDDY_ICON |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1522 | }; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1523 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1524 | typedef struct { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1525 | char *filename; |
| 15884 | 1526 | PurpleAccount *account; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1527 | char *who; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1528 | } _DndData; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1529 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10681
diff
changeset
|
1530 | 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
|
1531 | { |
|
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
|
1532 | 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
|
1533 | gchar *filedata; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1534 | size_t size; |
|
14914
290eb2170f38
[gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14781
diff
changeset
|
1535 | struct stat st; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1536 | GError *err = NULL; |
| 15884 | 1537 | PurpleConversation *conv; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1538 | PidginConversation *gtkconv; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1539 | GtkTextIter iter; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1540 | 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
|
1541 | 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
|
1542 | PurpleContact *contact; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1543 | switch (choice) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1544 | case DND_BUDDY_ICON: |
|
14914
290eb2170f38
[gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14781
diff
changeset
|
1545 | if (g_stat(data->filename, &st)) { |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1546 | char *str; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1547 | |
|
14914
290eb2170f38
[gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14781
diff
changeset
|
1548 | 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
|
1549 | data->filename, g_strerror(errno)); |
| 15884 | 1550 | purple_notify_error(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1551 | _("Failed to load image"), |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1552 | str); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1553 | g_free(str); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1554 | |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1555 | break; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1556 | } |
| 10335 | 1557 | |
| 23288 | 1558 | buddy = purple_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
|
1559 | 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
|
1560 | 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
|
1561 | 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
|
1562 | } |
|
4b4f5e80e324
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
Etan Reisner <deryni@pidgin.im>
parents:
23286
diff
changeset
|
1563 | 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
|
1564 | 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
|
1565 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1566 | case DND_FILE_TRANSFER: |
| 15884 | 1567 | 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
|
1568 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1569 | case DND_IM_IMAGE: |
| 15884 | 1570 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, data->account, data->who); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1571 | gtkconv = PIDGIN_CONVERSATION(conv); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1572 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1573 | if (!g_file_get_contents(data->filename, &filedata, &size, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1574 | &err)) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1575 | char *str; |
| 10335 | 1576 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1577 | str = g_strdup_printf(_("The following error has occurred loading %s: %s"), data->filename, err->message); |
| 15884 | 1578 | purple_notify_error(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1579 | _("Failed to load image"), |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1580 | str); |
| 10335 | 1581 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1582 | g_error_free(err); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1583 | g_free(str); |
| 10335 | 1584 | |
|
26846
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1585 | break; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1586 | } |
|
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
|
1587 | 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
|
1588 | shortname = shortname ? shortname + 1 : data->filename; |
|
743be8e50f23
When drag-dropping an image into an IM window and sending as an inline
Mark Doliner <markdoliner@pidgin.im>
parents:
31217
diff
changeset
|
1589 | id = purple_imgstore_add_with_id(filedata, size, shortname); |
| 10335 | 1590 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1591 | gtk_text_buffer_get_iter_at_mark(GTK_IMHTML(gtkconv->entry)->text_buffer, &iter, |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1592 | gtk_text_buffer_get_insert(GTK_IMHTML(gtkconv->entry)->text_buffer)); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1593 | gtk_imhtml_insert_image_at_iter(GTK_IMHTML(gtkconv->entry), id, &iter); |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
16314
diff
changeset
|
1594 | purple_imgstore_unref_by_id(id); |
| 10335 | 1595 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1596 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1597 | } |
|
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
|
1598 | 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
|
1599 | 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
|
1600 | g_free(data); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1601 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1602 | |
|
10850
6889f793b918
[gaim-migrate @ 12522]
Mark Doliner <markdoliner@pidgin.im>
parents:
10681
diff
changeset
|
1603 | 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
|
1604 | { |
|
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
|
1605 | 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
|
1606 | 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
|
1607 | g_free(data); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1608 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1609 | |
|
11110
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1610 | static void dnd_set_icon_ok_cb(_DndData *data) |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1611 | { |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1612 | dnd_image_ok_callback(data, DND_BUDDY_ICON); |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1613 | } |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1614 | |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1615 | static void dnd_set_icon_cancel_cb(_DndData *data) |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1616 | { |
|
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
|
1617 | 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
|
1618 | 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
|
1619 | g_free(data); |
|
11110
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1620 | } |
|
acc4e51cb91a
[gaim-migrate @ 13162]
Richard Laager <rlaager@pidgin.im>
parents:
11017
diff
changeset
|
1621 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1622 | void |
| 15884 | 1623 | 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
|
1624 | { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1625 | GdkPixbuf *pb; |
| 15884 | 1626 | GList *files = purple_uri_list_extract_filenames((const gchar *)sd->data); |
| 1627 | PurpleConnection *gc = purple_account_get_connection(account); | |
| 1628 | PurplePluginProtocolInfo *prpl_info = NULL; | |
| 10335 | 1629 | #ifndef _WIN32 |
| 15884 | 1630 | PurpleDesktopItem *item; |
| 10335 | 1631 | #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
|
1632 | 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
|
1633 | gchar *basename = NULL; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1634 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1635 | g_return_if_fail(account != NULL); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1636 | g_return_if_fail(who != NULL); |
| 10335 | 1637 | |
|
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
|
1638 | 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
|
1639 | 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
|
1640 | 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
|
1641 | |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1642 | 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
|
1643 | basename = g_path_get_basename(filename); |
| 10335 | 1644 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1645 | /* 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
|
1646 | if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1647 | continue; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1648 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1649 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1650 | /* XXX - make ft api suupport sending a directory */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1651 | /* Are we dealing with a directory? */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1652 | 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
|
1653 | char *str, *str2; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1654 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1655 | 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
|
1656 | 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
|
1657 | |
| 15884 | 1658 | purple_notify_error(NULL, NULL, |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
1659 | str, str2); |
| 10335 | 1660 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1661 | g_free(str); |
|
16071
044392e01c96
make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents:
15987
diff
changeset
|
1662 | g_free(str2); |
| 10335 | 1663 | continue; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1664 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1665 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1666 | /* 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
|
1667 | pb = pidgin_pixbuf_new_from_file(filename); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1668 | if (pb) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1669 | _DndData *data = g_malloc(sizeof(_DndData)); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1670 | gboolean ft = FALSE, im = FALSE; |
| 10335 | 1671 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1672 | data->who = g_strdup(who); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1673 | data->filename = g_strdup(filename); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1674 | data->account = account; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1675 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1676 | if (gc) |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32620
diff
changeset
|
1677 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10335
diff
changeset
|
1678 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1679 | if (prpl_info && prpl_info->options & OPT_PROTO_IM_IMAGE) |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1680 | im = TRUE; |
| 10335 | 1681 | |
|
10348
0ab5eb1a828e
[gaim-migrate @ 11562]
Mark Doliner <markdoliner@pidgin.im>
parents:
10335
diff
changeset
|
1682 | if (prpl_info && prpl_info->can_receive_file) |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1683 | ft = prpl_info->can_receive_file(gc, who); |
|
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
|
1684 | else if (prpl_info && prpl_info->send_file) |
|
c5cf79b99382
When drag-dropping an image onto a conversation, include 'Send image file' as
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20895
diff
changeset
|
1685 | ft = TRUE; |
| 10335 | 1686 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1687 | if (im && ft) |
| 15884 | 1688 | purple_request_choice(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1689 | _("You have dragged an image"), |
|
10951
a81bececc6f0
[gaim-migrate @ 12751]
Richard Laager <rlaager@pidgin.im>
parents:
10871
diff
changeset
|
1690 | _("You can send this image as a file transfer, " |
|
a81bececc6f0
[gaim-migrate @ 12751]
Richard Laager <rlaager@pidgin.im>
parents:
10871
diff
changeset
|
1691 | "embed it into this message, or use it as the buddy icon for this user."), |
| 29245 | 1692 | DND_FILE_TRANSFER, _("OK"), (GCallback)dnd_image_ok_callback, |
| 1693 | _("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
|
1694 | 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
|
1695 | 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
|
1696 | _("Set as buddy icon"), DND_BUDDY_ICON, |
| 10335 | 1697 | _("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
|
1698 | _("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
|
1699 | NULL); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1700 | else if (!(im || ft)) |
| 15884 | 1701 | 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
|
1702 | _("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
|
1703 | 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
|
1704 | 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
|
1705 | data, (GCallback)dnd_set_icon_ok_cb, (GCallback)dnd_set_icon_cancel_cb); |
| 10335 | 1706 | else |
| 15884 | 1707 | purple_request_choice(NULL, NULL, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1708 | _("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
|
1709 | (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
|
1710 | _("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
|
1711 | (ft ? DND_FILE_TRANSFER : DND_IM_IMAGE), |
| 29245 | 1712 | _("OK"), (GCallback)dnd_image_ok_callback, |
| 1713 | _("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
|
1714 | 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
|
1715 | data, |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1716 | _("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
|
1717 | (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
|
1718 | NULL); |
|
26820
76f90ca8f6f2
Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26753
diff
changeset
|
1719 | 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
|
1720 | |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1721 | 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
|
1722 | 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
|
1723 | 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
|
1724 | 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
|
1725 | } |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1726 | return; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1727 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1728 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1729 | #ifndef _WIN32 |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1730 | /* Are we trying to send a .desktop file? */ |
| 15884 | 1731 | else if (purple_str_has_suffix(basename, ".desktop") && (item = purple_desktop_item_new_from_file(filename))) { |
| 1732 | PurpleDesktopItemType dtype; | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1733 | char key[64]; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1734 | const char *itemname = NULL; |
| 10335 | 1735 | |
| 10679 | 1736 | const char * const *langs; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1737 | int i; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1738 | langs = g_get_language_names(); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1739 | for (i = 0; langs[i]; i++) { |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1740 | g_snprintf(key, sizeof(key), "Name[%s]", langs[i]); |
| 15884 | 1741 | itemname = purple_desktop_item_get_string(item, key); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1742 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1743 | } |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
1744 | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1745 | if (!itemname) |
| 15884 | 1746 | itemname = purple_desktop_item_get_string(item, "Name"); |
| 1747 | ||
| 1748 | dtype = purple_desktop_item_get_entry_type(item); | |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1749 | switch (dtype) { |
| 15884 | 1750 | PurpleConversation *conv; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1751 | PidginConversation *gtkconv; |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1752 | |
| 15884 | 1753 | case PURPLE_DESKTOP_ITEM_TYPE_LINK: |
| 1754 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1755 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 10335 | 1756 | gtk_imhtml_insert_link(GTK_IMHTML(gtkconv->entry), |
| 1757 | gtk_text_buffer_get_insert(GTK_IMHTML(gtkconv->entry)->text_buffer), | |
| 15884 | 1758 | purple_desktop_item_get_string(item, "URL"), itemname); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1759 | break; |
| 10335 | 1760 | 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
|
1761 | /* 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
|
1762 | * 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
|
1763 | * 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
|
1764 | * 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
|
1765 | * "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
|
1766 | * 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
|
1767 | * return. */ |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1768 | /* 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
|
1769 | 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
|
1770 | _("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
|
1771 | "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
|
1772 | "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
|
1773 | "launcher itself.")); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1774 | break; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1775 | } |
| 15884 | 1776 | 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
|
1777 | 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
|
1778 | 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
|
1779 | 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
|
1780 | 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
|
1781 | } |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1782 | return; |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1783 | } |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1784 | #endif /* _WIN32 */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1785 | |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1786 | /* Everything is fine, let's send */ |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1787 | serv_send_file(gc, who, filename); |
|
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1788 | } |
|
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
|
1789 | |
|
850dc251c138
Fix various leaks of the basename/filename/entire list in pidgin_dnd_file_manage.
Paul Aurich <darkrain42@pidgin.im>
parents:
28234
diff
changeset
|
1790 | 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
|
1791 | g_free(basename); |
|
10229
39ffee70c286
[gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents:
10209
diff
changeset
|
1792 | } |
| 10483 | 1793 | |
| 15884 | 1794 | void pidgin_buddy_icon_get_scale_size(GdkPixbuf *buf, PurpleBuddyIconSpec *spec, PurpleIconScaleRules rules, int *width, int *height) |
| 10483 | 1795 | { |
| 1796 | *width = gdk_pixbuf_get_width(buf); | |
| 1797 | *height = gdk_pixbuf_get_height(buf); | |
| 1798 | ||
|
15301
26153c5f156a
[gaim-migrate @ 18029]
Mark Doliner <markdoliner@pidgin.im>
parents:
15289
diff
changeset
|
1799 | if ((spec == NULL) || !(spec->scale_rules & rules)) |
|
26153c5f156a
[gaim-migrate @ 18029]
Mark Doliner <markdoliner@pidgin.im>
parents:
15289
diff
changeset
|
1800 | return; |
|
26153c5f156a
[gaim-migrate @ 18029]
Mark Doliner <markdoliner@pidgin.im>
parents:
15289
diff
changeset
|
1801 | |
| 15884 | 1802 | purple_buddy_icon_get_scale_size(spec, width, height); |
| 10483 | 1803 | |
| 1804 | /* and now for some arbitrary sanity checks */ | |
| 1805 | if(*width > 100) | |
| 1806 | *width = 100; | |
| 1807 | if(*height > 100) | |
| 1808 | *height = 100; | |
| 1809 | } | |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1810 | |
| 15884 | 1811 | 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
|
1812 | { |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1813 | 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
|
1814 | GdkPixbuf *pixbuf = NULL; |
|
26847
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1815 | const char *stock = pidgin_stock_id_from_status_primitive(prim); |
|
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1816 | |
|
bcf32ab6ec75
Reduce code duplication.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26846
diff
changeset
|
1817 | 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
|
1818 | 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
|
1819 | return pixbuf; |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1820 | } |
|
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1821 | |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1822 | static const char * |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1823 | 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
|
1824 | { |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1825 | const char *stock = NULL; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1826 | switch (prim) { |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1827 | case PURPLE_STATUS_UNSET: |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1828 | stock = NULL; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1829 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1830 | 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
|
1831 | 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
|
1832 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1833 | 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
|
1834 | 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
|
1835 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1836 | 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
|
1837 | 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
|
1838 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1839 | case PURPLE_STATUS_INVISIBLE: |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1840 | 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
|
1841 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1842 | 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
|
1843 | 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
|
1844 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1845 | default: |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1846 | 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
|
1847 | break; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1848 | } |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1849 | return stock; |
|
d5546da39e44
Use stock-id in the status editor window too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26821
diff
changeset
|
1850 | } |
|
15799
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15645
diff
changeset
|
1851 | |
|
26894
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1852 | const char * |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1853 | 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
|
1854 | { |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1855 | 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
|
1856 | } |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1857 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1858 | const char * |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1859 | 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
|
1860 | { |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1861 | PurpleStatus *status; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1862 | PurpleStatusType *type; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1863 | PurpleStatusPrimitive prim; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1864 | gboolean idle; |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1865 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1866 | 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
|
1867 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1868 | status = purple_presence_get_active_status(presence); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1869 | type = purple_status_get_type(status); |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1870 | 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
|
1871 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1872 | 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
|
1873 | |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1874 | 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
|
1875 | } |
|
a48de595d2ee
New API to get the stock-id for a presence.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26865
diff
changeset
|
1876 | |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1877 | GdkPixbuf * |
| 15884 | 1878 | pidgin_create_prpl_icon(PurpleAccount *account, PidginPrplIconSize size) |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1879 | { |
| 15884 | 1880 | PurplePlugin *prpl; |
|
12080
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1881 | |
|
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1882 | g_return_val_if_fail(account != NULL, NULL); |
|
2aaca2265a51
[gaim-migrate @ 14377]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12067
diff
changeset
|
1883 | |
| 15884 | 1884 | prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1885 | if (prpl == NULL) |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1886 | return NULL; |
|
17368
e2c6cb39043c
Remove code duplication for prpl-icon creation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17363
diff
changeset
|
1887 | return pidgin_create_prpl_icon_from_prpl(prpl, size, account); |
|
13091
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1888 | } |
|
b5ed878998dd
[gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents:
13081
diff
changeset
|
1889 | |
| 12919 | 1890 | static void |
| 1891 | menu_action_cb(GtkMenuItem *item, gpointer object) | |
| 1892 | { | |
| 1893 | gpointer data; | |
| 1894 | void (*callback)(gpointer, gpointer); | |
| 1895 | ||
| 15884 | 1896 | callback = g_object_get_data(G_OBJECT(item), "purplecallback"); |
| 1897 | data = g_object_get_data(G_OBJECT(item), "purplecallbackdata"); | |
| 12919 | 1898 | |
| 1899 | if (callback) | |
| 1900 | callback(object, data); | |
| 1901 | } | |
| 1902 | ||
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1903 | GtkWidget * |
| 15884 | 1904 | pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act, |
| 12919 | 1905 | gpointer object) |
| 1906 | { | |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1907 | GtkWidget *menuitem; |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1908 | GList *list; |
|
17386
f68ba6199d79
merge of 'de0c8e6287f1090343edb9c43e0d8d681e58df07'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
1909 | |
| 12919 | 1910 | 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
|
1911 | return pidgin_separator(menu); |
|
17386
f68ba6199d79
merge of 'de0c8e6287f1090343edb9c43e0d8d681e58df07'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
1912 | } |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1913 | |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1914 | list = purple_menu_action_get_children(act); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1915 | 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
|
1916 | |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1917 | if (list == NULL) { |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1918 | PurpleCallback callback; |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1919 | |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1920 | callback = purple_menu_action_get_callback(act); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1921 | |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1922 | 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
|
1923 | 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
|
1924 | "purplecallback", |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1925 | callback); |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1926 | 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
|
1927 | "purplecallbackdata", |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1928 | 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
|
1929 | 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
|
1930 | 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
|
1931 | object); |
| 12919 | 1932 | } else { |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1933 | gtk_widget_set_sensitive(menuitem, FALSE); |
| 12919 | 1934 | } |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1935 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1936 | 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
|
1937 | } else { |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1938 | 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
|
1939 | 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
|
1940 | GtkAccelGroup *group; |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1941 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1942 | 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
|
1943 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1944 | 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
|
1945 | 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
|
1946 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1947 | 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
|
1948 | if (group) { |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1949 | char *path = g_strdup_printf("%s/%s", GTK_MENU_ITEM(menuitem)->accel_path, |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1950 | 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
|
1951 | 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
|
1952 | 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
|
1953 | 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
|
1954 | } |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1955 | |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1956 | 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
|
1957 | 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
|
1958 | |
|
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1959 | 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
|
1960 | } |
|
32287
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1961 | g_list_free(list); |
|
c8cf9b704a49
Hide-a-PurpleMenuAction.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32229
diff
changeset
|
1962 | purple_menu_action_set_children(act, NULL); |
| 12919 | 1963 | } |
|
17363
f16ea1b259e2
Use purple_conversation_extended_menu to add items in the conversation
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17360
diff
changeset
|
1964 | 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
|
1965 | return menuitem; |
| 12919 | 1966 | } |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1967 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1968 | typedef struct |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1969 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1970 | GtkWidget *entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1971 | GtkWidget *accountopt; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1972 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1973 | PidginFilterBuddyCompletionEntryFunc filter_func; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1974 | gpointer filter_func_user_data; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1975 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
1976 | GtkListStore *store; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
1977 | } PidginCompletionData; |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1978 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
1979 | static gboolean buddyname_completion_match_func(GtkEntryCompletion *completion, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1980 | const gchar *key, GtkTreeIter *iter, gpointer user_data) |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1981 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1982 | GtkTreeModel *model; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1983 | GValue val1; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1984 | GValue val2; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1985 | const char *tmp; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1986 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1987 | model = gtk_entry_completion_get_model (completion); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1988 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1989 | val1.g_type = 0; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1990 | gtk_tree_model_get_value(model, iter, 2, &val1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1991 | tmp = g_value_get_string(&val1); |
| 15884 | 1992 | if (tmp != NULL && purple_str_has_prefix(tmp, key)) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1993 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1994 | g_value_unset(&val1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1995 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1996 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1997 | g_value_unset(&val1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1998 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
1999 | val2.g_type = 0; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2000 | gtk_tree_model_get_value(model, iter, 3, &val2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2001 | tmp = g_value_get_string(&val2); |
| 15884 | 2002 | if (tmp != NULL && purple_str_has_prefix(tmp, key)) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2003 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2004 | g_value_unset(&val2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2005 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2006 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2007 | g_value_unset(&val2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2008 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2009 | return FALSE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2010 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2011 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2012 | 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
|
2013 | GtkTreeModel *model, GtkTreeIter *iter, PidginCompletionData *data) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2014 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2015 | GValue val; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2016 | GtkWidget *optmenu = data->accountopt; |
| 15884 | 2017 | PurpleAccount *account; |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2018 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2019 | val.g_type = 0; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2020 | gtk_tree_model_get_value(model, iter, 1, &val); |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2021 | 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
|
2022 | g_value_unset(&val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2023 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2024 | gtk_tree_model_get_value(model, iter, 4, &val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2025 | account = g_value_get_pointer(&val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2026 | g_value_unset(&val); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2027 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2028 | if (account == NULL) |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2029 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2030 | |
| 17117 | 2031 | 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
|
2032 | aop_option_menu_select_by_data(optmenu, account); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2033 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2034 | return TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2035 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2036 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2037 | 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
|
2038 | 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
|
2039 | const PurpleAccount *account, const char *buddyname) |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2040 | { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2041 | GtkTreeIter iter; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2042 | 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
|
2043 | gchar *normalized_buddyname; |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2044 | gchar *tmp; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2045 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2046 | 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
|
2047 | normalized_buddyname = g_utf8_casefold(tmp, -1); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2048 | g_free(tmp); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2049 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2050 | /* 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
|
2051 | 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
|
2052 | 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
|
2053 | 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
|
2054 | 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
|
2055 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2056 | tmp = g_utf8_casefold(tmp2, -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2057 | g_free(tmp2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2058 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2059 | gtk_list_store_append(store, &iter); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2060 | gtk_list_store_set(store, &iter, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2061 | 0, completion_entry, |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2062 | 1, buddyname, |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2063 | 2, normalized_buddyname, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2064 | 3, tmp, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2065 | 4, account, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2066 | -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2067 | g_free(completion_entry); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2068 | g_free(tmp); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2069 | completion_added = TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2070 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2071 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2072 | /* 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
|
2073 | 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
|
2074 | if (contact_alias && strcmp(contact_alias, buddyname)) { |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2075 | /* 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
|
2076 | if (!buddy_alias || strcmp(contact_alias, buddy_alias)) { |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2077 | 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
|
2078 | buddyname, contact_alias); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2079 | 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
|
2080 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2081 | tmp = g_utf8_casefold(tmp2, -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2082 | g_free(tmp2); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2083 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2084 | gtk_list_store_append(store, &iter); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2085 | gtk_list_store_set(store, &iter, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2086 | 0, completion_entry, |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2087 | 1, buddyname, |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2088 | 2, normalized_buddyname, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2089 | 3, tmp, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2090 | 4, account, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2091 | -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2092 | g_free(completion_entry); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2093 | g_free(tmp); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2094 | completion_added = TRUE; |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2095 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2096 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2097 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2098 | 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
|
2099 | /* Add the buddy's name. */ |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2100 | gtk_list_store_append(store, &iter); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2101 | gtk_list_store_set(store, &iter, |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2102 | 0, buddyname, |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2103 | 1, buddyname, |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2104 | 2, normalized_buddyname, |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2105 | 3, NULL, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2106 | 4, account, |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2107 | -1); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2108 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2109 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2110 | g_free(normalized_buddyname); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2111 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2112 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2113 | 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
|
2114 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2115 | 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
|
2116 | 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
|
2117 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2118 | /* 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
|
2119 | * 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
|
2120 | 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
|
2121 | PidginBuddyCompletionEntry entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2122 | entry.is_buddy = FALSE; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2123 | entry.entry.logged_buddy = set; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2124 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2125 | 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
|
2126 | 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
|
2127 | 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
|
2128 | } |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2129 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2130 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2131 | |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2132 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2133 | add_completion_list(PidginCompletionData *data) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2134 | { |
| 15884 | 2135 | PurpleBlistNode *gnode, *cnode, *bnode; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2136 | 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
|
2137 | gpointer user_data = data->filter_func_user_data; |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2138 | GHashTable *sets; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2139 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2140 | gtk_list_store_clear(data->store); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2141 | |
| 15884 | 2142 | for (gnode = purple_get_blist()->root; gnode != NULL; gnode = gnode->next) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2143 | { |
| 15884 | 2144 | if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2145 | continue; |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2146 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2147 | for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2148 | { |
| 15884 | 2149 | if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2150 | continue; |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2151 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2152 | for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2153 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2154 | PidginBuddyCompletionEntry entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2155 | entry.is_buddy = TRUE; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2156 | entry.entry.buddy = (PurpleBuddy *) bnode; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2157 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2158 | 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
|
2159 | 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
|
2160 | ((PurpleContact *)cnode)->alias, |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2161 | 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
|
2162 | purple_buddy_get_account(entry.entry.buddy), |
|
0edad3ff7243
Use the PurpleBuddy accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2163 | 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
|
2164 | ); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2165 | } |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2166 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2167 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2168 | } |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2169 | |
| 15884 | 2170 | 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
|
2171 | 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
|
2172 | 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
|
2173 | |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2174 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2175 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2176 | 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
|
2177 | buddyname_autocomplete_destroyed_cb(GtkWidget *widget, gpointer data) |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2178 | { |
|
17707
b5f042209c68
Unleak a few bytes in the screenname completion code
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17605
diff
changeset
|
2179 | g_free(data); |
| 15884 | 2180 | purple_signals_disconnect_by_handle(widget); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2181 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2182 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2183 | static void |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2184 | repopulate_autocomplete(gpointer something, gpointer data) |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2185 | { |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2186 | add_completion_list(data); |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2187 | } |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2188 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2189 | void |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2190 | pidgin_setup_screenname_autocomplete_with_filter(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
|
2191 | { |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2192 | PidginCompletionData *data; |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2193 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2194 | /* |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2195 | * 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
|
2196 | * 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
|
2197 | * 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
|
2198 | */ |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2199 | GtkListStore *store; |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2200 | |
|
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2201 | GtkEntryCompletion *completion; |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2202 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2203 | data = g_new0(PidginCompletionData, 1); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2204 | store = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2205 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2206 | data->entry = entry; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2207 | data->accountopt = accountopt; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2208 | if (filter_func == NULL) { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2209 | 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
|
2210 | 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
|
2211 | } else { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2212 | data->filter_func = filter_func; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2213 | 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
|
2214 | } |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2215 | data->store = store; |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2216 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2217 | add_completion_list(data); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2218 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2219 | /* Sort the completion list by buddy name */ |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2220 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2221 | 1, GTK_SORT_ASCENDING); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2222 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2223 | 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
|
2224 | 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
|
2225 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2226 | 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
|
2227 | G_CALLBACK(buddyname_completion_match_selected_cb), data); |
|
13361
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2228 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2229 | gtk_entry_set_completion(GTK_ENTRY(entry), completion); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2230 | g_object_unref(completion); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2231 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2232 | gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store)); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2233 | g_object_unref(store); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2234 | |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2235 | gtk_entry_completion_set_text_column(completion, 0); |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2236 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2237 | 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
|
2238 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2239 | 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
|
2240 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
|
13366
e01cf252b407
[gaim-migrate @ 15738]
Richard Laager <rlaager@pidgin.im>
parents:
13365
diff
changeset
|
2241 | |
| 15884 | 2242 | 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
|
2243 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
| 15884 | 2244 | 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
|
2245 | PURPLE_CALLBACK(repopulate_autocomplete), data); |
|
13365
8e6ae65497ef
[gaim-migrate @ 15737]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13361
diff
changeset
|
2246 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
25888
diff
changeset
|
2247 | 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
|
2248 | } |
|
bb2f64cf6721
[gaim-migrate @ 15733]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13281
diff
changeset
|
2249 | |
|
18966
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2250 | gboolean |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2251 | 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
|
2252 | 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
|
2253 | |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2254 | if (completion_entry->is_buddy) { |
|
32709
0edad3ff7243
Use the PurpleBuddy accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents:
32678
diff
changeset
|
2255 | 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
|
2256 | } else { |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2257 | 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
|
2258 | } |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2259 | } |
|
6a0715b72b6b
Screenname auto-completion filtering by Leonardo Fernandes, Fixes #519
Sean Egan <seanegan@pidgin.im>
parents:
18941
diff
changeset
|
2260 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2261 | void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2262 | { |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2263 | GdkCursor *cursor; |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2264 | |
|
13470
5550131ec50b
[gaim-migrate @ 15845]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
2265 | g_return_if_fail(widget != NULL); |
|
5550131ec50b
[gaim-migrate @ 15845]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
2266 | if (widget->window == NULL) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2267 | return; |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2268 | |
|
22787
18842b6fda42
Use the desired cursor, instead of always using GDK_WATCH.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22702
diff
changeset
|
2269 | cursor = gdk_cursor_new(cursor_type); |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2270 | gdk_window_set_cursor(widget->window, cursor); |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2271 | gdk_cursor_unref(cursor); |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2272 | |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2273 | gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2274 | } |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2275 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2276 | void pidgin_clear_cursor(GtkWidget *widget) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2277 | { |
|
13470
5550131ec50b
[gaim-migrate @ 15845]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
2278 | g_return_if_fail(widget != NULL); |
|
5550131ec50b
[gaim-migrate @ 15845]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
2279 | if (widget->window == NULL) |
|
13435
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2280 | return; |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2281 | |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2282 | gdk_window_set_cursor(widget->window, NULL); |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2283 | } |
|
4c22eed6e0a6
[gaim-migrate @ 15809]
Richard Laager <rlaager@pidgin.im>
parents:
13372
diff
changeset
|
2284 | |
| 14195 | 2285 | struct _icon_chooser { |
| 2286 | GtkWidget *icon_filesel; | |
| 2287 | GtkWidget *icon_preview; | |
| 2288 | GtkWidget *icon_text; | |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15405
diff
changeset
|
2289 | |
| 14195 | 2290 | void (*callback)(const char*,gpointer); |
| 2291 | gpointer data; | |
| 2292 | }; | |
| 2293 | ||
| 2294 | static void | |
| 2295 | icon_filesel_choose_cb(GtkWidget *widget, gint response, struct _icon_chooser *dialog) | |
| 2296 | { | |
| 2297 | char *filename, *current_folder; | |
| 2298 | ||
| 2299 | if (response != GTK_RESPONSE_ACCEPT) { | |
| 2300 | if (response == GTK_RESPONSE_CANCEL) { | |
| 2301 | gtk_widget_destroy(dialog->icon_filesel); | |
| 2302 | } | |
| 2303 | dialog->icon_filesel = NULL; | |
| 2304 | if (dialog->callback) | |
| 2305 | dialog->callback(NULL, dialog->data); | |
| 2306 | g_free(dialog); | |
| 2307 | return; | |
| 2308 | } | |
| 2309 | ||
| 2310 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
| 2311 | current_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
| 2312 | 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
|
2313 | purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_icon_folder", current_folder); |
| 14195 | 2314 | g_free(current_folder); |
| 2315 | } | |
| 2316 | ||
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
2317 | |
| 14195 | 2318 | if (dialog->callback) |
| 2319 | dialog->callback(filename, dialog->data); | |
| 2320 | gtk_widget_destroy(dialog->icon_filesel); | |
| 2321 | g_free(filename); | |
| 2322 | g_free(dialog); | |
| 2323 | } | |
| 2324 | ||
| 2325 | ||
| 2326 | static void | |
| 2327 | icon_preview_change_cb(GtkFileChooser *widget, struct _icon_chooser *dialog) | |
| 2328 | { | |
| 2329 | GdkPixbuf *pixbuf, *scale; | |
| 2330 | int height, width; | |
| 2331 | char *basename, *markup, *size; | |
| 2332 | struct stat st; | |
| 2333 | char *filename; | |
| 2334 | ||
| 2335 | filename = gtk_file_chooser_get_preview_filename( | |
| 2336 | GTK_FILE_CHOOSER(dialog->icon_filesel)); | |
| 2337 | ||
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
2338 | if (!filename || g_stat(filename, &st) || !(pixbuf = pidgin_pixbuf_new_from_file(filename))) |
| 14195 | 2339 | { |
| 2340 | gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), NULL); | |
| 2341 | gtk_label_set_markup(GTK_LABEL(dialog->icon_text), ""); | |
| 2342 | g_free(filename); | |
| 2343 | return; | |
| 2344 | } | |
| 2345 | ||
| 2346 | width = gdk_pixbuf_get_width(pixbuf); | |
| 2347 | height = gdk_pixbuf_get_height(pixbuf); | |
| 2348 | basename = g_path_get_basename(filename); | |
| 15884 | 2349 | size = purple_str_size_to_units(st.st_size); |
| 14195 | 2350 | markup = g_strdup_printf(_("<b>File:</b> %s\n" |
| 2351 | "<b>File size:</b> %s\n" | |
| 2352 | "<b>Image size:</b> %dx%d"), | |
| 2353 | basename, size, width, height); | |
| 2354 | ||
| 2355 | scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height, | |
| 2356 | 50, GDK_INTERP_BILINEAR); | |
| 2357 | gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), scale); | |
| 2358 | gtk_label_set_markup(GTK_LABEL(dialog->icon_text), markup); | |
| 2359 | ||
| 2360 | g_object_unref(G_OBJECT(pixbuf)); | |
| 2361 | g_object_unref(G_OBJECT(scale)); | |
| 2362 | g_free(filename); | |
| 2363 | g_free(basename); | |
| 2364 | g_free(size); | |
| 2365 | g_free(markup); | |
| 2366 | } | |
| 2367 | ||
| 2368 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2369 | GtkWidget *pidgin_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char *, gpointer), gpointer data) { |
| 14195 | 2370 | struct _icon_chooser *dialog = g_new0(struct _icon_chooser, 1); |
| 2371 | ||
|
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
|
2372 | GtkWidget *vbox; |
| 14195 | 2373 | const char *current_folder; |
| 2374 | ||
| 2375 | dialog->callback = callback; | |
| 2376 | dialog->data = data; | |
| 2377 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16071
diff
changeset
|
2378 | current_folder = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/filelocations/last_icon_folder"); |
| 14195 | 2379 | |
| 2380 | dialog->icon_filesel = gtk_file_chooser_dialog_new(_("Buddy Icon"), | |
| 2381 | parent, | |
| 2382 | GTK_FILE_CHOOSER_ACTION_OPEN, | |
| 2383 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
| 2384 | GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, | |
| 2385 | NULL); | |
| 2386 | gtk_dialog_set_default_response(GTK_DIALOG(dialog->icon_filesel), GTK_RESPONSE_ACCEPT); | |
| 2387 | if ((current_folder != NULL) && (*current_folder != '\0')) | |
| 2388 | gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog->icon_filesel), | |
| 2389 | current_folder); | |
| 2390 | ||
| 2391 | dialog->icon_preview = gtk_image_new(); | |
| 2392 | 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
|
2393 | |
|
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
|
2394 | 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
|
2395 | 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
|
2396 | 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
|
2397 | 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
|
2398 | 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
|
2399 | |
|
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
|
2400 | 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
|
2401 | 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
|
2402 | 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
|
2403 | |
| 14195 | 2404 | g_signal_connect(G_OBJECT(dialog->icon_filesel), "update-preview", |
| 2405 | G_CALLBACK(icon_preview_change_cb), dialog); | |
| 2406 | g_signal_connect(G_OBJECT(dialog->icon_filesel), "response", | |
| 2407 | G_CALLBACK(icon_filesel_choose_cb), dialog); | |
| 2408 | icon_preview_change_cb(NULL, dialog); | |
|
21729
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2409 | |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2410 | #ifdef _WIN32 |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2411 | g_signal_connect(G_OBJECT(dialog->icon_filesel), "show", |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2412 | G_CALLBACK(winpidgin_ensure_onscreen), dialog->icon_filesel); |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2413 | #endif |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2414 | |
|
a06176e84f3a
applied changes from 6546cfd72ecd9aa76fc524aaf3ac48489aeb2a90
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
2415 | return dialog->icon_filesel; |
| 14195 | 2416 | } |
| 2417 | ||
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2418 | /** |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2419 | * @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
|
2420 | */ |
| 14195 | 2421 | static gboolean |
| 2422 | str_array_match(char **a, char **b) | |
| 2423 | { | |
| 2424 | int i, j; | |
| 2425 | ||
| 2426 | if (!a || !b) | |
| 2427 | return FALSE; | |
| 2428 | for (i = 0; a[i] != NULL; i++) | |
| 2429 | for (j = 0; b[j] != NULL; j++) | |
| 2430 | if (!g_ascii_strcasecmp(a[i], b[j])) | |
| 2431 | return TRUE; | |
| 2432 | return FALSE; | |
| 2433 | } | |
| 2434 | ||
|
16446
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
2435 | gpointer |
|
3a6ed6c3400e
Fix the custom icon stuff, and various memory leaks. At this point, custom
Richard Laager <rlaager@pidgin.im>
parents:
16437
diff
changeset
|
2436 | pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len) |
| 14195 | 2437 | { |
| 15884 | 2438 | PurplePluginProtocolInfo *prpl_info; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2439 | PurpleBuddyIconSpec *spec; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2440 | 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
|
2441 | GdkPixbufFormat *format; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2442 | char **pixbuf_formats; |
|
14720
6751e3e9c5bf
[gaim-migrate @ 17404]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14717
diff
changeset
|
2443 | char **prpl_formats; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2444 | GError *error = NULL; |
|
15284
98e8f9912107
[gaim-migrate @ 18012]
Mark Doliner <markdoliner@pidgin.im>
parents:
15254
diff
changeset
|
2445 | gchar *contents; |
|
98e8f9912107
[gaim-migrate @ 18012]
Mark Doliner <markdoliner@pidgin.im>
parents:
15254
diff
changeset
|
2446 | gsize length; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2447 | GdkPixbuf *pixbuf, *original; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2448 | float scale_factor; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2449 | int i; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2450 | gchar *tmp; |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14196
diff
changeset
|
2451 | |
| 15884 | 2452 | prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2453 | spec = &prpl_info->icon_spec; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2454 | 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
|
2455 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2456 | 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
|
2457 | if (format == NULL) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2458 | 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
|
2459 | return NULL; |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2460 | } |
|
15289
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2461 | |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2462 | pixbuf_formats = gdk_pixbuf_format_get_extensions(format); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2463 | prpl_formats = g_strsplit(spec->format, ",", 0); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2464 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2465 | if (str_array_match(pixbuf_formats, prpl_formats) && /* This is an acceptable format AND */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2466 | (!(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
|
2467 | (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
|
2468 | spec->min_height <= orig_height && spec->max_height >= orig_height))) /* The icon is the correct size */ |
| 14195 | 2469 | { |
| 2470 | 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
|
2471 | |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2472 | 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
|
2473 | 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
|
2474 | "of %s: %s\n", path, error->message); |
|
15289
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2475 | g_strfreev(prpl_formats); |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2476 | return NULL; |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2477 | } |
|
2b90dc4e1483
[gaim-migrate @ 18017]
Mark Doliner <markdoliner@pidgin.im>
parents:
15284
diff
changeset
|
2478 | |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2479 | 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
|
2480 | /* 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
|
2481 | 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
|
2482 | if (len) |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2483 | *len = length; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2484 | g_strfreev(prpl_formats); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2485 | return contents; |
| 14195 | 2486 | } |
| 2487 | ||
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2488 | /* 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
|
2489 | g_free(contents); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2490 | } else { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2491 | 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
|
2492 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2493 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2494 | /* 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
|
2495 | 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
|
2496 | if (error) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2497 | 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
|
2498 | "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
|
2499 | 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
|
2500 | g_strfreev(prpl_formats); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2501 | return NULL; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2502 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2503 | 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
|
2504 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2505 | 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
|
2506 | 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
|
2507 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2508 | /* 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
|
2509 | 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
|
2510 | (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
|
2511 | 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
|
2512 | { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2513 | 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
|
2514 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2515 | 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
|
2516 | 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
|
2517 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2518 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2519 | scale_factor = 1; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2520 | do { |
| 14195 | 2521 | for (i = 0; prpl_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
|
2522 | int quality = 100; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2523 | do { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2524 | 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
|
2525 | 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
|
2526 | 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
|
2527 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2528 | purple_debug_info("buddyicon", "Converting buddy icon to %s\n", prpl_formats[i]); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2529 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2530 | if (g_str_equal(prpl_formats[i], "png")) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2531 | key = "compression"; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2532 | value = "9"; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2533 | } else if (g_str_equal(prpl_formats[i], "jpeg")) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2534 | 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
|
2535 | key = "quality"; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2536 | value = tmp_buf; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2537 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2538 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2539 | if (!gdk_pixbuf_save_to_buffer(pixbuf, &contents, &length, |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2540 | prpl_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
|
2541 | { |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2542 | /* 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
|
2543 | * 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
|
2544 | purple_debug_warning("buddyicon", |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2545 | "Could not convert to %s: %s\n", prpl_formats[i], |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2546 | (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
|
2547 | 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
|
2548 | error = NULL; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2549 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2550 | /* 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
|
2551 | 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
|
2552 | 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
|
2553 | } |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2554 | |
|
30054
82871fde0aac
Allow icons to be exactly the max file size
Mark Doliner <markdoliner@pidgin.im>
parents:
30053
diff
changeset
|
2555 | 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
|
2556 | /* 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
|
2557 | 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
|
2558 | the image. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2559 | 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
|
2560 | "%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
|
2561 | "filesize=%" G_GSIZE_FORMAT "\n", |
|
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
2562 | orig_width, orig_height, new_width, new_height, |
|
a152b1950ea6
Use correct format for printing gsize types.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32709
diff
changeset
|
2563 | prpl_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
|
2564 | if (len) |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2565 | *len = length; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2566 | g_strfreev(prpl_formats); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2567 | 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
|
2568 | 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
|
2569 | return contents; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2570 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2571 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2572 | g_free(contents); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2573 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2574 | if (!g_str_equal(prpl_formats[i], "jpeg")) { |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2575 | /* 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
|
2576 | 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
|
2577 | break; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2578 | } |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2579 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2580 | /* 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
|
2581 | lowering the quality. */ |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2582 | quality -= 5; |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2583 | } 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
|
2584 | } |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2585 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2586 | /* 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
|
2587 | 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
|
2588 | 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
|
2589 | 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
|
2590 | 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
|
2591 | 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
|
2592 | 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
|
2593 | } while ((new_width > 10 || new_height > 10) && new_width > spec->min_width && new_height > spec->min_height); |
|
29931
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2594 | g_strfreev(prpl_formats); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2595 | 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
|
2596 | 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
|
2597 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2598 | tmp = g_strdup_printf(_("The file '%s' is too large for %s. Please try a smaller image.\n"), |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2599 | path, plugin->info->name); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2600 | 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
|
2601 | g_free(tmp); |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2602 | |
|
1d21766368d2
Change pidgin_convert_buddy_icon() to be more accommodating when attempting
Mark Doliner <markdoliner@pidgin.im>
parents:
29928
diff
changeset
|
2603 | return NULL; |
| 14195 | 2604 | } |
|
14290
f20819ff8d86
[gaim-migrate @ 16910]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14253
diff
changeset
|
2605 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2606 | char *pidgin_make_pretty_arrows(const char *str) |
| 15084 | 2607 | { |
| 2608 | char *ret; | |
| 2609 | char **split = g_strsplit(str, "->", -1); | |
| 2610 | ret = g_strjoinv("\342\207\250", split); | |
| 2611 | g_strfreev(split); | |
| 2612 | ||
| 2613 | split = g_strsplit(ret, "<-", -1); | |
| 2614 | g_free(ret); | |
| 2615 | ret = g_strjoinv("\342\207\246", split); | |
| 2616 | g_strfreev(split); | |
| 2617 | ||
| 2618 | return ret; | |
| 2619 | } | |
| 15094 | 2620 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2621 | void pidgin_set_urgent(GtkWindow *window, gboolean urgent) |
| 15403 | 2622 | { |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
2623 | #if defined _WIN32 |
|
15574
18d9d1c05994
Win32 de-gaimification of pidgin
Daniel Atallah <datallah@pidgin.im>
parents:
15568
diff
changeset
|
2624 | winpidgin_window_flash(window, urgent); |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20241
diff
changeset
|
2625 | #else |
|
29497
4502da3fe427
I screwed up the logic here and didn't realize it earlier.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29496
diff
changeset
|
2626 | gtk_window_set_urgency_hint(window, urgent); |
| 15403 | 2627 | #endif |
| 2628 | } | |
| 2629 | ||
|
26865
c29554ceb409
Hide the list of minidialogs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26847
diff
changeset
|
2630 | static GSList *minidialogs = NULL; |
| 15094 | 2631 | |
| 2632 | 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
|
2633 | pidgin_utils_get_handle(void) |
| 15094 | 2634 | { |
| 2635 | static int handle; | |
| 2636 | ||
| 2637 | return &handle; | |
| 2638 | } | |
| 2639 | ||
| 15884 | 2640 | static void connection_signed_off_cb(PurpleConnection *gc) |
| 15094 | 2641 | { |
|
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
|
2642 | 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
|
2643 | 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
|
2644 | l_next = list->next; |
| 15094 | 2645 | if (g_object_get_data(G_OBJECT(list->data), "gc") == gc) { |
| 2646 | gtk_widget_destroy(GTK_WIDGET(list->data)); | |
| 2647 | } | |
| 2648 | } | |
| 2649 | } | |
| 2650 | ||
| 2651 | static void alert_killed_cb(GtkWidget *widget) | |
| 2652 | { | |
| 2653 | minidialogs = g_slist_remove(minidialogs, widget); | |
| 2654 | } | |
| 2655 | ||
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2656 | 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
|
2657 | { |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2658 | PidginUtilMiniDialogCallback cb; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2659 | gpointer data; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2660 | }; |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2661 | |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2662 | static void |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2663 | 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
|
2664 | GtkButton *button, |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2665 | 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
|
2666 | { |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2667 | 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
|
2668 | 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
|
2669 | } |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2670 | |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2671 | static void |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2672 | 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
|
2673 | GList *cb_datas) |
| 15094 | 2674 | { |
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2675 | 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
|
2676 | { |
|
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2677 | 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
|
2678 | 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
|
2679 | } |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2680 | } |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2681 | |
|
30635
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2682 | static void |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2683 | mini_dialog_init(PidginMiniDialog *mini_dialog, PurpleConnection *gc, void *user_data, va_list args) |
| 15094 | 2684 | { |
| 2685 | 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
|
2686 | GList *cb_datas = NULL; |
| 15094 | 2687 | static gboolean first_call = TRUE; |
| 2688 | ||
| 2689 | if (first_call) { | |
| 2690 | first_call = FALSE; | |
| 15884 | 2691 | 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
|
2692 | 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
|
2693 | PURPLE_CALLBACK(connection_signed_off_cb), NULL); |
| 15094 | 2694 | } |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15405
diff
changeset
|
2695 | |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2696 | 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
|
2697 | 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
|
2698 | G_CALLBACK(alert_killed_cb), NULL); |
|
15409
37b46bbce4cb
[gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents:
15405
diff
changeset
|
2699 | |
| 15094 | 2700 | 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
|
2701 | 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
|
2702 | 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
|
2703 | PidginUtilMiniDialogCallback callback = |
|
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2704 | 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
|
2705 | |
|
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
|
2706 | 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
|
2707 | 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
|
2708 | 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
|
2709 | 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
|
2710 | 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
|
2711 | } |
|
21323
0ad61638683f
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
Will Thompson <resiak@pidgin.im>
parents:
21320
diff
changeset
|
2712 | 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
|
2713 | 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
|
2714 | cb_datas = g_list_append(cb_datas, data); |
| 15094 | 2715 | } |
| 2716 | ||
|
21326
62bb702f824a
Don't leak all bar one of the closure structs allocated by
Will Thompson <resiak@pidgin.im>
parents:
21323
diff
changeset
|
2717 | 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
|
2718 | 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
|
2719 | } |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2720 | |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2721 | #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
|
2722 | va_list args; \ |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2723 | 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
|
2724 | 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
|
2725 | 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
|
2726 | 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
|
2727 | |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2728 | GtkWidget * |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2729 | 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
|
2730 | const char *icon_name, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2731 | const char *primary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2732 | const char *secondary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2733 | void *user_data, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2734 | ...) |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2735 | { |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2736 | 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
|
2737 | 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
|
2738 | } |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2739 | |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2740 | GtkWidget * |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2741 | 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
|
2742 | GdkPixbuf *custom_icon, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2743 | const char *primary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2744 | const char *secondary, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2745 | void *user_data, |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2746 | ...) |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2747 | { |
|
e9893ecc9057
Display the protocol icon for the authorization request dialog
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30054
diff
changeset
|
2748 | 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
|
2749 | INIT_AND_RETURN_MINI_DIALOG(mini_dialog); |
| 15094 | 2750 | } |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2751 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2752 | /* |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2753 | * "This is so dead sexy." |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2754 | * "Two thumbs up." |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2755 | * "Best movie of the year." |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2756 | * |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2757 | * 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
|
2758 | * 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
|
2759 | * entered string. |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2760 | * |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2761 | * 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
|
2762 | * "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
|
2763 | * 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
|
2764 | * 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
|
2765 | * used rarely, so it shouldn't matter TOO much. |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2766 | */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15506
diff
changeset
|
2767 | 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
|
2768 | const gchar *key, GtkTreeIter *iter, gpointer data) |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2769 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2770 | gchar *enteredstring; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2771 | gchar *tmp; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2772 | gchar *withmarkup; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2773 | gchar *nomarkup; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2774 | gchar *normalized; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2775 | gboolean result; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2776 | size_t i; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2777 | size_t len; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2778 | PangoLogAttr *log_attrs; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2779 | gchar *word; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2780 | |
|
17155
143ff2796376
Replace strcasecmp() calls with glib equivalents.
Richard Laager <rlaager@pidgin.im>
parents:
17116
diff
changeset
|
2781 | if (g_ascii_strcasecmp(key, "Global Thermonuclear War") == 0) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2782 | { |
| 15884 | 2783 | purple_notify_info(NULL, "WOPR", |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2784 | "Wouldn't you prefer a nice game of chess?", NULL); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2785 | return FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2786 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2787 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2788 | gtk_tree_model_get(model, iter, column, &withmarkup, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2789 | if (withmarkup == NULL) /* This is probably a separator */ |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2790 | return TRUE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2791 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2792 | tmp = g_utf8_normalize(key, -1, G_NORMALIZE_DEFAULT); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2793 | enteredstring = g_utf8_casefold(tmp, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2794 | g_free(tmp); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2795 | |
| 15884 | 2796 | nomarkup = purple_markup_strip_html(withmarkup); |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2797 | tmp = g_utf8_normalize(nomarkup, -1, G_NORMALIZE_DEFAULT); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2798 | g_free(nomarkup); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2799 | normalized = g_utf8_casefold(tmp, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2800 | g_free(tmp); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2801 | |
| 15884 | 2802 | if (purple_str_has_prefix(normalized, enteredstring)) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2803 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2804 | g_free(withmarkup); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2805 | g_free(enteredstring); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2806 | g_free(normalized); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2807 | return FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2808 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2809 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2810 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2811 | /* Use Pango to separate by words. */ |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2812 | len = g_utf8_strlen(normalized, -1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2813 | log_attrs = g_new(PangoLogAttr, len + 1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2814 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2815 | 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
|
2816 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2817 | word = normalized; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2818 | result = TRUE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2819 | for (i = 0; i < (len - 1) ; i++) |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2820 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2821 | if (log_attrs[i].is_word_start && |
| 15884 | 2822 | purple_str_has_prefix(word, enteredstring)) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2823 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2824 | result = FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2825 | break; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2826 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2827 | word = g_utf8_next_char(word); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2828 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2829 | g_free(log_attrs); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2830 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2831 | /* The non-Pango version. */ |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2832 | #if 0 |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2833 | word = normalized; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2834 | result = TRUE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2835 | while (word[0] != '\0') |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2836 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2837 | gunichar c = g_utf8_get_char(word); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2838 | if (!g_unichar_isalnum(c)) |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2839 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2840 | word = g_utf8_find_next_char(word, NULL); |
| 15884 | 2841 | if (purple_str_has_prefix(word, enteredstring)) |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2842 | { |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2843 | result = FALSE; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2844 | break; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2845 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2846 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2847 | else |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2848 | word = g_utf8_find_next_char(word, NULL); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2849 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2850 | #endif |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2851 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2852 | g_free(withmarkup); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2853 | g_free(enteredstring); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2854 | g_free(normalized); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2855 | |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2856 | return result; |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2857 | } |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15114
diff
changeset
|
2858 | |
|
15320
c4eea0409712
[gaim-migrate @ 18048]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15302
diff
changeset
|
2859 | |
| 15568 | 2860 | 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
|
2861 | int height, rowstride, i; |
|
30705
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2862 | unsigned char *pixels; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2863 | unsigned char *row; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2864 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2865 | if (!gdk_pixbuf_get_has_alpha(pixbuf)) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2866 | return TRUE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2867 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2868 | height = gdk_pixbuf_get_height (pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2869 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2870 | pixels = gdk_pixbuf_get_pixels (pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2871 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2872 | row = pixels; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2873 | for (i = 3; i < rowstride; i+=4) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2874 | if (row[i] < 0xfe) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2875 | return FALSE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2876 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2877 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2878 | for (i = 1; i < height - 1; i++) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2879 | row = pixels + (i * rowstride); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2880 | if (row[3] < 0xfe || row[rowstride - 1] < 0xfe) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2881 | return FALSE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2882 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2883 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2884 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2885 | row = pixels + ((height - 1) * rowstride); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2886 | for (i = 3; i < rowstride; i += 4) { |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2887 | if (row[i] < 0xfe) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2888 | return FALSE; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2889 | } |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2890 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2891 | return TRUE; |
| 15474 | 2892 | } |
| 2893 | ||
|
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
|
2894 | 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
|
2895 | int width, height, rowstride; |
|
30705
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2896 | guchar *pixels; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2897 | if (!gdk_pixbuf_get_has_alpha(pixbuf)) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2898 | return; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2899 | width = gdk_pixbuf_get_width(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2900 | height = gdk_pixbuf_get_height(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2901 | rowstride = gdk_pixbuf_get_rowstride(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2902 | pixels = gdk_pixbuf_get_pixels(pixbuf); |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2903 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2904 | if (width < 6 || height < 6) |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2905 | return; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2906 | /* Top left */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2907 | pixels[3] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2908 | pixels[7] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2909 | pixels[11] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2910 | pixels[rowstride + 3] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2911 | pixels[rowstride * 2 + 3] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2912 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2913 | /* Top right */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2914 | pixels[width * 4 - 1] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2915 | pixels[width * 4 - 5] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2916 | pixels[width * 4 - 9] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2917 | pixels[rowstride + (width * 4) - 1] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2918 | pixels[(2 * rowstride) + (width * 4) - 1] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2919 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2920 | /* Bottom left */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2921 | pixels[(height - 1) * rowstride + 3] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2922 | pixels[(height - 1) * rowstride + 7] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2923 | pixels[(height - 1) * rowstride + 11] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2924 | pixels[(height - 2) * rowstride + 3] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2925 | pixels[(height - 3) * rowstride + 3] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2926 | |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2927 | /* Bottom right */ |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2928 | pixels[height * rowstride - 1] = 0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2929 | pixels[(height - 1) * rowstride - 1] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2930 | pixels[(height - 2) * rowstride - 1] = 0xC0; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2931 | pixels[height * rowstride - 5] = 0x80; |
|
7ff782ca5089
Space-to-tab.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30688
diff
changeset
|
2932 | 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
|
2933 | } |
|
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
|
2934 | |
|
18278
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2935 | 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
|
2936 | static char dim_grey_string[8] = ""; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2937 | GtkStyle *style; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2938 | |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2939 | if (!widget) |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2940 | return "dim grey"; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2941 | |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2942 | style = gtk_widget_get_style(widget); |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2943 | if (!style) |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2944 | return "dim grey"; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25173
diff
changeset
|
2945 | |
|
18278
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2946 | 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
|
2947 | 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
|
2948 | 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
|
2949 | 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
|
2950 | return dim_grey_string; |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2951 | } |
|
06bf54cee797
Chat topics in status line of chat infopanes
Sean Egan <seanegan@pidgin.im>
parents:
18275
diff
changeset
|
2952 | |
|
20036
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2953 | static void |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2954 | combo_box_changed_cb(GtkComboBox *combo_box, GtkEntry *entry) |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2955 | { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2956 | char *text = gtk_combo_box_get_active_text(combo_box); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2957 | 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
|
2958 | 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
|
2959 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2960 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2961 | static gboolean |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2962 | entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBox *combo) |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2963 | { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2964 | if (key->keyval == GDK_Down || key->keyval == GDK_Up) { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2965 | gtk_combo_box_popup(combo); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2966 | 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
|
2967 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2968 | 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
|
2969 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2970 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2971 | GtkWidget * |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2972 | 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
|
2973 | { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2974 | GtkComboBox *ret = NULL; |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2975 | 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
|
2976 | |
|
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
|
2977 | 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
|
2978 | 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
|
2979 | gtk_container_add(GTK_CONTAINER(ret), 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
|
2980 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2981 | 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
|
2982 | 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
|
2983 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2984 | 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
|
2985 | 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
|
2986 | if (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
|
2987 | gtk_combo_box_append_text(ret, text); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2988 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2989 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2990 | 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
|
2991 | 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
|
2992 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2993 | 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
|
2994 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2995 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2996 | 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
|
2997 | { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2998 | return gtk_entry_get_text(GTK_ENTRY(GTK_BIN((widget))->child)); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
2999 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
3000 | |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
3001 | 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
|
3002 | { |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
3003 | gtk_entry_set_text(GTK_ENTRY(GTK_BIN((widget))->child), (text)); |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
3004 | } |
|
3bdbea94ad0c
Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
3005 | |
|
22131
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3006 | GtkWidget * |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3007 | 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
|
3008 | { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3009 | 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
|
3010 | 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
|
3011 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3012 | 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
|
3013 | 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
|
3014 | 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
|
3015 | 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
|
3016 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3017 | 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
|
3018 | 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
|
3019 | 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
|
3020 | 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
|
3021 | 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
|
3022 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3023 | 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
|
3024 | } else { |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3025 | 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
|
3026 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3027 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3028 | 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
|
3029 | 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
|
3030 | 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
|
3031 | 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
|
3032 | 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
|
3033 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3034 | |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3035 | 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
|
3036 | (*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
|
3037 | 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
|
3038 | } |
|
12b395dc8c59
Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22013
diff
changeset
|
3039 | |
|
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
|
3040 | 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
|
3041 | { |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3042 | #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
|
3043 | /* 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
|
3044 | * 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
|
3045 | #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
|
3046 | 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
|
3047 | 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
|
3048 | 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
|
3049 | 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
|
3050 | 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
|
3051 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3052 | 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
|
3053 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3054 | 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
|
3055 | _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
|
3056 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3057 | 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
|
3058 | _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
|
3059 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3060 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3061 | 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
|
3062 | 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
|
3063 | 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
|
3064 | 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
|
3065 | 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
|
3066 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3067 | 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
|
3068 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3069 | if (window == 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
|
3070 | !GTK_WIDGET_VISIBLE(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
|
3071 | 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
|
3072 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3073 | 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
|
3074 | 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
|
3075 | 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
|
3076 | 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
|
3077 | 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
|
3078 | 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
|
3079 | 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
|
3080 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3081 | 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
|
3082 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3083 | 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
|
3084 | 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
|
3085 | 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
|
3086 | 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
|
3087 | /* 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
|
3088 | * 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
|
3089 | */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3090 | 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
|
3091 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3092 | 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
|
3093 | 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
|
3094 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3095 | 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
|
3096 | #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
|
3097 | #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
|
3098 | /* 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
|
3099 | 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
|
3100 | 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
|
3101 | 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
|
3102 | 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
|
3103 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3104 | 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
|
3105 | /* 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
|
3106 | 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
|
3107 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3108 | /* 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
|
3109 | 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
|
3110 | /* 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
|
3111 | 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
|
3112 | 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
|
3113 | 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
|
3114 | */ |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3115 | } 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
|
3116 | 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
|
3117 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3118 | 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
|
3119 | 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
|
3120 | 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
|
3121 | 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
|
3122 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3123 | if (window == 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
|
3124 | !GTK_WIDGET_VISIBLE(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
|
3125 | 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
|
3126 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3127 | |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3128 | if (gtk_window_has_toplevel_focus(GTK_WINDOW(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
|
3129 | (menu && menu == window->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
|
3130 | 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
|
3131 | 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
|
3132 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3133 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3134 | 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
|
3135 | 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
|
3136 | 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
|
3137 | 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
|
3138 | 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
|
3139 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3140 | 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
|
3141 | #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
|
3142 | } |
|
386062b58867
Try to make a window transient for a suitable parent window. This currently
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22005
diff
changeset
|
3143 | |
|
31889
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3144 | 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
|
3145 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3146 | GObject *pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3147 | GdkPixbufLoader *loader; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3148 | 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
|
3149 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3150 | 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
|
3151 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3152 | 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
|
3153 | 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
|
3154 | "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
|
3155 | 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
|
3156 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3157 | 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
|
3158 | 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
|
3159 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3160 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3161 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3162 | 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
|
3163 | 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
|
3164 | "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
|
3165 | 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
|
3166 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3167 | 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
|
3168 | 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
|
3169 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3170 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3171 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3172 | if (animated) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3173 | 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
|
3174 | else |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3175 | 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
|
3176 | if (!pixbuf) { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3177 | 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
|
3178 | "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
|
3179 | 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
|
3180 | : "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
|
3181 | 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
|
3182 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3183 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3184 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3185 | 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
|
3186 | 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
|
3187 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3188 | return pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3189 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3190 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3191 | 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
|
3192 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3193 | 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
|
3194 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3195 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3196 | 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
|
3197 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3198 | 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
|
3199 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3200 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3201 | 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
|
3202 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3203 | 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
|
3204 | 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
|
3205 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3206 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3207 | 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
|
3208 | { |
|
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3209 | 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
|
3210 | 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
|
3211 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3212 | 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
|
3213 | 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
|
3214 | 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
|
3215 | "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
|
3216 | 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
|
3217 | filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3218 | 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
|
3219 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3220 | 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
|
3221 | if (pixbuf) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3222 | 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
|
3223 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3224 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3225 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3226 | return pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3227 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3228 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3229 | 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
|
3230 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3231 | GdkPixbuf *pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3232 | 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
|
3233 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3234 | 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
|
3235 | 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
|
3236 | 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
|
3237 | 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
|
3238 | "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
|
3239 | 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
|
3240 | filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3241 | 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
|
3242 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3243 | 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
|
3244 | if (pixbuf) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3245 | 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
|
3246 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3247 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3248 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3249 | return pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3250 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3251 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3252 | 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
|
3253 | { |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3254 | GdkPixbuf *pixbuf; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3255 | 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
|
3256 | |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3257 | 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
|
3258 | 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
|
3259 | 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
|
3260 | 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
|
3261 | "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
|
3262 | 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
|
3263 | filename, |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3264 | 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
|
3265 | if (error) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3266 | 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
|
3267 | if (pixbuf) |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3268 | 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
|
3269 | return NULL; |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3270 | } |
|
96183796df0c
Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents:
31565
diff
changeset
|
3271 | |
|
22897
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3272 | 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
|
3273 | } |
|
93d7ad160755
Add a utility function to create a pixbuf from a stored image.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22895
diff
changeset
|
3274 | |
|
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
|
3275 | static void url_copy(GtkWidget *w, gchar *url) |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3276 | { |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3277 | 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
|
3278 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3279 | 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
|
3280 | 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
|
3281 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3282 | 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
|
3283 | 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
|
3284 | } |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3285 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3286 | static gboolean |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3287 | link_context_menu(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *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
|
3288 | { |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3289 | GtkWidget *img, *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
|
3290 | const char *url; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3291 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3292 | url = gtk_imhtml_link_get_url(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
|
3293 | |
| 24992 | 3294 | /* 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
|
3295 | 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
|
3296 | 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
|
3297 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3298 | g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(gtk_imhtml_link_activate), 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
|
3299 | 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
|
3300 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3301 | /* 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
|
3302 | 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
|
3303 | 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
|
3304 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3305 | g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(url_copy), (gpointer)url); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3306 | 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
|
3307 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3308 | 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
|
3309 | } |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3310 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3311 | static gboolean |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3312 | copy_email_address(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *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
|
3313 | { |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3314 | GtkWidget *img, *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
|
3315 | const char *text; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3316 | 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
|
3317 | #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
|
3318 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3319 | text = gtk_imhtml_link_get_url(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
|
3320 | g_return_val_if_fail(text && strlen(text) > MAILTOSIZE, FALSE); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3321 | address = (char*)text + MAILTOSIZE; |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3322 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3323 | /* 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
|
3324 | 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
|
3325 | 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
|
3326 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3327 | g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(url_copy), 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
|
3328 | 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
|
3329 | |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3330 | 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
|
3331 | } |
|
f9dd7117ade0
Clean up some crufts. I think this is now mergeable with .next.minor.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24674
diff
changeset
|
3332 | |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3333 | static void |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3334 | file_open_uri(GtkIMHtml *imhtml, const char *uri) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3335 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3336 | /* 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
|
3337 | #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
|
3338 | /* 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
|
3339 | 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
|
3340 | 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
|
3341 | { |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3342 | 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
|
3343 | 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
|
3344 | 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
|
3345 | |
|
73c3b1db2364
Fix parameter types passed to ShellExecuteW(). One of these is just a warning
Daniel Atallah <datallah@pidgin.im>
parents:
32036
diff
changeset
|
3346 | 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
|
3347 | |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3348 | 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
|
3349 | 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
|
3350 | 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
|
3351 | } else { |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3352 | 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
|
3353 | 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
|
3354 | |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3355 | 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
|
3356 | 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
|
3357 | |
|
4377067bda01
Open an explorer.exe window at the location of the file when clicking
Mark Doliner <markdoliner@pidgin.im>
parents:
31889
diff
changeset
|
3358 | 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
|
3359 | } |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3360 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3361 | 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
|
3362 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3363 | purple_notify_error(imhtml, NULL, |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3364 | _("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
|
3365 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3366 | 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
|
3367 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3368 | purple_notify_error(imhtml, NULL, |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3369 | _("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
|
3370 | 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
|
3371 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3372 | #else |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3373 | 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
|
3374 | 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
|
3375 | 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
|
3376 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3377 | 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
|
3378 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3379 | 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
|
3380 | 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
|
3381 | 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
|
3382 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3383 | 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
|
3384 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3385 | 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
|
3386 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3387 | 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
|
3388 | 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
|
3389 | else |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3390 | 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
|
3391 | 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
|
3392 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3393 | else |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3394 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3395 | 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
|
3396 | return; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3397 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3398 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3399 | 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
|
3400 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3401 | 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
|
3402 | 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
|
3403 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3404 | 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
|
3405 | uri, error->message); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3406 | purple_notify_error(imhtml, NULL, _("Unable to open file."), tmp); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3407 | 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
|
3408 | 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
|
3409 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3410 | 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
|
3411 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3412 | 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
|
3413 | 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
|
3414 | 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
|
3415 | purple_notify_error(imhtml, NULL, primary, secondary); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3416 | 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
|
3417 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3418 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3419 | #endif |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3420 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3421 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3422 | #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
|
3423 | static gboolean |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3424 | file_clicked_cb(GtkIMHtml *imhtml, GtkIMHtmlLink *link) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3425 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3426 | const char *uri = gtk_imhtml_link_get_url(link) + FILELINKSIZE; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3427 | file_open_uri(imhtml, uri); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3428 | 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
|
3429 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3430 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3431 | static gboolean |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3432 | open_containing_cb(GtkIMHtml *imhtml, const char *url) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3433 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3434 | char *dir = g_path_get_dirname(url + FILELINKSIZE); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3435 | file_open_uri(imhtml, dir); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3436 | 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
|
3437 | 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
|
3438 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3439 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3440 | static gboolean |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3441 | file_context_menu(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *menu) |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3442 | { |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3443 | GtkWidget *img, *item; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3444 | const char *url; |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3445 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3446 | url = gtk_imhtml_link_get_url(link); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3447 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3448 | /* 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
|
3449 | 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
|
3450 | 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
|
3451 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3452 | g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(gtk_imhtml_link_activate), link); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3453 | 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
|
3454 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3455 | /* 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
|
3456 | 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
|
3457 | 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
|
3458 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
3459 | |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3460 | g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(open_containing_cb), (gpointer)url); |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3461 | 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
|
3462 | |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3463 | 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
|
3464 | } |
|
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3465 | |
|
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
|
3466 | #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
|
3467 | 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
|
3468 | audio_clicked_cb(GtkIMHtml *imhtml, GtkIMHtmlLink *link) |
|
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
|
3469 | { |
|
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
|
3470 | const char *uri; |
|
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
|
3471 | PidginConversation *conv = g_object_get_data(G_OBJECT(imhtml), "gtkconv"); |
|
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
|
3472 | 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
|
3473 | 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
|
3474 | uri = gtk_imhtml_link_get_url(link) + AUDIOLINKSIZE; |
|
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
|
3475 | purple_sound_play_file(uri, NULL); |
|
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
|
3476 | 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
|
3477 | } |
|
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
|
3478 | |
|
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
|
3479 | 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
|
3480 | 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
|
3481 | { |
|
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
|
3482 | 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
|
3483 | 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
|
3484 | 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
|
3485 | 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
|
3486 | |
|
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
|
3487 | 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
|
3488 | 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
|
3489 | 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
|
3490 | g_error_free(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
|
3491 | 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
|
3492 | } |
|
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
|
3493 | |
|
27820
dbce81931c2b
Use purple_util_write_data_to_file_absolute. Closes #9688.
Paul Aurich <darkrain42@pidgin.im>
parents:
27695
diff
changeset
|
3494 | 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
|
3495 | 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
|
3496 | 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
|
3497 | } |
|
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
|
3498 | } |
|
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
|
3499 | |
|
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
|
3500 | 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
|
3501 | 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
|
3502 | { |
|
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
|
3503 | PidginConversation *conv = g_object_get_data(G_OBJECT(item), "gtkconv"); |
|
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
|
3504 | if (!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
|
3505 | 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
|
3506 | purple_request_file(conv->active_conv, _("Save File"), NULL, 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
|
3507 | G_CALLBACK(savefile_write_cb), NULL, |
|
32620
a5c32f843d18
Use purple_conversation accessor methods.
Andrew Victor <andrew.victor@mxit.com>
parents:
32577
diff
changeset
|
3508 | purple_conversation_get_account(conv->active_conv), NULL, conv->active_conv, |
|
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
|
3509 | (void *)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
|
3510 | 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
|
3511 | } |
|
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
|
3512 | |
|
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
|
3513 | 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
|
3514 | audio_context_menu(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *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
|
3515 | { |
|
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
|
3516 | GtkWidget *img, *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
|
3517 | 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
|
3518 | PidginConversation *conv = g_object_get_data(G_OBJECT(imhtml), "gtkconv"); |
|
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
|
3519 | 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
|
3520 | 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
|
3521 | |
|
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
|
3522 | url = gtk_imhtml_link_get_url(link); |
|
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
|
3523 | |
|
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
|
3524 | /* 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
|
3525 | 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
|
3526 | 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
|
3527 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28234
diff
changeset
|
3528 | |
|
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
|
3529 | g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(gtk_imhtml_link_activate), link); |
|
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
|
3530 | 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
|
3531 | |
|
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
|
3532 | /* 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
|
3533 | 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
|
3534 | 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
|
3535 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img); |
|
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
|
3536 | g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(save_file_cb), (gpointer)(url+AUDIOLINKSIZE)); |
|
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
|
3537 | 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
|
3538 | 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
|
3539 | |
|
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
|
3540 | 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
|
3541 | } |
|
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
|
3542 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3543 | /* 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
|
3544 | static gboolean |
|
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
|
3545 | open_dialog(GtkIMHtml *imhtml, GtkIMHtmlLink *link) |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3546 | { |
|
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
|
3547 | 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
|
3548 | 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
|
3549 | |
|
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
|
3550 | url = gtk_imhtml_link_get_url(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
|
3551 | 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
|
3552 | return FALSE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3553 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3554 | 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
|
3555 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3556 | 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
|
3557 | 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
|
3558 | 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
|
3559 | 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
|
3560 | else |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3561 | return FALSE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3562 | return TRUE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3563 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3564 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3565 | static gboolean |
|
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
|
3566 | dummy(GtkIMHtml *imhtml, GtkIMHtmlLink *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
|
3567 | { |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3568 | return TRUE; |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3569 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3570 | |
|
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
|
3571 | static gboolean |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3572 | register_gnome_url_handlers(void) |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3573 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3574 | char *tmp; |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3575 | char *err; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3576 | char *c; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3577 | char *start; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3578 | |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3579 | 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
|
3580 | if (tmp == NULL) |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3581 | return FALSE; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3582 | |
|
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
|
3583 | g_free(tmp); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3584 | 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
|
3585 | |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3586 | 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
|
3587 | &tmp, &err, NULL, NULL)) |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3588 | { |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3589 | g_free(tmp); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3590 | g_free(err); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3591 | g_return_val_if_reached(FALSE); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3592 | } |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3593 | g_free(err); |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3594 | err = NULL; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3595 | |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3596 | for (c = start = tmp ; *c ; c++) |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3597 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3598 | /* Skip leading spaces. */ |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3599 | if (c == start && *c == ' ') |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3600 | start = c + 1; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3601 | else if (*c == '\n') |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3602 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3603 | *c = '\0'; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3604 | 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
|
3605 | { |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3606 | char *cmd; |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3607 | char *tmp2 = NULL; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3608 | char *protocol; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3609 | |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3610 | /* 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
|
3611 | 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
|
3612 | 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
|
3613 | { |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3614 | g_free(err); |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3615 | err = NULL; |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3616 | if (!strcmp(tmp2, "false\n")) |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3617 | { |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3618 | g_free(tmp2); |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3619 | g_free(cmd); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3620 | start = c + 1; |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3621 | continue; |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3622 | } |
|
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3623 | } |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3624 | g_free(cmd); |
|
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3625 | g_free(tmp2); |
|
24998
12caddc17a20
Finish up the GNOME URL handler code:
Richard Laager <rlaager@pidgin.im>
parents:
24997
diff
changeset
|
3626 | |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3627 | 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
|
3628 | |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3629 | 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
|
3630 | registered_url_handlers = g_slist_prepend(registered_url_handlers, protocol); |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3631 | gtk_imhtml_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
|
3632 | } |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3633 | start = c + 1; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3634 | } |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3635 | } |
|
25012
7a6cb07f2366
Cleanup the GNOME URL registration code
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
25009
diff
changeset
|
3636 | g_free(tmp); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3637 | |
|
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
|
3638 | return (registered_url_handlers != NULL); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3639 | } |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3640 | |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3641 | #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
|
3642 | 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
|
3643 | 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
|
3644 | { |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3645 | 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
|
3646 | 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
|
3647 | |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3648 | do { |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3649 | DWORD nameSize = 256; |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3650 | wchar_t start[256]; |
|
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3651 | 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
|
3652 | 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
|
3653 | 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
|
3654 | HKEY reg_key = NULL; |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3655 | 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
|
3656 | if (ret == ERROR_SUCCESS) { |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3657 | 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
|
3658 | if (ret == ERROR_SUCCESS) { |
|
29629
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3659 | 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
|
3660 | gchar *protocol = g_strdup_printf("%s:", utf8); |
|
585cdb37b3c8
Handle non-ASCII protocol names on Win32
Daniel Atallah <datallah@pidgin.im>
parents:
29627
diff
changeset
|
3661 | 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
|
3662 | 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
|
3663 | /* We still pass everything to the "http" "open" handler for security reasons */ |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3664 | gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3665 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3666 | 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
|
3667 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3668 | 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
|
3669 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3670 | } 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
|
3671 | |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3672 | 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
|
3673 | 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
|
3674 | ret); |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3675 | } |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3676 | #endif |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3677 | |
|
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
|
3678 | 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
|
3679 | 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
|
3680 | { |
|
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
|
3681 | 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
|
3682 | |
|
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
|
3683 | 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
|
3684 | 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
|
3685 | 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
|
3686 | 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
|
3687 | 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
|
3688 | 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
|
3689 | if (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
|
3690 | if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal) |
|
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
|
3691 | 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
|
3692 | 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
|
3693 | 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
|
3694 | } |
|
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
|
3695 | 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
|
3696 | } |
|
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
|
3697 | |
|
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
|
3698 | 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
|
3699 | } |
|
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
|
3700 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3701 | 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
|
3702 | { |
|
25008
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3703 | gtk_imhtml_class_register_protocol("http://", url_clicked_cb, link_context_menu); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3704 | gtk_imhtml_class_register_protocol("https://", url_clicked_cb, link_context_menu); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3705 | gtk_imhtml_class_register_protocol("ftp://", url_clicked_cb, link_context_menu); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3706 | gtk_imhtml_class_register_protocol("gopher://", url_clicked_cb, link_context_menu); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3707 | gtk_imhtml_class_register_protocol("mailto:", url_clicked_cb, copy_email_address); |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3708 | |
|
27656
0eaa3f40d459
Install a custom GtkIMHtml procol handler for the "file://" type which
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27525
diff
changeset
|
3709 | gtk_imhtml_class_register_protocol("file://", file_clicked_cb, file_context_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
|
3710 | gtk_imhtml_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
|
3711 | |
|
25015
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3712 | /* Example custom URL handler. */ |
|
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3713 | gtk_imhtml_class_register_protocol("open://", open_dialog, dummy); |
|
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3714 | |
|
b748dd8a5633
Remove all the special-casing in the GNOME URL handler registration.
Richard Laager <rlaager@pidgin.im>
parents:
25012
diff
changeset
|
3715 | /* 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
|
3716 | 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
|
3717 | 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
|
3718 | |
|
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
|
3719 | /* 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
|
3720 | 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
|
3721 | "{\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
|
3722 | "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
|
3723 | "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
|
3724 | "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
|
3725 | "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
|
3726 | "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
|
3727 | "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
|
3728 | "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
|
3729 | "}\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
|
3730 | "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
|
3731 | |
|
28673
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3732 | #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
|
3733 | 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
|
3734 | #endif |
|
f6f0113c1a6c
Register URL handlers for everything that Windows has knows about like we do
Daniel Atallah <datallah@pidgin.im>
parents:
28474
diff
changeset
|
3735 | |
|
24674
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3736 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3737 | |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3738 | 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
|
3739 | { |
|
25008
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3740 | gtk_imhtml_class_register_protocol("open://", NULL, NULL); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3741 | |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3742 | /* 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
|
3743 | if (registered_url_handlers) |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3744 | { |
|
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
|
3745 | 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
|
3746 | 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
|
3747 | { |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3748 | gtk_imhtml_class_register_protocol((char *)l->data, NULL, NULL); |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3749 | g_free(l->data); |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3750 | } |
|
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
|
3751 | 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
|
3752 | registered_url_handlers = NULL; |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3753 | return; |
|
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3754 | } |
|
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
|
3755 | |
|
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
|
3756 | gtk_imhtml_class_register_protocol("audio://", NULL, NULL); |
|
27676
a1991c15288f
Set the "Open Containing Directory" icon to the "directory" stock icon
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27656
diff
changeset
|
3757 | gtk_imhtml_class_register_protocol("file://", NULL, NULL); |
|
24997
de02784645a2
First round of GNOME URL handler support.
Richard Laager <rlaager@pidgin.im>
parents:
24992
diff
changeset
|
3758 | |
|
25008
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3759 | gtk_imhtml_class_register_protocol("http://", NULL, NULL); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3760 | gtk_imhtml_class_register_protocol("https://", NULL, NULL); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3761 | gtk_imhtml_class_register_protocol("ftp://", NULL, NULL); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3762 | gtk_imhtml_class_register_protocol("mailto:", NULL, NULL); |
|
f52b9372eb19
Revert the URL scheme passing changes, keeping the miscellaneous other stuff
Richard Laager <rlaager@pidgin.im>
parents:
25007
diff
changeset
|
3763 | gtk_imhtml_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
|
3764 | } |
|
36bf974a7d78
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24672
diff
changeset
|
3765 |