No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-popup-menu.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-popup-menu.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) version 3.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with the program; if not, see <http://www.gnu.org/licenses/>
14 *
15 *
16 * Authors:
17 * Miguel de Icaza <miguel@ximian.com>
18 * Jody Goldberg (jgoldberg@home.com)
19 * Jeffrey Stedfast <fejj@ximian.com>
20 *
21 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
22 *
23 */
24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28
29 #include <libintl.h>
30 #include <string.h>
31
32 #include <gdk/gdkkeysyms.h>
33 #include <gtk/gtk.h>
34
35 #include "e-popup-menu.h"
36
37 /*
38 * Creates an item with an optional icon
39 */
40 static void
41 make_item (GtkMenu *menu,
42 GtkMenuItem *item,
43 const gchar *name)
44 {
45 GtkWidget *label;
46
47 if (*name == '\0')
48 return;
49
50 /*
51 * Ugh. This needs to go into Gtk+
52 */
53 label = gtk_label_new_with_mnemonic (name);
54 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
55 gtk_widget_show (label);
56
57 gtk_container_add (GTK_CONTAINER (item), label);
58 }
59
60 GtkMenu *
61 e_popup_menu_create_with_domain (EPopupMenu *menu_list,
62 guint32 disable_mask,
63 guint32 hide_mask,
64 gpointer default_closure,
65 const gchar *domain)
66 {
67 GtkMenu *menu = GTK_MENU (gtk_menu_new ());
68 gboolean last_item_separator = TRUE;
69 gint last_non_separator = -1;
70 gint i;
71
72 for (i = 0; menu_list[i].name; i++) {
73 if (strcmp ("", menu_list[i].name) && !(menu_list[i].disable_mask & hide_mask)) {
74 last_non_separator = i;
75 }
76 }
77
78 for (i = 0; i <= last_non_separator; i++) {
79 gboolean separator;
80
81 separator = !strcmp ("", menu_list[i].name);
82
83 if ((!(separator && last_item_separator)) && !(menu_list[i].disable_mask & hide_mask)) {
84 GtkWidget *item = NULL;
85
86 if (!separator) {
87 item = gtk_menu_item_new ();
88
89 make_item (menu, GTK_MENU_ITEM (item), dgettext (domain, menu_list[i].name));
90 } else {
91 item = gtk_menu_item_new ();
92 }
93
94 gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
95
96 if (menu_list[i].fn)
97 g_signal_connect (
98 item, "activate",
99 G_CALLBACK (menu_list[i].fn),
100 default_closure);
101
102 if (menu_list[i].disable_mask & disable_mask)
103 gtk_widget_set_sensitive (item, FALSE);
104
105 gtk_widget_show (item);
106
107 last_item_separator = separator;
108 }
109 }
110
111 return menu;
112 }