本文整理匯總了C++中GNT_TREE函數的典型用法代碼示例。如果您正苦於以下問題:C++ GNT_TREE函數的具體用法?C++ GNT_TREE怎麽用?C++ GNT_TREE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GNT_TREE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: plugin_toggled_cb
static void
plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null)
{
GError *error = NULL;
if (gnt_tree_get_choice(GNT_TREE(tree), plugin))
{
if (!purple_plugin_load(plugin, &error)) {
purple_notify_error(NULL, _("ERROR"), _("loading plugin failed"), error->message, NULL);
gnt_tree_set_choice(GNT_TREE(tree), plugin, FALSE);
g_error_free(error);
}
}
else
{
if (!purple_plugin_unload(plugin, &error)) {
purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"), error->message, NULL);
purple_plugin_disable(plugin);
gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE);
g_error_free(error);
}
finch_plugin_pref_close(plugin);
}
decide_conf_button(plugin);
finch_plugins_save_loaded();
}
示例2: toggle_tag_selection
static gboolean
toggle_tag_selection(GntBindable *bind, GList *null)
{
GntFileSel *sel = GNT_FILE_SEL(bind);
char *str;
GList *find;
char *file;
GntWidget *tree;
if (!sel->multiselect)
return FALSE;
tree = sel->dirsonly ? sel->dirs : sel->files;
if (!gnt_widget_has_focus(tree) ||
gnt_tree_is_searching(GNT_TREE(tree)))
return FALSE;
file = gnt_tree_get_selection_data(GNT_TREE(tree));
str = gnt_file_sel_get_selected_file(sel);
if ((find = g_list_find_custom(sel->tags, str, (GCompareFunc)g_utf8_collate)) != NULL) {
g_free(find->data);
sel->tags = g_list_delete_link(sel->tags, find);
gnt_tree_set_row_flags(GNT_TREE(tree), file, GNT_TEXT_FLAG_NORMAL);
g_free(str);
} else {
sel->tags = g_list_prepend(sel->tags, str);
gnt_tree_set_row_flags(GNT_TREE(tree), file, GNT_TEXT_FLAG_BOLD);
}
gnt_bindable_perform_action_named(GNT_BINDABLE(tree), "move-down", NULL);
return TRUE;
}
示例3: save_savedstatus_cb
static void
save_savedstatus_cb(GntWidget *button, EditStatus *edit)
{
const char *title, *message;
PurpleStatusPrimitive prim;
PurpleSavedStatus *find;
title = gnt_entry_get_text(GNT_ENTRY(edit->title));
message = gnt_entry_get_text(GNT_ENTRY(edit->message));
if (!message || !*message)
message = NULL;
prim = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(edit->type)));
if (!title || !*title)
{
purple_notify_error(edit, _("Error"), _("Invalid title"),
_("Please enter a non-empty title for the status."));
gnt_box_give_focus_to_child(GNT_BOX(edit->window), edit->title);
return;
}
find = purple_savedstatus_find(title);
if (find && find != edit->saved)
{
purple_notify_error(edit, _("Error"), _("Duplicate title"),
_("Please enter a different title for the status."));
gnt_box_give_focus_to_child(GNT_BOX(edit->window), edit->title);
return;
}
if (edit->saved == NULL)
{
edit->saved = purple_savedstatus_new(title, prim);
purple_savedstatus_set_message(edit->saved, message);
set_substatuses(edit);
if (statuses.tree)
gnt_tree_add_row_last(GNT_TREE(statuses.tree), edit->saved,
gnt_tree_create_row(GNT_TREE(statuses.tree), title,
purple_primitive_get_name_from_type(prim), message), NULL);
}
else
{
purple_savedstatus_set_title(edit->saved, title);
purple_savedstatus_set_type(edit->saved, prim);
purple_savedstatus_set_message(edit->saved, message);
if (statuses.tree)
{
gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 0, title);
gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 1,
purple_primitive_get_name_from_type(prim));
gnt_tree_change_text(GNT_TREE(statuses.tree), edit->saved, 2, message);
}
}
if (g_object_get_data(G_OBJECT(button), "use"))
purple_savedstatus_activate(edit->saved);
gnt_widget_destroy(edit->window);
}
示例4: add_substatus
static void
add_substatus(EditStatus *edit, PurpleAccount *account)
{
char *name;
const char *type = NULL, *message = NULL;
PurpleSavedStatusSub *sub = NULL;
RowInfo *key;
if (!edit || !edit->tree)
return;
if (edit->saved)
sub = purple_savedstatus_get_substatus(edit->saved, account);
key = g_new0(RowInfo, 1);
key->account = account;
if (sub)
{
key->type = purple_savedstatus_substatus_get_type(sub);
type = purple_status_type_get_name(key->type);
message = purple_savedstatus_substatus_get_message(sub);
key->message = g_strdup(message);
}
name = g_strdup_printf("%s (%s)", purple_account_get_username(account),
purple_account_get_protocol_name(account));
gnt_tree_add_choice(GNT_TREE(edit->tree), key,
gnt_tree_create_row(GNT_TREE(edit->tree),
name, type ? type : "", message ? message : ""), NULL, NULL);
if (sub)
gnt_tree_set_choice(GNT_TREE(edit->tree), key, TRUE);
g_free(name);
}
示例5: finch_savedstatus_show_all
void finch_savedstatus_show_all()
{
GntWidget *window, *tree, *box, *button;
int widths[] = {25, 12, 35};
if (statuses.window) {
gnt_window_present(statuses.window);
return;
}
statuses.window = window = gnt_vbox_new(FALSE);
gnt_box_set_toplevel(GNT_BOX(window), TRUE);
gnt_box_set_title(GNT_BOX(window), _("Saved Statuses"));
gnt_box_set_fill(GNT_BOX(window), FALSE);
gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
gnt_box_set_pad(GNT_BOX(window), 0);
/* XXX: Add some sorting function to sort alphabetically, perhaps */
statuses.tree = tree = gnt_tree_new_with_columns(3);
gnt_tree_set_column_titles(GNT_TREE(tree), _("Title"), _("Type"), _("Message"));
gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
gnt_tree_set_column_width_ratio(GNT_TREE(tree), widths);
gnt_widget_set_size(tree, 72, 0);
gnt_box_add_widget(GNT_BOX(window), tree);
populate_statuses(GNT_TREE(tree));
box = gnt_hbox_new(FALSE);
gnt_box_add_widget(GNT_BOX(window), box);
button = gnt_button_new(_("Use"));
gnt_box_add_widget(GNT_BOX(box), button);
g_signal_connect(G_OBJECT(button), "activate",
G_CALLBACK(use_savedstatus_cb), NULL);
button = gnt_button_new(_("Add"));
gnt_box_add_widget(GNT_BOX(box), button);
gnt_util_set_trigger_widget(tree, GNT_KEY_INS, button);
g_signal_connect_swapped(G_OBJECT(button), "activate",
G_CALLBACK(finch_savedstatus_edit), NULL);
button = gnt_button_new(_("Edit"));
gnt_box_add_widget(GNT_BOX(box), button);
g_signal_connect(G_OBJECT(button), "activate",
G_CALLBACK(edit_savedstatus_cb), NULL);
button = gnt_button_new(_("Delete"));
gnt_box_add_widget(GNT_BOX(box), button);
gnt_util_set_trigger_widget(tree, GNT_KEY_DEL, button);
g_signal_connect(G_OBJECT(button), "activate",
G_CALLBACK(ask_before_delete), NULL);
button = gnt_button_new(_("Close"));
gnt_box_add_widget(GNT_BOX(box), button);
g_signal_connect_swapped(G_OBJECT(button), "activate",
G_CALLBACK(gnt_widget_destroy), window);
g_signal_connect(G_OBJECT(window), "destroy",
G_CALLBACK(reset_status_window), NULL);
gnt_widget_show(window);
}
示例6: check_for_trigger
static gboolean
check_for_trigger(GntMenu *menu, char trigger)
{
/* check for a trigger key */
GList *iter;
GList *find;
GList *nth = g_list_find(menu->list, gnt_tree_get_selection_data(GNT_TREE(menu)));
if (nth == NULL)
return FALSE;
find = find_item_with_trigger(nth->next, NULL, trigger);
if (!find)
find = find_item_with_trigger(menu->list, nth->next, trigger);
if (!find)
return FALSE;
if (find != nth) {
gnt_tree_set_selected(GNT_TREE(menu), find->data);
iter = find_item_with_trigger(find->next, NULL, trigger);
if (iter != NULL && iter != find)
return TRUE;
iter = find_item_with_trigger(menu->list, nth, trigger);
if (iter != NULL && iter != find)
return TRUE;
}
gnt_widget_activate(GNT_WIDGET(menu));
return TRUE;
}
示例7: setup_email_dialog
static void
setup_email_dialog(void)
{
GntWidget *box, *tree, *button;
if (emaildialog.window)
return;
emaildialog.window = box = gnt_vbox_new(FALSE);
gnt_box_set_toplevel(GNT_BOX(box), TRUE);
gnt_box_set_title(GNT_BOX(box), _("Emails"));
gnt_box_set_fill(GNT_BOX(box), FALSE);
gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID);
gnt_box_set_pad(GNT_BOX(box), 0);
gnt_box_add_widget(GNT_BOX(box),
gnt_label_new_with_format(_("You have mail!"), GNT_TEXT_FLAG_BOLD));
emaildialog.tree = tree = gnt_tree_new_with_columns(3);
gnt_tree_set_column_titles(GNT_TREE(tree), _("Account"), _("Sender"), _("Subject"));
gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
gnt_tree_set_col_width(GNT_TREE(tree), 0, 15);
gnt_tree_set_col_width(GNT_TREE(tree), 1, 25);
gnt_tree_set_col_width(GNT_TREE(tree), 2, 25);
gnt_box_add_widget(GNT_BOX(box), tree);
button = gnt_button_new(_("Close"));
gnt_box_add_widget(GNT_BOX(box), button);
g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), box);
g_signal_connect(G_OBJECT(box), "destroy", G_CALLBACK(reset_email_dialog), NULL);
}
示例8: plugin_toggled_cb
static void
plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null)
{
if (gnt_tree_get_choice(GNT_TREE(tree), plugin))
{
if (!purple_plugin_load(plugin)) {
purple_notify_error(NULL, _("ERROR"), _("loading plugin failed"), NULL);
gnt_tree_set_choice(GNT_TREE(tree), plugin, FALSE);
}
}
else
{
GntWidget *win;
if (!purple_plugin_unload(plugin)) {
purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"), NULL);
purple_plugin_disable(plugin);
gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE);
}
if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL)
{
gnt_widget_destroy(win);
}
}
decide_conf_button(plugin);
finch_plugins_save_loaded();
}
示例9: update_location
static void
update_location(GntFileSel *sel)
{
char *old;
const char *tmp;
tmp = sel->suggest ? sel->suggest :
(const char*)gnt_tree_get_selection_data(sel->dirsonly ? GNT_TREE(sel->dirs) : GNT_TREE(sel->files));
old = g_strdup_printf("%s%s%s", SAFE(sel->current), SAFE(sel->current)[1] ? G_DIR_SEPARATOR_S : "", tmp ? tmp : "");
gnt_entry_set_text(GNT_ENTRY(sel->location), old);
g_free(old);
}
示例10: set_substatuses
static void
set_substatuses(EditStatus *edit)
{
GList *iter;
for (iter = gnt_tree_get_rows(GNT_TREE(edit->tree)); iter; iter = iter->next) {
RowInfo *key = iter->data;
if (gnt_tree_get_choice(GNT_TREE(edit->tree), key)) {
purple_savedstatus_set_substatus(edit->saved, key->account, key->type, key->message);
}
}
}
示例11: hide_popup
static void
hide_popup(GntComboBox *box, gboolean set)
{
gnt_widget_set_size(box->dropdown,
box->dropdown->priv.width - 1, box->dropdown->priv.height);
if (set)
set_selection(box, gnt_tree_get_selection_data(GNT_TREE(box->dropdown)));
else
gnt_tree_set_selected(GNT_TREE(box->dropdown), box->selected);
gnt_widget_hide(box->dropdown->parent);
}
示例12: reset_cb
static void
reset_cb(GntWidget *button, gpointer null)
{
/* Don't dereference this pointer ! */
gpointer key = gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events));
FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(key)];
g_free(event->file);
event->file = NULL;
gnt_tree_change_text(GNT_TREE(pref_dialog->events), key, 1, _("(default)"));
}
示例13: populate_pounces_list
static void
populate_pounces_list(PouncesManager *dialog)
{
GList *pounces;
gnt_tree_remove_all(GNT_TREE(dialog->tree));
for (pounces = purple_pounces_get_all_for_ui(FINCH_UI); pounces != NULL;
pounces = g_list_delete_link(pounces, pounces))
{
add_pounce_to_treeview(GNT_TREE(dialog->tree), pounces->data);
}
}
示例14: file_cb
static void
file_cb(GntFileSel *w, const char *path, const char *file, gpointer data)
{
FinchSoundEvent *event = data;
g_free(event->file);
event->file = g_strdup(path);
gnt_tree_change_text(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(event->id), 1, file);
gnt_tree_set_choice(GNT_TREE(pref_dialog->events), GINT_TO_POINTER(event->id), TRUE);
gnt_widget_destroy(GNT_WIDGET(w));
}
示例15: finch_notify_emails
static void *
finch_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed,
const char **subjects, const char **froms, const char **tos,
const char **urls)
{
PurpleAccount *account = purple_connection_get_account(gc);
GString *message = g_string_new(NULL);
void *ret;
static int key = 0;
if (count == 0)
return NULL;
if (!detailed)
{
g_string_append_printf(message,
ngettext("%s (%s) has %d new message.",
"%s (%s) has %d new messages.",
(int)count),
tos ? *tos : purple_account_get_username(account),
purple_account_get_protocol_name(account), (int)count);
}
else
{
char *to;
gboolean newwin = (emaildialog.window == NULL);
if (newwin)
setup_email_dialog();
to = g_strdup_printf("%s (%s)", tos ? *tos : purple_account_get_username(account),
purple_account_get_protocol_name(account));
gnt_tree_add_row_after(GNT_TREE(emaildialog.tree), GINT_TO_POINTER(++key),
gnt_tree_create_row(GNT_TREE(emaildialog.tree), to,
froms ? *froms : "[Unknown sender]",
*subjects),
NULL, NULL);
g_free(to);
if (newwin)
gnt_widget_show(emaildialog.window);
else
gnt_window_present(emaildialog.window);
return NULL;
}
ret = finch_notify_common(PURPLE_NOTIFY_EMAIL, PURPLE_NOTIFY_MSG_INFO,
_("New Mail"), _("You have mail!"), message->str);
g_string_free(message, TRUE);
return ret;
}