1/* gtkplacessidebarprivate.h
2 *
3 * Copyright (C) 2015 Red Hat
4 *
5 * This file is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This file is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Authors: Carlos Soriano <csoriano@gnome.org>
19 */
20
21#ifndef __GTK_PLACES_SIDEBAR_PRIVATE_H__
22#define __GTK_PLACES_SIDEBAR_PRIVATE_H__
23
24#include <glib.h>
25#include <gtk/gtkwidget.h>
26#include <gtk/gtkenums.h>
27
28G_BEGIN_DECLS
29
30#define GTK_TYPE_PLACES_SIDEBAR (gtk_places_sidebar_get_type ())
31#define GTK_PLACES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PLACES_SIDEBAR, GtkPlacesSidebar))
32#define GTK_PLACES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PLACES_SIDEBAR, GtkPlacesSidebarClass))
33#define GTK_IS_PLACES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PLACES_SIDEBAR))
34#define GTK_IS_PLACES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PLACES_SIDEBAR))
35#define GTK_PLACES_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PLACES_SIDEBAR, GtkPlacesSidebarClass))
36
37typedef struct _GtkPlacesSidebar GtkPlacesSidebar;
38typedef struct _GtkPlacesSidebarClass GtkPlacesSidebarClass;
39
40/*
41 * GtkPlacesOpenFlags:
42 * @GTK_PLACES_OPEN_NORMAL: This is the default mode that GtkPlacesSidebar uses if no other flags
43 * are specified. It indicates that the calling application should open the selected location
44 * in the normal way, for example, in the folder view beside the sidebar.
45 * @GTK_PLACES_OPEN_NEW_TAB: When passed to gtk_places_sidebar_set_open_flags(), this indicates
46 * that the application can open folders selected from the sidebar in new tabs. This value
47 * will be passed to the GtkPlacesSidebar::open-location signal when the user selects
48 * that a location be opened in a new tab instead of in the standard fashion.
49 * @GTK_PLACES_OPEN_NEW_WINDOW: Similar to @GTK_PLACES_OPEN_NEW_TAB, but indicates that the application
50 * can open folders in new windows.
51 *
52 * These flags serve two purposes. First, the application can call gtk_places_sidebar_set_open_flags()
53 * using these flags as a bitmask. This tells the sidebar that the application is able to open
54 * folders selected from the sidebar in various ways, for example, in new tabs or in new windows in
55 * addition to the normal mode.
56 *
57 * Second, when one of these values gets passed back to the application in the
58 * GtkPlacesSidebar::open-location signal, it means that the application should
59 * open the selected location in the normal way, in a new tab, or in a new
60 * window. The sidebar takes care of determining the desired way to open the location,
61 * based on the modifier keys that the user is pressing at the time the selection is made.
62 *
63 * If the application never calls gtk_places_sidebar_set_open_flags(), then the sidebar will only
64 * use GTK_PLACES_OPEN_NORMAL in the GtkPlacesSidebar::open-location signal. This is the
65 * default mode of operation.
66 */
67typedef enum {
68 GTK_PLACES_OPEN_NORMAL = 1 << 0,
69 GTK_PLACES_OPEN_NEW_TAB = 1 << 1,
70 GTK_PLACES_OPEN_NEW_WINDOW = 1 << 2
71} GtkPlacesOpenFlags;
72
73GType gtk_places_sidebar_get_type (void) G_GNUC_CONST;
74GtkWidget * gtk_places_sidebar_new (void);
75
76GtkPlacesOpenFlags gtk_places_sidebar_get_open_flags (GtkPlacesSidebar *sidebar);
77void gtk_places_sidebar_set_open_flags (GtkPlacesSidebar *sidebar,
78 GtkPlacesOpenFlags flags);
79
80GFile * gtk_places_sidebar_get_location (GtkPlacesSidebar *sidebar);
81void gtk_places_sidebar_set_location (GtkPlacesSidebar *sidebar,
82 GFile *location);
83
84gboolean gtk_places_sidebar_get_show_recent (GtkPlacesSidebar *sidebar);
85void gtk_places_sidebar_set_show_recent (GtkPlacesSidebar *sidebar,
86 gboolean show_recent);
87
88gboolean gtk_places_sidebar_get_show_desktop (GtkPlacesSidebar *sidebar);
89void gtk_places_sidebar_set_show_desktop (GtkPlacesSidebar *sidebar,
90 gboolean show_desktop);
91
92gboolean gtk_places_sidebar_get_show_enter_location (GtkPlacesSidebar *sidebar);
93void gtk_places_sidebar_set_show_enter_location (GtkPlacesSidebar *sidebar,
94 gboolean show_enter_location);
95
96void gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar,
97 GFile *location);
98void gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar,
99 GFile *location);
100GListModel * gtk_places_sidebar_get_shortcuts (GtkPlacesSidebar *sidebar);
101
102GFile * gtk_places_sidebar_get_nth_bookmark (GtkPlacesSidebar *sidebar,
103 int n);
104void gtk_places_sidebar_set_drop_targets_visible (GtkPlacesSidebar *sidebar,
105 gboolean visible);
106gboolean gtk_places_sidebar_get_show_trash (GtkPlacesSidebar *sidebar);
107void gtk_places_sidebar_set_show_trash (GtkPlacesSidebar *sidebar,
108 gboolean show_trash);
109
110void gtk_places_sidebar_set_show_other_locations (GtkPlacesSidebar *sidebar,
111 gboolean show_other_locations);
112gboolean gtk_places_sidebar_get_show_other_locations (GtkPlacesSidebar *sidebar);
113
114void gtk_places_sidebar_set_show_starred_location (GtkPlacesSidebar *sidebar,
115 gboolean show_starred_location);
116gboolean gtk_places_sidebar_get_show_starred_location (GtkPlacesSidebar *sidebar);
117
118/* Keep order, since it's used for the sort functions */
119typedef enum {
120 GTK_PLACES_SECTION_INVALID,
121 GTK_PLACES_SECTION_COMPUTER,
122 GTK_PLACES_SECTION_MOUNTS,
123 GTK_PLACES_SECTION_CLOUD,
124 GTK_PLACES_SECTION_BOOKMARKS,
125 GTK_PLACES_SECTION_OTHER_LOCATIONS,
126 GTK_PLACES_N_SECTIONS
127} GtkPlacesSectionType;
128
129typedef enum {
130 GTK_PLACES_INVALID,
131 GTK_PLACES_BUILT_IN,
132 GTK_PLACES_XDG_DIR,
133 GTK_PLACES_MOUNTED_VOLUME,
134 GTK_PLACES_BOOKMARK,
135 GTK_PLACES_HEADING,
136 GTK_PLACES_CONNECT_TO_SERVER,
137 GTK_PLACES_ENTER_LOCATION,
138 GTK_PLACES_DROP_FEEDBACK,
139 GTK_PLACES_BOOKMARK_PLACEHOLDER,
140 GTK_PLACES_OTHER_LOCATIONS,
141 GTK_PLACES_STARRED_LOCATION,
142 GTK_PLACES_N_PLACES
143} GtkPlacesPlaceType;
144
145char *gtk_places_sidebar_get_location_title (GtkPlacesSidebar *sidebar);
146
147G_END_DECLS
148
149#endif /* __GTK_PLACES_SIDEBAR_PRIVATE_H__ */
150

source code of gtk/gtk/gtkplacessidebarprivate.h