blob: dc2d14df9ef2e74a601c621444535139e10a7d71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "rodisc.h"
void file_add_disc(const char *path)
{
static int num = 0;
GFile *file = g_file_new_for_path(path);
GFileInfo *info = g_file_query_info(file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
G_FILE_ATTRIBUTE_STANDARD_SIZE,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
g_return_if_fail(info);
const int my_num = ++num;
RODisc *disc = rodisc_new();
disc->id = g_strdup_printf("file%d", my_num);
disc->uri = g_strdup_printf("/file%d", my_num);
disc->file_path = g_file_get_path(file);
disc->file = file;
disc->label = g_strdup(g_file_info_get_display_name(info));
disc->type = RODISC_TYPE_GENERIC;
disc->size = g_file_info_get_size(info);
rodisc_export(disc);
g_object_unref(info);
}
|