2 * nautilus-property-page-provider.c - Interface for Nautilus extensions
3 * that provide context menu items
6 * Copyright (C) 2003 Novell, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Author: Dave Camp <dave@ximian.com>
27 #include "nautilus-menu-provider.h"
29 #include <glib-object.h>
32 nautilus_menu_provider_base_init (gpointer g_class
)
34 static gboolean initialized
= FALSE
;
38 /* This signal should be emited each time the extension modify the list of menu items */
39 g_signal_new ("items_updated",
40 NAUTILUS_TYPE_MENU_PROVIDER
,
44 g_cclosure_marshal_VOID__VOID
,
51 nautilus_menu_provider_get_type (void)
53 static GType type
= 0;
56 const GTypeInfo info
= {
57 sizeof (NautilusMenuProviderIface
),
58 nautilus_menu_provider_base_init
,
68 type
= g_type_register_static (G_TYPE_INTERFACE
,
69 "NautilusMenuProvider",
71 g_type_interface_add_prerequisite (type
, G_TYPE_OBJECT
);
78 nautilus_menu_provider_get_file_items (NautilusMenuProvider
*provider
,
82 g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider
), NULL
);
84 if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider
)->get_file_items
) {
85 return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider
)->get_file_items
86 (provider
, window
, files
);
93 nautilus_menu_provider_get_background_items (NautilusMenuProvider
*provider
,
95 NautilusFileInfo
*current_folder
)
97 g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider
), NULL
);
98 g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder
), NULL
);
100 if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider
)->get_background_items
) {
101 return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider
)->get_background_items
102 (provider
, window
, current_folder
);
109 nautilus_menu_provider_get_toolbar_items (NautilusMenuProvider
*provider
,
111 NautilusFileInfo
*current_folder
)
113 g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider
), NULL
);
114 g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder
), NULL
);
116 if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider
)->get_toolbar_items
) {
117 return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider
)->get_toolbar_items
118 (provider
, window
, current_folder
);
124 /* This function emit a signal to inform nautilus that its item list has changed */
126 nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider
* provider
)
128 g_return_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider
));
130 g_signal_emit_by_name (provider
, "items_updated");