From eec7dc24096e5786220276183d62166e5db4b583 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 21 Jun 2015 20:12:57 +0200 Subject: [PATCH] PsppireScanf and PsppireAcr: Avoid deprected API features --- src/ui/gui/psppire-acr.c | 15 ++++++++++----- src/ui/gui/psppire-acr.h | 4 ++-- src/ui/gui/psppire-scanf.c | 5 +++-- src/ui/gui/psppire-scanf.h | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/ui/gui/psppire-acr.c b/src/ui/gui/psppire-acr.c index fc89b82212..13b5803e5e 100644 --- a/src/ui/gui/psppire-acr.c +++ b/src/ui/gui/psppire-acr.c @@ -40,7 +40,11 @@ #include "psppire-acr.h" #include "helper.h" -G_DEFINE_TYPE (PsppireAcr, psppire_acr, GTK_TYPE_HBOX); +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + +G_DEFINE_TYPE (PsppireAcr, psppire_acr, GTK_TYPE_BOX); static void psppire_acr_dispose (GObject *obj) @@ -248,7 +252,6 @@ psppire_acr_set_enabled (PsppireAcr *acr, gboolean status) && row_is_selected (acr)); } - static void psppire_acr_init (PsppireAcr *acr) { @@ -256,11 +259,13 @@ psppire_acr_init (PsppireAcr *acr) GtkWidget *sw = gtk_scrolled_window_new (NULL, NULL); + gtk_orientable_set_orientation (GTK_ORIENTABLE (acr), GTK_ORIENTATION_HORIZONTAL); + acr->tv = GTK_TREE_VIEW (gtk_tree_view_new ()); - acr->add_button = gtk_button_new_from_stock (GTK_STOCK_ADD); - acr->change_button = gtk_button_new_from_stock (GTK_STOCK_EDIT); - acr->remove_button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); + acr->add_button = gtk_button_new_with_label (_("Add")); + acr->change_button = gtk_button_new_with_label (_("Edit")); + acr->remove_button = gtk_button_new_with_label (_("Remove")); acr->get_value = NULL; acr->get_value_data = NULL; diff --git a/src/ui/gui/psppire-acr.h b/src/ui/gui/psppire-acr.h index b58385524a..73873df356 100644 --- a/src/ui/gui/psppire-acr.h +++ b/src/ui/gui/psppire-acr.h @@ -64,7 +64,7 @@ typedef void (*UpdateCallbackFunc) (gpointer); struct _PsppireAcr { - GtkHBox parent; + GtkBox parent; GtkListStore *list_store; @@ -90,7 +90,7 @@ struct _PsppireAcr struct _PsppireAcrClass { - GtkHBoxClass parent_class; + GtkBoxClass parent_class; }; diff --git a/src/ui/gui/psppire-scanf.c b/src/ui/gui/psppire-scanf.c index c2c8e55ade..52446b3892 100644 --- a/src/ui/gui/psppire-scanf.c +++ b/src/ui/gui/psppire-scanf.c @@ -29,7 +29,7 @@ static void psppire_scanf_class_init (PsppireScanfClass *class); static void psppire_scanf_init (PsppireScanf *w); -G_DEFINE_TYPE (PsppireScanf, psppire_scanf, GTK_TYPE_HBOX) +G_DEFINE_TYPE (PsppireScanf, psppire_scanf, GTK_TYPE_BOX) /* Properties */ enum @@ -331,6 +331,7 @@ psppire_scanf_class_init (PsppireScanfClass *class) static void psppire_scanf_init (PsppireScanf *w) { + gtk_orientable_set_orientation (GTK_ORIENTABLE (w), GTK_ORIENTATION_HORIZONTAL); } gchar @@ -349,7 +350,7 @@ psppire_scanf_get_child (PsppireScanf *w, gint n) /* - This widget is a GtkHBox populated with GtkLabel and GtkEntry widgets. + This widget is a horizontal GtkBox populated with GtkLabel and GtkEntry widgets. Each conversion in FMT will cause a GtkEntry (possibly a GtkSpinButton) to be created. Any text between conversions produces a GtkLabel. There should be N arguments following FMT should be of type GtkEntry **, diff --git a/src/ui/gui/psppire-scanf.h b/src/ui/gui/psppire-scanf.h index a2ef479100..d81d54cc74 100644 --- a/src/ui/gui/psppire-scanf.h +++ b/src/ui/gui/psppire-scanf.h @@ -41,7 +41,7 @@ typedef struct _PsppireScanfClass PsppireScanfClass; /* All members are private. */ struct _PsppireScanf { - GtkHBox parent; + GtkBox parent; const gchar *format; GtkWidget **widgets; @@ -56,7 +56,7 @@ struct _PsppireScanf struct _PsppireScanfClass { - GtkHBoxClass parent_class; + GtkBoxClass parent_class; }; -- 2.30.2