+
+/* --- prototypes --- */
+static void psppire_dict_class_init (PsppireDictClass *class);
+static void psppire_dict_init (PsppireDict *dict);
+static void psppire_dict_dispose (GObject *object);
+
+static void dictionary_tree_model_init (GtkTreeModelIface *iface);
+
+
+
+static guint
+gni (GListModel *list)
+{
+ PsppireDict *dict = PSPPIRE_DICT (list);
+
+ return psppire_dict_get_var_cnt (dict);
+}
+
+static GType
+git (GListModel *list)
+{
+ return GTK_TYPE_BUTTON;
+}
+
+static gpointer
+gi (GListModel *list, guint id)
+{
+ GtkWidget *button = gtk_button_new ();
+
+ PsppireDict *dict = PSPPIRE_DICT (list);
+
+ if (id >= psppire_dict_get_var_cnt (dict))
+ {
+ gtk_button_set_label (GTK_BUTTON (button), _("Var"));
+ }
+ else
+ {
+ const struct variable *v = psppire_dict_get_variable (dict, id);
+
+ gtk_button_set_label (GTK_BUTTON (button), var_get_name (v));
+ gtk_widget_set_tooltip_text (button, var_get_label (v));
+
+ PangoRectangle rect;
+
+ PangoContext *context = gtk_widget_create_pango_context (button);
+ PangoLayout *layout = pango_layout_new (context);
+
+ pango_layout_set_text (layout, "M", 1);
+
+ pango_layout_get_extents (layout, NULL, &rect);
+
+ g_object_unref (G_OBJECT (layout));
+ g_object_unref (G_OBJECT (context));
+
+ gtk_widget_set_size_request (button,
+ var_get_display_width (v) * rect.width / PANGO_SCALE,
+ -1);
+ }
+
+ return button;
+}
+
+
+static void
+ssw_init_iface (GListModelInterface *iface)
+{
+ iface->get_n_items = gni;
+ iface->get_item = gi;
+ iface->get_item_type = git;
+}
+
+
+/* --- variables --- */
+static GObjectClass *parent_class = NULL;
+