Add a construct-only 'file_system' property, split test case into testfilechooser, testfilechooser-vfs

This commit is contained in:
Owen Taylor 2003-03-26 17:09:26 +00:00
parent 5ef90224aa
commit 79491c1d25
9 changed files with 304 additions and 116 deletions

View File

@ -20,6 +20,7 @@
#include "gtkfilechooser.h"
#include "gtkfilechooserenums.h"
#include "gtkfilesystem.h"
#define _(str) (str)
@ -42,6 +43,8 @@ gtk_file_chooser_get_type (void)
file_chooser_type = g_type_register_static (G_TYPE_INTERFACE,
"GtkFileChooser",
&file_chooser_info, 0);
g_type_interface_add_prerequisite (file_chooser_type, GTK_TYPE_WIDGET);
}
return file_chooser_type;
@ -78,6 +81,12 @@ gtk_file_chooser_base_init (gpointer g_class)
GTK_TYPE_FILE_CHOOSER_ACTION,
GTK_FILE_CHOOSER_ACTION_OPEN,
G_PARAM_READWRITE));
g_object_interface_install_property (iface_type,
g_param_spec_object ("file_system",
_("File System"),
_("File system object to use"),
GTK_TYPE_FILE_SYSTEM,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_interface_install_property (iface_type,
g_param_spec_boolean ("folder_mode",
_("Folder Mode"),

View File

@ -79,15 +79,19 @@ struct _GtkFileChooserImplDefault
static void gtk_file_chooser_impl_default_class_init (GtkFileChooserImplDefaultClass *class);
static void gtk_file_chooser_impl_default_iface_init (GtkFileChooserIface *iface);
static void gtk_file_chooser_impl_default_init (GtkFileChooserImplDefault *impl);
static void gtk_file_chooser_impl_default_finalize (GObject *object);
static void gtk_file_chooser_impl_default_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_impl_default_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GObject* gtk_file_chooser_impl_default_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params);
static void gtk_file_chooser_impl_default_finalize (GObject *object);
static void gtk_file_chooser_impl_default_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_impl_default_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_impl_default_set_current_folder (GtkFileChooser *chooser,
const char *uri);
@ -107,6 +111,24 @@ static void list_selection_changed (GtkTreeSelection *tree_selection,
static void entry_activate (GtkEntry *entry,
GtkFileChooserImplDefault *impl);
static void tree_name_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gpointer data);
static void list_name_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gpointer data);
static void list_size_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gpointer data);
GObjectClass *parent_class;
GType
_gtk_file_chooser_impl_default_get_type (void)
{
@ -150,6 +172,7 @@ gtk_file_chooser_impl_default_class_init (GtkFileChooserImplDefaultClass *class)
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = gtk_file_chooser_impl_default_finalize;
gobject_class->constructor = gtk_file_chooser_impl_default_constructor;
gobject_class->set_property = gtk_file_chooser_impl_default_set_property;
gobject_class->get_property = gtk_file_chooser_impl_default_get_property;
@ -171,6 +194,55 @@ gtk_file_chooser_impl_default_iface_init (GtkFileChooserIface *iface)
static void
gtk_file_chooser_impl_default_init (GtkFileChooserImplDefault *impl)
{
impl->folder_mode = FALSE;
impl->local_only = TRUE;
impl->preview_widget_active = TRUE;
impl->select_multiple = FALSE;
impl->show_hidden = FALSE;
gtk_container_set_border_width (GTK_CONTAINER (impl), 5);
}
static void
gtk_file_chooser_impl_default_finalize (GObject *object)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (object);
g_object_unref (impl->file_system);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
set_preview_widget (GtkFileChooserImplDefault *impl,
GtkWidget *preview_widget)
{
if (preview_widget == impl->preview_widget)
return;
if (impl->preview_widget)
{
g_object_unref (impl->preview_widget);
impl->preview_widget = NULL;
}
impl->preview_widget = preview_widget;
if (impl->preview_widget)
{
g_object_ref (impl->preview_widget);
gtk_object_sink (GTK_OBJECT (impl->preview_widget));
}
}
static GObject*
gtk_file_chooser_impl_default_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
GtkFileChooserImplDefault *impl;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GObject *object;
GtkWidget *hpaned;
GtkWidget *hbox;
GtkWidget *label;
@ -179,14 +251,13 @@ gtk_file_chooser_impl_default_init (GtkFileChooserImplDefault *impl)
GList *focus_chain;
#endif
impl->folder_mode = FALSE;
impl->local_only = TRUE;
impl->preview_widget_active = TRUE;
impl->select_multiple = FALSE;
impl->show_hidden = FALSE;
object = parent_class->constructor (type,
n_construct_properties,
construct_params);
impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (object);
g_assert (impl->file_system);
gtk_container_set_border_width (GTK_CONTAINER (impl), 5);
gtk_widget_push_composite_child ();
hpaned = gtk_hpaned_new ();
@ -257,35 +328,42 @@ gtk_file_chooser_impl_default_init (GtkFileChooserImplDefault *impl)
#endif
gtk_widget_pop_composite_child ();
}
static void
gtk_file_chooser_impl_default_finalize (GObject *object)
{
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (object);
impl->tree_model = _gtk_file_system_model_new (impl->file_system, NULL, -1,
GTK_FILE_INFO_DISPLAY_NAME);
_gtk_file_system_model_set_show_files (impl->tree_model, FALSE);
g_object_unref (impl->file_system);
}
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->tree),
GTK_TREE_MODEL (impl->tree_model));
static void
set_preview_widget (GtkFileChooserImplDefault *impl,
GtkWidget *preview_widget)
{
if (preview_widget == impl->preview_widget)
return;
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (impl->tree), 0,
"File name",
gtk_cell_renderer_text_new (),
tree_name_data_func, impl, NULL);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->tree),
GTK_FILE_SYSTEM_MODEL_DISPLAY_NAME);
if (impl->preview_widget)
{
g_object_unref (impl->preview_widget);
impl->preview_widget = NULL;
}
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "File name");
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func (column, renderer,
list_name_data_func, impl, NULL);
gtk_tree_view_column_set_sort_column_id (column, 0);
gtk_tree_view_append_column (GTK_TREE_VIEW (impl->list), column);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Size");
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func (column, renderer,
list_size_data_func, impl, NULL);
gtk_tree_view_column_set_sort_column_id (column, 1);
gtk_tree_view_append_column (GTK_TREE_VIEW (impl->list), column);
impl->preview_widget = preview_widget;
if (impl->preview_widget)
{
g_object_ref (impl->preview_widget);
gtk_object_sink (GTK_OBJECT (impl->preview_widget));
}
_gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->entry),
impl->file_system);
return object;
}
static void
@ -302,6 +380,19 @@ gtk_file_chooser_impl_default_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_ACTION:
impl->action = g_value_get_enum (value);
break;
case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM:
{
GtkFileSystem *file_system = g_value_get_object (value);
if (impl->file_system != file_system)
{
if (impl->file_system)
g_object_unref (impl->file_system);
impl->file_system = file_system;
if (impl->file_system)
g_object_ref (impl->file_system);
}
}
break;
case GTK_FILE_CHOOSER_PROP_FOLDER_MODE:
{
gboolean folder_mode = g_value_get_boolean (value);
@ -887,46 +978,7 @@ list_size_data_func (GtkTreeViewColumn *tree_column,
GtkWidget *
_gtk_file_chooser_impl_default_new (GtkFileSystem *file_system)
{
GtkWidget *result = g_object_new (GTK_TYPE_FILE_CHOOSER_IMPL_DEFAULT, NULL);
GtkFileChooserImplDefault *impl = GTK_FILE_CHOOSER_IMPL_DEFAULT (result);
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
impl->file_system = g_object_ref(file_system);
impl->tree_model = _gtk_file_system_model_new (file_system, NULL, -1,
GTK_FILE_INFO_DISPLAY_NAME);
_gtk_file_system_model_set_show_files (impl->tree_model, FALSE);
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->tree),
GTK_TREE_MODEL (impl->tree_model));
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (impl->tree), 0,
"File name",
gtk_cell_renderer_text_new (),
tree_name_data_func, impl, NULL);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->tree),
GTK_FILE_SYSTEM_MODEL_DISPLAY_NAME);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "File name");
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func (column, renderer,
list_name_data_func, impl, NULL);
gtk_tree_view_column_set_sort_column_id (column, 0);
gtk_tree_view_append_column (GTK_TREE_VIEW (impl->list), column);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Size");
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func (column, renderer,
list_size_data_func, impl, NULL);
gtk_tree_view_column_set_sort_column_id (column, 1);
gtk_tree_view_append_column (GTK_TREE_VIEW (impl->list), column);
_gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->entry),
file_system);
return result;
return g_object_new (GTK_TYPE_FILE_CHOOSER_IMPL_DEFAULT,
"file-system", file_system,
NULL);
}

View File

@ -22,12 +22,15 @@
#include "gtkfilechooserwidget.h"
#include "gtkfilechooserenums.h"
#include "gtkfilechooserutils.h"
#include "gtkfilesystem.h"
#include <stdarg.h>
struct _GtkFileChooserDialogPrivate
{
GtkWidget *widget;
GtkFileSystem *file_system;
};
#define GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE(o) (GTK_FILE_CHOOSER_DIALOG (o)->priv)
@ -35,14 +38,19 @@ struct _GtkFileChooserDialogPrivate
static void gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class);
static void gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog);
static void gtk_file_chooser_dialog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GObject* gtk_file_chooser_dialog_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params);
static void gtk_file_chooser_dialog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
GObjectClass *parent_class;
GType
gtk_file_chooser_dialog_get_type (void)
@ -86,6 +94,9 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
gobject_class->constructor = gtk_file_chooser_dialog_constructor;
gobject_class->set_property = gtk_file_chooser_dialog_set_property;
gobject_class->get_property = gtk_file_chooser_dialog_get_property;
@ -101,17 +112,39 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
GTK_TYPE_FILE_CHOOSER_DIALOG,
GtkFileChooserDialogPrivate);
dialog->priv = priv;
}
static GObject*
gtk_file_chooser_dialog_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
GtkFileChooserDialogPrivate *priv;
GObject *object;
object = parent_class->constructor (type,
n_construct_properties,
construct_params);
priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (object);
gtk_widget_push_composite_child ();
priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), priv->widget, TRUE, TRUE, 0);
if (priv->file_system)
priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET,
"file_system", priv->file_system,
NULL);
else
priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
gtk_widget_show (priv->widget);
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (dialog),
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),
GTK_FILE_CHOOSER (priv->widget));
gtk_widget_pop_composite_child ();
return object;
}
static void
@ -122,8 +155,26 @@ gtk_file_chooser_dialog_set_property (GObject *object,
{
GtkFileChooserDialogPrivate *priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (object);
g_object_set_property (G_OBJECT (priv->widget), pspec->name, value);
switch (prop_id)
{
case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM:
{
GtkFileSystem *file_system = g_value_get_object (value);
if (priv->file_system != file_system)
{
if (priv->file_system)
g_object_unref (priv->file_system);
priv->file_system = file_system;
if (priv->file_system)
g_object_ref (priv->file_system);
}
}
break;
default:
g_object_set_property (G_OBJECT (priv->widget), pspec->name, value);
break;
}
}
static void

View File

@ -22,6 +22,7 @@
#include "gtkfilechooserutils.h"
#include "gtkfilechooser.h"
#include "gtkfilechooserenums.h"
#include "gtkfilesystem.h"
static void delegate_set_current_folder (GtkFileChooser *chooser,
const char *uri);
@ -58,6 +59,11 @@ _gtk_file_chooser_install_properties (GObjectClass *klass)
g_param_spec_override ("action",
GTK_TYPE_FILE_CHOOSER_ACTION,
G_PARAM_READWRITE));
g_object_class_install_property (klass,
GTK_FILE_CHOOSER_PROP_FILE_SYSTEM,
g_param_spec_override ("file_system",
GTK_TYPE_FILE_SYSTEM,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (klass,
GTK_FILE_CHOOSER_PROP_FOLDER_MODE,
g_param_spec_override ("folder_mode",

View File

@ -28,6 +28,7 @@ G_BEGIN_DECLS
typedef enum {
GTK_FILE_CHOOSER_PROP_ACTION = 0x1000,
GTK_FILE_CHOOSER_PROP_FILE_SYSTEM,
GTK_FILE_CHOOSER_PROP_FOLDER_MODE,
GTK_FILE_CHOOSER_PROP_LOCAL_ONLY,
GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET,

View File

@ -22,26 +22,33 @@
#include "gtkfilechooserimpldefault.h"
#include "gtkfilechooserenums.h"
#include "gtkfilechooserutils.h"
#include "gtkfilesystemgnomevfs.h"
#include "gtkfilesystemunix.h"
struct _GtkFileChooserWidgetPrivate
{
GtkWidget *impl;
GtkFileSystem *file_system;
};
#define GTK_FILE_CHOOSER_WIDGET_GET_PRIVATE(o) (GTK_FILE_CHOOSER_WIDGET (o)->priv)
static void gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class);
static void gtk_file_chooser_widget_init (GtkFileChooserWidget *chooser_widget);
static void gtk_file_chooser_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GObject* gtk_file_chooser_widget_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params);
static void gtk_file_chooser_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
GObjectClass *parent_class;
GType
gtk_file_chooser_widget_get_type (void)
@ -85,6 +92,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
gobject_class->constructor = gtk_file_chooser_widget_constructor;
gobject_class->set_property = gtk_file_chooser_widget_set_property;
gobject_class->get_property = gtk_file_chooser_widget_get_property;
@ -99,15 +109,31 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *chooser_widget)
GtkFileChooserWidgetPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser_widget,
GTK_TYPE_FILE_CHOOSER_WIDGET,
GtkFileChooserWidgetPrivate);
chooser_widget->priv = priv;
}
static GObject*
gtk_file_chooser_widget_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
GtkFileChooserWidgetPrivate *priv;
GObject *object;
gchar *current_folder;
gchar *current_folder_uri;
chooser_widget->priv = priv;
object = parent_class->constructor (type,
n_construct_properties,
construct_params);
priv = GTK_FILE_CHOOSER_WIDGET_GET_PRIVATE (object);
gtk_widget_push_composite_child ();
priv->impl = _gtk_file_chooser_impl_default_new (_gtk_file_system_gnome_vfs_new ());
gtk_box_pack_start (GTK_BOX (chooser_widget), priv->impl, TRUE, TRUE, 0);
if (!priv->file_system)
priv->file_system = _gtk_file_system_unix_new ();
priv->impl = _gtk_file_chooser_impl_default_new (priv->file_system);
gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0);
gtk_widget_show (priv->impl);
current_folder = g_get_current_dir ();
@ -119,10 +145,12 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *chooser_widget)
}
g_free (current_folder);
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (chooser_widget),
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),
GTK_FILE_CHOOSER (priv->impl));
gtk_widget_pop_composite_child ();
return object;
}
static void
@ -132,8 +160,26 @@ gtk_file_chooser_widget_set_property (GObject *object,
GParamSpec *pspec)
{
GtkFileChooserWidgetPrivate *priv = GTK_FILE_CHOOSER_WIDGET_GET_PRIVATE (object);
g_object_set_property (G_OBJECT (priv->impl), pspec->name, value);
switch (prop_id)
{
case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM:
{
GtkFileSystem *file_system = g_value_get_object (value);
if (priv->file_system != file_system)
{
if (priv->file_system)
g_object_unref (priv->file_system);
priv->file_system = file_system;
if (priv->file_system)
g_object_ref (priv->file_system);
}
}
break;
default:
g_object_set_property (G_OBJECT (priv->impl), pspec->name, value);
break;
}
}
static void

View File

@ -289,6 +289,8 @@ gtk_file_system_get_type (void)
file_system_type = g_type_register_static (G_TYPE_INTERFACE,
"GtkFileSystem",
&file_system_info, 0);
g_type_interface_add_prerequisite (file_system_type, G_TYPE_OBJECT);
}
return file_system_type;
@ -485,6 +487,8 @@ gtk_file_folder_get_type (void)
file_folder_type = g_type_register_static (G_TYPE_INTERFACE,
"GtkFileFolder",
&file_folder_info, 0);
g_type_interface_add_prerequisite (file_folder_type, G_TYPE_OBJECT);
}
return file_folder_type;

View File

@ -22,6 +22,7 @@
#define __GTK_FILE_SYSTEM_UNIX_H__
#include <glib-object.h>
#include "gtkfilesystem.h"
G_BEGIN_DECLS

View File

@ -3,6 +3,12 @@
#include "gtkfilechooser.h"
#include "prop-editor.h"
#ifdef USE_GNOME_VFS
#include "gtkfilesystemgnomevfs.h"
#else
#include "gtkfilesystemunix.h"
#endif
static void
print_current_folder (GtkFileChooser *chooser)
{
@ -45,14 +51,26 @@ main (int argc, char **argv)
GtkWidget *button;
GtkWidget *dialog;
GtkWidget *prop_editor;
GtkFileSystem *file_system;
gtk_init (&argc, &argv);
dialog = gtk_file_chooser_dialog_new ("Select a file", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
#ifdef USE_GNOME_VFS
file_system = _gtk_file_system_gnome_vfs_new ();
#else
file_system = _gtk_file_system_unix_new ();
#endif
dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG,
"action", GTK_FILE_CHOOSER_ACTION_OPEN,
"file_system", file_system,
"title", "Select a file",
NULL);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
g_signal_connect (dialog, "selection_changed",