1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
3 nautilus-view.h: Interface for nautilus views
5 Copyright (C) 2004 Red Hat Inc.
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public
18 License along with this program; if not, write to the
19 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Author: Alexander Larsson <alexl@redhat.com>
25 #ifndef NAUTILUS_VIEW_H
26 #define NAUTILUS_VIEW_H
28 #include <glib-object.h>
29 #include <gtk/gtkwidget.h>
31 /* For NautilusZoomLevel */
32 #include <libnautilus-private/nautilus-icon-info.h>
36 #define NAUTILUS_TYPE_VIEW (nautilus_view_get_type ())
37 #define NAUTILUS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_VIEW, NautilusView))
38 #define NAUTILUS_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_VIEW))
39 #define NAUTILUS_VIEW_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_VIEW, NautilusViewIface))
42 typedef struct _NautilusView NautilusView
; /* dummy typedef */
43 typedef struct _NautilusViewIface NautilusViewIface
;
45 struct _NautilusViewIface
47 GTypeInterface g_iface
;
51 /* emitted when the view-specific title as returned by get_title changes */
52 void (* title_changed
) (NautilusView
*view
);
54 /* BONOBOTODO: remove this? */
55 void (* zoom_parameters_changed
)(NautilusView
*view
);
56 void (* zoom_level_changed
) (NautilusView
*view
);
60 /* Get the id string for this view. Its a constant string, not memory managed */
61 const char * (* get_view_id
) (NautilusView
*view
);
63 /* Get the widget for this view, can be the same object or a different
64 object owned by the view. Doesn't ref the widget. */
65 GtkWidget
* (* get_widget
) (NautilusView
*view
);
67 /* Called to tell the view to start loading a location, or to reload it.
68 The view responds with a load_underway as soon as it starts loading,
69 and a load_complete when the location is completely read. */
70 void (* load_location
) (NautilusView
*view
,
71 const char *location_uri
);
73 /* Called to tell the view to stop loading the location its currently loading */
74 void (* stop_loading
) (NautilusView
*view
);
76 /* Returns the number of selected items in the view */
77 int (* get_selection_count
) (NautilusView
*view
);
79 /* Returns a list of uris for th selected items in the view, caller frees it */
80 GList
* (* get_selection
) (NautilusView
*view
);
82 /* This is called when the window wants to change the selection in the view */
83 void (* set_selection
) (NautilusView
*view
,
86 /* Return the uri of the first visible file */
87 char * (* get_first_visible_file
) (NautilusView
*view
);
88 /* Scroll the view so that the file specified by the uri is at the top
90 void (* scroll_to_file
) (NautilusView
*view
,
93 /* This function can supply a special window title, if you don't want one
94 have this function return NULL, or just don't supply a function */
95 char * (* get_title
) (NautilusView
*view
);
99 gboolean (* supports_zooming
) (NautilusView
*view
);
100 void (* bump_zoom_level
) (NautilusView
*view
,
102 void (* zoom_to_level
) (NautilusView
*view
,
103 NautilusZoomLevel level
);
104 NautilusZoomLevel (* get_zoom_level
) (NautilusView
*view
);
105 void (* restore_default_zoom_level
) (NautilusView
*view
);
106 gboolean (* can_zoom_in
) (NautilusView
*view
);
107 gboolean (* can_zoom_out
) (NautilusView
*view
);
109 void (* grab_focus
) (NautilusView
*view
);
111 /* Request popup of context menu referring to the open location.
112 * This is triggered in spatial windows by right-clicking the location button,
113 * in navigational windows by right-clicking the "Location:" label in the
115 * The view may display the popup synchronously, asynchronously
116 * or not react to the popup request at all. */
117 void (* pop_up_location_context_menu
) (NautilusView
*view
,
118 GdkEventButton
*event
);
120 /* Padding for future expansion */
121 void (*_reserved1
) (void);
122 void (*_reserved2
) (void);
123 void (*_reserved3
) (void);
124 void (*_reserved4
) (void);
125 void (*_reserved5
) (void);
126 void (*_reserved6
) (void);
127 void (*_reserved7
) (void);
130 GType
nautilus_view_get_type (void);
132 const char * nautilus_view_get_view_id (NautilusView
*view
);
133 GtkWidget
* nautilus_view_get_widget (NautilusView
*view
);
134 void nautilus_view_load_location (NautilusView
*view
,
135 const char *location_uri
);
136 void nautilus_view_stop_loading (NautilusView
*view
);
137 int nautilus_view_get_selection_count (NautilusView
*view
);
138 GList
* nautilus_view_get_selection (NautilusView
*view
);
139 void nautilus_view_set_selection (NautilusView
*view
,
141 char * nautilus_view_get_first_visible_file (NautilusView
*view
);
142 void nautilus_view_scroll_to_file (NautilusView
*view
,
144 char * nautilus_view_get_title (NautilusView
*view
);
145 gboolean
nautilus_view_supports_zooming (NautilusView
*view
);
146 void nautilus_view_bump_zoom_level (NautilusView
*view
,
148 void nautilus_view_zoom_to_level (NautilusView
*view
,
149 NautilusZoomLevel level
);
150 void nautilus_view_restore_default_zoom_level (NautilusView
*view
);
151 gboolean
nautilus_view_can_zoom_in (NautilusView
*view
);
152 gboolean
nautilus_view_can_zoom_out (NautilusView
*view
);
153 NautilusZoomLevel
nautilus_view_get_zoom_level (NautilusView
*view
);
154 void nautilus_view_pop_up_location_context_menu (NautilusView
*view
,
155 GdkEventButton
*event
);
156 void nautilus_view_grab_focus (NautilusView
*view
);
160 #endif /* NAUTILUS_VIEW_H */