X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fhelper.c;h=b1fdb27193df933ab583420693bd6b6b5f8481ec;hb=8036ac5538ee58a7216a255bbd0d60a430460f79;hp=fc9105d75921456a8f94ea41e1246d7065c59a55;hpb=a992bf1121d3e1eef76fd6184b95fe079bb91558;p=pspp-builds.git diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index fc9105d7..b1fdb271 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) @@ -164,8 +179,38 @@ give_help (void) gtk_widget_destroy (dialog); } -void -connect_help (GladeXML *xml) +static void +connect_help_builder (GtkBuilder *xml) +{ + GSList *helps = gtk_builder_get_objects (xml); + + 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); + + 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); +} + +static void +connect_help_glade (GladeXML *xml) { GList *helps = glade_xml_get_widget_prefix (xml, "help_button_"); @@ -177,6 +222,22 @@ connect_help (GladeXML *xml) } +void +connect_help (gpointer xml) +{ + if (GTK_IS_BUILDER (xml)) + connect_help_builder (GTK_BUILDER (xml)); + + else if (GLADE_IS_XML (xml)) + connect_help_glade (GLADE_XML (xml)); + + else + { + g_error ("XML of type %s", G_OBJECT_TYPE_NAME (xml)); + } +} + + void reference_manual (GtkMenuItem *menu, gpointer data) @@ -268,7 +329,7 @@ execute_syntax (struct getl_interface *sss) som_flush (); - reload_the_viewer (); + psppire_output_window_reload (); return retval; } @@ -319,4 +380,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); +}