summaryrefslogtreecommitdiffstats
path: root/src/nautilus-window-slot.h
blob: 3518c948c4d037702d2865cd309f172c0b474985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
   nautilus-window-slot.h: Nautilus window slot
 
   Copyright (C) 2008 Free Software Foundation, Inc.
  
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.
  
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.
  
   You should have received a copy of the GNU General Public
   License along with this program; if not, see <http://www.gnu.org/licenses/>.
  
   Author: Christian Neumair <cneumair@gnome.org>
*/

#pragma once

#include <gdk/gdk.h>
#include <gio/gio.h>
#include <gtk/gtk.h>

#include "nautilus-types.h"

typedef enum {
	NAUTILUS_LOCATION_CHANGE_STANDARD,
	NAUTILUS_LOCATION_CHANGE_BACK,
	NAUTILUS_LOCATION_CHANGE_FORWARD,
	NAUTILUS_LOCATION_CHANGE_RELOAD
} NautilusLocationChangeType;

#define NAUTILUS_TYPE_WINDOW_SLOT (nautilus_window_slot_get_type ())
G_DECLARE_DERIVABLE_TYPE (NautilusWindowSlot, nautilus_window_slot, NAUTILUS, WINDOW_SLOT, GtkBox)

typedef struct
{
    NautilusFile *file;
    gint view_before_search;
    GList *back_list;
    GList *forward_list;
    NautilusBookmark *current_location_bookmark;
} NautilusNavigationState;

struct _NautilusWindowSlotClass {
	GtkBoxClass parent_class;

	/* wrapped NautilusWindowInfo signals, for overloading */
	void (* active)   (NautilusWindowSlot *slot);
	void (* inactive) (NautilusWindowSlot *slot);

        /* Use this in case the subclassed slot has some special views differents
         * that the ones supported here. You can return your nautilus view
         * subclass in this function.
         */
        NautilusView*  (* get_view_for_location) (NautilusWindowSlot *slot,
                                                  GFile              *location);
        /* Whether this type of slot handles the location or not. This can be used
         * for the special slots which handle special locations like the desktop
         * or the other locations. */
        gboolean (* handles_location) (NautilusWindowSlot *slot,
                                       GFile              *location);
};

NautilusWindowSlot * nautilus_window_slot_new              (NautilusWindow     *window);

NautilusWindow * nautilus_window_slot_get_window           (NautilusWindowSlot *slot);
void             nautilus_window_slot_set_window           (NautilusWindowSlot *slot,
							    NautilusWindow     *window);

void nautilus_window_slot_open_location_full              (NautilusWindowSlot      *slot,
                                                           GFile                   *location,
                                                           NautilusWindowOpenFlags  flags,
                                                           GList                   *new_selection);

void nautilus_window_slot_open_location_set_navigation_state (NautilusWindowSlot         *slot,
                                                              GFile                      *location,
                                                              NautilusWindowOpenFlags     flags,
                                                              GList                      *new_selection,
                                                              NautilusLocationChangeType  change_type,
                                                              NautilusNavigationState    *navigation_state,
                                                              guint                       distance);

GFile * nautilus_window_slot_get_location		   (NautilusWindowSlot *slot);
GFile * nautilus_window_slot_get_pending_location          (NautilusWindowSlot *slot);

NautilusBookmark *nautilus_window_slot_get_bookmark        (NautilusWindowSlot *slot);

GList * nautilus_window_slot_get_back_history              (NautilusWindowSlot *slot);
GList * nautilus_window_slot_get_forward_history           (NautilusWindowSlot *slot);

gboolean nautilus_window_slot_get_allow_stop               (NautilusWindowSlot *slot);
void     nautilus_window_slot_set_allow_stop		   (NautilusWindowSlot *slot,
							    gboolean	        allow_stop);
void     nautilus_window_slot_stop_loading                 (NautilusWindowSlot *slot);

const gchar *nautilus_window_slot_get_title                (NautilusWindowSlot *slot);
void         nautilus_window_slot_update_title		   (NautilusWindowSlot *slot);

gboolean nautilus_window_slot_handle_event       	   (NautilusWindowSlot *slot,
							    GdkEvent           *event);

void    nautilus_window_slot_queue_reload		   (NautilusWindowSlot *slot);

GIcon*   nautilus_window_slot_get_icon                     (NautilusWindowSlot *slot);

const gchar*   nautilus_window_slot_get_tooltip                  (NautilusWindowSlot *slot);

NautilusToolbarMenuSections * nautilus_window_slot_get_toolbar_menu_sections (NautilusWindowSlot *slot);

GMenuModel* nautilus_window_slot_get_templates_menu (NautilusWindowSlot *self);

GMenuModel* nautilus_window_slot_get_extensions_background_menu (NautilusWindowSlot *self);

gboolean nautilus_window_slot_get_active                   (NautilusWindowSlot *slot);

void     nautilus_window_slot_set_active                   (NautilusWindowSlot *slot,
                                                            gboolean            active);
gboolean nautilus_window_slot_get_loading                  (NautilusWindowSlot *slot);

gboolean nautilus_window_slot_get_searching                (NautilusWindowSlot *slot);

GList* nautilus_window_slot_get_selection                  (NautilusWindowSlot *slot);

void     nautilus_window_slot_search                       (NautilusWindowSlot *slot,
                                                            NautilusQuery      *query);

gboolean nautilus_window_slot_handles_location (NautilusWindowSlot *self,
                                                GFile              *location);

void nautilus_window_slot_restore_navigation_state (NautilusWindowSlot      *self,
                                                    NautilusNavigationState *data);

NautilusNavigationState* nautilus_window_slot_get_navigation_state (NautilusWindowSlot *self);

NautilusQueryEditor *nautilus_window_slot_get_query_editor (NautilusWindowSlot *self);

/* Only used by slot-dnd */
NautilusView*  nautilus_window_slot_get_current_view       (NautilusWindowSlot *slot);

void nautilus_window_slot_back_or_forward                  (NautilusWindowSlot     *slot,
                                                            gboolean                back,
                                                            guint                   distance,
                                                            NautilusWindowOpenFlags flags);

void free_navigation_state                                 (gpointer data);