コード例 #1
0
ファイル: ui_tabcomp.c プロジェクト: BestImageViewer/geeqie
static void tab_completion_select_show(TabCompData *td)
{
	const gchar *title;
	const gchar *path;
	gchar *filter = NULL;
	gchar *filter_desc = NULL;

	if (td->fd)
		{
		gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(td->fd)->dialog));
		return;
		}

	title = (td->fd_title) ? td->fd_title : _("Select path");
	td->fd = file_dialog_new(title, "select_path", td->entry,
				 tab_completion_select_cancel_cb, td);
	file_dialog_add_button(td->fd, GTK_STOCK_OK, NULL,
				 tab_completion_select_ok_cb, TRUE);

	generic_dialog_add_message(GENERIC_DIALOG(td->fd), NULL, title, NULL, FALSE);

	if (td->filter)
		{
		filter = td->filter;
		}
	else
		{
		filter = "*";
		}
	if (td->filter_desc)
		{
		filter_desc = td->filter_desc;
		}
	else
		{
		filter_desc = _("All files");
		}

	path = gtk_entry_get_text(GTK_ENTRY(td->entry));
	if (strlen(path) == 0) path = NULL;
	if (td->fd_folders_only)
		{
		file_dialog_add_path_widgets(td->fd, NULL, path, td->history_key, NULL, NULL);
		}
	else
		{
		file_dialog_add_path_widgets(td->fd, NULL, path, td->history_key, filter, filter_desc);
		}

	gtk_widget_show(GENERIC_DIALOG(td->fd)->dialog);
}
コード例 #2
0
ファイル: fileutil.c プロジェクト: gentoo/pornview
FileDialog *
file_util_file_dlg (const gchar * title, const gchar * message,
		    const gchar * wmclass, const gchar * wmsubclass,
		    void (*cb_cancel) (FileDialog *, gpointer), gpointer data)
{
    FileDialog *fd;

    fd = file_dialog_new (title, message, wmclass, wmsubclass, cb_cancel,
			  data);
    if (place_dialogs_under_mouse)
	gtk_window_position (GTK_WINDOW (GENERIC_DIALOG (fd)->dialog),
			     GTK_WIN_POS_MOUSE);
    else if (place_dialogs_center)
	gtk_window_position (GTK_WINDOW (GENERIC_DIALOG (fd)->dialog),
			     GTK_WIN_POS_CENTER);

    return fd;
}