From 656e46ed80e20bf34312f01607a7bebdd2d8d622 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 2 Sep 2017 20:42:53 +0200 Subject: [PATCH] Cope with changes to ssw_axis_model (upstream) --- src/ui/gui/psppire-dict.c | 14 ++++----- src/ui/gui/psppire-var-sheet-header.c | 41 +++++++++++++++------------ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/ui/gui/psppire-dict.c b/src/ui/gui/psppire-dict.c index 924ff7c556..3bc39e4095 100644 --- a/src/ui/gui/psppire-dict.c +++ b/src/ui/gui/psppire-dict.c @@ -34,8 +34,6 @@ #include "ui/gui/psppire-marshal.h" #include "ui/gui/psppire-var-ptr.h" -#include - #include #include @@ -81,29 +79,29 @@ gni (GListModel *list) static GType git (GListModel *list) { - return SSW_TYPE_DATUM; + return GTK_TYPE_BUTTON; } static gpointer gi (GListModel *list, guint id) { - SswDatum *gd = SSW_DATUM (g_object_new (SSW_TYPE_DATUM, NULL)); + GtkWidget *button = gtk_button_new (); PsppireDict *dict = PSPPIRE_DICT (list); if (id >= psppire_dict_get_var_cnt (dict)) { - gd->text = g_strdup (_("Var")); + gtk_button_set_label (GTK_BUTTON (button), _("Var")); } else { const struct variable *v = psppire_dict_get_variable (dict, id); - gd->text = g_strdup (var_get_name (v)); - gd->label = g_strdup (var_get_label (v)); + gtk_button_set_label (GTK_BUTTON (button), var_get_name (v)); + gtk_widget_set_tooltip_text (button, var_get_label (v)); } - return gd; + return button; } diff --git a/src/ui/gui/psppire-var-sheet-header.c b/src/ui/gui/psppire-var-sheet-header.c index e26fa95794..ad0401e6c8 100644 --- a/src/ui/gui/psppire-var-sheet-header.c +++ b/src/ui/gui/psppire-var-sheet-header.c @@ -21,8 +21,10 @@ #include "psppire-var-sheet-header.h" -#include -#include +#include + +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid enum {CHANGED, n_SIGNALS}; @@ -38,56 +40,59 @@ gni (GListModel *list) static GType git (GListModel *list) { - return SSW_TYPE_DATUM; + return GTK_TYPE_BUTTON; } + static gpointer gi (GListModel *list, guint position) { - SswDatum *gd = SSW_DATUM (g_object_new (SSW_TYPE_DATUM, NULL)); + GtkWidget *button = gtk_button_new (); + gchar *text = NULL; switch (position) { case 0: - gd->text = g_strdup ("Name"); + text = N_("Name"); break; case 1: - gd->text = g_strdup ("Type"); + text = N_("Type"); break; case 2: - gd->text = g_strdup ("Width"); + text = N_("Width"); break; case 3: - gd->text = g_strdup ("Decimal"); + text = N_("Decimal"); break; case 4: - gd->text = g_strdup ("Label"); + text = N_("Label"); break; case 5: - gd->text = g_strdup ("Value Labels"); + text = N_("Value Labels"); break; case 6: - gd->text = g_strdup ("Missing Values"); + text = N_("Missing Values"); break; case 7: - gd->text = g_strdup ("Columns"); + text = N_("Columns"); break; case 8: - gd->text = g_strdup ("Align"); + text = N_("Align"); break; case 9: - gd->text = g_strdup ("Measure"); + text = N_("Measure"); break; case 10: - gd->text = g_strdup ("Role"); + text = N_("Role"); break; default: - // g_assert_not_reached (); - g_print ("Bug: Request for item %d\n", position); break; } - return gd; + if (text) + gtk_button_set_label (GTK_BUTTON (button), gettext (text)); + + return button; } -- 2.30.2