No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-mail-label-tree-view.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-mail-label-tree-view.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * e-mail-label-tree-view.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-tree-view.h"
27
28 #include <glib/gi18n.h>
29 #include "e-mail-label-list-store.h"
30
31 #define E_MAIL_LABEL_TREE_VIEW_GET_PRIVATE(obj) \
32 (G_TYPE_INSTANCE_GET_PRIVATE \
33 ((obj), E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeViewPrivate))
34
35 struct _EMailLabelTreeViewPrivate {
36 gint placeholder;
37 };
38
39 G_DEFINE_TYPE (EMailLabelTreeView, e_mail_label_tree_view, GTK_TYPE_TREE_VIEW)
40
41 static void
42 mail_label_tree_view_render_pixbuf (GtkTreeViewColumn *column,
43 GtkCellRenderer *renderer,
44 GtkTreeModel *model,
45 GtkTreeIter *iter,
46 EMailLabelTreeView *tree_view)
47 {
48 EMailLabelListStore *store;
49 gchar *stock_id;
50
51 store = E_MAIL_LABEL_LIST_STORE (model);
52 stock_id = e_mail_label_list_store_get_stock_id (store, iter);
53 g_object_set (renderer, "stock-id", stock_id, NULL);
54 g_free (stock_id);
55 }
56
57 static void
58 mail_label_tree_view_render_text (GtkTreeViewColumn *column,
59 GtkCellRenderer *renderer,
60 GtkTreeModel *model,
61 GtkTreeIter *iter,
62 EMailLabelTreeView *tree_view)
63 {
64 EMailLabelListStore *store;
65 gchar *name;
66
67 store = E_MAIL_LABEL_LIST_STORE (model);
68 name = e_mail_label_list_store_get_name (store, iter);
69 g_object_set (renderer, "text", name, NULL);
70 g_free (name);
71 }
72
73 static void
74 e_mail_label_tree_view_class_init (EMailLabelTreeViewClass *class)
75 {
76 g_type_class_add_private (class, sizeof (EMailLabelTreeViewPrivate));
77 }
78
79 static void
80 e_mail_label_tree_view_init (EMailLabelTreeView *tree_view)
81 {
82 GtkTreeViewColumn *column;
83 GtkCellRenderer *renderer;
84
85 tree_view->priv = E_MAIL_LABEL_TREE_VIEW_GET_PRIVATE (tree_view);
86
87 column = gtk_tree_view_column_new ();
88 renderer = gtk_cell_renderer_pixbuf_new ();
89 gtk_tree_view_column_set_title (column, _("Color"));
90 gtk_tree_view_column_pack_start (column, renderer, TRUE);
91 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
92
93 gtk_tree_view_column_set_cell_data_func (
94 column, renderer, (GtkTreeCellDataFunc)
95 mail_label_tree_view_render_pixbuf, tree_view, NULL);
96
97 column = gtk_tree_view_column_new ();
98 renderer = gtk_cell_renderer_text_new ();
99 gtk_tree_view_column_set_title (column, _("Name"));
100 gtk_tree_view_column_pack_start (column, renderer, TRUE);
101 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
102
103 gtk_tree_view_column_set_cell_data_func (
104 column, renderer, (GtkTreeCellDataFunc)
105 mail_label_tree_view_render_text, tree_view, NULL);
106 }
107
108 GtkWidget *
109 e_mail_label_tree_view_new (void)
110 {
111 return g_object_new (E_TYPE_MAIL_LABEL_TREE_VIEW, NULL);
112 }