Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#16760) gui-ftwl: patch to make use of the client page
Home

[Freeciv-Dev] (PR#16760) gui-ftwl: patch to make use of the client page

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16760) gui-ftwl: patch to make use of the client page system
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Sun, 30 Apr 2006 02:42:04 -0700
Reply-to: bugs@xxxxxxxxxxx

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

With this little patch the ftwl client doesn't quit when started without
the "-a" option, but shows a message in the chat window instead. This is
done on the "main" page" and the mapcanvas shows up as before when the
client switches to the "start" page (still only in autoconnect mode).
diff -urN -X devel/diff_ignore devel.orig/client/gui-ftwl/gui_main.c 
devel/client/gui-ftwl/gui_main.c
--- devel.orig/client/gui-ftwl/gui_main.c       2006-04-29 10:48:03.000000000 
+0200
+++ devel/client/gui-ftwl/gui_main.c    2006-04-30 01:11:42.000000000 +0200
@@ -224,10 +224,10 @@
     freelog(LOG_ERROR, "The resolution '%s' doesn't parse", resolution);
   }
   free(resolution);
-  
+
   if (!auto_connect) {
-    die("Connection dialog not yet implemented. Start client using "
-        "the -a option.");
+    freelog(LOG_ERROR, "Connection dialog not yet implemented. Start client"
+                       "using the -a option.");
   }
 
   sw_init();
@@ -244,15 +244,15 @@
   get_colors();
   root_window = sw_create_root_window();
   sw_widget_set_background_color(root_window,
-                                enum_color_to_be_color(COLOR_EXT_GREEN));
+                                enum_color_to_be_color(COLOR_STD_BACKGROUND));
 
   chat_create(); 
   chatline_create();
+  
   tileset_load_tiles(tileset);
   timer_callback(NULL);
   sw_window_set_key_notify(root_window, my_key_handler, NULL);
 
-  popup_mapcanvas();
   set_client_state(CLIENT_PRE_GAME_STATE);
   sw_mainloop(input_from_server);
 }
diff -urN -X devel/diff_ignore devel.orig/client/gui-ftwl/gui_main.h 
devel/client/gui-ftwl/gui_main.h
--- devel.orig/client/gui-ftwl/gui_main.h       2006-04-17 19:05:18.000000000 
+0200
+++ devel/client/gui-ftwl/gui_main.h    2006-04-30 01:11:42.000000000 +0200
@@ -18,9 +18,6 @@
 #include "gui_main_g.h"
 #include "common_types.h"
 
-void popup_mapcanvas(void);
-void popdown_mapcanvas(void);
-
 extern struct sw_widget *root_window;
 
 be_color enum_color_to_be_color(int color);
diff -urN -X devel/diff_ignore devel.orig/client/gui-ftwl/mapview.h 
devel/client/gui-ftwl/mapview.h
--- devel.orig/client/gui-ftwl/mapview.h        2006-03-29 06:46:43.000000000 
+0200
+++ devel/client/gui-ftwl/mapview.h     2006-04-30 01:11:42.000000000 +0200
@@ -17,6 +17,8 @@
 #include "mapview_g.h"
 
 void mapview_update_actions(void);
+void popup_mapcanvas(void);
+void popdown_mapcanvas(void);
 
 void set_focus_tile(struct tile *ptile);
 void clear_focus_tile(void);
diff -urN -X devel/diff_ignore devel.orig/client/gui-ftwl/pages.c 
devel/client/gui-ftwl/pages.c
--- devel.orig/client/gui-ftwl/pages.c  2006-04-29 10:59:37.000000000 +0200
+++ devel/client/gui-ftwl/pages.c       2006-04-30 02:17:11.000000000 +0200
@@ -15,14 +15,36 @@
 #include <config.h>
 #endif
 
+#include "chatline.h"
+#include "mapview.h"
+
 #include "pages.h"
 
+static enum client_pages old_page = PAGE_MAIN;
+
+static void show_main_page()
+{
+  append_output_window("Connection dialog not yet implemented. Start client"
+                       "using the -a option.");
+}
+
 /**************************************************************************
   Does a toplevel window page transition.
 **************************************************************************/
 void set_client_page(enum client_pages page)
 {
-  /* PORTME */
+  if ((page == old_page) && (page != PAGE_MAIN)) {
+    return;
+  }
+  
+  old_page = page;    
+    
+  if (page == PAGE_MAIN) {
+    show_main_page();
+  } else if (page == PAGE_START) {
+    popup_mapcanvas();
+  }
+  
 }
 
 /**************************************************************************
@@ -30,8 +52,7 @@
 **************************************************************************/
 enum client_pages get_client_page(void)
 {
-  /* PORTME */
-  return PAGE_MAIN;
+  return old_page;
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#16760) gui-ftwl: patch to make use of the client page system, Christian Prochaska <=