~ubuntu-branches/debian/sid/freeciv/sid

« back to all changes in this revision

Viewing changes to client/gui-gtk-2.0/dialogs.c

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2009-11-27 23:24:00 UTC
  • mfrom: (7.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091127232400-nmoil1yvvskugn1h
[ Karl Goetz ]
* New upstream release
* Bump standards-version to 3.8.3
* Update watch file
  - Now version 3
  - Switched to gna.org instead of sf.net
* Switch readline dev dependency to libreadline-dev instead of
libreadline5-dev. Closes: #553758
* Changed compat to 5
* Relaxed dependencies on freeciv-server for sdl and gtk clients,
freeciv-server is now a recommends
* Stop d/rules trying to gzip scenarios - upstream does this.
* Remove export of datarootdir in d/rules, upstream seems to handle
this correctly now.
* Deleted 01_configure_ac_localedir.diff from d/patches/ and from series.
* Create per-client .desktop files. Closes: #470978, LP: #190555
* Desktop files mention which client they are (sdl/gtk/xaw3d).
* Add myself to uploaders on Clint's suggestion.

[ Clint Adams ]
* Change watch file to grab bz2 tarballs.
* Switch to 3.0 (quilt) source format.
* Remove quilt code from debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 
61
61
/******************************************************************/
62
62
static GtkWidget  *races_shell;
63
 
struct player *races_player;
 
63
static char races_player_name[MAX_LEN_NAME];
64
64
static GtkWidget  *races_nation_list[MAX_NUM_NATION_GROUPS + 1];
65
65
static GtkWidget  *races_leader;
66
66
static GList      *races_leader_list;
88
88
static gboolean races_selection_func(GtkTreeSelection *select,
89
89
                                     GtkTreeModel *model, GtkTreePath *path,
90
90
                                     gboolean selected, gpointer data);
 
91
static const struct player *get_races_player(void);
91
92
 
92
93
static int selected_nation;
93
94
static int selected_sex;
625
626
  GtkTreeSelection *select;
626
627
  GtkCellRenderer *render;
627
628
  GtkTreeViewColumn *column;
 
629
  const struct player *races_player = get_races_player();
628
630
 
629
631
  store = gtk_list_store_new(5, G_TYPE_INT, G_TYPE_BOOLEAN,
630
632
      GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
777
779
                                      GTK_RESPONSE_ACCEPT,
778
780
                                      NULL);
779
781
  races_shell = shell;
780
 
  races_player = pplayer;
 
782
  if (pplayer) {
 
783
    sz_strlcpy(races_player_name, player_name(pplayer));
 
784
  } else {
 
785
    races_player_name[0] = '\0';
 
786
  }
781
787
  setup_dialog(shell, toplevel);
782
788
 
783
789
  gtk_window_set_position(GTK_WINDOW(shell), GTK_WIN_POS_CENTER_ON_PARENT);
1233
1239
**************************************************************************/
1234
1240
static void races_response(GtkWidget *w, gint response, gpointer data)
1235
1241
{
 
1242
  const struct player *races_player;
 
1243
  int plrno;
 
1244
 
 
1245
  races_player = get_races_player();
 
1246
  if (!races_player) {
 
1247
    popdown_races_dialog();
 
1248
    return;
 
1249
  }
 
1250
  plrno = player_number(races_player);
 
1251
 
1236
1252
  if (response == GTK_RESPONSE_ACCEPT) {
1237
1253
    const char *s;
1238
1254
 
1239
1255
    if (selected_nation == -1) {
1240
 
      dsend_packet_nation_select_req(&aconnection,
1241
 
                                     races_player->player_no,
1242
 
                                     -1, FALSE, "", 0);
 
1256
      dsend_packet_nation_select_req(&aconnection, plrno,
 
1257
                                     -1, FALSE, "", 0);
1243
1258
      popdown_races_dialog();
1244
1259
      return;
1245
1260
    }
1263
1278
      return;
1264
1279
    }
1265
1280
 
1266
 
    dsend_packet_nation_select_req(&aconnection,
1267
 
                                   player_number(races_player), selected_nation,
1268
 
                                   selected_sex, s, selected_city_style);
 
1281
    dsend_packet_nation_select_req(&aconnection, plrno, selected_nation,
 
1282
                                   selected_sex, s, selected_city_style);
1269
1283
  } else if (response == GTK_RESPONSE_NO) {
1270
 
    dsend_packet_nation_select_req(&aconnection,
1271
 
                                   player_number(races_player),
1272
 
                                   -1, FALSE, "", 0);
 
1284
    dsend_packet_nation_select_req(&aconnection, plrno, -1, FALSE, "", 0);
1273
1285
  } else if (response == GTK_RESPONSE_CANCEL) {
1274
1286
    /* Nothing - this allows the player to keep his currently selected
1275
1287
     * nation. */
1334
1346
  gui_dialog_destroy_all();
1335
1347
}
1336
1348
 
 
1349
/**************************************************************************
 
1350
  Helper function to work-around the fact that players may be renumbered
 
1351
  over the life-time of the nation selection dialog. It uses player names
 
1352
  ('races_player_name') to try to uniquely determine the player that the
 
1353
  user wants to modify.
 
1354
 
 
1355
  NB: May return NULL.
 
1356
**************************************************************************/
 
1357
static const struct player *get_races_player(void)
 
1358
{
 
1359
  return find_player_by_name(races_player_name);
 
1360
}
 
1361