[AS_HELP_STRING([--without-gui], [don't build the PSPPIRE gui])])
required_gtk_version=2.12
-if test x"$enable_anachronistic_dependencies" = x"yes" ; then
- required_gtk_version=2.8.20
-fi
if test x"$with_gui" != x"no" ; then
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $required_gtk_version,,
src_ui_gui_psppiredir = $(pkgdatadir)
+nodist_src_ui_gui_psppire_DATA = \
+ $(top_srcdir)/src/ui/gui/oneway.ui
+
+EXTRA_DIST += \
+ $(top_srcdir)/src/ui/gui/oneway.glade
+
dist_src_ui_gui_psppire_DATA = \
$(top_srcdir)/src/ui/gui/data-editor.glade \
$(top_srcdir)/src/ui/gui/descriptives-dialog.glade \
$(top_srcdir)/src/ui/gui/crosstabs.glade \
$(top_srcdir)/src/ui/gui/frequencies.glade \
$(top_srcdir)/src/ui/gui/message-dialog.glade \
- $(top_srcdir)/src/ui/gui/oneway.glade \
$(top_srcdir)/src/ui/gui/output-viewer.glade \
$(top_srcdir)/src/ui/gui/psppire.glade \
$(top_srcdir)/src/ui/gui/rank.glade \
src/ui/gui/psppire-marshal.h
-
-
yelp-check:
@if ! yelp --version > /dev/null 2>&1 ; then \
echo ; \
src/ui/gui/psppire-marshal.h: src/ui/gui/marshaller-list
glib-genmarshal --header --prefix=psppire_marshal $< > $@
+.glade.ui:
+ gtk-builder-convert $< $@
+
EXTRA_DIST += src/ui/gui/OChangeLog\
src/ui/gui/marshaller-list
#include <data/casereader-provider.h>
#include <libpspp/message.h>
+#include <gtk/gtkbuilder.h>
#include <libpspp/i18n.h>
#include <ctype.h>
}
+GtkBuilder *
+builder_new_real (const gchar *name)
+{
+ GtkBuilder *builder = gtk_builder_new ();
+
+ GError *err = NULL;
+ if ( ! gtk_builder_add_from_file (builder, name, &err))
+ {
+ g_critical ("Couldnt open user interface file %s: %s", name, err->message);
+ g_clear_error (&err);
+ }
+
+ return builder;
+}
+
+
+
GtkWidget *
-get_widget_assert (GladeXML *xml, const gchar *name)
+get_widget_assert (gpointer x, const gchar *name)
{
- GtkWidget *w;
- g_assert (xml);
+ GObject *obj = G_OBJECT (x);
+ GtkWidget *w = NULL;
g_assert (name);
- w = glade_xml_get_widget (xml, name);
+ if (GTK_IS_BUILDER (obj))
+ w = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (obj), name));
+
+ if (GLADE_IS_XML (obj))
+ w = glade_xml_get_widget (GLADE_XML (obj), name);
if ( !w )
g_critical ("Widget \"%s\" could not be found\n", name);
}
+
gboolean text_to_value (const gchar *text, union value *v,
struct fmt_spec format);
-GtkWidget * get_widget_assert (GladeXML *xml, const gchar *name);
+GtkWidget * get_widget_assert (gpointer x, const gchar *name);
/* Converts a string in the pspp locale to utf-8 */
char * pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err);
glade_xml_new (relocate(PKGDATADIR "/" FILE), NULL, NULL)
-void marshaller_VOID__INT_INT_INT (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data);
+#define builder_new(NAME) builder_new_real (relocate (PKGDATADIR "/" NAME))
+
+GtkBuilder *builder_new_real (const gchar *name);
/* Create a deep copy of SRC */
#include <config.h>
-#include <glade/glade.h>
#include <gtk/gtk.h>
#include "oneway-anova-dialog.h"
#include "psppire-dict.h"
}
+
/* Pops up the dialog box */
void
oneway_anova_dialog (GObject *o, gpointer data)
PsppireVarStore *vs = NULL;
- GladeXML *xml = XML_NEW ("oneway.glade");
-
struct oneway_anova_dialog ow;
+ GtkBuilder *builder = builder_new ("oneway.ui");
+
GtkWidget *dict_view =
- get_widget_assert (xml, "oneway-anova-treeview1");
+ get_widget_assert (builder, "oneway-anova-treeview1");
GtkWidget *selector2 =
- get_widget_assert (xml, "oneway-anova-selector2");
+ get_widget_assert (builder, "oneway-anova-selector2");
GtkWidget *selector1 =
- get_widget_assert (xml, "oneway-anova-selector1");
+ get_widget_assert (builder, "oneway-anova-selector1");
GtkWidget *contrasts_button =
- get_widget_assert (xml, "contrasts-button");
+ get_widget_assert (builder, "contrasts-button");
g_signal_connect_swapped (contrasts_button, "clicked",
G_CALLBACK (run_contrasts_dialog), &ow);
- ow.factor_entry = get_widget_assert (xml, "oneway-anova-entry");
+ ow.factor_entry = get_widget_assert (builder, "oneway-anova-entry");
ow.vars_treeview =
- get_widget_assert (xml, "oneway-anova-treeview2");
+ get_widget_assert (builder, "oneway-anova-treeview2");
ow.descriptives =
- GTK_TOGGLE_BUTTON (get_widget_assert (xml, "checkbutton1"));
+ GTK_TOGGLE_BUTTON (get_widget_assert (builder, "checkbutton1"));
ow.homogeneity =
- GTK_TOGGLE_BUTTON (get_widget_assert (xml, "checkbutton2"));
+ GTK_TOGGLE_BUTTON (get_widget_assert (builder, "checkbutton2"));
g_object_get (de->data_editor, "var-store", &vs, NULL);
ow.dict = vs->dict;
ow.dialog =
- GTK_WINDOW (get_widget_assert (xml, "oneway-anova-dialog"));
+ GTK_WINDOW (get_widget_assert (builder, "oneway-anova-dialog"));
gtk_window_set_transient_for (ow.dialog, de->parent.window);
{
struct contrasts_subdialog *cd = &ow.contrasts;
- GtkEntry *entry = GTK_ENTRY (get_widget_assert (xml, "entry1"));
+ GtkEntry *entry = GTK_ENTRY (get_widget_assert (builder, "entry1"));
- cd->acr = PSPPIRE_ACR (get_widget_assert (xml, "psppire-acr1"));
- cd->contrasts_dialog = get_widget_assert (xml, "contrasts-dialog");
+ cd->acr = PSPPIRE_ACR (get_widget_assert (builder, "psppire-acr1"));
+ cd->contrasts_dialog = get_widget_assert (builder, "contrasts-dialog");
- cd->next = get_widget_assert (xml, "next-button");
- cd->prev = get_widget_assert (xml, "prev-button");
- cd->ctotal = get_widget_assert (xml, "entry2");
+ cd->next = get_widget_assert (builder, "next-button");
+ cd->prev = get_widget_assert (builder, "prev-button");
+ cd->ctotal = get_widget_assert (builder, "entry2");
- cd->stack_label = get_widget_assert (xml, "contrast-stack-label");
+ cd->stack_label = get_widget_assert (builder, "contrast-stack-label");
/* Contrasts */
ow.contrasts_array = g_array_new (FALSE, FALSE, sizeof (GtkListStore *));
g_array_free (ow.contrasts_array, FALSE);
- g_object_unref (xml);
+ g_object_unref (builder);
}
#include <gtk/gtk.h>
#include <gtk/gtksignal.h>
+#include <gtk/gtkbuildable.h>
#include "psppire-dialog.h"
#include "psppire-buttonbox.h"
#include "psppire-selector.h"
static guint signals [n_SIGNALS];
+static void psppire_dialog_buildable_init (GtkBuildableIface *iface);
+
+
GType
psppire_dialog_get_type (void)
{
(GInstanceInitFunc) psppire_dialog_init,
};
+ static const GInterfaceInfo buildable_info =
+ {
+ (GInterfaceInitFunc) psppire_dialog_buildable_init,
+ NULL,
+ NULL
+ };
+
dialog_type = g_type_register_static (GTK_TYPE_WINDOW,
"PsppireDialog", &dialog_info, 0);
+
+ g_type_add_interface_static (dialog_type,
+ GTK_TYPE_BUILDABLE,
+ &buildable_info);
+
}
return dialog_type;
}
+
+
+
+static GObject *
+get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname)
+{
+ PsppireDialog *dialog = PSPPIRE_DIALOG (buildable);
+
+ if ( 0 == strcmp(childname, "hbox"))
+ return G_OBJECT (dialog->box);
+
+ return NULL;
+}
+
+
+
+static void
+psppire_dialog_buildable_init (GtkBuildableIface *iface)
+{
+ iface->get_internal_child = get_internal_child;
+}