1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3
* Copyright (C) 2010 ammonkey
5
* This library is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU Lesser General Public License
7
* version 3.0 as published by the Free Software Foundation.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser General Public License version 3.0 for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library. If not, see
16
* <http://www.gnu.org/licenses/>.
18
* Author: ammonkey <am.monkeyd@gmail.com>
21
#include "marlin-window-columns.h"
22
//#include "gof-directory-async.h"
23
//#include "fm-list-view.h"
24
#include "fm-columns-view.h"
26
/*static void gof_window_slot_init (GOFWindowSlot *slot);
27
static void gof_window_slot_class_init (GOFWindowSlotClass *class);
28
static void gof_window_slot_finalize (GObject *object);*/
29
static void marlin_window_columns_finalize (GObject *object);
31
G_DEFINE_TYPE (MarlinWindowColumns, marlin_window_columns, G_TYPE_OBJECT)
33
#define parent_class marlin_window_columns_parent_class
36
marlin_window_columns_change_location (GOFWindowSlot *slot, GFile *location)
38
MarlinWindowColumns *mwcols = slot->mwcols;
39
GtkWidget *window = mwcols->window;
41
load_dir_async_cancel(slot->directory);
42
gtk_widget_destroy (mwcols->view_box);
44
mwcols = marlin_window_columns_new (location, window);
48
marlin_window_columns_new (GFile *location, GtkWidget *window)
50
printf("%s\n", G_STRFUNC);
51
MarlinWindowColumns *mwcols;
52
mwcols = g_object_new (MARLIN_TYPE_WINDOW_COLUMNS, NULL);
53
mwcols->location = location;
54
mwcols->window = window;
56
GOFWindowSlot *slot = gof_window_slot_column_new (location, window);
57
slot->mwcols = mwcols;
58
mwcols->active_slot = slot;
59
//marlin_window_set_active_slot (MARLIN_WINDOW (window), slot);
61
mwcols->colpane = gtk_hbox_new (FALSE, 0);
62
slot->colpane = mwcols->colpane;
63
gtk_widget_show (mwcols->colpane);
64
mwcols->view_box = gtk_scrolled_window_new(0, 0);
65
gtk_widget_show (mwcols->view_box);
66
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (mwcols->view_box), mwcols->colpane);
67
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (mwcols->view_box),
71
gof_window_column_add(slot, slot->view_box);
73
gtk_container_add( GTK_CONTAINER(window), mwcols->view_box);
78
marlin_window_columns_add (MarlinWindowColumns *mwcols, GFile *location)
80
GOFWindowSlot *slot = gof_window_slot_column_new (location, mwcols->window);
81
slot->mwcols = mwcols;
82
slot->colpane = mwcols->active_slot->colpane;
83
//mwcols->active_slot = slot;
84
//add_column(mwcols, slot->view_box);
85
gof_window_column_add(slot, slot->view_box);
89
marlin_window_columns_init (MarlinWindowColumns *mwcol)
92
GtkWidget *content_box, *eventbox, *extras_vbox, *frame, *hsep;
94
content_box = gtk_vbox_new (FALSE, 0);
95
slot->content_box = content_box;
96
gtk_widget_show (content_box);
98
frame = gtk_frame_new (NULL);
99
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
100
gtk_box_pack_start (GTK_BOX (content_box), frame, TRUE, TRUE, 0);
101
gtk_widget_show (frame);
103
slot->view_box = gtk_vbox_new (FALSE, 0);
104
gtk_container_add (GTK_CONTAINER (frame), slot->view_box);
105
gtk_widget_show (slot->view_box);
107
//slot->view_box = GTK_WIDGET (g_object_new (FM_TYPE_LIST_VIEW, NULL));
108
/*slot->view_box = GTK_WIDGET (g_object_new (FM_TYPE_LIST_VIEW,
109
"window-slot", slot, NULL));*/
110
//gtk_box_pack_start (GTK_BOX (slot->content_box), GTK_WIDGET (slot->list_view->tree), TRUE, TRUE, 0);
113
/*GtkWidget *m_scwin;
114
m_scwin = gtk_scrolled_window_new(NULL,NULL);
115
slot->content_box = m_scwin;
116
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_scwin), GTK_POLICY_AUTOMATIC , GTK_POLICY_AUTOMATIC);
117
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_scwin), GTK_SHADOW_NONE);*/
119
//gtk_container_add( GTK_CONTAINER(m_scwin), GTK_WIDGET (slot->list_view->tree));
123
eventbox = gtk_event_box_new ();
124
slot->extra_location_event_box = eventbox;
125
gtk_widget_set_name (eventbox, "nautilus-extra-view-widget");
126
gtk_box_pack_start (GTK_BOX (slot->view_box), eventbox, FALSE, FALSE, 0);
128
extras_vbox = gtk_vbox_new (FALSE, 6);
129
gtk_container_set_border_width (GTK_CONTAINER (extras_vbox), 6);
130
slot->extra_location_widgets = extras_vbox;
131
gtk_container_add (GTK_CONTAINER (eventbox), extras_vbox);
132
gtk_widget_show (extras_vbox);
134
hsep = gtk_hseparator_new ();
135
gtk_box_pack_start (GTK_BOX (slot->view_box), hsep, FALSE, FALSE, 0);
136
slot->extra_location_separator = hsep;
138
slot->title = g_strdup (_("Loading..."));
143
marlin_window_columns_class_init (MarlinWindowColumnsClass *class)
145
/*class->active = real_active;
146
class->inactive = real_inactive;
147
class->update_query_editor = real_update_query_editor; */
149
G_OBJECT_CLASS (class)->finalize = marlin_window_columns_finalize;
153
marlin_window_columns_get_active_slot (MarlinWindowColumns *mwcols)
155
return (mwcols->active_slot);
159
marlin_window_columns_get_location (MarlinWindowColumns *mwcols)
161
return mwcols->location;
166
nautilus_window_slot_remove_extra_location_widgets (NautilusWindowSlot *slot)
168
gtk_container_foreach (GTK_CONTAINER (slot->extra_location_widgets),
170
slot->extra_location_widgets);
171
gtk_widget_hide (slot->extra_location_event_box);
172
gtk_widget_hide (slot->extra_location_separator);
176
nautilus_window_slot_add_extra_location_widget (NautilusWindowSlot *slot,
179
gtk_box_pack_start (GTK_BOX (slot->extra_location_widgets),
180
widget, TRUE, TRUE, 0);
181
gtk_widget_show (slot->extra_location_event_box);
182
gtk_widget_show (slot->extra_location_separator);
186
nautilus_window_slot_add_current_location_to_history_list (NautilusWindowSlot *slot)
189
if ((slot->pane->window == NULL || !NAUTILUS_IS_DESKTOP_WINDOW (slot->pane->window)) &&
190
nautilus_add_bookmark_to_history_list (slot->current_location_bookmark)) {
191
nautilus_send_history_list_changed ();
197
marlin_window_columns_finalize (GObject *object)
199
//MarlinWindowColumns *mwcols = MARLIN_WINDOW_COLUMNS (object);
201
G_OBJECT_CLASS (parent_class)->finalize (object);
206
if (slot->content_view) {
207
widget = nautilus_view_get_widget (slot->content_view);
208
gtk_widget_destroy (widget);
209
g_object_unref (slot->content_view);
210
slot->content_view = NULL;
213
if (slot->new_content_view) {
214
widget = nautilus_view_get_widget (slot->new_content_view);
215
gtk_widget_destroy (widget);
216
g_object_unref (slot->new_content_view);
217
slot->new_content_view = NULL;
220
nautilus_window_slot_set_viewed_file (slot, NULL);
221
/* TODO? why do we unref here? the file is NULL.
222
* It was already here before the slot move, though */
223
nautilus_file_unref (slot->viewed_file);
226
eel_g_list_free_deep (slot->pending_selection);
227
slot->pending_selection = NULL;
229
g_free (slot->title);
232
g_free (slot->status_text);
233
slot->status_text = NULL;
235
//G_OBJECT_CLASS (parent_class)->dispose (object);