| 53 void |
53 void |
| 54 pidgin_dialogs_destroy_all() |
54 pidgin_dialogs_destroy_all() |
| 55 { |
55 { |
| 56 g_list_free_full(dialogwindows, (GDestroyNotify)gtk_widget_destroy); |
56 g_list_free_full(dialogwindows, (GDestroyNotify)gtk_widget_destroy); |
| 57 dialogwindows = NULL; |
57 dialogwindows = NULL; |
| 58 } |
|
| 59 |
|
| 60 static void destroy_win(GtkWidget *button, GtkWidget *win) |
|
| 61 { |
|
| 62 gtk_widget_destroy(win); |
|
| 63 } |
|
| 64 |
|
| 65 #if 0 |
|
| 66 /* This function puts the version number onto the pixmap we use in the 'about' |
|
| 67 * screen in Pidgin. */ |
|
| 68 static void |
|
| 69 pidgin_logo_versionize(GdkPixbuf **original, GtkWidget *widget) { |
|
| 70 GdkPixmap *pixmap; |
|
| 71 GtkStyle *style; |
|
| 72 PangoContext *context; |
|
| 73 PangoLayout *layout; |
|
| 74 gchar *markup; |
|
| 75 gint width, height; |
|
| 76 gint lwidth = 0, lheight = 0; |
|
| 77 |
|
| 78 style = gtk_widget_get_style(widget); |
|
| 79 |
|
| 80 gdk_pixbuf_render_pixmap_and_mask(*original, &pixmap, NULL, 255); |
|
| 81 width = gdk_pixbuf_get_width(*original); |
|
| 82 height = gdk_pixbuf_get_height(*original); |
|
| 83 g_object_unref(G_OBJECT(*original)); |
|
| 84 |
|
| 85 context = gtk_widget_get_pango_context(widget); |
|
| 86 layout = pango_layout_new(context); |
|
| 87 |
|
| 88 markup = g_strdup_printf("<span foreground=\"#000000\">%s</span>", DISPLAY_VERSION); |
|
| 89 pango_layout_set_font_description(layout, style->font_desc); |
|
| 90 pango_layout_set_markup(layout, markup, strlen(markup)); |
|
| 91 g_free(markup); |
|
| 92 |
|
| 93 pango_layout_get_pixel_size(layout, &lwidth, &lheight); |
|
| 94 gdk_draw_layout(GDK_DRAWABLE(pixmap), style->bg_gc[GTK_STATE_NORMAL], |
|
| 95 width - (lwidth + 3), 1, layout); |
|
| 96 g_object_unref(G_OBJECT(layout)); |
|
| 97 |
|
| 98 *original = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, |
|
| 99 0, 0, 0, 0, |
|
| 100 width, height); |
|
| 101 g_object_unref(G_OBJECT(pixmap)); |
|
| 102 } |
|
| 103 #endif |
|
| 104 |
|
| 105 /* Note: Frees 'string' */ |
|
| 106 static GtkWidget * |
|
| 107 pidgin_build_help_dialog(const char *title, const char *role, GString *string) |
|
| 108 { |
|
| 109 GtkWidget *win, *vbox, *logo, *view, *button; |
|
| 110 GdkPixbuf *pixbuf; |
|
| 111 GtkTextBuffer *buffer; |
|
| 112 AtkObject *obj; |
|
| 113 char *filename, *tmp; |
|
| 114 |
|
| 115 win = pidgin_dialog_new(title, 0, role, TRUE); |
|
| 116 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 0); |
|
| 117 gtk_window_set_default_size(GTK_WINDOW(win), 475, 450); |
|
| 118 |
|
| 119 /* Generate a logo with a version number */ |
|
| 120 filename = g_build_filename(PURPLE_DATADIR, |
|
| 121 "pixmaps", "pidgin", "logo.png", NULL); |
|
| 122 pixbuf = pidgin_pixbuf_new_from_file(filename); |
|
| 123 g_free(filename); |
|
| 124 |
|
| 125 /* Insert the logo */ |
|
| 126 logo = gtk_image_new_from_pixbuf(pixbuf); |
|
| 127 if (pixbuf) |
|
| 128 g_object_unref(G_OBJECT(pixbuf)); |
|
| 129 obj = gtk_widget_get_accessible(logo); |
|
| 130 tmp = g_strconcat(PIDGIN_NAME, " " DISPLAY_VERSION, NULL); |
|
| 131 atk_object_set_description(obj, tmp); |
|
| 132 g_free(tmp); |
|
| 133 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 0); |
|
| 134 |
|
| 135 buffer = talkatu_html_buffer_new(); |
|
| 136 talkatu_markup_append_html(TALKATU_BUFFER(buffer), string->str, -1); |
|
| 137 |
|
| 138 view = talkatu_view_new_with_buffer(buffer); |
|
| 139 gtk_box_pack_start(GTK_BOX(vbox), view, TRUE, TRUE, 0); |
|
| 140 |
|
| 141 button = pidgin_dialog_add_button(GTK_DIALOG(win), _("_Close"), |
|
| 142 G_CALLBACK(destroy_win), win); |
|
| 143 |
|
| 144 gtk_widget_set_can_default(button, TRUE); |
|
| 145 gtk_widget_grab_default(button); |
|
| 146 |
|
| 147 gtk_widget_show_all(win); |
|
| 148 gtk_window_present(GTK_WINDOW(win)); |
|
| 149 |
|
| 150 g_string_free(string, TRUE); |
|
| 151 |
|
| 152 return win; |
|
| 153 } |
|
| 154 |
|
| 155 void pidgin_dialogs_plugins_info(void) |
|
| 156 { |
|
| 157 GString *str; |
|
| 158 GList *plugins, *l = NULL; |
|
| 159 PurplePlugin *plugin = NULL; |
|
| 160 PurplePluginInfo *info; |
|
| 161 GPluginPluginInfo *ginfo; |
|
| 162 PurplePluginExtraCb extra_cb; |
|
| 163 char *title = g_strdup_printf(_("%s Plugin Information"), PIDGIN_NAME); |
|
| 164 char *pname = NULL, *authors, *pauthors, *pextra; |
|
| 165 const char *pver, *plicense, *pwebsite, *pid; |
|
| 166 gboolean ploaded, ploadable; |
|
| 167 const char * const *authorlist; |
|
| 168 guint n_authors; |
|
| 169 static GtkWidget *plugins_info = NULL; |
|
| 170 |
|
| 171 str = g_string_sized_new(4096); |
|
| 172 |
|
| 173 g_string_append_printf(str, "<h2>%s</h2><dl>", _("Plugin Information")); |
|
| 174 |
|
| 175 plugins = purple_plugins_find_all(); |
|
| 176 |
|
| 177 for(l = plugins; l; l = l->next) { |
|
| 178 plugin = PURPLE_PLUGIN(l->data); |
|
| 179 info = purple_plugin_get_info(plugin); |
|
| 180 ginfo = GPLUGIN_PLUGIN_INFO(info); |
|
| 181 extra_cb = purple_plugin_info_get_extra_cb(info); |
|
| 182 |
|
| 183 pname = g_markup_escape_text( |
|
| 184 gplugin_plugin_info_get_name(ginfo), -1); |
|
| 185 authorlist = gplugin_plugin_info_get_authors(ginfo); |
|
| 186 |
|
| 187 if (authorlist) { |
|
| 188 authors = g_strjoinv(", ", (gchar **)authorlist); |
|
| 189 n_authors = g_strv_length((gchar **)authorlist); |
|
| 190 } else { |
|
| 191 authors = NULL; |
|
| 192 n_authors = 0; |
|
| 193 } |
|
| 194 |
|
| 195 if (authors) |
|
| 196 pauthors = g_markup_escape_text(authors, -1); |
|
| 197 else |
|
| 198 pauthors = NULL; |
|
| 199 |
|
| 200 pver = gplugin_plugin_info_get_version(ginfo); |
|
| 201 plicense = gplugin_plugin_info_get_license_id(ginfo); |
|
| 202 pwebsite = gplugin_plugin_info_get_website(ginfo); |
|
| 203 pid = gplugin_plugin_info_get_id(ginfo); |
|
| 204 ploadable = !purple_plugin_info_get_error(info); |
|
| 205 ploaded = purple_plugin_is_loaded(plugin); |
|
| 206 |
|
| 207 if (ploaded && extra_cb) |
|
| 208 pextra = extra_cb(plugin); |
|
| 209 else |
|
| 210 pextra = NULL; |
|
| 211 |
|
| 212 g_string_append_printf(str, "<dt>%s</dt><dd>", pname); |
|
| 213 if (pauthors) { |
|
| 214 g_string_append_printf(str, "<b>%s:</b> %s<br/>", |
|
| 215 (n_authors > 1 ? "Authors" : "Author"), |
|
| 216 pauthors); |
|
| 217 } |
|
| 218 g_string_append_printf(str, |
|
| 219 "<b>Version:</b> %s<br/>" |
|
| 220 "<b>License:</b> %s<br/>" |
|
| 221 "<b>Website:</b> %s<br/>" |
|
| 222 "<b>ID String:</b> %s<br/>" |
|
| 223 "<b>Extra:</b> %s<br/>" |
|
| 224 "<b>Loadable:</b> %s<br/>" |
|
| 225 "<b>Loaded:</b> %s" |
|
| 226 "</dd><br/>", |
|
| 227 pver ? pver : "", |
|
| 228 plicense ? plicense : "", |
|
| 229 pwebsite ? pwebsite : "", |
|
| 230 pid, |
|
| 231 pextra ? pextra : "", |
|
| 232 ploadable ? "Yes" : "<span style=\"color: #FF0000;\"><b>No</b></span>", |
|
| 233 ploaded ? "Yes" : "No"); |
|
| 234 |
|
| 235 g_free(pname); |
|
| 236 g_free(pextra); |
|
| 237 g_free(pauthors); |
|
| 238 g_free(authors); |
|
| 239 } |
|
| 240 g_list_free(plugins); |
|
| 241 |
|
| 242 g_string_append(str, "</dl><br/>"); |
|
| 243 |
|
| 244 plugins_info = pidgin_build_help_dialog(title, "plugins_info", str); |
|
| 245 g_signal_connect(G_OBJECT(plugins_info), "destroy", |
|
| 246 G_CALLBACK(gtk_widget_destroyed), &plugins_info); |
|
| 247 g_free(title); |
|
| 248 } |
58 } |
| 249 |
59 |
| 250 static void |
60 static void |
| 251 pidgin_dialogs_im_cb(gpointer data, PurpleRequestFields *fields) |
61 pidgin_dialogs_im_cb(gpointer data, PurpleRequestFields *fields) |
| 252 { |
62 { |