コード例 #1
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_label_new(const char *id, const char *text)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);
	g_return_val_if_fail(text != NULL, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_LABEL);

	return field;
}
コード例 #2
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_choice_new(const char *id, const char *text,
							  int default_value)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);
	g_return_val_if_fail(text != NULL, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_CHOICE);

	purple_request_field_choice_set_default_value(field, default_value);
	purple_request_field_choice_set_value(field, default_value);

	return field;
}
コード例 #3
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_bool_new(const char *id, const char *text,
							gboolean default_value)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);
	g_return_val_if_fail(text != NULL, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_BOOLEAN);

	purple_request_field_bool_set_default_value(field, default_value);
	purple_request_field_bool_set_value(field, default_value);

	return field;
}
コード例 #4
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_list_new(const char *id, const char *text)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_LIST);

	field->u.list.item_data = g_hash_table_new_full(g_str_hash, g_str_equal,
													g_free, NULL);

	field->u.list.selected_table =
		g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);

	return field;
}
コード例 #5
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_string_new(const char *id, const char *text,
							  const char *default_value, gboolean multiline)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);
	g_return_val_if_fail(text != NULL, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_STRING);

	field->u.string.multiline = multiline;
	field->u.string.editable  = TRUE;

	purple_request_field_string_set_default_value(field, default_value);
	purple_request_field_string_set_value(field, default_value);

	return field;
}
コード例 #6
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);
	g_return_val_if_fail(text != NULL, NULL);
	g_return_val_if_fail(buf  != NULL, NULL);
	g_return_val_if_fail(size > 0, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_IMAGE);

	field->u.image.buffer  = g_memdup(buf, size);
	field->u.image.size    = size;
	field->u.image.scale_x = 1;
	field->u.image.scale_y = 1;

	return field;
}
コード例 #7
0
ファイル: request.c プロジェクト: gotomypc/pidgin_whiteboard
PurpleRequestField *
purple_request_field_account_new(const char *id, const char *text,
							   PurpleAccount *account)
{
	PurpleRequestField *field;

	g_return_val_if_fail(id   != NULL, NULL);
	g_return_val_if_fail(text != NULL, NULL);

	field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_ACCOUNT);

	if (account == NULL && purple_connections_get_all() != NULL)
	{
		account = purple_connection_get_account(
			(PurpleConnection *)purple_connections_get_all()->data);
	}

	purple_request_field_account_set_default_value(field, account);
	purple_request_field_account_set_value(field, account);

	return field;
}
コード例 #8
0
ファイル: buddytime.c プロジェクト: Javran/purple-plugin-pack
static void
buddytimezone_createfields_cb(PurpleRequestFields * fields, PurpleBlistNode * data)
{
    purple_debug(PURPLE_DEBUG_INFO, PLUGIN_STATIC_NAME, "buddytimezone_createfields_cb(%p,%p)\n", fields, data);
    PurpleRequestField *field;
    PurpleRequestFieldGroup *group;
    const char *timezone;
    gboolean is_default;

    switch (data->type)
    {
        case PURPLE_BLIST_BUDDY_NODE:
        case PURPLE_BLIST_CONTACT_NODE:
            is_default = FALSE;
            break;
        case PURPLE_BLIST_GROUP_NODE:
            is_default = TRUE;
            break;
        case PURPLE_BLIST_CHAT_NODE:
        case PURPLE_BLIST_OTHER_NODE:
        default:
            /* Not applicable */
            return;
    }

    group = purple_request_field_group_new(NULL);
    purple_request_fields_add_group(fields, group);

    timezone = buddy_get_timezone(data, FALSE, NULL);

    if (ui_ops != NULL && ui_ops->create_menu)
    {
        field =
            purple_request_field_new(CONTROL_NAME,
                                   is_default ? "Default timezone for group" : "Timezone of contact",
                                   PURPLE_REQUEST_FIELD_LIST);
        field->ui_data = ui_ops->create_menu(timezone);
    }
    else
    {
        field =
            purple_request_field_list_new(CONTROL_NAME,
                                        is_default ? "Default timezone for group" :
                                        "Timezone of contact (type to select)");
        purple_request_field_list_set_multi_select(field, FALSE);
        purple_request_field_list_add(field, "<Default>", "");
        purple_request_field_list_add(field, "<Disabled>", DISABLED_FLAG);

        recurse_directory("/usr/share/zoneinfo/", buddy_add_timezone_cb, field);

        if (timezone)
        {
            if (strcmp(timezone, "none") == 0)
                purple_request_field_list_add_selected(field, "<Disabled>");
            else
                purple_request_field_list_add_selected(field, timezone);
        }
        else
            purple_request_field_list_add_selected(field, "<Default>");
    }

    purple_request_field_group_add_field(group, field);
}