| 18 * along with this program; if not, write to the Free Software |
18 * along with this program; if not, write to the Free Software |
| 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 20 */ |
20 */ |
| 21 #define _PIDGIN_GTKDIALOGS_C_ |
21 #define _PIDGIN_GTKDIALOGS_C_ |
| 22 |
22 |
| |
23 #include <talkatu.h> |
| |
24 |
| 23 #include "internal.h" |
25 #include "internal.h" |
| 24 #include "pidgin.h" |
26 #include "pidgin.h" |
| 25 #include "package_revision.h" |
27 #include "package_revision.h" |
| 26 #ifdef HAVE_MESON_CONFIG |
28 #ifdef HAVE_MESON_CONFIG |
| 27 #include "meson-config.h" |
29 #include "meson-config.h" |
| 111 |
112 |
| 112 /* Note: Frees 'string' */ |
113 /* Note: Frees 'string' */ |
| 113 static GtkWidget * |
114 static GtkWidget * |
| 114 pidgin_build_help_dialog(const char *title, const char *role, GString *string) |
115 pidgin_build_help_dialog(const char *title, const char *role, GString *string) |
| 115 { |
116 { |
| 116 GtkWidget *win, *vbox, *frame, *logo, *webview, *button; |
117 GtkWidget *win, *vbox, *logo, *view, *button; |
| 117 GdkPixbuf *pixbuf; |
118 GdkPixbuf *pixbuf; |
| |
119 GtkTextBuffer *buffer; |
| 118 AtkObject *obj; |
120 AtkObject *obj; |
| 119 char *filename, *tmp; |
121 char *filename, *tmp; |
| 120 |
122 |
| 121 win = pidgin_create_dialog(title, 0, role, TRUE); |
123 win = pidgin_create_dialog(title, 0, role, TRUE); |
| 122 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 0); |
124 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 0); |
| 125 /* Generate a logo with a version number */ |
127 /* Generate a logo with a version number */ |
| 126 filename = g_build_filename(PURPLE_DATADIR, |
128 filename = g_build_filename(PURPLE_DATADIR, |
| 127 "pixmaps", "pidgin", "logo.png", NULL); |
129 "pixmaps", "pidgin", "logo.png", NULL); |
| 128 pixbuf = pidgin_pixbuf_new_from_file(filename); |
130 pixbuf = pidgin_pixbuf_new_from_file(filename); |
| 129 g_free(filename); |
131 g_free(filename); |
| 130 |
|
| 131 #if 0 /* Don't versionize the logo when the logo has the version in it */ |
|
| 132 pidgin_logo_versionize(&pixbuf, logo); |
|
| 133 #endif |
|
| 134 |
132 |
| 135 /* Insert the logo */ |
133 /* Insert the logo */ |
| 136 logo = gtk_image_new_from_pixbuf(pixbuf); |
134 logo = gtk_image_new_from_pixbuf(pixbuf); |
| 137 if (pixbuf) |
135 if (pixbuf) |
| 138 g_object_unref(G_OBJECT(pixbuf)); |
136 g_object_unref(G_OBJECT(pixbuf)); |
| 140 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL); |
138 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL); |
| 141 atk_object_set_description(obj, tmp); |
139 atk_object_set_description(obj, tmp); |
| 142 g_free(tmp); |
140 g_free(tmp); |
| 143 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); |
141 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); |
| 144 |
142 |
| 145 frame = pidgin_create_webview(FALSE, &webview, NULL); |
143 buffer = talkatu_html_buffer_new(); |
| 146 pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(webview), PIDGIN_WEBVIEW_ALL ^ PIDGIN_WEBVIEW_SMILEY); |
144 talkatu_markup_append_html(TALKATU_BUFFER(buffer), string->str, -1); |
| 147 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
145 |
| 148 |
146 view = talkatu_view_new_with_buffer(buffer); |
| 149 pidgin_webview_append_html(PIDGIN_WEBVIEW(webview), string->str); |
147 gtk_box_pack_start(GTK_BOX(vbox), view, TRUE, TRUE, 0); |
| 150 |
148 |
| 151 button = pidgin_dialog_add_button(GTK_DIALOG(win), _("_Close"), |
149 button = pidgin_dialog_add_button(GTK_DIALOG(win), _("_Close"), |
| 152 G_CALLBACK(destroy_win), win); |
150 G_CALLBACK(destroy_win), win); |
| 153 |
151 |
| 154 gtk_widget_set_can_default(button, TRUE); |
152 gtk_widget_set_can_default(button, TRUE); |
| 242 g_free(pauthors); |
240 g_free(pauthors); |
| 243 g_free(authors); |
241 g_free(authors); |
| 244 } |
242 } |
| 245 g_list_free(plugins); |
243 g_list_free(plugins); |
| 246 |
244 |
| 247 g_string_append(str, "</dl>"); |
245 g_string_append(str, "</dl><br/>"); |
| 248 |
246 |
| 249 plugins_info = pidgin_build_help_dialog(title, "plugins_info", str); |
247 plugins_info = pidgin_build_help_dialog(title, "plugins_info", str); |
| 250 g_signal_connect(G_OBJECT(plugins_info), "destroy", |
248 g_signal_connect(G_OBJECT(plugins_info), "destroy", |
| 251 G_CALLBACK(gtk_widget_destroyed), &plugins_info); |
249 G_CALLBACK(gtk_widget_destroyed), &plugins_info); |
| 252 g_free(title); |
250 g_free(title); |