dnl Process this file with autoconf to produce a configure script.
-AC_INIT(gtkmathview-bonobo, [0.0.1])
+AC_INIT(gtkmathview-bonobo, [0.0.3])
AC_CONFIG_SRCDIR(src/GNOME_GtkMathView.server.in.in)
AM_INIT_AUTOMAKE($AC_PACKAGE_NAME, $AC_PACKAGE_VERSION)
#include "control-data.h"
GtkMathViewControlData*
-gtk_math_view_control_data_new(GtkMathView *math_view)
+gtk_math_view_control_data_new(BonoboControl* control, GtkMathView *math_view)
{
GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1);
+ cd->control = control; /* we don't ref the control this is a weak pointer */
cd->math_view = math_view;
gtk_widget_ref(GTK_WIDGET(math_view));
cd->item_factory = NULL;
gtk_math_view_control_data_destroy(GtkMathViewControlData* cd)
{
GdomeException exc = 0;
+ cd->control = NULL; /* don't unref the control, see above */
gtk_widget_unref(GTK_WIDGET(cd->math_view));
cd->math_view = NULL;
if (cd->item_factory != NULL)
#ifndef __control_data_h__
#define __control_data_h__
+#include <bonobo.h>
#include <gtkmathview.h>
#include <gdome.h>
typedef struct _GtkMathViewControlData
{
+ BonoboControl* control; /* the control this data belongs to */
GtkMathView* math_view;
GtkWidget* item_factory;
gboolean semantic_selection;
gint y;
} GtkMathViewControlData;
-GtkMathViewControlData* gtk_math_view_control_data_new(GtkMathView*);
+GtkMathViewControlData* gtk_math_view_control_data_new(BonoboControl*, GtkMathView*);
void gtk_math_view_control_data_destroy(GtkMathViewControlData*);
gchar* gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData*);
void gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData*, const gchar*);
BonoboPropertyBag *prop_bag;
BonoboObject *persist_file;
BonoboObject *persist_stream;
+ BonoboEventSource *evs;
View* view;
math_view = gtk_math_view_new(NULL,NULL);
gtk_widget_show(math_view);
- control_data = gtk_math_view_control_data_new((GtkMathView*)math_view);
+ control_data = gtk_math_view_control_data_new(control, (GtkMathView*)math_view);
g_signal_connect (control, "destroy", G_CALLBACK (control_destroy), control_data);
gtk_item_factory_create_items (control_data->item_factory, nmenu_items, menu_items, control_data);
/* control_data->popup_menu = gtk_item_factory_get_widget (control_data->item_factory, "<main>"); */
/* gtk_widget_ref(control_data->popup_menu); */
+
+ evs = bonobo_event_source_new();
+ bonobo_object_add_interface(BONOBO_OBJECT(control), BONOBO_OBJECT(evs));
gtk_container_add(GTK_CONTAINER (scrolled_window), GTK_WIDGET (control_data->math_view));
{
}
+static void
+notify_browser(GtkMathViewControlData* control_data, const char* url)
+{
+ BonoboObject* evs = bonobo_object_query_local_interface(BONOBO_OBJECT(control_data->control),
+ "IDL:Bonobo/EventSource:1.0");
+ if (evs != NULL)
+ {
+ BonoboArg* arg = bonobo_arg_new(BONOBO_ARG_STRING);
+ BONOBO_ARG_SET_STRING(arg, url);
+ bonobo_event_source_notify_listeners (evs, "URL", arg, NULL);
+ /* bonobo_arg_release(arg); */
+ bonobo_object_unref(BONOBO_OBJECT(evs));
+ }
+}
+
void
click_cb(GtkMathView* math_view, GdomeElement* elem, gint state,
GtkMathViewControlData* control_data)
g_return_if_fail(math_view != NULL);
g_return_if_fail(control_data != NULL);
-
+
if (elem != NULL)
{
GdomeElement* action;
if (href != NULL)
{
/*gtk_math_view_load_uri(math_view,href->str);*/
- set_clipboard(href);
+
+ notify_browser(control_data, href->str);
+
+ //set_clipboard(href);
gdome_str_unref(href);
return;
}
The embedded object should display a mathematical formula.
<br />
<br />
-<object data="test.mml" width="400" height="100" type="application/mathml+xml">
+<object data="test2.mml" width="400" height="100" type="application/mathml+xml">
No viewer capable of displaying the test document installed.
</object>