refraction part 8
[mancala] / src / plugin / mancala-ui-plugin.c
index 528b9d6..68d3717 100644 (file)
@@ -27,6 +27,8 @@
 #include <gtk/gtk.h>
 #include <startup_plugin.h>
 #include <startup_app.h>
+#include <dbus/dbus-glib.h>
+
 
 static GtkWidget *load_plugin               (void);
 static void       unload_plugin             (void);
@@ -92,7 +94,7 @@ static void show_help_subwindow (void)
     
     gtk_container_add (GTK_CONTAINER (win), pannable_text);
     
-    g_signal_connect (win, "destroy", destroy_help_subwindow, NULL);
+    g_signal_connect (win, "destroy",    destroy_help_subwindow, NULL);
     
 
     /* This call show the window and also add the window to the stack */
@@ -100,13 +102,42 @@ static void show_help_subwindow (void)
 }
 
 
+static void show_help_browser (void)
+{
+    char *uri = "file:///home/opt/mancala/data/mancala.html";
+    DBusGConnection *connection;
+    GError *error = NULL;
+    DBusGProxy *proxy;
+    
+    connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+    
+    if (connection == NULL){
+        printf("Dbus connection failed: %s\n",error->message);
+        g_error_free (error);
+        return;
+    }
+    
+    proxy = dbus_g_proxy_new_for_name (connection,
+                                       "com.nokia.osso_browser",
+                                       "/com/nokia/osso_browser/request",
+                                       "com.nokia.osso_browser");
+
+    error = NULL;
+
+    if (!dbus_g_proxy_call (proxy, "load_url", &error, G_TYPE_STRING, uri, G_TYPE_INVALID, G_TYPE_INVALID)){
+        printf("Load_URL failed: %s\n",error->message);
+        g_error_free (error);
+    }
+
+}
+
 
 static GtkWidget *load_plugin (void)
 {
     GtkWidget *button;
     button =  gtk_button_new_with_label ("Instuctions");
     
-    g_signal_connect (button, "clicked", G_CALLBACK (show_help_subwindow), NULL);
+    g_signal_connect (button, "clicked", G_CALLBACK (show_help_browser), NULL);
     
     return GTK_WIDGET(button);