Fix inappropriate comments in headers
[pspp] / src / ui / gui / psppire-var-sheet-header.c
1 /*  PSPPIRE - a graphical user interface for PSPP.
2     Copyright (C) 2016  John Darrington
3
4     This program is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
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
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <config.h>
19 #include <gtk/gtk.h>
20
21 #include "psppire-var-sheet-header.h"
22
23 #include <gettext.h>
24
25 #define _(msgid) gettext (msgid)
26 #define N_(msgid) msgid
27
28 enum  {CHANGED,
29        n_SIGNALS};
30
31 static guint signals [n_SIGNALS];
32
33 static guint
34 gni (GListModel *list)
35 {
36   return 11;
37 }
38
39 static GType
40 git (GListModel *list)
41 {
42   return GTK_TYPE_BUTTON;
43 }
44
45
46 static gpointer
47 gi (GListModel *list, guint position)
48 {
49   GtkWidget *button = gtk_button_new ();
50   gchar *text = NULL;
51
52   switch (position)
53     {
54     case 0:
55       text = N_("Name");
56       break;
57     case 1:
58       text = N_("Type");
59       break;
60     case 2:
61       text = N_("Width");
62       break;
63     case 3:
64       text = N_("Decimal");
65       break;
66     case 4:
67       text = N_("Label");
68       break;
69     case 5:
70       text = N_("Value Labels");
71       break;
72     case 6:
73       text = N_("Missing Values");
74       break;
75     case 7:
76       text = N_("Columns");
77       break;
78     case 8:
79       text = N_("Align");
80       break;
81     case 9:
82       text = N_("Measure");
83       break;
84     case 10:
85       text = N_("Role");
86       break;
87     default:
88       break;
89     }
90
91   if (text)
92     gtk_button_set_label (GTK_BUTTON (button), gettext (text));
93   
94   return button;
95 }
96
97
98 static void
99 psppire_init_iface (GListModelInterface *iface)
100 {
101   iface->get_n_items = gni;
102   iface->get_item = gi;
103   iface->get_item_type = git;
104 }
105
106
107 G_DEFINE_TYPE_WITH_CODE (PsppireVarSheetHeader, psppire_var_sheet_header,
108                          G_TYPE_OBJECT,
109                          G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, psppire_init_iface));
110
111 static void
112 psppire_var_sheet_header_init (PsppireVarSheetHeader *d)
113 {
114 }
115
116
117
118 static void
119 psppire_var_sheet_header_class_init (PsppireVarSheetHeaderClass *dc)
120 {
121   GObjectClass *object_class = G_OBJECT_CLASS (dc);
122
123   /* This signal is never emitted.  It is just to satisfy the interface. */
124   signals [CHANGED] =
125     g_signal_new ("changed",
126                   G_TYPE_FROM_CLASS (object_class),
127                   G_SIGNAL_RUN_FIRST,
128                   0,
129                   NULL, NULL,
130                   g_cclosure_marshal_VOID__VOID,
131                   G_TYPE_NONE,
132                   0);
133 }
134