No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | nautilus-menu-provider.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * nautilus-property-page-provider.c - Interface for Nautilus extensions
3 * that provide context menu items
4 * for files.
5 *
6 * Copyright (C) 2003 Novell, Inc.
7 *
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.
12 *
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.
17 *
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.
21 *
22 * Author: Dave Camp <dave@ximian.com>
23 *
24 */
25
26 #include <config.h>
27 #include "nautilus-menu-provider.h"
28
29 #include <glib-object.h>
30
31 static void
32 nautilus_menu_provider_base_init (gpointer g_class)
33 {
34 static gboolean initialized = FALSE;
35
36 if (!initialized)
37 {
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,
41 G_SIGNAL_RUN_LAST,
42 0,
43 NULL, NULL,
44 g_cclosure_marshal_VOID__VOID,
45 G_TYPE_NONE, 0);
46 initialized = TRUE;
47 }
48 }
49
50 GType
51 nautilus_menu_provider_get_type (void)
52 {
53 static GType type = 0;
54
55 if (!type) {
56 const GTypeInfo info = {
57 sizeof (NautilusMenuProviderIface),
58 nautilus_menu_provider_base_init,
59 NULL,
60 NULL,
61 NULL,
62 NULL,
63 0,
64 0,
65 NULL
66 };
67
68 type = g_type_register_static (G_TYPE_INTERFACE,
69 "NautilusMenuProvider",
70 &info, 0);
71 g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
72 }
73
74 return type;
75 }
76
77 /**
78 * nautilus_menu_provider_get_file_items:
79 * @provider: a #NautilusMenuProvider
80 * @window: the parent #GtkWidget window
81 * @files: (element-type NautilusFileInfo): a list of #NautilusFileInfo
82 *
83 * Returns: (element-type NautilusMenuItem) (transfer full): the provided list of #NautilusMenuItem
84 */
85 GList *
86 nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
87 GtkWidget *window,
88 GList *files)
89 {
90 g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
91
92 if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items) {
93 return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items
94 (provider, window, files);
95 } else {
96 return NULL;
97 }
98 }
99
100 /**
101 * nautilus_menu_provider_get_background_items:
102 * @provider: a #NautilusMenuProvider
103 * @window: the parent #GtkWidget window
104 * @current_folder: the folder for which background items are requested
105 *
106 * Returns: (element-type NautilusMenuItem) (transfer full): the provided list of #NautilusMenuItem
107 */
108 GList *
109 nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
110 GtkWidget *window,
111 NautilusFileInfo *current_folder)
112 {
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);
115
116 if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items) {
117 return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items
118 (provider, window, current_folder);
119 } else {
120 return NULL;
121 }
122 }
123
124 /* This function emit a signal to inform nautilus that its item list has changed */
125 void
126 nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider* provider)
127 {
128 g_return_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider));
129
130 g_signal_emit_by_name (provider, "items_updated");
131 }