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 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33 
34 #include <api/na-object-api.h>
35 
36 #include "nact-clipboard.h"
37 #include "nact-menubar-priv.h"
38 #include "nact-main-window.h"
39 #include "nact-tree-ieditable.h"
40 
41 /**
42  * nact_menubar_maintainer_on_update_sensitivities:
43  * @bar: this #NactMenubar object.
44  *
45  * Update sensitivities on the Maintainer menu.
46  */
47 void
nact_menubar_maintainer_on_update_sensitivities(const NactMenubar * bar)48 nact_menubar_maintainer_on_update_sensitivities( const NactMenubar *bar )
49 {
50 }
51 
52 /**
53  * nact_menubar_maintainer_on_dump_selection:
54  * @action: the #GtkAction of the item.
55  * @window: the #BaseWindow main application window.
56  *
57  * Triggers the "Maintainer/Dump selection" item.
58  */
59 void
nact_menubar_maintainer_on_dump_selection(GtkAction * action,BaseWindow * window)60 nact_menubar_maintainer_on_dump_selection( GtkAction *action, BaseWindow *window )
61 {
62 	BAR_WINDOW_VOID( window );
63 
64 	na_object_dump_tree( bar->private->selected_items );
65 }
66 
67 /**
68  * nact_menubar_maintainer_on_brief_tree_store_dump:
69  * @action: the #GtkAction of the item.
70  * @window: the #BaseWindow main application window.
71  *
72  * Triggers the "Maintainer/Brief treestore dump" item.
73  */
74 void
nact_menubar_maintainer_on_brief_tree_store_dump(GtkAction * action,BaseWindow * window)75 nact_menubar_maintainer_on_brief_tree_store_dump( GtkAction *action, BaseWindow *window )
76 {
77 	NactTreeView *items_view;
78 	GList *items;
79 
80 	items_view = nact_main_window_get_items_view( NACT_MAIN_WINDOW( window ));
81 	items = nact_tree_view_get_items( items_view );
82 	na_object_dump_tree( items );
83 	na_object_free_items( items );
84 }
85 
86 /**
87  * nact_menubar_maintainer_on_list_modified_items:
88  * @action: the #GtkAction of the item.
89  * @window: the #BaseWindow main application window.
90  *
91  * Triggers the "Maintainer/List modified items" item.
92  */
93 void
nact_menubar_maintainer_on_list_modified_items(GtkAction * action,BaseWindow * window)94 nact_menubar_maintainer_on_list_modified_items( GtkAction *action, BaseWindow *window )
95 {
96 	NactTreeView *items_view;
97 
98 	items_view = nact_main_window_get_items_view( NACT_MAIN_WINDOW( window ));
99 	nact_tree_ieditable_dump_modified( NACT_TREE_IEDITABLE( items_view ));
100 }
101 
102 /**
103  * nact_menubar_maintainer_on_dump_clipboard:
104  * @action: the #GtkAction of the item.
105  * @window: the #BaseWindow main application window.
106  *
107  * Triggers the "Maintainer/Dump clipboard" item.
108  */
109 void
nact_menubar_maintainer_on_dump_clipboard(GtkAction * action,BaseWindow * window)110 nact_menubar_maintainer_on_dump_clipboard( GtkAction *action, BaseWindow *window )
111 {
112 	nact_clipboard_dump( nact_main_window_get_clipboard( NACT_MAIN_WINDOW( window )));
113 }
114 
115 /*
116  * Test a miscellaneous function
117  */
118 void
nact_menubar_maintainer_on_test_function(GtkAction * action,BaseWindow * window)119 nact_menubar_maintainer_on_test_function( GtkAction *action, BaseWindow *window )
120 {
121 	BaseApplication *application = base_window_get_application( window );
122 	gboolean is_willing = base_application_is_willing_to_quit( application );
123 	g_debug( "nact_menubar_maintainer_on_test_function: willing_to=%s", is_willing ? "True":"False" );
124 }
125