2 * This file is part of Crazyparking
4 * Copyright (C) 2005 INdT - Instituto Nokia de Tecnologia
5 * http://www.indt.org/maemo
7 * This software is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
12 * This software is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 #include <hildon/hildon.h>
28 #include <startup_plugin.h>
31 static GtkWidget *load_plugin (void);
32 static void unload_plugin (void);
33 static void write_config (void);
34 static GtkWidget **load_menu (guint *);
35 static void update_menu (void);
37 static GameStartupInfo gs;
40 GtkWidget *settings_item;
41 GtkWidget *settings_menu;
42 GtkWidget *difficulty_item;
43 GtkWidget *difficulty_menu;
44 GtkWidget *menu_items[2];
46 static StartupPluginInfo plugin_info = {
56 STARTUP_INIT_PLUGIN(plugin_info, gs, FALSE, FALSE)
58 static GtkWidget *load_plugin (void)
61 GtkTextBuffer *textbox_buffer;
63 PangoFontDescription *font_desc;
64 GtkWidget *pannable_text;
66 /* Create and pack labels */
67 textbox_text = g_strdup_printf("Welcome to Mancala, the ancient African game of skill!\n\nMancala 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.\n\nIf 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.\n\nThe 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.");
69 textbox = hildon_text_view_new();
70 gtk_text_view_set_editable(GTK_TEXT_VIEW(textbox), FALSE);
71 // gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textbox), FALSE);
72 gtk_text_view_set_indent(GTK_TEXT_VIEW(textbox), 10);
73 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textbox), 10);
74 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textbox), 10);
75 gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(textbox), 3);
76 gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(textbox), 2);
77 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textbox), GTK_WRAP_WORD);
78 // gtk_widget_set_sensitive(textbox, FALSE);
79 font_desc = pango_font_description_from_string ("vera 18");
80 gtk_widget_modify_font(textbox, font_desc);
81 pango_font_description_free (font_desc);
83 textbox_buffer = hildon_text_view_get_buffer (HILDON_TEXT_VIEW (textbox));
85 gtk_text_buffer_set_text(textbox_buffer, textbox_text, -1);
88 pannable_text = hildon_pannable_area_new();
89 hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA(pannable_text), textbox);
91 return GTK_WIDGET(pannable_text);
106 static GtkWidget **load_menu (guint *nitems)
110 //number of entries in osso-games-startup main menu for this game
113 settings_item = gtk_menu_item_new_with_label ("Settings");
114 settings_menu = gtk_menu_new ();
115 menu_items[0] = settings_item;
116 gtk_menu_item_set_submenu (GTK_MENU_ITEM (settings_item), settings_menu);
118 //difficulty settings
119 difficulty_menu = gtk_menu_new ();
120 difficulty_item = gtk_menu_item_new_with_label ("Difficulty");
121 gtk_menu_item_set_submenu (GTK_MENU_ITEM (difficulty_item), difficulty_menu);
122 gtk_menu_append (GTK_MENU (settings_menu), difficulty_item);
125 return GTK_WIDGET(menu_items);
130 static void update_menu (void)