|
|
@@ -28,7 +28,10 @@ struct _OupisWindow
|
|
|
|
|
|
/* Template widgets */
|
|
|
GtkSearchEntry *searchentry;
|
|
|
- GtkLabel *label;
|
|
|
+ GtkScrolledWindow *scrolledwindow;
|
|
|
+ GtkListView *listview;
|
|
|
+ GtkSingleSelection *singleselection;
|
|
|
+ GtkDirectoryList *directorylist;
|
|
|
};
|
|
|
|
|
|
G_DEFINE_FINAL_TYPE (OupisWindow, oupis_window, ADW_TYPE_APPLICATION_WINDOW)
|
|
|
@@ -42,6 +45,28 @@ oupis_window__search_request (GtkSearchEntry *self,
|
|
|
g_print ("%s\n", request);
|
|
|
}
|
|
|
|
|
|
+static void
|
|
|
+listview_activate (GtkListView *listview, int position, gpointer user_data) {
|
|
|
+ GFileInfo *info = G_FILE_INFO (g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (listview)), position));
|
|
|
+ //TODO do something with info
|
|
|
+ g_object_unref (info);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static GIcon *
|
|
|
+get_icon (GtkListItem *item, GFileInfo *info) {
|
|
|
+ GIcon *icon;
|
|
|
+ /* g_file_info_get_icon can return NULL */
|
|
|
+ icon = G_IS_FILE_INFO (info) ? g_file_info_get_icon (info) : NULL;
|
|
|
+ return icon ? g_object_ref (icon) : NULL;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static char *
|
|
|
+get_file_name (GtkListItem *item, GFileInfo *info) {
|
|
|
+ return G_IS_FILE_INFO (info) ? g_strdup (g_file_info_get_name (info)) : NULL;
|
|
|
+}
|
|
|
+
|
|
|
static void
|
|
|
oupis_window_class_init (OupisWindowClass *klass)
|
|
|
{
|
|
|
@@ -49,20 +74,26 @@ oupis_window_class_init (OupisWindowClass *klass)
|
|
|
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/lu/arnoux/Oupis/oupis-window.ui");
|
|
|
gtk_widget_class_bind_template_child (widget_class, OupisWindow, searchentry);
|
|
|
- gtk_widget_class_bind_template_child (widget_class, OupisWindow, label);
|
|
|
+ gtk_widget_class_bind_template_child (widget_class, OupisWindow, scrolledwindow);
|
|
|
+ gtk_widget_class_bind_template_child (widget_class, OupisWindow, listview);
|
|
|
+ gtk_widget_class_bind_template_child (widget_class, OupisWindow, singleselection);
|
|
|
+ gtk_widget_class_bind_template_child (widget_class, OupisWindow, directorylist);
|
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, oupis_window__search_request);
|
|
|
+ gtk_widget_class_bind_template_callback (widget_class, listview_activate);
|
|
|
+ gtk_widget_class_bind_template_callback (widget_class, get_icon);
|
|
|
+ gtk_widget_class_bind_template_callback (widget_class, get_file_name);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-static void
|
|
|
-oupis_window_init (OupisWindow *self)
|
|
|
-{
|
|
|
- gtk_widget_init_template (GTK_WIDGET (self) );
|
|
|
+ static void
|
|
|
+ oupis_window_init (OupisWindow *self)
|
|
|
+ {
|
|
|
+ GFile *file;
|
|
|
|
|
|
- //GtkSearchEntry *searchentry = GTK_SEARCH_ENTRY (self->searchentry);
|
|
|
- //g_signal_connect (searchentry,
|
|
|
- // "activate",
|
|
|
- // G_CALLBACK (oupis_window__search_request),
|
|
|
- // self);
|
|
|
+ gtk_widget_init_template (GTK_WIDGET (self) );
|
|
|
|
|
|
-}
|
|
|
+ file = g_file_new_for_path (".");
|
|
|
+ gtk_directory_list_set_file (GTK_DIRECTORY_LIST (self->directorylist), file);
|
|
|
+ g_object_unref (file);
|
|
|
+ }
|