コード例 #1
0
ファイル: gntstatus.c プロジェクト: crodjer/pidgin_whiteboard
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);
}
コード例 #2
0
ファイル: gntentry.c プロジェクト: mclarkelauer/HoneyIM
static gboolean
history_search(GntBindable *bind, GList *null)
{
	GntEntry *entry = GNT_ENTRY(bind);
	GList *iter;
	const char *current , *pos;
	int len;
	
	if (entry->history->prev && entry->search->needle)
		current = entry->search->needle;
	else
		current = gnt_entry_get_text(entry);

	if (!entry->histlength || !entry->history->next || !*current)
		return FALSE;

	len = g_utf8_strlen(current, -1);

	for (iter = entry->history->next; iter; iter = iter->next) {
		const char *str = iter->data;
		/* A more utf8-friendly version of strstr would have been better, but
		 * for now, this will have to do. */
		if ((pos = strstr(str, current)))
			break;
	}

	if (!iter)
		return TRUE;

	if (entry->history->prev == NULL) {
		/* We are doing it for the first time. Save the current contents */
		char *text = g_strdup(gnt_entry_get_text(entry));

		g_free(entry->search->needle);
		entry->search->needle = g_strdup(current);

		g_free(entry->history->data);
		entry->history->data = text;
	}

	entry->history = iter;
	gnt_entry_set_text_internal(entry, entry->history->data);
	destroy_suggest(entry);
	entry_text_changed(entry);

	update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
	return TRUE;
}
コード例 #3
0
ファイル: gntdebug.c プロジェクト: bf4/pidgin-mac
static gboolean
match_string(const char *category, const char *args)
{
	const char *str = gnt_entry_get_text(GNT_ENTRY(debug.search));
	if (!str || !*str)
		return TRUE;
	if (g_strrstr(category, str) != NULL)
		return TRUE;
	if (g_strrstr(args, str) != NULL)
		return TRUE;
	return FALSE;
}
コード例 #4
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
update_selected_account(GntEntry *screenname, const char *start, const char *end,
		GntComboBox *accountlist)
{
	GList *accounts = gnt_tree_get_rows(GNT_TREE(accountlist->dropdown));
	const char *name = gnt_entry_get_text(screenname);
	while (accounts) {
		if (purple_find_buddy(accounts->data, name)) {
			gnt_combo_box_set_selected(accountlist, accounts->data);
			gnt_widget_draw(GNT_WIDGET(accountlist));
			break;
		}
		accounts = accounts->next;
	}
}
コード例 #5
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
notify_input_cb(GntWidget *button, GntWidget *entry)
{
	PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback");
	gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata");
	const char *text = gnt_entry_get_text(GNT_ENTRY(entry));

	if (callback)
		callback(data, text);

	while (button->parent)
		button = button->parent;

	purple_request_close(PURPLE_REQUEST_INPUT, button);
}
コード例 #6
0
ファイル: gntsound.c プロジェクト: Herrie82/pidgin-2.10.12
static void
prof_add_cb(GntButton *button, GntEntry * entry)
{
	const char * profile = gnt_entry_get_text(entry);
	GntTreeRow * row;
	if (!finch_sound_profile_exists(profile)) {
		gpointer key = g_strdup(profile);
		row = gnt_tree_create_row(GNT_TREE(pref_dialog->profiles), profile);
		gnt_tree_add_row_after(GNT_TREE(pref_dialog->profiles), key,
				row,
				NULL, NULL);
		gnt_entry_set_text(entry, "");
		gnt_tree_set_selected(GNT_TREE(pref_dialog->profiles), key);
		finch_sound_set_active_profile(key);
	} else
		reload_pref_window(profile);
}
コード例 #7
0
ファイル: gntstatus.c プロジェクト: crodjer/pidgin_whiteboard
static void
use_trans_status_cb(GntWidget *button, EditStatus *edit)
{
	const char *message;
	PurpleStatusPrimitive prim;
	PurpleSavedStatus *saved;

	message = gnt_entry_get_text(GNT_ENTRY(edit->message));
	prim = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(edit->type)));

	saved = purple_savedstatus_find_transient_by_type_and_message(prim, message);
	if (saved == NULL) {
		saved = purple_savedstatus_new(NULL, prim);
		edit->saved = saved;
		set_substatuses(edit);
	}
	purple_savedstatus_set_message(saved, message);
	purple_savedstatus_activate(saved);
	gnt_widget_destroy(edit->window);
}
コード例 #8
0
ファイル: gntsound.c プロジェクト: N8Fear/purple-facebook
static void
save_cb(GntWidget *button, gpointer win)
{
	GList * itr;

	purple_prefs_set_string(make_pref("/method"), gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->method)));
	purple_prefs_set_path(make_pref("/command"), gnt_entry_get_text(GNT_ENTRY(pref_dialog->command)));
	purple_prefs_set_bool(make_pref("/conv_focus"), gnt_check_box_get_checked(GNT_CHECK_BOX(pref_dialog->conv_focus)));
	purple_prefs_set_int("/purple/sound/while_status", GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->while_status))));

	for (itr = gnt_tree_get_rows(GNT_TREE(pref_dialog->events)); itr; itr = itr->next) {
		FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(itr->data)];
		char * filepref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s", finch_sound_get_active_profile(), event->pref);
		char * boolpref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s", finch_sound_get_active_profile(), event->pref);
		purple_prefs_set_bool(boolpref, gnt_tree_get_choice(GNT_TREE(pref_dialog->events), itr->data));
		purple_prefs_set_path(filepref, event->file ? event->file : "");
		g_free(filepref);
		g_free(boolpref);
	}
	gnt_widget_destroy(GNT_WIDGET(win));
}
コード例 #9
0
ファイル: gntsound.c プロジェクト: Herrie82/pidgin-2.10.12
static void
prof_del_cb(GntWidget *button, gpointer null)
{
	const char * profile = gnt_entry_get_text(GNT_ENTRY(pref_dialog->new_profile));
	gchar * pref;

	if (!strcmp(profile, DEFAULT_PROFILE))
		return;

	pref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s", profile);
	purple_prefs_remove(pref);
	g_free(pref);

	if (!strcmp(pref_dialog->original_profile, profile)) {
		g_free(pref_dialog->original_profile);
		pref_dialog->original_profile = g_strdup(DEFAULT_PROFILE);
	}

	if(!strcmp(profile, finch_sound_get_active_profile()))
		reload_pref_window(DEFAULT_PROFILE);

	gnt_tree_remove(GNT_TREE(pref_dialog->profiles), (gchar *) profile);
}
コード例 #10
0
ファイル: gntstatus.c プロジェクト: crodjer/pidgin_whiteboard
static void
save_substatus_cb(GntWidget *widget, EditSubStatus *sub)
{
	PurpleSavedStatus *saved = sub->parent->saved;
	RowInfo *row = sub->key;
	const char *message;
	PurpleStatusType *type;

	type = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(sub->type));
	message = gnt_entry_get_text(GNT_ENTRY(sub->message));

	row->type = type;
	row->message = g_strdup(message);

	if (saved)    /* Save the substatus if the savedstatus actually exists. */
		purple_savedstatus_set_substatus(saved, row->account, type, message);

	gnt_tree_set_choice(GNT_TREE(sub->parent->tree), row, TRUE);
	gnt_tree_change_text(GNT_TREE(sub->parent->tree), row, 1,
			purple_status_type_get_name(type));
	gnt_tree_change_text(GNT_TREE(sub->parent->tree), row, 2, message);
	
	gnt_widget_destroy(sub->window);
}
コード例 #11
0
ファイル: gntentry.c プロジェクト: mclarkelauer/HoneyIM
static gboolean
history_prev(GntBindable *bind, GList *null)
{
	GntEntry *entry = GNT_ENTRY(bind);
	if (entry->histlength && entry->history->next)
	{
		if (entry->history->prev == NULL)
		{
			/* Save the current contents */
			char *text = g_strdup(gnt_entry_get_text(entry));
			g_free(entry->history->data);
			entry->history->data = text;
		}

		entry->history = entry->history->next;
		gnt_entry_set_text_internal(entry, entry->history->data);
		destroy_suggest(entry);
		entry_text_changed(entry);

		update_kill_ring(entry, ENTRY_JAIL, NULL, 0);
		return TRUE;
	}
	return FALSE;
}
コード例 #12
0
ファイル: gntfilesel.c プロジェクト: bf4/pidgin-mac
static gboolean
location_key_pressed(GntTree *tree, const char *key, GntFileSel *sel)
{
	char *path;
	char *str;
#if 0
	int count;
	glob_t gl;
	struct stat st;
	int glob_ret;
#endif
	if (strcmp(key, "\r") && strcmp(key, "\n"))
		return FALSE;

	str = (char*)gnt_entry_get_text(GNT_ENTRY(sel->location));
	if (*str == G_DIR_SEPARATOR)
		path = g_strdup(str);
	else
		path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", sel->current, str);
	str = process_path(path);
	g_free(path);
	path = str;

	if (gnt_file_sel_set_current_location(sel, path))
		goto success;

	path = g_path_get_dirname(str);
	g_free(str);

	if (!gnt_file_sel_set_current_location(sel, path)) {
		g_free(path);
		return FALSE;
	}
#if 0
	/* XXX: there needs to be a way to allow other methods for globbing,
	 * like the read_fn stuff. */
	glob_ret = glob(path, GLOB_MARK, NULL, &gl);
	if (!glob_ret) {  /* XXX: do something with the return value */
		char *loc = g_path_get_dirname(gl.gl_pathv[0]);

		stat(gl.gl_pathv[0], &st);
		gnt_file_sel_set_current_location(sel, loc);  /* XXX: check the return value */
		g_free(loc);
		if (!S_ISDIR(st.st_mode) && !sel->dirsonly) {
			gnt_tree_remove_all(GNT_TREE(sel->files));
			for (count = 0; count < gl.gl_pathc; count++) {
				char *tmp = process_path(gl.gl_pathv[count]);
				loc = g_path_get_dirname(tmp);
				if (g_utf8_collate(sel->current, loc) == 0) {
					char *base = g_path_get_basename(tmp);
					char size[128];
					snprintf(size, sizeof(size), "%ld", (long)st.st_size);
					gnt_tree_add_row_after(GNT_TREE(sel->files), base,
							gnt_tree_create_row(GNT_TREE(sel->files), base, size, ""), NULL, NULL);
				}
				g_free(loc);
				g_free(tmp);
			}
			gnt_widget_draw(sel->files);
		}
	} else if (sel->files) {
		gnt_tree_remove_all(GNT_TREE(sel->files));
		gnt_widget_draw(sel->files);
	}
	globfree(&gl);
#endif
success:
	g_free(path);
	return TRUE;
}
コード例 #13
0
ファイル: gntpounce.c プロジェクト: CkNoSFeRaTU/pidgin
static void
save_pounce_cb(GntWidget *w, PurpleGntPounceDialog *dialog)
{
	const char *name;
	const char *message, *command, *reason;
	PurplePounceEvent events   = PURPLE_POUNCE_NONE;
	PurplePounceOption options = PURPLE_POUNCE_OPTION_NONE;

	name = gnt_entry_get_text(GNT_ENTRY(dialog->buddy_entry));

	if (*name == '\0')
	{
		purple_notify_error(NULL, NULL,
						  _("Please enter a buddy to pounce."), NULL);
		return;
	}

	/* Options */
	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->on_away)))
		options |= PURPLE_POUNCE_OPTION_AWAY;

	/* Events */
	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->signon)))
		events |= PURPLE_POUNCE_SIGNON;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->signoff)))
		events |= PURPLE_POUNCE_SIGNOFF;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->away)))
		events |= PURPLE_POUNCE_AWAY;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->away_return)))
		events |= PURPLE_POUNCE_AWAY_RETURN;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->idle)))
		events |= PURPLE_POUNCE_IDLE;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->idle_return)))
		events |= PURPLE_POUNCE_IDLE_RETURN;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->typing)))
		events |= PURPLE_POUNCE_TYPING;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->typed)))
		events |= PURPLE_POUNCE_TYPED;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->stop_typing)))
		events |= PURPLE_POUNCE_TYPING_STOPPED;

	if (gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->message_recv)))
		events |= PURPLE_POUNCE_MESSAGE_RECEIVED;

	/* Data fields */
	message = gnt_entry_get_text(GNT_ENTRY(dialog->send_msg_entry));
	command = gnt_entry_get_text(GNT_ENTRY(dialog->exec_cmd_entry));
	reason  = gnt_entry_get_text(GNT_ENTRY(dialog->popup_entry));

	if (*reason == '\0') reason = NULL;
	if (*message == '\0') message = NULL;
	if (*command == '\0') command = NULL;

	if (dialog->pounce == NULL) {
		dialog->pounce = purple_pounce_new(FINCH_UI, dialog->account,
										 name, events, options);
	} else {
		purple_pounce_set_events(dialog->pounce, events);
		purple_pounce_set_options(dialog->pounce, options);
		purple_pounce_set_pouncer(dialog->pounce, dialog->account);
		purple_pounce_set_pouncee(dialog->pounce, name);
	}

	/* Actions */
	purple_pounce_action_set_enabled(dialog->pounce, "open-window",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->open_win)));
	purple_pounce_action_set_enabled(dialog->pounce, "popup-notify",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->popup)));
	purple_pounce_action_set_enabled(dialog->pounce, "send-message",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->send_msg)));
	purple_pounce_action_set_enabled(dialog->pounce, "execute-command",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->exec_cmd)));
	purple_pounce_action_set_enabled(dialog->pounce, "play-beep",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->play_sound)));

	purple_pounce_action_set_attribute(dialog->pounce, "send-message",
									 "message", message);
	purple_pounce_action_set_attribute(dialog->pounce, "execute-command",
									 "command", command);
	purple_pounce_action_set_attribute(dialog->pounce, "popup-notify",
									 "reason", reason);

	/* Set the defaults for next time. */
	purple_prefs_set_bool("/finch/pounces/default_actions/open-window",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->open_win)));
	purple_prefs_set_bool("/finch/pounces/default_actions/popup-notify",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->popup)));
	purple_prefs_set_bool("/finch/pounces/default_actions/send-message",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->send_msg)));
	purple_prefs_set_bool("/finch/pounces/default_actions/execute-command",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->exec_cmd)));
	purple_prefs_set_bool("/finch/pounces/default_actions/play-beep",
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->play_sound)));

	purple_pounce_set_save(dialog->pounce,
		gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->save_pounce)));

	purple_pounce_set_pouncer(dialog->pounce,
		(PurpleAccount *)gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->account_menu)));

	update_pounces();

	gnt_widget_destroy(dialog->window);
}
コード例 #14
0
ファイル: test2014_75.c プロジェクト: Federico2014/edg4x-rose
static void
entry_key_pressed(GntWidget *w, FinchConv *ggconv)
{
	const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry));
	if (*text == '/' && *(text + 1) != '/')
	{
		PurpleConversation *conv = ggconv->active_conv;
		PurpleCmdStatus status;
		const char *cmdline = text + 1;
		char *error = NULL, *escape;

		escape = g_markup_escape_text(cmdline, -1);
		status = purple_cmd_do_command(conv, cmdline, escape, &error);
		g_free(escape);

		switch (status)
		{
			case PURPLE_CMD_STATUS_OK:
				break;
			case PURPLE_CMD_STATUS_NOT_FOUND:
				purple_conversation_write(conv, "", _("No such command."),
						PURPLE_MESSAGE_NO_LOG, time(NULL));
				break;
			case PURPLE_CMD_STATUS_WRONG_ARGS:
				purple_conversation_write(conv, "", _("Syntax Error:  You typed the wrong number of arguments "
							"to that command."),
						PURPLE_MESSAGE_NO_LOG, time(NULL));
				break;
			case PURPLE_CMD_STATUS_FAILED:
				purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."),
						PURPLE_MESSAGE_NO_LOG, time(NULL));
				break;
			case PURPLE_CMD_STATUS_WRONG_TYPE:
				if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
					purple_conversation_write(conv, "", _("That command only works in chats, not IMs."),
							PURPLE_MESSAGE_NO_LOG, time(NULL));
				else
					purple_conversation_write(conv, "", _("That command only works in IMs, not chats."),
							PURPLE_MESSAGE_NO_LOG, time(NULL));
				break;
			case PURPLE_CMD_STATUS_WRONG_PRPL:
				purple_conversation_write(conv, "", _("That command doesn't work on this protocol."),
						PURPLE_MESSAGE_NO_LOG, time(NULL));
				break;
		}
		g_free(error);
	}
	else if (!purple_account_is_connected(purple_conversation_get_account(ggconv->active_conv)))
	{
		purple_conversation_write(ggconv->active_conv, "", _("Message was not sent, because you are not signed on."),
				PURPLE_MESSAGE_ERROR | PURPLE_MESSAGE_NO_LOG, time(NULL));
	}
	else
	{
		char *escape = purple_markup_escape_text((*text == '/' ? text + 1 : text), -1);
		switch (purple_conversation_get_type(ggconv->active_conv))
		{
			case PURPLE_CONV_TYPE_IM:
				purple_conv_im_send_with_flags(PURPLE_CONV_IM(ggconv->active_conv), escape, PURPLE_MESSAGE_SEND);
				break;
			case PURPLE_CONV_TYPE_CHAT:
				purple_conv_chat_send(PURPLE_CONV_CHAT(ggconv->active_conv), escape);
				break;
			default:
				g_free(escape);
				g_return_if_reached();
		}
		g_free(escape);
		purple_idle_touch();
	}
	gnt_entry_add_to_history(GNT_ENTRY(ggconv->entry), text);
	gnt_entry_clear(GNT_ENTRY(ggconv->entry));
}
コード例 #15
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
request_fields_cb(GntWidget *button, PurpleRequestFields *fields)
{
	PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback");
	gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata");
	GList *list;

	/* Update the data of the fields. Pidgin does this differently. Instead of
	 * updating the fields at the end like here, it updates the appropriate field
	 * instantly whenever a change is made. That allows it to make sure the
	 * 'required' fields are entered before the user can hit OK. It's not the case
	 * here, althought it can be done. */
	for (list = purple_request_fields_get_groups(fields); list; list = list->next)
	{
		PurpleRequestFieldGroup *group = list->data;
		GList *fields = purple_request_field_group_get_fields(group);

		for (; fields ; fields = fields->next)
		{
			PurpleRequestField *field = fields->data;
			PurpleRequestFieldType type = purple_request_field_get_type(field);
			if (type == PURPLE_REQUEST_FIELD_BOOLEAN)
			{
				GntWidget *check = FINCH_GET_DATA(field);
				gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check));
				purple_request_field_bool_set_value(field, value);
			}
			else if (type == PURPLE_REQUEST_FIELD_STRING)
			{
				GntWidget *entry = FINCH_GET_DATA(field);
				const char *text = gnt_entry_get_text(GNT_ENTRY(entry));
				purple_request_field_string_set_value(field, (text && *text) ? text : NULL);
			}
			else if (type == PURPLE_REQUEST_FIELD_INTEGER)
			{
				GntWidget *entry = FINCH_GET_DATA(field);
				const char *text = gnt_entry_get_text(GNT_ENTRY(entry));
				int value = (text && *text) ? atoi(text) : 0;
				purple_request_field_int_set_value(field, value);
			}
			else if (type == PURPLE_REQUEST_FIELD_CHOICE)
			{
				GntWidget *combo = FINCH_GET_DATA(field);
				int id;
				id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)));
				purple_request_field_choice_set_value(field, id);
			}
			else if (type == PURPLE_REQUEST_FIELD_LIST)
			{
				GList *list = NULL;
				if (purple_request_field_list_get_multi_select(field))
				{
					GList *iter;
					GntWidget *tree = FINCH_GET_DATA(field);

					iter = purple_request_field_list_get_items(field);
					for (; iter; iter = iter->next)
					{
						const char *text = iter->data;
						gpointer key = purple_request_field_list_get_data(field, text);
						if (gnt_tree_get_choice(GNT_TREE(tree), key))
							list = g_list_prepend(list, key);
					}
				}
				else
				{
					GntWidget *combo = FINCH_GET_DATA(field);
					gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo));
					list = g_list_append(list, data);
				}

				purple_request_field_list_set_selected(field, list);
				g_list_free(list);
			}
			else if (type == PURPLE_REQUEST_FIELD_ACCOUNT)
			{
				GntWidget *combo = FINCH_GET_DATA(field);
				PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo));
				purple_request_field_account_set_value(field, acc);
			}
		}
	}

	purple_notify_close_with_handle(button);

	if (!g_object_get_data(G_OBJECT(button), "cancellation-function") &&
			!purple_request_fields_all_required_filled(fields)) {
		purple_notify_error(button, _("Error"),
				_("You must fill all the required fields."),
				_("The required fields are underlined."));
		return;
	}

	if (callback)
		callback(data, fields);

	while (button->parent)
		button = button->parent;

	purple_request_close(PURPLE_REQUEST_FIELDS, button);
}
コード例 #16
0
ファイル: gntdebug.c プロジェクト: bf4/pidgin-mac
static gboolean
for_real(gpointer entry)
{
	purple_prefs_set_string(PREF_ROOT "/filter", gnt_entry_get_text(entry));
	return FALSE;
}