コード例 #1
0
void finch_prefs_show_all()
{
	PurpleRequestFields *fields;

	if (pref_request.showing) {
		gnt_window_present(pref_request.window);
		return;
	}

	if (pref_request.keyring_window != NULL)
		purple_request_close(PURPLE_REQUEST_FIELDS,
			pref_request.keyring_window);

	fields = purple_request_fields_new();

	add_pref_group(fields, _("Buddy List"), blist);
	add_pref_group(fields, _("Conversations"), convs);
	add_pref_group(fields, _("Keyring"), keyring);
	add_pref_group(fields, _("Logging"), logging);
	add_pref_group(fields, _("Idle"), idle);

	pref_request.showing = TRUE;
	pref_request.window = purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
			_("Save"), G_CALLBACK(save_cb), _("Cancel"), free_strings,
			NULL, NULL);
}
コード例 #2
0
ファイル: gntplugin.c プロジェクト: N8Fear/purple-facebook
static void
finch_plugin_pref_close(PurplePlugin *plugin)
{
	PurplePluginInfo *info;
	FinchPluginUiData *ui_data;

	g_return_if_fail(plugin != NULL);

	info = purple_plugin_get_info(plugin);
	ui_data = purple_plugin_info_get_ui_data(info);

	if (!ui_data)
		return;

	if (ui_data->type == FINCH_PLUGIN_UI_DATA_TYPE_REQUEST) {
		purple_request_close(PURPLE_REQUEST_FIELDS,
			ui_data->u.request_handle);
		return;
	}

	g_return_if_fail(ui_data->type == FINCH_PLUGIN_UI_DATA_TYPE_WINDOW);

	gnt_widget_destroy(ui_data->u.window);

	g_free(ui_data);
	purple_plugin_info_set_ui_data(info, NULL);
}
コード例 #3
0
ファイル: purple.c プロジェクト: AaronVanGeffen/bitlbee
/* q->free() callback from query_del()*/
static void prplcb_request_action_free(void *data)
{
	struct prplcb_request_action_data *pqad = data;

	pqad->bee_data = NULL;
	purple_request_close(PURPLE_REQUEST_ACTION, pqad);
}
コード例 #4
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
file_cancel_cb(gpointer fq, GntWidget *wid)
{
	FinchFileRequest *data = fq;
	if (data->cbs[1] != NULL)
		((PurpleRequestFileCb)data->cbs[1])(data->user_data, NULL);

	purple_request_close(PURPLE_REQUEST_FILE, data->dialog);
}
コード例 #5
0
ファイル: Request.cpp プロジェクト: transacid/CenterIM5
void Request::OnDialogResponse(CppConsUI::SplitDialog& dialog,
                               CppConsUI::AbstractDialog::ResponseType response)
{
    RequestDialog *rdialog = dynamic_cast<RequestDialog*>(&dialog);
    g_assert(rdialog);

    requests.erase(rdialog);
    purple_request_close(rdialog->GetRequestType(), rdialog);
}
コード例 #6
0
ファイル: Request.cpp プロジェクト: transacid/CenterIM5
Request::~Request()
{
    // close all opened requests
    while (requests.size()) {
        RequestDialog *rdialog = *(requests.begin());
        purple_request_close(rdialog->GetRequestType(), rdialog);
    }

    purple_request_set_ui_ops(NULL);
}
コード例 #7
0
ファイル: chat.c プロジェクト: arminius2/apolloim
void jabber_chat_free(JabberChat *chat)
{
	if(chat->config_dialog_handle)
		purple_request_close(chat->config_dialog_type, chat->config_dialog_handle);

	g_free(chat->room);
	g_free(chat->server);
	g_free(chat->handle);
	g_hash_table_destroy(chat->members);
	g_free(chat);
}
コード例 #8
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
request_action_cb(GntWidget *button, GntWidget *window)
{
	PurpleRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback");
	gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata");
	int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id"));

	if (callback)
		callback(data, id);

	purple_request_close(PURPLE_REQUEST_ACTION, window);
}
コード例 #9
0
ファイル: purple.c プロジェクト: AaronVanGeffen/bitlbee
void purple_request_input_callback(guint id, struct im_connection *ic,
                                   const char *message, const char *who)
{
	struct purple_data *pd = ic->proto_data;
	struct request_input_data *ri;

	if (!(ri = g_hash_table_lookup(pd->input_requests, GUINT_TO_POINTER(id)))) {
		return;
	}

	ri->data_callback(ri->user_data, message);

	purple_request_close(PURPLE_REQUEST_INPUT, ri);
}
コード例 #10
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
file_ok_cb(gpointer fq, GntWidget *widget)
{
	FinchFileRequest *data = fq;
	char *file = gnt_file_sel_get_selected_file(GNT_FILE_SEL(data->dialog));
	char *dir = g_path_get_dirname(file);
	if (data->cbs[0] != NULL)
		((PurpleRequestFileCb)data->cbs[0])(data->user_data, file);
	g_free(file);
	purple_prefs_set_path(data->save ? "/finch/filelocations/last_save_folder" :
			"/finch/filelocations/last_open_folder", dir);
	g_free(dir);

	purple_request_close(PURPLE_REQUEST_FILE, data->dialog);
}
コード例 #11
0
ファイル: gntrequest.c プロジェクト: bf4/pidgin-mac
static void
request_choice_cb(GntWidget *button, GntComboBox *combo)
{
	PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback");
	gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata");
	int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1;

	if (callback)
		callback(data, choice);

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

	purple_request_close(PURPLE_REQUEST_INPUT, button);
}
コード例 #12
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);
}
コード例 #13
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);
}