1 /* nautilus-view.h 2 * 3 * Copyright (C) 2015 Georges Basile Stavracas Neto <georges.stavracas@gmail.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #pragma once 20 21 #include <glib.h> 22 #include <gtk/gtk.h> 23 24 #include "nautilus-query.h" 25 #include "nautilus-toolbar-menu-sections.h" 26 27 /* Keep values in sync with the org.gnome.nautilus.FolderView schema enums: */ 28 #define NAUTILUS_VIEW_GRID_ID 0 29 #define NAUTILUS_VIEW_LIST_ID 1 30 /* Special ids, not used by GSettings schemas: */ 31 #define NAUTILUS_VIEW_OTHER_LOCATIONS_ID 3 32 #define NAUTILUS_VIEW_INVALID_ID 4 33 34 G_BEGIN_DECLS 35 36 #define NAUTILUS_TYPE_VIEW (nautilus_view_get_type ()) 37 38 G_DECLARE_INTERFACE (NautilusView, nautilus_view, NAUTILUS, VIEW, GtkWidget) 39 40 struct _NautilusViewInterface 41 { 42 GTypeInterface parent; 43 44 guint (*get_view_id) (NautilusView *view); 45 /* 46 * Returns the menu sections that should be shown in the toolbar menu 47 * when this view is active. Implementations must not return %NULL 48 */ 49 NautilusToolbarMenuSections * (*get_toolbar_menu_sections) (NautilusView *view); 50 51 /* 52 * Returns the menu for the background click of extensions. 53 */ 54 GMenuModel * (*get_extensions_background_menu) (NautilusView *view); 55 56 void (*set_extensions_background_menu) (NautilusView *view, 57 GMenuModel *menu); 58 /* 59 * Returns the menu for templates. 60 */ 61 GMenuModel * (*get_templates_menu) (NautilusView *view); 62 63 void (*set_templates_menu) (NautilusView *view, 64 GMenuModel *menu); 65 /* Current location of the view */ 66 GFile* (*get_location) (NautilusView *view); 67 void (*set_location) (NautilusView *view, 68 GFile *location); 69 70 /* Selection */ 71 GList* (*get_selection) (NautilusView *view); 72 void (*set_selection) (NautilusView *view, 73 GList *selection); 74 75 /* Search */ 76 NautilusQuery* (*get_search_query) (NautilusView *view); 77 void (*set_search_query) (NautilusView *view, 78 NautilusQuery *query); 79 80 /* Whether the current view is loading the location */ 81 gboolean (*is_loading) (NautilusView *view); 82 83 /* Whether the current view is searching or not */ 84 gboolean (*is_searching) (NautilusView *view); 85 }; 86 87 GIcon * nautilus_view_get_icon (guint view_id); 88 89 const gchar * nautilus_view_get_tooltip (guint view_id); 90 91 guint nautilus_view_get_view_id (NautilusView *view); 92 93 NautilusToolbarMenuSections * nautilus_view_get_toolbar_menu_sections (NautilusView *view); 94 95 GFile * nautilus_view_get_location (NautilusView *view); 96 97 void nautilus_view_set_location (NautilusView *view, 98 GFile *location); 99 100 GList * nautilus_view_get_selection (NautilusView *view); 101 102 void nautilus_view_set_selection (NautilusView *view, 103 GList *selection); 104 105 NautilusQuery * nautilus_view_get_search_query (NautilusView *view); 106 107 void nautilus_view_set_search_query (NautilusView *view, 108 NautilusQuery *query); 109 110 gboolean nautilus_view_is_loading (NautilusView *view); 111 112 gboolean nautilus_view_is_searching (NautilusView *view); 113 114 void nautilus_view_set_templates_menu (NautilusView *view, 115 GMenuModel *menu); 116 GMenuModel * nautilus_view_get_templates_menu (NautilusView *view); 117 void nautilus_view_set_extensions_background_menu (NautilusView *view, 118 GMenuModel *menu); 119 GMenuModel * nautilus_view_get_extensions_background_menu (NautilusView *view); 120 121 G_END_DECLS 122