summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-window-info.h
blob: 4bb271b6727d6c5872edea92e975f0053982860a (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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-

   caja-window-info.h: Interface for caja windows

   Copyright (C) 2004 Red Hat 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, write to the
   Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
   Boston, MA 02110-1301, USA.

   Author: Alexander Larsson <alexl@redhat.com>
*/

#ifndef CAJA_WINDOW_INFO_H
#define CAJA_WINDOW_INFO_H

#include <glib-object.h>
#include <libcaja-private/caja-view.h>
#include <gtk/gtk.h>

#ifdef __cplusplus
extern "C" {
#endif

    typedef enum
    {
        CAJA_WINDOW_SHOW_HIDDEN_FILES_DEFAULT,
        CAJA_WINDOW_SHOW_HIDDEN_FILES_ENABLE,
        CAJA_WINDOW_SHOW_HIDDEN_FILES_DISABLE
    }
    CajaWindowShowHiddenFilesMode;


    typedef enum
    {
        CAJA_WINDOW_OPEN_ACCORDING_TO_MODE,
        CAJA_WINDOW_OPEN_IN_SPATIAL,
        CAJA_WINDOW_OPEN_IN_NAVIGATION
    } CajaWindowOpenMode;

    typedef enum
    {
        /* used in spatial mode */
        CAJA_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1<<0,
        /* used in navigation mode */
        CAJA_WINDOW_OPEN_FLAG_NEW_WINDOW = 1<<1,
        CAJA_WINDOW_OPEN_FLAG_NEW_TAB = 1<<2
    } CajaWindowOpenFlags;

    typedef	enum
    {
        CAJA_WINDOW_SPATIAL,
        CAJA_WINDOW_NAVIGATION,
        CAJA_WINDOW_DESKTOP
    } CajaWindowType;

#define CAJA_TYPE_WINDOW_INFO           (caja_window_info_get_type ())
#define CAJA_WINDOW_INFO(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_WINDOW_INFO, CajaWindowInfo))
#define CAJA_IS_WINDOW_INFO(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_WINDOW_INFO))
#define CAJA_WINDOW_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_WINDOW_INFO, CajaWindowInfoIface))

#ifndef CAJA_WINDOW_DEFINED
#define CAJA_WINDOW_DEFINED
    /* Using CajaWindow for the vtable to make implementing this in
     * CajaWindow easier */
    typedef struct CajaWindow          CajaWindow;
#endif

#ifndef CAJA_WINDOW_SLOT_DEFINED
#define CAJA_WINDOW_SLOT_DEFINED
    typedef struct CajaWindowSlot      CajaWindowSlot;
#endif


    typedef CajaWindowSlot              CajaWindowSlotInfo;
    typedef CajaWindow                  CajaWindowInfo;

    typedef struct _CajaWindowInfoIface CajaWindowInfoIface;

    struct _CajaWindowInfoIface
    {
        GTypeInterface g_iface;

        /* signals: */

        void           (* loading_uri)              (CajaWindowInfo *window,
                const char        *uri);
        /* Emitted when the view in the window changes the selection */
        void           (* selection_changed)        (CajaWindowInfo *window);
        void           (* title_changed)            (CajaWindowInfo *window,
                const char         *title);
        void           (* hidden_files_mode_changed)(CajaWindowInfo *window);

        /* VTable: */
        /* A view calls this once after a load_location, once it starts loading the
         * directory. Might be called directly, or later on the mainloop.
         * This can also be called at any other time if the view needs to
         * re-load the location. But the view needs to call load_complete first if
         * its currently loading. */
        void (* report_load_underway) (CajaWindowInfo *window,
                                       CajaView *view);
        /* A view calls this once after reporting load_underway, when the location
           has been fully loaded, or when the load was stopped
           (by an error or by the user). */
        void (* report_load_complete) (CajaWindowInfo *window,
                                       CajaView *view);
        /* This can be called at any time when there has been a catastrophic failure of
           the view. It will result in the view being removed. */
        void (* report_view_failed)   (CajaWindowInfo *window,
                                       CajaView *view);
        void (* report_selection_changed) (CajaWindowInfo *window);

        /* Returns the number of selected items in the view */
        int  (* get_selection_count)  (CajaWindowInfo    *window);

        /* Returns a list of uris for th selected items in the view, caller frees it */
        GList *(* get_selection)      (CajaWindowInfo    *window);

        char * (* get_current_location)  (CajaWindowInfo *window);
        void   (* push_status)           (CajaWindowInfo *window,
                                          const char *status);
        char * (* get_title)             (CajaWindowInfo *window);
        GList *(* get_history)           (CajaWindowInfo *window);
        CajaWindowType
        (* get_window_type)       (CajaWindowInfo *window);
        CajaWindowShowHiddenFilesMode
        (* get_hidden_files_mode) (CajaWindowInfo *window);
        void   (* set_hidden_files_mode) (CajaWindowInfo *window,
                                          CajaWindowShowHiddenFilesMode mode);

        CajaWindowSlotInfo * (* get_active_slot) (CajaWindowInfo *window);
        CajaWindowSlotInfo * (* get_extra_slot)  (CajaWindowInfo *window);

        gboolean (* get_initiated_unmount) (CajaWindowInfo *window);
        void   (* set_initiated_unmount) (CajaWindowInfo *window,
                                          gboolean initiated_unmount);

        void   (* view_visible)        (CajaWindowInfo *window,
                                        CajaView *view);
        void   (* close_window)       (CajaWindowInfo *window);
        GtkUIManager *     (* get_ui_manager)   (CajaWindowInfo *window);
    };

    GType                             caja_window_info_get_type                 (void);
    void                              caja_window_info_report_load_underway     (CajaWindowInfo                *window,
            CajaView                      *view);
    void                              caja_window_info_report_load_complete     (CajaWindowInfo                *window,
            CajaView                      *view);
    void                              caja_window_info_report_view_failed       (CajaWindowInfo                *window,
            CajaView                      *view);
    void                              caja_window_info_report_selection_changed (CajaWindowInfo                *window);
    CajaWindowSlotInfo *          caja_window_info_get_active_slot          (CajaWindowInfo                *window);
    CajaWindowSlotInfo *          caja_window_info_get_extra_slot           (CajaWindowInfo                *window);
    void                              caja_window_info_view_visible             (CajaWindowInfo                *window,
            CajaView                      *view);
    void                              caja_window_info_close                    (CajaWindowInfo                *window);
    void                              caja_window_info_push_status              (CajaWindowInfo                *window,
            const char                        *status);
    CajaWindowType                caja_window_info_get_window_type          (CajaWindowInfo                *window);
    char *                            caja_window_info_get_title                (CajaWindowInfo                *window);
    GList *                           caja_window_info_get_history              (CajaWindowInfo                *window);
    char *                            caja_window_info_get_current_location     (CajaWindowInfo                *window);
    int                               caja_window_info_get_selection_count      (CajaWindowInfo                *window);
    GList *                           caja_window_info_get_selection            (CajaWindowInfo                *window);
    CajaWindowShowHiddenFilesMode caja_window_info_get_hidden_files_mode    (CajaWindowInfo                *window);
    void                              caja_window_info_set_hidden_files_mode    (CajaWindowInfo                *window,
            CajaWindowShowHiddenFilesMode  mode);
    gboolean                          caja_window_info_get_initiated_unmount    (CajaWindowInfo                *window);
    void                              caja_window_info_set_initiated_unmount    (CajaWindowInfo                *window,
            gboolean initiated_unmount);
    GtkUIManager *                    caja_window_info_get_ui_manager           (CajaWindowInfo                *window);

#ifdef __cplusplus
}
#endif

#endif /* CAJA_WINDOW_INFO_H */