evolution-3.6.4/mail/e-mail-label-action.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-label-action.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-label-action.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  * e-mail-label-action.c
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) version 3.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 16  *
 17  *
 18  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 19  *
 20  */
 21 
 22 #ifdef HAVE_CONFIG_H
 23 #include <config.h>
 24 #endif
 25 
 26 #include "e-mail-label-action.h"
 27 
 28 #define E_MAIL_LABEL_ACTION_GET_PRIVATE(obj) \
 29 	(G_TYPE_INSTANCE_GET_PRIVATE \
 30 	((obj), E_TYPE_MAIL_LABEL_ACTION, EMailLabelActionPrivate))
 31 
 32 struct _EMailLabelActionPrivate {
 33 	gint placeholder;
 34 };
 35 
 36 G_DEFINE_TYPE (EMailLabelAction, e_mail_label_action, GTK_TYPE_TOGGLE_ACTION)
 37 
 38 static void
 39 mail_label_action_menu_item_realize_cb (GtkWidget *menu_item)
 40 {
 41 	GtkAction *action;
 42 	GtkActivatable *activatable;
 43 	GtkWidget *container;
 44 	GtkWidget *widget;
 45 
 46 	activatable = GTK_ACTIVATABLE (menu_item);
 47 	action = gtk_activatable_get_related_action (activatable);
 48 	g_return_if_fail (E_IS_MAIL_LABEL_ACTION (action));
 49 
 50 	/* Prevent GtkMenuItem's sync_action_properties() method from
 51 	 * destroying our hack.  Instead we use EBindings to keep the
 52 	 * label and image in sync with the action. */
 53 	gtk_activatable_set_use_action_appearance (activatable, FALSE);
 54 
 55 	/* Remove the menu item's child widget. */
 56 	widget = gtk_bin_get_child (GTK_BIN (menu_item));
 57 	gtk_widget_destroy (widget);
 58 
 59 	/* Now add our own child widget. */
 60 
 61 	widget = gtk_hbox_new (FALSE, 3);
 62 	gtk_container_add (GTK_CONTAINER (menu_item), widget);
 63 	gtk_widget_show (widget);
 64 
 65 	container = widget;
 66 
 67 	widget = gtk_action_create_icon (action, GTK_ICON_SIZE_MENU);
 68 	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
 69 	gtk_widget_show (widget);
 70 
 71 	widget = gtk_label_new (NULL);
 72 	gtk_label_set_use_underline (GTK_LABEL (widget), TRUE);
 73 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
 74 	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 75 	gtk_widget_show (widget);
 76 
 77 	g_object_bind_property (
 78 		action, "label",
 79 		widget, "label",
 80 		G_BINDING_BIDIRECTIONAL |
 81 		G_BINDING_SYNC_CREATE);
 82 }
 83 
 84 static GtkWidget *
 85 mail_label_action_create_menu_item (GtkAction *action)
 86 {
 87 	GtkWidget *menu_item;
 88 
 89 	menu_item = gtk_check_menu_item_new ();
 90 
 91 	g_signal_connect (
 92 		menu_item, "realize",
 93 		G_CALLBACK (mail_label_action_menu_item_realize_cb), NULL);
 94 
 95 	return menu_item;
 96 }
 97 
 98 static void
 99 e_mail_label_action_class_init (EMailLabelActionClass *class)
100 {
101 	GtkActionClass *action_class;
102 
103 	g_type_class_add_private (class, sizeof (EMailLabelActionPrivate));
104 
105 	action_class = GTK_ACTION_CLASS (class);
106 	action_class->create_menu_item = mail_label_action_create_menu_item;
107 }
108 
109 static void
110 e_mail_label_action_init (EMailLabelAction *action)
111 {
112 	action->priv = E_MAIL_LABEL_ACTION_GET_PRIVATE (action);
113 }
114 
115 EMailLabelAction *
116 e_mail_label_action_new (const gchar *name,
117                          const gchar *label,
118                          const gchar *tooltip,
119                          const gchar *stock_id)
120 {
121 	g_return_val_if_fail (name != NULL, NULL);
122 
123 	return g_object_new (
124 		E_TYPE_MAIL_LABEL_ACTION,
125 		"name", name, "label", label,
126 		"tooltip", tooltip, "stock-id", stock_id, NULL);
127 }