From 1053641161be77d31f67e6f9dd9c7f6d25e0b187 Mon Sep 17 00:00:00 2001 From: Luca Padovani Date: Mon, 8 Sep 2003 20:07:34 +0000 Subject: [PATCH] * code cleanup * added partial implementation for view --- helm/gtkmathview-bonobo/src/Makefile.am | 3 +- helm/gtkmathview-bonobo/src/control-data.c | 35 ++++ helm/gtkmathview-bonobo/src/control-data.h | 18 +- helm/gtkmathview-bonobo/src/control-factory.c | 158 +++++++-------- helm/gtkmathview-bonobo/src/handlers.c | 191 +++++++++--------- helm/gtkmathview-bonobo/src/handlers.h | 33 ++- 6 files changed, 221 insertions(+), 217 deletions(-) create mode 100644 helm/gtkmathview-bonobo/src/control-data.c diff --git a/helm/gtkmathview-bonobo/src/Makefile.am b/helm/gtkmathview-bonobo/src/Makefile.am index e78683aaf..4de86a0b7 100644 --- a/helm/gtkmathview-bonobo/src/Makefile.am +++ b/helm/gtkmathview-bonobo/src/Makefile.am @@ -5,7 +5,7 @@ server_in_files = GNOME_GtkMathView.server.in.in CLEANFILES = $(server_in_files:.server.in.in=.server) -IDL = $(top_srcdir)/idl/GNOME_GtkMathView_View.idl +IDL = $(top_srcdir)/idl/GtkMathView.idl IDL_GENERATED_C = \ GNOME_GtkMathView_View-common.c \ @@ -28,6 +28,7 @@ libgtkmathview_bonobo_la_LDFLAGS = -version-info @GTKMATHVIEW_CONTROL_VERSION_IN libgtkmathview_bonobo_la_SOURCES = \ $(IDL_GENERATED_C) \ + control-data.c \ control-factory.c \ persist-file.c \ persist-stream.c \ diff --git a/helm/gtkmathview-bonobo/src/control-data.c b/helm/gtkmathview-bonobo/src/control-data.c new file mode 100644 index 000000000..382ea8d1d --- /dev/null +++ b/helm/gtkmathview-bonobo/src/control-data.c @@ -0,0 +1,35 @@ + +#include "control-data.h" + +GtkMathViewControlData* +gtk_math_view_control_data_new(GtkMathView *math_view) +{ + GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1); + cd->math_view = math_view; + cd->semantic_selection = FALSE; + cd->first_selected = NULL; + cd->root_selected = NULL; + return cd; +} + +void +gtk_math_view_control_data_destroy(GtkMathViewControlData* cd) +{ + GdomeException exc = 0; + //gtk_object_unref(cd->math_view); + cd->math_view = NULL; + if (cd->first_selected != NULL) + { + gdome_el_unref(cd->first_selected, &exc); + g_assert(exc == 0); + cd->first_selected = NULL; + } + if (cd->root_selected != NULL) + { + gdome_el_unref(cd->root_selected, &exc); + g_assert(exc == 0); + cd->root_selected = NULL; + } + g_free(cd); +} + diff --git a/helm/gtkmathview-bonobo/src/control-data.h b/helm/gtkmathview-bonobo/src/control-data.h index 0f636c2f4..0d90f6a4c 100644 --- a/helm/gtkmathview-bonobo/src/control-data.h +++ b/helm/gtkmathview-bonobo/src/control-data.h @@ -1,12 +1,16 @@ -#ifndef __CONTROL_DATA__ -#define __CONTROL_DATA__ + +#ifndef __control_data_h__ +#define __control_data_h__ + +#include +#include typedef struct _GtkMathViewControlData { - gboolean semantic_selection; - GdomeElement* first_selected; - GdomeElement* root_selected; - GtkMathView *math_view; + GtkMathView* math_view; + gboolean semantic_selection; + GdomeElement* first_selected; + GdomeElement* root_selected; } GtkMathViewControlData; -#endif +#endif // __control_data_h__ diff --git a/helm/gtkmathview-bonobo/src/control-factory.c b/helm/gtkmathview-bonobo/src/control-factory.c index 3f6b65e3e..a209e6854 100644 --- a/helm/gtkmathview-bonobo/src/control-factory.c +++ b/helm/gtkmathview-bonobo/src/control-factory.c @@ -7,46 +7,25 @@ #include "control-data.h" #include "view.h" -enum { - MATH_VIEW_WIDTH, - MATH_VIEW_HEIGHT, - MATH_VIEW_TOP_X, - MATH_VIEW_TOP_Y, - MATH_VIEW_FONT_SIZE, - MATH_VIEW_ANTI_ALIASING, - MATH_VIEW_TRANSPARENCY, - MATH_VIEW_VERBOSITY, - MATH_VIEW_FONT_MANAGER -} math_args; - - -static GtkMathViewControlData* -gtk_math_view_control_data_new(GtkMathView *math_view) -{ - GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1); - cd->math_view = math_view; - cd->semantic_selection = FALSE; - cd->doc_name = NULL; - cd->first_selected = NULL; - cd->root_selected = NULL; - return cd; -} - -static void -gtk_math_view_control_data_destroy(GtkMathViewControlData* cd) -{ - //gtk_object_unref(cd->math_view); - cd->math_view = NULL; - - g_free(cd); -} +enum + { + MATH_VIEW_WIDTH, + MATH_VIEW_HEIGHT, + MATH_VIEW_TOP_X, + MATH_VIEW_TOP_Y, + MATH_VIEW_FONT_SIZE, + MATH_VIEW_ANTI_ALIASING, + MATH_VIEW_TRANSPARENCY, + MATH_VIEW_VERBOSITY, + MATH_VIEW_FONT_MANAGER + } math_args; static void -get_prop(BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, +get_prop(BonoboPropertyBag* bag, + BonoboArg* arg, + guint arg_id, CORBA_Environment *ev, - gpointer user_data) + gpointer user_data) { GtkMathView *math_view; @@ -54,7 +33,7 @@ get_prop(BonoboPropertyBag *bag, math_view = GTK_MATH_VIEW(user_data); - switch(arg_id) + switch (arg_id) { case MATH_VIEW_WIDTH: { @@ -66,7 +45,6 @@ get_prop(BonoboPropertyBag *bag, case MATH_VIEW_HEIGHT: { guint i = gtk_math_view_get_height(math_view); - g_assert(arg->_type == BONOBO_ARG_INT); BONOBO_ARG_SET_INT(arg,i); } @@ -74,7 +52,6 @@ get_prop(BonoboPropertyBag *bag, case MATH_VIEW_TOP_X: { guint new_top_y,new_top_x; - g_assert(arg->_type == BONOBO_ARG_INT); gtk_math_view_get_top(math_view,&new_top_x, &new_top_y); BONOBO_ARG_SET_INT(arg,new_top_x); @@ -83,7 +60,6 @@ get_prop(BonoboPropertyBag *bag, case MATH_VIEW_TOP_Y: { guint new_top_y,new_top_x; - g_assert(arg->_type == BONOBO_ARG_INT); gtk_math_view_get_top(math_view,&new_top_x,&new_top_y); BONOBO_ARG_SET_INT(arg,new_top_y); @@ -93,7 +69,6 @@ get_prop(BonoboPropertyBag *bag, { guint i = gtk_math_view_get_font_size(math_view); g_assert(arg->_type == BONOBO_ARG_INT); - BONOBO_ARG_SET_INT(arg,i); } break; @@ -101,7 +76,6 @@ get_prop(BonoboPropertyBag *bag, { gboolean i = gtk_math_view_get_anti_aliasing(math_view); g_assert(arg->_type == BONOBO_ARG_BOOLEAN); - BONOBO_ARG_SET_BOOLEAN(arg,i); } break; @@ -109,7 +83,6 @@ get_prop(BonoboPropertyBag *bag, { gboolean i = gtk_math_view_get_transparency(math_view); g_assert(arg->_type == BONOBO_ARG_BOOLEAN); - BONOBO_ARG_SET_BOOLEAN(arg,i); } break; @@ -117,14 +90,13 @@ get_prop(BonoboPropertyBag *bag, { gint i = gtk_math_view_get_log_verbosity(math_view); g_assert(arg->_type == BONOBO_ARG_INT); - BONOBO_ARG_SET_INT(arg,i); } break; case MATH_VIEW_FONT_MANAGER: { - gint i = (gint) gtk_math_view_get_font_manager_type(math_view); - BONOBO_ARG_SET_INT(arg,i); + gint i = (gint) gtk_math_view_get_font_manager_type(math_view); + BONOBO_ARG_SET_INT(arg,i); } break; default: @@ -133,11 +105,11 @@ get_prop(BonoboPropertyBag *bag, } static void -set_prop(BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) +set_prop(BonoboPropertyBag* bag, + const BonoboArg* arg, + guint arg_id, + CORBA_Environment* ev, + gpointer user_data) { GtkMathView *math_view; @@ -145,13 +117,12 @@ set_prop(BonoboPropertyBag *bag, math_view = GTK_MATH_VIEW(user_data); - switch(arg_id) + switch (arg_id) { case MATH_VIEW_TOP_X: { guint old_top_y; g_assert(arg->_type == BONOBO_ARG_INT); - gtk_math_view_get_top(math_view, NULL, &old_top_y); gtk_math_view_set_top(math_view, BONOBO_ARG_GET_INT(arg), old_top_y); } @@ -160,7 +131,6 @@ set_prop(BonoboPropertyBag *bag, { guint old_top_x; g_assert(arg->_type == BONOBO_ARG_INT); - gtk_math_view_get_top(math_view, &old_top_x, NULL); gtk_math_view_set_top(math_view, BONOBO_ARG_GET_INT(arg), old_top_x); } @@ -169,7 +139,6 @@ set_prop(BonoboPropertyBag *bag, { guint i = gtk_math_view_get_font_size(math_view); g_assert(arg->_type == BONOBO_ARG_INT); - BONOBO_ARG_SET_INT(arg,i); } break; @@ -177,7 +146,6 @@ set_prop(BonoboPropertyBag *bag, { gboolean i = gtk_math_view_get_anti_aliasing(math_view); g_assert(arg->_type == BONOBO_ARG_BOOLEAN); - BONOBO_ARG_SET_BOOLEAN(arg,i); } break; @@ -185,7 +153,6 @@ set_prop(BonoboPropertyBag *bag, { gboolean i = gtk_math_view_get_transparency(math_view); g_assert(arg->_type == BONOBO_ARG_BOOLEAN); - BONOBO_ARG_SET_BOOLEAN(arg,i); } break; @@ -193,7 +160,6 @@ set_prop(BonoboPropertyBag *bag, { gint i = gtk_math_view_get_log_verbosity(math_view); g_assert(arg->_type == BONOBO_ARG_INT); - BONOBO_ARG_SET_INT(arg,i); } break; @@ -204,19 +170,19 @@ set_prop(BonoboPropertyBag *bag, } break; default: - bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); + bonobo_exceptionset (ev, ex_Bonobo_PropertyBag_NotFound); break; } } static void -control_destroy(BonoboObject *object,GtkMathViewControlData *cd) +control_destroy(BonoboObject *object, GtkMathViewControlData *cd) { - gtk_math_view_control_data_destroy(cd); + gtk_math_view_control_data_destroy(cd); } static void -gtk_math_view_control_init(BonoboControl *control,GtkWidget *scrolled_window) +gtk_math_view_control_init(BonoboControl *control, GtkWidget *scrolled_window) { GtkMathViewControlData *control_data; GtkWidget *math_view; @@ -249,56 +215,74 @@ gtk_math_view_control_init(BonoboControl *control,GtkWidget *scrolled_window) prop_bag = bonobo_property_bag_new(get_prop, set_prop, math_view); bonobo_control_set_properties(control, BONOBO_OBJREF(prop_bag), NULL); - bonobo_property_bag_add(prop_bag,"width",MATH_VIEW_WIDTH,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"width", + MATH_VIEW_WIDTH, BONOBO_ARG_INT, NULL,"width",0); - bonobo_property_bag_add(prop_bag,"height",MATH_VIEW_HEIGHT,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"height", + MATH_VIEW_HEIGHT, BONOBO_ARG_INT, NULL,"height",0); - bonobo_property_bag_add(prop_bag,"top_x",MATH_VIEW_TOP_X,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"top_x", + MATH_VIEW_TOP_X, BONOBO_ARG_INT, NULL,"top_x",0); - bonobo_property_bag_add(prop_bag,"top_y",MATH_VIEW_TOP_Y,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"top_y", + MATH_VIEW_TOP_Y, BONOBO_ARG_INT, NULL,"top_y",0); - bonobo_property_bag_add(prop_bag,"font_size",MATH_VIEW_FONT_SIZE,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"font_size", + MATH_VIEW_FONT_SIZE, BONOBO_ARG_INT, NULL,"font_size",0); - bonobo_property_bag_add(prop_bag,"anti_aliasing",MATH_VIEW_ANTI_ALIASING,BONOBO_ARG_BOOLEAN, + bonobo_property_bag_add(prop_bag,"anti_aliasing", + MATH_VIEW_ANTI_ALIASING, BONOBO_ARG_BOOLEAN, NULL,"anti_aliasing",0); - bonobo_property_bag_add(prop_bag,"transparency",MATH_VIEW_TRANSPARENCY,BONOBO_ARG_BOOLEAN, + bonobo_property_bag_add(prop_bag,"transparency", + MATH_VIEW_TRANSPARENCY, BONOBO_ARG_BOOLEAN, NULL,"transparency",0); - bonobo_property_bag_add(prop_bag,"verbosity",MATH_VIEW_VERBOSITY,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"verbosity", + MATH_VIEW_VERBOSITY, BONOBO_ARG_INT, NULL,"verbosity",0); - bonobo_property_bag_add(prop_bag,"font_manager",MATH_VIEW_FONT_MANAGER,BONOBO_ARG_INT, + bonobo_property_bag_add(prop_bag,"font_manager", + MATH_VIEW_FONT_MANAGER, BONOBO_ARG_INT, NULL,"font_manager",0); bonobo_object_unref(BONOBO_OBJECT(prop_bag)); - g_signal_connect(control,"set_frame",G_CALLBACK(set_frame),control_data); - g_signal_connect(control_data->math_view, "click", G_CALLBACK (click_cb),control_data); - g_signal_connect(control_data->math_view, "select_begin",G_CALLBACK(select_begin_cb),control_data); - g_signal_connect(control_data->math_view, "select_over",G_CALLBACK(select_over_cb),control_data); - g_signal_connect(control_data->math_view, "select_end",G_CALLBACK(select_end_cb),control_data); - g_signal_connect(control_data->math_view, "select_abort",G_CALLBACK(select_abort_cb),control_data); + g_signal_connect(control,"set_frame", G_CALLBACK(set_frame), control_data); + g_signal_connect(control_data->math_view, "click", G_CALLBACK (click_cb), + control_data); + g_signal_connect(control_data->math_view, "select_begin", G_CALLBACK(select_begin_cb), + control_data); + g_signal_connect(control_data->math_view, "select_over", G_CALLBACK(select_over_cb), + control_data); + g_signal_connect(control_data->math_view, "select_end", G_CALLBACK(select_end_cb), + control_data); + g_signal_connect(control_data->math_view, "select_abort", G_CALLBACK(select_abort_cb), + control_data); } static BonoboObject* -gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, gpointer closure) +gtk_math_view_control_factory(BonoboGenericFactory* factory, const gchar* component_id, + gpointer closure) { BonoboControl *control; GtkWidget *scrolled_window; scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_SHADOW_IN); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show_all (scrolled_window); control = bonobo_control_new(scrolled_window); if(control) - { - gtk_math_view_control_init(control,scrolled_window); - return BONOBO_OBJECT(control); - } + { + gtk_math_view_control_init(control,scrolled_window); + return BONOBO_OBJECT(control); + } else - return NULL; + return NULL; } -BONOBO_ACTIVATION_SHLIB_FACTORY (CONTROL_FACTORY_ID, "GtkMathView Factory", gtk_math_view_control_factory, NULL); +BONOBO_ACTIVATION_SHLIB_FACTORY (CONTROL_FACTORY_ID, "GtkMathView Factory", + gtk_math_view_control_factory, NULL); diff --git a/helm/gtkmathview-bonobo/src/handlers.c b/helm/gtkmathview-bonobo/src/handlers.c index c3bda4737..485ad0183 100644 --- a/helm/gtkmathview-bonobo/src/handlers.c +++ b/helm/gtkmathview-bonobo/src/handlers.c @@ -1,185 +1,174 @@ + #include "handlers.h" void -set_frame(BonoboControl *control,gpointer data) +set_frame(BonoboControl *control, gpointer data) { - /*Bonobo_UIContainer remote_ui_container; - BonoboUIComponent *ui_component; - GtkMathViewControlData *control_data; - GtkWidget *scrolled_window; - Bonobo_ControlFrame frame; - control_data = (GtkMathViewControlData *) data;*/ } void -click_cb(GtkMathView* math_view, GdomeElement* elem, gint state, GtkMathViewControlData* control_data) +click_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) { - GdomeException exc; - GdomeDOMString* name; - GdomeDOMString* ns_uri; - //GdomeElement* p; + GdomeException exc = 0; g_return_if_fail(math_view != NULL); - - printf("*** click signal: %p %x %p\n", elem, state, control_data); + g_return_if_fail(control_data != NULL); if (elem != NULL) - { + { GdomeElement* action; GdomeDOMString* href = find_hyperlink(elem); + if (href != NULL) - { - /* printf("hyperlink %s\n", href->str); */ + { gtk_math_view_load_uri(math_view,href->str); gdome_str_unref(href); - } - else - { - action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction"); - /* printf("action? %p\n", action); */ - if (action != NULL) - { - gtk_math_view_freeze(math_view); - action_toggle(action); - gtk_math_view_thaw(math_view); - gdome_el_unref(action, &exc); - g_assert(exc == 0); - return; - } - } - if (control_data->root_selected != NULL) - { - gtk_math_view_freeze(math_view); - gtk_math_view_unselect(math_view, control_data->root_selected); - gtk_math_view_thaw(math_view); - gdome_el_unref(control_data->root_selected, &exc); - g_assert(exc == 0); - control_data->root_selected = NULL; - } - } + return; + } + + action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction"); + if (action != NULL) + { + gtk_math_view_freeze(math_view); + action_toggle(action); + gtk_math_view_thaw(math_view); + gdome_el_unref(action, &exc); + g_assert(exc == 0); + return; + } + } + + if (control_data->root_selected != NULL) + { + gtk_math_view_freeze(math_view); + gtk_math_view_unselect(math_view, control_data->root_selected); + gtk_math_view_thaw(math_view); + gdome_el_unref(control_data->root_selected, &exc); + g_assert(exc == 0); + control_data->root_selected = NULL; + } } void -select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state,GtkMathViewControlData* control_data) +select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) { g_return_if_fail(math_view != NULL); - g_return_if_fail(GTK_IS_MATH_VIEW(math_view)); - printf("*** select_begin signal: %p %x\n", elem, state); + g_return_if_fail(control_data != NULL); + if (elem != NULL) { GdomeException exc = 0; gtk_math_view_freeze(math_view); if (control_data->root_selected != NULL) - { - gtk_math_view_unselect(math_view,control_data->root_selected); - gdome_el_unref(control_data->root_selected, &exc); - g_assert(exc == 0); - control_data->root_selected = NULL; - } + { + gtk_math_view_unselect(math_view, control_data->root_selected); + gdome_el_unref(control_data->root_selected, &exc); + g_assert(exc == 0); + control_data->root_selected = NULL; + } if (control_data->semantic_selection) - { - GdomeElement* new_elem = find_xref_element(elem); - if (new_elem != NULL) - { - gdome_el_ref(new_elem, &exc); - g_assert(exc == 0); - } - control_data->first_selected = control_data->root_selected = new_elem; - } + { + GdomeElement* new_elem = find_xref_element(elem); + if (new_elem != NULL) + { + gdome_el_ref(new_elem, &exc); + g_assert(exc == 0); + } + control_data->first_selected = control_data->root_selected = new_elem; + } else - { - gdome_el_ref(elem, &exc); - g_assert(exc == 0); - gdome_el_ref(elem, &exc); - g_assert(exc == 0); - control_data->first_selected = control_data->root_selected = elem; - } + { + gdome_el_ref(elem, &exc); + g_assert(exc == 0); + gdome_el_ref(elem, &exc); + g_assert(exc == 0); + control_data->first_selected = control_data->root_selected = elem; + } if (control_data->root_selected != NULL) - gtk_math_view_select(math_view, control_data->root_selected); + gtk_math_view_select(math_view, control_data->root_selected); gtk_math_view_thaw(math_view); } } void -select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state,GtkMathViewControlData* control_data) +select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) { g_return_if_fail(math_view != NULL); - g_return_if_fail(GTK_IS_MATH_VIEW(math_view)); - - printf("*** select_over signal: %p %x\n", elem, state); + g_return_if_fail(control_data != NULL); if (control_data->first_selected != NULL && elem != NULL) { GdomeException exc = 0; gtk_math_view_freeze(math_view); - + if (control_data->root_selected != NULL) - { + { gtk_math_view_unselect(math_view, control_data->root_selected); gdome_el_unref(control_data->root_selected, &exc); g_assert(exc == 0); control_data->root_selected = NULL; - } - + } + if (control_data->semantic_selection) - { - GdomeElement* new_root = find_common_ancestor(control_data->first_selected, elem); - if (new_root != NULL) - { - control_data->root_selected = find_xref_element(new_root); - gdome_el_unref(new_root, &exc); - g_assert(exc == 0); - } - else - control_data->root_selected = NULL; - } + { + GdomeElement* new_root = find_common_ancestor(control_data->first_selected, elem); + if (new_root != NULL) + { + control_data->root_selected = find_xref_element(new_root); + gdome_el_unref(new_root, &exc); + g_assert(exc == 0); + } + else + control_data->root_selected = NULL; + } else control_data->root_selected = find_common_ancestor(control_data->first_selected, elem); - + if (control_data->root_selected != NULL) gtk_math_view_select(math_view, control_data->root_selected); - + gtk_math_view_thaw(math_view); } } void -select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state,GtkMathViewControlData* control_data) +select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state, + GtkMathViewControlData* control_data) { g_return_if_fail(math_view != NULL); - g_return_if_fail(GTK_IS_MATH_VIEW(math_view)); - - printf("*** select_end signal: %p %x\n", elem, state); + g_return_if_fail(control_data != NULL); if (control_data->first_selected != NULL) - { + { GdomeException exc = 0; gdome_el_unref(control_data->first_selected, &exc); g_assert(exc == 0); control_data->first_selected = NULL; - } + } } void -select_abort_cb(GtkMathView* math_view,GtkMathViewControlData* control_data) +select_abort_cb(GtkMathView* math_view, GtkMathViewControlData* control_data) { GdomeException exc = 0; g_return_if_fail(math_view != NULL); - g_return_if_fail(GTK_IS_MATH_VIEW(math_view)); - - printf("*** select_abort signal\n"); + g_return_if_fail(control_data != NULL); if (control_data->first_selected != NULL) - { + { gdome_el_unref(control_data->first_selected, &exc); g_assert(exc == 0); control_data->first_selected = NULL; - } + } + if (control_data->root_selected != NULL) { gtk_math_view_freeze(math_view); diff --git a/helm/gtkmathview-bonobo/src/handlers.h b/helm/gtkmathview-bonobo/src/handlers.h index 84f6bc943..81b1eb70b 100644 --- a/helm/gtkmathview-bonobo/src/handlers.h +++ b/helm/gtkmathview-bonobo/src/handlers.h @@ -1,27 +1,18 @@ -#ifndef __handlers___ -#define __handlers___ + +#ifndef __handlers_h__ +#define __handlers_h__ #include -#include #include -#include "control-data.h" - -void -set_frame(BonoboControl*,gpointer); - -void -click_cb(GtkMathView*, GdomeElement*, gint,GtkMathViewControlData*); - -void -select_begin_cb(GtkMathView*,GdomeElement*, gint,GtkMathViewControlData*); - -void -select_over_cb(GtkMathView*,GdomeElement*,gint,GtkMathViewControlData*); +#include -void -select_end_cb(GtkMathView*,GdomeElement*,gint,GtkMathViewControlData*); +#include "control-data.h" -void -select_abort_cb(GtkMathView*,GtkMathViewControlData*); +void set_frame(BonoboControl*, gpointer); +void click_cb(GtkMathView*, GdomeElement*, gint, GtkMathViewControlData*); +void select_begin_cb(GtkMathView*,GdomeElement*, gint, GtkMathViewControlData*); +void select_over_cb(GtkMathView*,GdomeElement*,gint, GtkMathViewControlData*); +void select_end_cb(GtkMathView*,GdomeElement*,gint, GtkMathViewControlData*); +void select_abort_cb(GtkMathView*, GtkMathViewControlData*); -#endif +#endif // __handlers_h__ -- 2.39.2