refraction part 8 refraction-works-browser
authorReto Zingg <g.d0b3rm4n@gmail.com>
Sat, 26 Dec 2009 15:26:56 +0000 (17:26 +0200)
committerReto Zingg <g.d0b3rm4n@gmail.com>
Sat, 26 Dec 2009 15:26:56 +0000 (17:26 +0200)
Makefile
data/mancala.html [new file with mode: 0644]
src/plugin/mancala-ui-plugin.c

index e06e0e8..61290a4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@ install:
        cp data/com.nokia.mancala_startup.service $(DESTDIR)/usr/share/dbus-1/services/
        cp data/mancala.conf $(DESTDIR)/home/opt/mancala/data/
        cp data/mancala.game $(DESTDIR)/home/opt/mancala/data/
+       cp data/mancala.html $(DESTDIR)/home/opt/mancala/data/
        cp data/mancala.sh $(DESTDIR)/home/opt/mancala/bin/
 
 clean:
diff --git a/data/mancala.html b/data/mancala.html
new file mode 100644 (file)
index 0000000..d87e82c
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+<head></head>
+<body>
+<h1>Welcome to Mancala, the ancient African game of skill!</h1>
+<p>Mancala is a very simple, easy-to-learn game. Each player begins with a horizontal row of holes or pits filled with a certain number of stones. At either end of the board are the players' home pits, which are used to keep score. In this case, the human player has the left home pit and the upper row holes. A move is made by clicking into the hole you wish to move from. The stones are then picked up and distributed, one to each hole, moving toward your home pit is reached, and then moving through your opponent's row, bypassing his/her home, and moving back towards in a circle (counterclockwise), until all the stones have been distributed.</p>
+<p>If the last stone is placed in your home, you receive an extra turn. If the last stone lands in an empty hole on your side, you 'capture' the stones in the opposite hole on your opponent's side, moving them to your home.</p>
+<p>The game ends when one player cannot play (ie. there are no stones on his/her side of the board.  The player who has the most stones on his/her *side* wins.</p>
+</body>
+</html>
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);