예제 #1
0
파일: collect.c 프로젝트: XelaRellum/geeqie
gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted)
{
	struct stat st;

	if (!insert_ci) return collection_add(cd, fd, sorted);

	if (stat_utf8(fd->path, &st) >= 0 && !S_ISDIR(st.st_mode))
		{
		CollectInfo *ci;

		ci = collection_info_new_if_not_exists(cd, &st, fd);
		if (!ci) return FALSE;

		DEBUG_3("insert in collection: %s", fd->path);

		cd->list = collection_list_insert(cd->list, ci, insert_ci, sorted ? cd->sort_method : SORT_NONE);
		cd->changed = TRUE;

		collection_window_insert(collection_window_find(cd), ci);

		return TRUE;
		}

	return FALSE;
}
예제 #2
0
파일: collect.c 프로젝트: XelaRellum/geeqie
void collection_window_close_by_collection(CollectionData *cd)
{
	CollectWindow *cw;

	cw = collection_window_find(cd);
	if (cw) collection_window_close_final(cw);
}
예제 #3
0
static void collection_save_or_load_dialog(const gchar *path,
					   gint type, CollectionData *cd)
{
	FileDialog *fd;
	GtkWidget *parent = NULL;
	CollectWindow *cw;
	const gchar *title;
	const gchar *btntext;
	void *btnfunc;
	gchar *base;
	const gchar *stock_id;

	if (type == DIALOG_SAVE || type == DIALOG_SAVE_CLOSE)
		{
		if (!cd) return;
		title = _("Save collection");
		btntext = NULL;
		btnfunc = collection_save_cb;
		stock_id = GTK_STOCK_SAVE;
		}
	else if (type == DIALOG_LOAD)
		{
		title = _("Open collection");
		btntext = NULL;
		btnfunc = collection_load_cb;
		stock_id = GTK_STOCK_OPEN;
		}
	else
		{
		if (!cd) return;
		title = _("Append collection");
		btntext = _("_Append");
		btnfunc = collection_append_cb;
		stock_id = GTK_STOCK_ADD;
		}

	if (cd) collection_ref(cd);

	cw = collection_window_find(cd);
	if (cw) parent = cw->window;

	fd = file_util_file_dlg(title, "GQview", "dlg_collection", parent,
			     collection_save_or_load_dialog_close_cb, cd);

	generic_dialog_add_message(GENERIC_DIALOG(fd), NULL, title, NULL);
	file_dialog_add_button(fd, stock_id, btntext, btnfunc, TRUE);

	base = g_strconcat(homedir(), "/", GQVIEW_RC_DIR_COLLECTIONS, NULL);
	file_dialog_add_path_widgets(fd, base, path,
				     "collection_load_save", ".gqv", _("Collection Files"));
	g_free(base);

	fd->type = type;

	gtk_widget_show(GENERIC_DIALOG(fd)->dialog);
}
예제 #4
0
파일: collect.c 프로젝트: XelaRellum/geeqie
static void collection_remove_by_info(CollectionData *cd, CollectInfo *info)
{
	if (!info || !g_list_find(cd->list, info)) return;

	cd->list = g_list_remove(cd->list, info);
	cd->changed = (cd->list != NULL);

	collection_window_remove(collection_window_find(cd), info);
	collection_info_free(info);
}
예제 #5
0
파일: collect.c 프로젝트: XelaRellum/geeqie
void collection_randomize(CollectionData *cd)
{
	if (!cd) return;

	cd->list = collection_list_randomize(cd->list);
	cd->sort_method = SORT_NONE;
	if (cd->list) cd->changed = TRUE;

	collection_window_refresh(collection_window_find(cd));
}
예제 #6
0
파일: collect.c 프로젝트: XelaRellum/geeqie
void collection_set_sort_method(CollectionData *cd, SortType method)
{
	if (!cd) return;

	if (cd->sort_method == method) return;

	cd->sort_method = method;
	cd->list = collection_list_sort(cd->list, cd->sort_method);
	if (cd->list) cd->changed = TRUE;

	collection_window_refresh(collection_window_find(cd));
}
예제 #7
0
파일: collect.c 프로젝트: XelaRellum/geeqie
gboolean collection_rename(CollectionData *cd, FileData *fd)
{
	CollectInfo *ci;
	ci = collection_list_find_fd(cd->list, fd);

	if (!ci) return FALSE;

	cd->changed = TRUE;

	collection_window_update(collection_window_find(cd), ci);

	return TRUE;
}
예제 #8
0
파일: collect.c 프로젝트: XelaRellum/geeqie
gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, gboolean must_exist)
{
	struct stat st;
	gboolean valid;

	if (must_exist)
		{
		valid = (stat_utf8(fd->path, &st) && !S_ISDIR(st.st_mode));
		}
	else
		{
		valid = TRUE;
		st.st_size = 0;
		st.st_mtime = 0;
		}

	if (valid)
		{
		CollectInfo *ci;

		ci = collection_info_new_if_not_exists(cd, &st, fd);
		if (!ci) return FALSE;
		DEBUG_3("add to collection: %s", fd->path);

		cd->list = collection_list_add(cd->list, ci, sorted ? cd->sort_method : SORT_NONE);
		cd->changed = TRUE;

		if (!sorted || cd->sort_method == SORT_NONE)
			{
			collection_window_add(collection_window_find(cd), ci);
			}
		else
			{
			collection_window_insert(collection_window_find(cd), ci);
			}
		}

	return valid;
}
예제 #9
0
파일: collect.c 프로젝트: XelaRellum/geeqie
gboolean collection_remove(CollectionData *cd, FileData *fd)
{
	CollectInfo *ci;

	ci = collection_list_find_fd(cd->list, fd);

	if (!ci) return FALSE;

	g_hash_table_remove(cd->existence, fd->path);

	cd->list = g_list_remove(cd->list, ci);
	cd->changed = TRUE;

	collection_window_remove(collection_window_find(cd), ci);
	collection_info_free(ci);

	return TRUE;
}
예제 #10
0
void collection_dialog_save_as(gchar *path, CollectionData *cd)
{
#if 0
	if (!cd->list)
		{
		GtkWidget *parent = NULL;
		CollectWindow *cw;

		cw = collection_window_find(cd);
		if (cw) parent = cw->window;
		file_util_warning_dialog(_("Collection empty"),
					 _("The current collection is empty, save aborted."),
					 GTK_STOCK_DIALOG_INFO, parent);
		return;
		}
#endif

	if (!path) path = cd->path;
	if (!path) path = cd->name;

	collection_save_or_load_dialog(path, DIALOG_SAVE, cd);
}
예제 #11
0
파일: collect.c 프로젝트: XelaRellum/geeqie
void collection_remove_by_info_list(CollectionData *cd, GList *list)
{
	GList *work;

	if (!list) return;

	if (!list->next)
		{
		/* more efficient (in collect-table) to remove a single item this way */
		collection_remove_by_info(cd, (CollectInfo *)list->data);
		return;
		}

	work = list;
	while (work)
		{
		cd->list = collection_list_remove(cd->list, work->data);
		work = work->next;
		}
	cd->changed = (cd->list != NULL);

	collection_window_refresh(collection_window_find(cd));
}
예제 #12
0
파일: collect.c 프로젝트: XelaRellum/geeqie
void collection_update_geometry(CollectionData *cd)
{
	collection_window_get_geometry(collection_window_find(cd));
}
예제 #13
0
파일: collect.c 프로젝트: XelaRellum/geeqie
void collection_path_changed(CollectionData *cd)
{
	collection_window_update_title(collection_window_find(cd));
}