X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fgtkmathview-bonobo%2Ftest%2Fmain.c;h=84aa7cae1cd13f4e5c4a6d94b5e1158367abc3d1;hb=450d16b153ca65b088474c69e5d8972659735731;hp=dccb6e63a570e25b6948f5003e99adf64550fd81;hpb=22bb9330d93cdf89baa5df76df6db72709a4d6fb;p=helm.git diff --git a/helm/gtkmathview-bonobo/test/main.c b/helm/gtkmathview-bonobo/test/main.c index dccb6e63a..84aa7cae1 100644 --- a/helm/gtkmathview-bonobo/test/main.c +++ b/helm/gtkmathview-bonobo/test/main.c @@ -4,6 +4,7 @@ #include #include "control-factory.h" +#include "GNOME_GtkMathView_View.h" static GtkWidget *control; @@ -91,15 +92,14 @@ file_selection_ok_cb (GtkWidget *widget, else { const gchar *fname; - fname = gtk_file_selection_get_filename - (GTK_FILE_SELECTION (file_selection_info.widget)); + fname = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selection_info.widget)); switch (file_selection_info.Operations) { - case LOAD_STREAM: - load_through_persist_stream (fname, interface); - break; - case LOAD_FILE: - load_through_persist_file (fname, interface); - break; + case LOAD_STREAM: + load_through_persist_stream (fname, interface); + break; + case LOAD_FILE: + load_through_persist_file (fname, interface); + break; } } @@ -147,14 +147,44 @@ static void open_through_persist_file_cb (GtkWidget *widget, gpointer data) { - open_dialog (BONOBO_WINDOW (data),LOAD_FILE); + open_dialog (BONOBO_WINDOW (data), LOAD_FILE); } static void open_through_persist_stream_cb(GtkWidget *widget, gpointer data) { - open_dialog(BONOBO_WINDOW(data),LOAD_STREAM); + open_dialog(BONOBO_WINDOW(data), LOAD_STREAM); +} + +static void +test_view(GtkWidget* widget, gpointer data) +{ + CORBA_Object interface; + CORBA_Environment ev; + + CORBA_exception_init (&ev); + interface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (bonobo_window_get_contents (BONOBO_WINDOW(data)))), + "IDL:GNOME/GtkMathView/View:1.0", &ev); + CORBA_exception_free (&ev); + + if (interface == CORBA_OBJECT_NIL) + { + g_warning ("The Control does not seem to support `View'."); + } + + CORBA_exception_init (&ev); + GNOME_GtkMathView_View_freeze(interface, &ev); + CORBA_exception_free (&ev); + + CORBA_exception_init (&ev); + GNOME_GtkMathView_View_thaw(interface, &ev); + CORBA_exception_free (&ev); + + CORBA_exception_init (&ev); + Bonobo_Unknown_unref (interface, &ev); + CORBA_Object_release (interface, &ev); + CORBA_exception_free (&ev); } static void @@ -318,6 +348,7 @@ get_font_manager(GtkWidget *widget, static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("OpenFile", open_through_persist_file_cb), BONOBO_UI_UNSAFE_VERB ("OpenStream", open_through_persist_stream_cb), + BONOBO_UI_UNSAFE_VERB ("TestView", test_view), BONOBO_UI_UNSAFE_VERB ("Size", get_size), BONOBO_UI_UNSAFE_VERB ("Top", get_top), BONOBO_UI_UNSAFE_VERB ("Font Size", get_font_size), @@ -354,11 +385,12 @@ static char ui [] = " " " " " " +" " " " " " " " " " -" " +" " " "