static void selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) { PurplePlugin *plugin = current; char *text; GList *list = NULL, *iter = NULL; if (!plugin) return; /* If the selected plugin was unseen before, mark it as seen. But save the list * only when the plugin list is closed. So if the user enables a plugin, and it * crashes, it won't get marked as seen so the user can fix the bug and still * quickly find the plugin in the list. * I probably mean 'plugin developers' by 'users' here. */ list = g_object_get_data(G_OBJECT(widget), "seen-list"); if (list) iter = g_list_find_custom(list, plugin->path, (GCompareFunc)strcmp); if (!iter) { list = g_list_prepend(list, g_strdup(plugin->path)); g_object_set_data(G_OBJECT(widget), "seen-list", list); } /* XXX: Use formatting and stuff */ gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), SAFE(_(plugin->info->name)), SAFE(_(plugin->info->version)), SAFE(_(plugin->info->description)), SAFE(_(plugin->info->author)), SAFE(_(plugin->info->homepage)), SAFE(plugin->path)); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), text, GNT_TEXT_FLAG_NORMAL); gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); g_free(text); decide_conf_button(plugin); }
static void roomlist_selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) { GList *iter, *field; PurpleRoomlistRoom *room = current; GntTextView *tv = GNT_TEXT_VIEW(froomlist.details); gboolean first = TRUE; gnt_text_view_clear(tv); if (!room) return; for (iter = purple_roomlist_room_get_fields(room), field = purple_roomlist_get_fields(froomlist.roomlist); iter && field; iter = iter->next, field = field->next) { PurpleRoomlistField *f = field->data; char *label = NULL; if (purple_roomlist_field_get_hidden(f)) { continue; } if (!first) gnt_text_view_append_text_with_flags(tv, "\n", GNT_TEXT_FLAG_NORMAL); gnt_text_view_append_text_with_flags(tv, purple_roomlist_field_get_label(f), GNT_TEXT_FLAG_BOLD); gnt_text_view_append_text_with_flags(tv, ": ", GNT_TEXT_FLAG_BOLD); switch (purple_roomlist_field_get_type(f)) { case PURPLE_ROOMLIST_FIELD_BOOL: label = g_strdup(iter->data ? "True" : "False"); break; case PURPLE_ROOMLIST_FIELD_INT: label = g_strdup_printf("%d", (int)iter->data); break; case PURPLE_ROOMLIST_FIELD_STRING: label = g_strdup(iter->data); break; } gnt_text_view_append_text_with_flags(tv, label, GNT_TEXT_FLAG_NORMAL); g_free(label); first = FALSE; } if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { if (!first) gnt_text_view_append_text_with_flags(tv, "\n", GNT_TEXT_FLAG_NORMAL); gnt_text_view_append_text_with_flags(tv, _("Hit 'Enter' to find more rooms of this category."), GNT_TEXT_FLAG_NORMAL); } }
static void selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) { PurplePlugin *plugin = current; PurplePluginInfo *info; char *text, *authors = NULL; const char * const *authorlist; GList *list = NULL, *iter = NULL; if (!plugin) return; info = purple_plugin_get_info(plugin); authorlist = purple_plugin_info_get_authors(info); if (authorlist) authors = g_strjoinv(", ", (gchar **)authorlist); /* If the selected plugin was unseen before, mark it as seen. But save the list * only when the plugin list is closed. So if the user enables a plugin, and it * crashes, it won't get marked as seen so the user can fix the bug and still * quickly find the plugin in the list. * I probably mean 'plugin developers' by 'users' here. */ list = g_object_get_data(G_OBJECT(widget), "seen-list"); if (list) iter = g_list_find_custom(list, purple_plugin_get_filename(plugin), (GCompareFunc)strcmp); if (!iter) { list = g_list_prepend(list, g_strdup(purple_plugin_get_filename(plugin))); g_object_set_data(G_OBJECT(widget), "seen-list", list); } /* XXX: Use formatting and stuff */ gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); text = g_strdup_printf((g_strv_length((gchar **)authorlist) > 1 ? _("Name: %s\nVersion: %s\nDescription: %s\nAuthors: %s\nWebsite: %s\nFilename: %s\n") : _("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n")), SAFE(_(purple_plugin_info_get_name(info))), SAFE(_(purple_plugin_info_get_version(info))), SAFE(_(purple_plugin_info_get_description(info))), SAFE(authors), SAFE(_(purple_plugin_info_get_website(info))), SAFE(purple_plugin_get_filename(plugin))); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), text, GNT_TEXT_FLAG_NORMAL); gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); g_free(text); g_free(authors); decide_conf_button(plugin); }
static void * finch_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info) { char *primary; char *info; void *ui_handle; char *key = userinfo_hash(purple_connection_get_account(gc), who); info = purple_notify_user_info_get_xhtml(user_info); ui_handle = g_hash_table_lookup(userinfo, key); if (ui_handle != NULL) { GntTextView *msg = GNT_TEXT_VIEW(g_object_get_data(G_OBJECT(ui_handle), "info-widget")); char *strip = purple_markup_strip_html(info); int tvw, tvh, width, height, ntvw, ntvh; while (GNT_WIDGET(ui_handle)->parent) ui_handle = GNT_WIDGET(ui_handle)->parent; gnt_widget_get_size(GNT_WIDGET(ui_handle), &width, &height); gnt_widget_get_size(GNT_WIDGET(msg), &tvw, &tvh); gnt_text_view_clear(msg); if (!gnt_util_parse_xhtml_to_textview(info, msg)) gnt_text_view_append_text_with_flags(msg, strip, GNT_TEXT_FLAG_NORMAL); gnt_text_view_scroll(msg, 0); gnt_util_get_text_bound(strip, &ntvw, &ntvh); ntvw += 3; ntvh++; gnt_screen_resize_widget(GNT_WIDGET(ui_handle), width + MAX(0, ntvw - tvw), height + MAX(0, ntvh - tvh)); g_free(strip); g_free(key); } else { primary = g_strdup_printf(_("Info for %s"), who); ui_handle = finch_notify_formatted(_("Buddy Information"), primary, NULL, info); g_hash_table_insert(userinfo, key, ui_handle); g_free(primary); g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key); } g_free(info); return ui_handle; }
static void clear_debug_win(GntWidget *w, GntTextView *tv) { gnt_text_view_clear(tv); }