1 /*
2  * Nautilus-Actions
3  * A Nautilus extension which offers configurable context menu actions.
4  *
5  * Copyright (C) 2005 The GNOME Foundation
6  * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
7  * Copyright (C) 2009-2014 Pierre Wieser and others (see AUTHORS)
8  *
9  * Nautilus-Actions is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * Nautilus-Actions is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Nautilus-Actions; see the file COPYING. If not, see
21  * <http://www.gnu.org/licenses/>.
22  *
23  * Authors:
24  *   Frederic Ruaudel <grumz@grumz.net>
25  *   Rodrigo Moya <rodrigo@gnome-db.org>
26  *   Pierre Wieser <pwieser@trychlos.org>
27  *   ... and many others (see AUTHORS)
28  */
29 
30 #ifndef __NACT_MENUBAR_PRIV_H__
31 #define __NACT_MENUBAR_PRIV_H__
32 
33 /*
34  * SECTION: nact-menubar-priv
35  * @title: NactMenubarPrivate
36  * @short_description: The Menubar private data definition
37  * @include: nact-menubar-priv.h
38  *
39  * This file should only be included by nact-menubar -derived files.
40  */
41 
42 #include <core/na-updater.h>
43 
44 #include "nact-menubar.h"
45 #include "nact-sort-buttons.h"
46 
47 G_BEGIN_DECLS
48 
49 struct _NactMenubarPrivate {
50 	/*< private >*/
51 	gboolean         dispose_has_run;
52 
53 	/* set at instanciation time
54 	 */
55 	BaseWindow      *window;
56 	gulong			 update_sensitivities_handler_id;
57 
58 	/* set at initialization time
59 	 */
60 	NAUpdater       *updater;
61 	NactSortButtons *sort_buttons;
62 	GtkUIManager    *ui_manager;
63 	GtkActionGroup  *action_group;
64 	GtkActionGroup  *notebook_group;
65 	gboolean         is_level_zero_writable;
66 	gboolean         has_writable_providers;
67 
68 	/* set when the selection changes
69 	 */
70 	guint            count_selected;
71 	GList           *selected_items;
72 	gboolean         is_parent_writable;		/* new menu/new action/paste menu or action */
73 	gboolean         enable_new_profile;		/* new profile/paste a profile */
74 	gboolean         is_action_writable;
75 	gboolean         are_parents_writable;		/* duplicate */
76 	gboolean         are_items_writable;		/* cut/delete */
77 
78 	/* set when the count of modified or deleted NAObjectItem changes
79 	 * or when the lever zero is changed
80 	 */
81 	gboolean         is_tree_modified;
82 
83 	/* set on focus in/out
84 	 */
85 	gboolean         treeview_has_focus;
86 
87 	/* opening a contextual popup menu
88 	 */
89 	gulong           popup_handler;
90 
91 	/* set when total count of items changes
92 	 */
93 	gint             count_menus;
94 	gint             count_actions;
95 	gint             count_profiles;
96 	gboolean         have_exportables;
97 
98 	/* *** */
99 	gint            selected_menus;
100 	gint            selected_actions;
101 	gint            selected_profiles;
102 	gint            clipboard_menus;
103 	gint            clipboard_actions;
104 	gint            clipboard_profiles;
105 	/* *** */
106 };
107 
108 /* Signal emitted by the NactMenubar object on itself
109  */
110 #define MENUBAR_SIGNAL_UPDATE_SENSITIVITIES		"menubar-signal-update-sensitivities"
111 
112 /* Convenience macros to get a NactMenubar from a BaseWindow
113  */
114 #define WINDOW_DATA_MENUBAR						"window-data-menubar"
115 
116 #define BAR_WINDOW_VOID( window ) \
117 		g_return_if_fail( BASE_IS_WINDOW( window )); \
118 		NactMenubar *bar = ( NactMenubar * ) g_object_get_data( G_OBJECT( window ), WINDOW_DATA_MENUBAR ); \
119 		g_return_if_fail( NACT_IS_MENUBAR( bar ));
120 
121 #define BAR_WINDOW_VALUE( window, value ) \
122 		g_return_val_if_fail( BASE_IS_WINDOW( window ), value ); \
123 		NactMenubar *bar = ( NactMenubar * ) g_object_get_data( G_OBJECT( window ), WINDOW_DATA_MENUBAR ); \
124 		g_return_val_if_fail( NACT_IS_MENUBAR( bar ), value );
125 
126 /* These functions should only be called from a nact-menubar-derived file
127  */
128 void nact_menubar_enable_item                        ( const NactMenubar *bar, const gchar *name, gboolean enabled );
129 
130 void nact_menubar_edit_on_update_sensitivities       ( const NactMenubar *bar );
131 
132 void nact_menubar_edit_on_cut                        ( GtkAction *action, BaseWindow *window );
133 void nact_menubar_edit_on_copy                       ( GtkAction *action, BaseWindow *window );
134 void nact_menubar_edit_on_paste                      ( GtkAction *action, BaseWindow *window );
135 void nact_menubar_edit_on_paste_into                 ( GtkAction *action, BaseWindow *window );
136 void nact_menubar_edit_on_duplicate                  ( GtkAction *action, BaseWindow *window );
137 void nact_menubar_edit_on_delete                     ( GtkAction *action, BaseWindow *window );
138 void nact_menubar_edit_on_reload                     ( GtkAction *action, BaseWindow *window );
139 void nact_menubar_edit_on_prefererences              ( GtkAction *action, BaseWindow *window );
140 
141 void nact_menubar_file_initialize                    (       NactMenubar *bar );
142 void nact_menubar_file_on_update_sensitivities       ( const NactMenubar *bar );
143 
144 void nact_menubar_file_on_new_menu                   ( GtkAction *action, BaseWindow *window );
145 void nact_menubar_file_on_new_action                 ( GtkAction *action, BaseWindow *window );
146 void nact_menubar_file_on_new_profile                ( GtkAction *action, BaseWindow *window );
147 void nact_menubar_file_on_save                       ( GtkAction *action, BaseWindow *window );
148 void nact_menubar_file_on_quit                       ( GtkAction *action, BaseWindow *window );
149 
150 void nact_menubar_file_save_items                    ( BaseWindow *window );
151 
152 void nact_menubar_help_on_update_sensitivities       ( const NactMenubar *bar );
153 
154 void nact_menubar_help_on_help                       ( GtkAction *action, BaseWindow *window );
155 void nact_menubar_help_on_about                      ( GtkAction *action, BaseWindow *window );
156 
157 void nact_menubar_maintainer_on_update_sensitivities ( const NactMenubar *bar );
158 
159 void nact_menubar_maintainer_on_dump_selection       ( GtkAction *action, BaseWindow *window );
160 void nact_menubar_maintainer_on_brief_tree_store_dump( GtkAction *action, BaseWindow *window );
161 void nact_menubar_maintainer_on_list_modified_items  ( GtkAction *action, BaseWindow *window );
162 void nact_menubar_maintainer_on_dump_clipboard       ( GtkAction *action, BaseWindow *window );
163 void nact_menubar_maintainer_on_test_function        ( GtkAction *action, BaseWindow *window );
164 
165 void nact_menubar_tools_on_update_sensitivities      ( const NactMenubar *bar );
166 
167 void nact_menubar_tools_on_import                    ( GtkAction *action, BaseWindow *window );
168 void nact_menubar_tools_on_export                    ( GtkAction *action, BaseWindow *window );
169 
170 void nact_menubar_view_on_update_sensitivities       ( const NactMenubar *bar );
171 
172 void nact_menubar_view_on_expand_all                 ( GtkAction *action, BaseWindow *window );
173 void nact_menubar_view_on_collapse_all               ( GtkAction *action, BaseWindow *window );
174 void nact_menubar_view_on_toolbar_file               ( GtkToggleAction *action, BaseWindow *window );
175 void nact_menubar_view_on_toolbar_edit               ( GtkToggleAction *action, BaseWindow *window );
176 void nact_menubar_view_on_toolbar_tools              ( GtkToggleAction *action, BaseWindow *window );
177 void nact_menubar_view_on_toolbar_help               ( GtkToggleAction *action, BaseWindow *window );
178 
179 void nact_menubar_view_on_tabs_pos_changed           ( GtkRadioAction *action, GtkRadioAction *current, BaseWindow *window );
180 
181 G_END_DECLS
182 
183 #endif /* __NACT_MENUBAR_PRIV_H__ */
184