[Freeciv-Dev] (PR#9841) remove government dialog
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9841 >
This patch removes the government dialog.
Reasons:
- Popups are bad.
- It is no longer needed (government menu can be used instead).
gui-gtk, gui-gtk-2.0, gui-xaw, and gui-stub are updated.
The only problem is if the game is saved during a revolution. In this
case you get the "Please choose a government" message and you must
choose a government from the menu. But it's not a obvious as the popup.
This can be fixed of course if the target government is put into the
savegame (as it should be).
jason
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.398
diff -u -r1.398 packhand.c
--- client/packhand.c 27 Aug 2004 17:36:53 -0000 1.398
+++ client/packhand.c 27 Aug 2004 21:58:02 -0000
@@ -1507,20 +1507,8 @@
government_selected = FALSE;
} else if (!client_is_observer()) {
- int i = 0, governments = game.government_count - 1;
- struct government *government[governments];
-
- assert(game.government_when_anarchy >= 0
- && game.government_when_anarchy < game.government_count);
-
- government_iterate(g) {
- if (g->index != game.government_when_anarchy) {
- government[i] = g;
- i++;
- }
- } government_iterate_end;
-
- popup_government_dialog(governments, government);
+ create_event(-1, -1, E_REVOLT_DONE,
+ _("Game: Please choose a new government."));
}
}
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.144
diff -u -r1.144 dialogs.c
--- client/gui-gtk/dialogs.c 13 Jul 2004 22:52:16 -0000 1.144
+++ client/gui-gtk/dialogs.c 27 Aug 2004 21:58:02 -0000
@@ -157,8 +157,6 @@
static GtkWidget *caravan_dialog;
-static bool government_dialog_is_open = FALSE;
-
struct pillage_data {
int unit_id;
enum tile_special_type what;
@@ -1177,46 +1175,6 @@
/****************************************************************
...
*****************************************************************/
-static void government_callback(gpointer data)
-{
- dsend_packet_player_government(&aconnection, GPOINTER_TO_INT(data));
-
- assert(government_dialog_is_open);
- government_dialog_is_open = FALSE;
-}
-
-/****************************************************************
-...
-*****************************************************************/
-void popup_government_dialog(int governments,
- struct government **government)
-{
- int i;
- struct button_descr *buttons;
-
- if (government_dialog_is_open) {
- return;
- }
-
- buttons = fc_malloc(sizeof(struct button_descr) * governments);
-
- for (i = 0; i < governments; i++) {
- buttons[i].text = government[i]->name;
- buttons[i].callback = government_callback;
- buttons[i].data = GINT_TO_POINTER(government[i]->index);
- buttons[i].sensitive =
- can_change_to_government(game.player_ptr, government[i]->index);
- }
-
- government_dialog_is_open = TRUE;
- base_popup_message_dialog(top_vbox, _("Choose Your New Government"),
- _("Select government type:"), NULL, NULL,
- governments, buttons);
-}
-
-/****************************************************************
-...
-*****************************************************************/
static void revolution_callback_yes(gpointer data)
{
start_revolution();
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.70
diff -u -r1.70 dialogs.c
--- client/gui-gtk-2.0/dialogs.c 13 Jul 2004 22:52:16 -0000 1.70
+++ client/gui-gtk-2.0/dialogs.c 27 Aug 2004 21:58:02 -0000
@@ -106,8 +106,6 @@
static int selected_sex;
static int selected_city_style;
-static bool is_showing_government_dialog;
-
static int is_showing_pillage_dialog = FALSE;
static int unit_to_use_to_pillage;
@@ -1011,91 +1009,6 @@
return caravan_dialog != NULL;
}
-
-/****************************************************************
-...
-*****************************************************************/
-static void government_callback(GtkWidget *w, gpointer data)
-{
- dsend_packet_player_government(&aconnection, GPOINTER_TO_INT(data));
- is_showing_government_dialog = FALSE;
-}
-
-
-/****************************************************************
-...
-*****************************************************************/
-void popup_government_dialog(int governments,
- struct government **government)
-{
- int i;
- GtkWidget *dshell, *dlabel, *vbox;
-
- if(!is_showing_government_dialog) {
- is_showing_government_dialog = TRUE;
-
- dshell=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- setup_dialog(dshell, toplevel);
- g_object_set(GTK_WINDOW(dshell),
- "title", _("Choose Your New Government"),
- "window-position", GTK_WIN_POS_CENTER_ON_PARENT,
- NULL);
-
- g_signal_connect(
- dshell,
- "delete_event",
- G_CALLBACK(gtk_true),
- GINT_TO_POINTER(toplevel)
- );
-
- dlabel = gtk_frame_new(_("Select government type:"));
- gtk_container_add(GTK_CONTAINER(dshell), dlabel);
-
- vbox = gtk_vbutton_box_new();
- gtk_container_add(GTK_CONTAINER(dlabel), vbox);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-
- for (i = 0; i < governments; i++) {
- GtkWidget *label, *image, *hbox, *align, *button;
- struct Sprite *gsprite = government[i]->sprite;
-
- /* create button. */
- button = gtk_button_new();
-
- label = gtk_label_new_with_mnemonic(government[i]->name);
- gtk_label_set_mnemonic_widget(GTK_LABEL(label), button);
-
- image = gtk_image_new_from_pixmap(gsprite->pixmap, gsprite->mask);
- hbox = gtk_hbox_new(FALSE, 2);
-
- align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
-
- gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), align, TRUE, FALSE, 5);
-
- gtk_container_add(GTK_CONTAINER(align), label);
- gtk_container_add(GTK_CONTAINER(button), hbox);
-
- /* tidy up. */
- gtk_container_add(GTK_CONTAINER(vbox), button);
- g_signal_connect(button, "clicked", G_CALLBACK(government_callback),
- GINT_TO_POINTER(government[i]->index));
- g_signal_connect_swapped(button, "clicked",
- G_CALLBACK(gtk_widget_destroy), dshell);
-
- gtk_widget_set_sensitive(button,
- can_change_to_government(game.player_ptr,
- government[i]->
- index));
- }
-
- gtk_widget_show_all(dlabel);
- gtk_widget_show(dshell);
- }
-}
-
-
-
/****************************************************************
...
*****************************************************************/
Index: client/gui-stub/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/dialogs.c,v
retrieving revision 1.14
diff -u -r1.14 dialogs.c
--- client/gui-stub/dialogs.c 16 Jun 2004 02:50:27 -0000 1.14
+++ client/gui-stub/dialogs.c 27 Aug 2004 21:58:02 -0000
@@ -86,23 +86,6 @@
}
/**************************************************************************
- Popup a dialog asking the player what government to switch to (this
- happens after a revolution completes).
-**************************************************************************/
-void popup_government_dialog(int governments,
- struct government **government)
-{
- /* PORTME */
- int i;
-
- for (i = 0; i < governments; i++) {
- /* PORTME: add option for converting to government[i]. */
- }
-
- /* ... */
-}
-
-/**************************************************************************
Popup a dialog giving a player choices when their caravan arrives at
a city (other than its home city). Example:
- Establish traderoute.
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.99
diff -u -r1.99 dialogs.c
--- client/gui-xaw/dialogs.c 13 Jul 2004 22:52:17 -0000 1.99
+++ client/gui-xaw/dialogs.c 27 Aug 2004 21:58:03 -0000
@@ -158,8 +158,6 @@
/******************************************************************/
-int is_showing_government_dialog;
-
int is_showing_pillage_dialog = FALSE;
int unit_to_use_to_pillage;
@@ -1216,58 +1214,6 @@
return BOOL_VAL(caravan_dialog);
}
-
-/****************************************************************
-...
-*****************************************************************/
-static void government_callback(Widget w, XtPointer client_data,
- XtPointer call_data)
-{
- dsend_packet_player_government(&aconnection, (size_t) client_data);
- destroy_message_dialog(w);
- is_showing_government_dialog = 0;
-}
-
-/****************************************************************
-...
-*****************************************************************/
-void popup_government_dialog(int governments,
- struct government **government)
-{
- Widget shell, form, dlabel, prev;
- int i;
-
- if(is_showing_government_dialog) {
- return;
- }
- is_showing_government_dialog=1;
-
- XtSetSensitive(toplevel, FALSE);
-
- shell = I_T(XtCreatePopupShell("governmentdialog", transientShellWidgetClass,
- toplevel, NULL, 0));
- form = XtVaCreateManagedWidget("form", formWidgetClass, shell, NULL);
- dlabel = I_L(XtVaCreateManagedWidget("dlabel", labelWidgetClass, form,
NULL));
-
- prev = dlabel;
- for (i = 0; i < governments; i++) {
- Widget button =
- XtVaCreateManagedWidget("button", commandWidgetClass, form,
- XtNfromVert, prev,
- XtNlabel, (XtArgVal) government[i]->name,
- NULL);
- XtAddCallback(button, XtNcallback, government_callback,
- INT_TO_XTPOINTER(government[i]->index));
- XtSetSensitive(button,
- can_change_to_government(game.player_ptr,
- government[i]->index));
- prev = button;
- }
-
- xaw_set_relative_position(toplevel, shell, 10, 0);
- XtPopup(shell, XtGrabNone);
-}
-
/****************************************************************
...
*****************************************************************/
Index: client/include/dialogs_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/dialogs_g.h,v
retrieving revision 1.18
diff -u -r1.18 dialogs_g.h
--- client/include/dialogs_g.h 6 Jun 2004 21:02:16 -0000 1.18
+++ client/include/dialogs_g.h 27 Aug 2004 21:58:03 -0000
@@ -36,8 +36,6 @@
void races_toggles_set_sensitive(bool *nations_used);
void popup_revolution_dialog(void);
-void popup_government_dialog(int governments,
- struct government **government);
void popup_caravan_dialog(struct unit *punit,
struct city *phomecity, struct city *pdestcity);
bool caravan_dialog_is_open(void);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9841) remove government dialog,
Jason Short <=
|
|