<URL: http://bugs.freeciv.org/Ticket/Display.html?id=33510 >

 ...and patch comes here.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c	2007-01-10 18:13:57.000000000 +0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2007-01-14 07:33:06.000000000 +0200
@@ -899,6 +899,8 @@
       create_network_page(), NULL);
   gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
       create_nation_page(), NULL);
+  gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
+      create_beginner_help_page(), NULL);
 
   main_tips = gtk_tooltips_new();
 
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/pages.c freeciv/client/gui-gtk-2.0/pages.c
--- freeciv/client/gui-gtk-2.0/pages.c	2006-08-18 10:52:04.000000000 +0300
+++ freeciv/client/gui-gtk-2.0/pages.c	2007-01-14 08:51:25.000000000 +0200
@@ -38,6 +38,7 @@
 #include "civclient.h"
 #include "clinet.h"
 #include "connectdlg_common.h"
+#include "helpdata.h"
 #include "packhand.h"
 #include "servers.h"
 
@@ -168,6 +169,14 @@
 }
 #endif
 
+/****************************************************************************
+  Callback to show the beginner help text.
+****************************************************************************/
+static void beginner_help(void)
+{
+  set_client_page(PAGE_HELP);
+}
+
 /**************************************************************************
   create the main page.
 **************************************************************************/
@@ -239,6 +248,11 @@
   g_signal_connect(button, "clicked", ggz_login, NULL);
 #endif
 
+  button = gtk_button_new_with_mnemonic(_("_Beginner help"));
+  gtk_size_group_add_widget(size, button);
+  gtk_container_add(GTK_CONTAINER(bbox), button);
+  g_signal_connect(button, "clicked", beginner_help, NULL);
+
   bbox = gtk_vbox_new(FALSE, 6);
   gtk_container_add(GTK_CONTAINER(sbox), bbox);
 
@@ -1537,6 +1551,7 @@
   gtk_widget_set_name(text, "chatline");
   gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
   gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);
+  gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 5);
   gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
   gtk_container_add(GTK_CONTAINER(sw), text);
 
@@ -2101,6 +2116,41 @@
 }
 
 /**************************************************************************
+  Creates beginner help page
+**************************************************************************/
+GtkWidget *create_beginner_help_page(void)
+{
+  GtkWidget *box, *bbox, *button, *text;
+  int idx;
+  const struct help_item *pitem;
+
+  box = gtk_vbox_new(FALSE, 18);
+  gtk_container_set_border_width(GTK_CONTAINER(box), 4);
+
+  text = gtk_text_view_new();
+  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
+  gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
+  gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);
+  gtk_container_add(GTK_CONTAINER(box), text);
+
+  pitem = get_help_item_spec("First time user", HELP_TEXT, &idx);
+
+  if (pitem != NULL) {
+    gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
+			     pitem->text, -1);
+  }
+
+  bbox = gtk_hbutton_box_new();
+  gtk_box_pack_start(GTK_BOX(box), bbox, FALSE, FALSE, 0);
+
+  button = gtk_stockbutton_new(GTK_STOCK_CANCEL, _("Back to main menu"));
+  g_signal_connect(button, "clicked", G_CALLBACK(main_callback), NULL);
+  gtk_container_add(GTK_CONTAINER(bbox), button);
+
+  return box;
+}
+
+/**************************************************************************
   Returns current client page
 **************************************************************************/
 enum client_pages get_client_page(void)
@@ -2144,6 +2194,7 @@
   switch (new_page) {
   case PAGE_MAIN:
   case PAGE_GGZ:
+  case PAGE_HELP:
     break;
   case PAGE_START:
     if (is_server_running()) {
@@ -2188,6 +2239,7 @@
   case PAGE_MAIN:
   case PAGE_START:
   case PAGE_GGZ:
+  case PAGE_HELP:
     break;
   case PAGE_NATION:
     gtk_tree_view_focus(gtk_tree_selection_get_tree_view(nation_selection));
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/pages.h freeciv/client/gui-gtk-2.0/pages.h
--- freeciv/client/gui-gtk-2.0/pages.h	2006-07-17 23:56:48.000000000 +0300
+++ freeciv/client/gui-gtk-2.0/pages.h	2007-01-14 07:42:36.000000000 +0200
@@ -29,6 +29,7 @@
 GtkWidget *create_load_page(void);
 GtkWidget *create_network_page(void);
 GtkWidget *create_nation_page(void);
+GtkWidget *create_beginner_help_page(void);
 
 GtkWidget *create_statusbar(void);
 void append_network_statusbar(const char *text, bool force);
diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c	2006-08-18 10:52:09.000000000 +0300
+++ freeciv/client/helpdata.c	2007-01-14 08:24:31.000000000 +0200
@@ -1497,3 +1497,4 @@
   }
   return buf;
 }
+
diff -Nurd -X.diff_ignore freeciv/client/include/pages_g.h freeciv/client/include/pages_g.h
--- freeciv/client/include/pages_g.h	2006-07-17 23:56:50.000000000 +0300
+++ freeciv/client/include/pages_g.h	2007-01-14 07:45:39.000000000 +0200
@@ -23,6 +23,7 @@
   PAGE_LOAD,		/* Load saved game page. */
   PAGE_NETWORK,		/* Connect to network page.  */
   PAGE_NATION,		/* Select a nation page.  */
+  PAGE_HELP,            /* First time user help. */
   PAGE_GAME,		/* In game page. */
   PAGE_GGZ		/* In game page.  This one must be last. */
 };
diff -Nurd -X.diff_ignore freeciv/data/helpdata.txt freeciv/data/helpdata.txt
--- freeciv/data/helpdata.txt	2006-08-18 10:51:31.000000000 +0300
+++ freeciv/data/helpdata.txt	2007-01-14 08:47:56.000000000 +0200
@@ -1451,3 +1451,12 @@
 that will arrive earlier.  The only other option is to capture \
 their capital.\
 ")
+
+[help_first_time_user]
+name = _("First time user")
+text = _("\
+Welcome to Freeciv.\n\n\
+You should start by selecting 'Start Scenario Game' from main menu. \
+That opens list of available scenarios. Select 'Tutorial'.\n\
+More information about the game is available at http://www.freeciv.org.\
+")
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to