X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fhelper.c;h=8b5dbb5a9ab4658441b72f33cebf37e0aca95776;hb=c024275ff35e579eddef18b23b1d9c7dc81c4ca8;hp=fc9105d75921456a8f94ea41e1246d7065c59a55;hpb=c1f796a012aa172cf44ed3cf386b0222fa12ab35;p=pspp-builds.git diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index fc9105d7..8b5dbb5a 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -20,6 +20,8 @@ */ #include +#include "psppire-syntax-window.h" + #include #include @@ -46,7 +48,7 @@ #include #include "psppire-data-store.h" #include -#include "output-viewer.h" +#include "psppire-output-window.h" #include "xalloc.h" @@ -117,6 +119,19 @@ builder_new_real (const gchar *name) } +GObject * +get_object_assert (GtkBuilder *builder, const gchar *name) +{ + GObject *o = NULL; + g_assert (name); + + o = gtk_builder_get_object (builder, name); + + if ( !o ) + g_critical ("Object \"%s\" could not be found\n", name); + + return o; +} GtkWidget * get_widget_assert (gpointer x, const gchar *name) @@ -165,18 +180,35 @@ give_help (void) } void -connect_help (GladeXML *xml) +connect_help (GtkBuilder *xml) { - GList *helps = glade_xml_get_widget_prefix (xml, "help_button_"); + GSList *helps = gtk_builder_get_objects (xml); - GList *i; - for ( i = g_list_first (helps); i ; i = g_list_next (i)) - g_signal_connect (GTK_WIDGET (i->data), "clicked", give_help, 0); + GSList *i; + for ( i = helps; i ; i = g_slist_next (i)) + { + GObject *o = i->data; + if ( GTK_IS_WIDGET (o) ) + { + gchar *name = NULL; + gchar s[12] = {0}; + g_object_get (o, "name", &name, NULL); - g_list_free (helps); -} + if ( name) + strncpy (s, name, 11); + s[11] = '\0'; + if ( 0 == strcmp ("help_button", s)) + { + g_signal_connect (GTK_WIDGET (o), "clicked", give_help, 0); + } + } + } + + g_slist_free (helps); +} + void reference_manual (GtkMenuItem *menu, gpointer data) @@ -268,7 +300,7 @@ execute_syntax (struct getl_interface *sss) som_flush (); - reload_the_viewer (); + psppire_output_window_reload (); return retval; } @@ -319,4 +351,12 @@ clone_list_store (const GtkListStore *src) } +void +paste_syntax_in_new_window (const gchar *syntax) +{ + GtkWidget *se = psppire_syntax_window_new (); + gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); + + gtk_widget_show (se); +}