Author: sveinung Date: Thu Nov 12 15:58:12 2015 New Revision: 30573 URL: http://svn.gna.org/viewcvs/freeciv?rev=30573&view=rev Log: GTK clients: choice dialog meta buttons
Make it possible to add a button to a choice dialog that isn't an alternative choice. Since it isn't an alternative it shouldn't close the dialog. See patch #6576 Modified: branches/S2_6/client/gui-gtk-2.0/action_dialog.c branches/S2_6/client/gui-gtk-2.0/choice_dialog.c branches/S2_6/client/gui-gtk-2.0/choice_dialog.h branches/S2_6/client/gui-gtk-2.0/dialogs.c branches/S2_6/client/gui-gtk-3.0/action_dialog.c branches/S2_6/client/gui-gtk-3.0/choice_dialog.c branches/S2_6/client/gui-gtk-3.0/choice_dialog.h branches/S2_6/client/gui-gtk-3.0/citydlg.c branches/S2_6/client/gui-gtk-3.0/dialogs.c Modified: branches/S2_6/client/gui-gtk-2.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/action_dialog.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-2.0/action_dialog.c (original) +++ branches/S2_6/client/gui-gtk-2.0/action_dialog.c Thu Nov 12 15:58:12 2015 @@ -996,7 +996,8 @@ action_probabilities[action_id]); action_button_map[action_id] = choice_dialog_get_number_of_buttons(shl); - choice_dialog_add(shl, label, af_map[action_id], handler_args, tooltip); + choice_dialog_add(shl, label, af_map[action_id], handler_args, + FALSE, tooltip); } /****************************************************************** @@ -1148,13 +1149,14 @@ choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("_Keep moving"), (GCallback)diplomat_keep_moving_callback, - data, NULL); + data, FALSE, NULL); } action_button_map[BUTTON_CANCEL] = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, GTK_STOCK_CANCEL, - (GCallback)act_sel_cancel_callback, data, NULL); + (GCallback)act_sel_cancel_callback, data, + FALSE, NULL); choice_dialog_end(shl); Modified: branches/S2_6/client/gui-gtk-2.0/choice_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/choice_dialog.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-2.0/choice_dialog.c (original) +++ branches/S2_6/client/gui-gtk-2.0/choice_dialog.c Thu Nov 12 15:58:12 2015 @@ -152,7 +152,7 @@ *****************************************************************/ void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, - const gchar *tool_tip) + bool meta, const gchar *tool_tip) { GtkWidget *button, *bbox; char name[512]; @@ -172,8 +172,11 @@ g_signal_connect(button, "clicked", handler, data); } - g_signal_connect_after(button, "clicked", - G_CALLBACK(choice_dialog_clicked), dshell); + if (!meta) { + /* This button makes the choice. */ + g_signal_connect_after(button, "clicked", + G_CALLBACK(choice_dialog_clicked), dshell); + } if (tool_tip != NULL) { gtk_widget_set_tooltip_text(button, tool_tip); @@ -222,7 +225,7 @@ handler = va_arg(args, GCallback); data = va_arg(args, gpointer); - choice_dialog_add(dshell, name, handler, data, NULL); + choice_dialog_add(dshell, name, handler, data, FALSE, NULL); } va_end(args); Modified: branches/S2_6/client/gui-gtk-2.0/choice_dialog.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/choice_dialog.h?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-2.0/choice_dialog.h (original) +++ branches/S2_6/client/gui-gtk-2.0/choice_dialog.h Thu Nov 12 15:58:12 2015 @@ -24,7 +24,7 @@ const gchar *text); void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, - const gchar *tool_tip); + bool meta, const gchar *tool_tip); void choice_dialog_end(GtkWidget *dshell); int choice_dialog_get_number_of_buttons(GtkWidget *cd); void choice_dialog_button_set_sensitive(GtkWidget *shl, int button, Modified: branches/S2_6/client/gui-gtk-2.0/dialogs.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/dialogs.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-2.0/dialogs.c (original) +++ branches/S2_6/client/gui-gtk-2.0/dialogs.c Thu Nov 12 15:58:12 2015 @@ -363,11 +363,12 @@ BV_SET(what_extras, what); choice_dialog_add(shl, get_infrastructure_text(what_extras), - G_CALLBACK(pillage_callback), GINT_TO_POINTER(what), - NULL); - } - - choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, NULL); + G_CALLBACK(pillage_callback), + GINT_TO_POINTER(what), + FALSE, NULL); + } + + choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, FALSE, NULL); choice_dialog_end(shl); Modified: branches/S2_6/client/gui-gtk-3.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/action_dialog.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/action_dialog.c (original) +++ branches/S2_6/client/gui-gtk-3.0/action_dialog.c Thu Nov 12 15:58:12 2015 @@ -1006,7 +1006,8 @@ action_probabilities[action_id]); action_button_map[action_id] = choice_dialog_get_number_of_buttons(shl); - choice_dialog_add(shl, label, af_map[action_id], handler_args, tooltip); + choice_dialog_add(shl, label, af_map[action_id], handler_args, + FALSE, tooltip); } /****************************************************************** @@ -1158,13 +1159,14 @@ choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("_Keep moving"), (GCallback)diplomat_keep_moving_callback, - data, NULL); + data, FALSE, NULL); } action_button_map[BUTTON_CANCEL] = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, GTK_STOCK_CANCEL, - (GCallback)act_sel_cancel_callback, data, NULL); + (GCallback)act_sel_cancel_callback, data, + FALSE, NULL); choice_dialog_end(shl); Modified: branches/S2_6/client/gui-gtk-3.0/choice_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/choice_dialog.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/choice_dialog.c (original) +++ branches/S2_6/client/gui-gtk-3.0/choice_dialog.c Thu Nov 12 15:58:12 2015 @@ -155,7 +155,7 @@ *****************************************************************/ void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, - const gchar *tool_tip) + bool meta, const gchar *tool_tip) { GtkWidget *button, *bbox; char name[512]; @@ -175,8 +175,11 @@ g_signal_connect(button, "clicked", handler, data); } - g_signal_connect_after(button, "clicked", - G_CALLBACK(choice_dialog_clicked), dshell); + if (!meta) { + /* This button makes the choice. */ + g_signal_connect_after(button, "clicked", + G_CALLBACK(choice_dialog_clicked), dshell); + } if (tool_tip != NULL) { gtk_widget_set_tooltip_text(button, tool_tip); @@ -225,7 +228,7 @@ handler = va_arg(args, GCallback); data = va_arg(args, gpointer); - choice_dialog_add(dshell, name, handler, data, NULL); + choice_dialog_add(dshell, name, handler, data, FALSE, NULL); } va_end(args); Modified: branches/S2_6/client/gui-gtk-3.0/choice_dialog.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/choice_dialog.h?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/choice_dialog.h (original) +++ branches/S2_6/client/gui-gtk-3.0/choice_dialog.h Thu Nov 12 15:58:12 2015 @@ -24,7 +24,7 @@ const gchar *text); void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, - const gchar *tool_tip); + bool meta, const gchar *tool_tip); void choice_dialog_end(GtkWidget *dshell); int choice_dialog_get_number_of_buttons(GtkWidget *cd); void choice_dialog_button_set_sensitive(GtkWidget *shl, int button, Modified: branches/S2_6/client/gui-gtk-3.0/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/citydlg.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/citydlg.c (original) +++ branches/S2_6/client/gui-gtk-3.0/citydlg.c Thu Nov 12 15:58:12 2015 @@ -2836,7 +2836,7 @@ if (ptask != NULL) { choice_dialog_add(shl, _("Clear request"), G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_IDLE), NULL); + GINT_TO_POINTER(ACTIVITY_IDLE), FALSE, NULL); } if ((pterr->mining_result == pterr @@ -2845,7 +2845,7 @@ && effect_cumulative_max(EFT_MINING_TF_POSSIBLE, &for_terr) > 0)) { choice_dialog_add(shl, _("Mine"), G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_MINE), NULL); + GINT_TO_POINTER(ACTIVITY_MINE), FALSE, NULL); } if ((pterr->irrigation_result == pterr && effect_cumulative_max(EFT_IRRIG_POSSIBLE, &for_terr) > 0) @@ -2853,21 +2853,21 @@ && effect_cumulative_max(EFT_IRRIG_TF_POSSIBLE, &for_terr) > 0)) { choice_dialog_add(shl, _("Irrigate"), G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_IRRIGATE), NULL); + GINT_TO_POINTER(ACTIVITY_IRRIGATE), FALSE, NULL); } if (next_extra_for_tile(ptile, EC_ROAD, city_owner(pcity), NULL) != NULL) { choice_dialog_add(shl, _("Road"), G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_GEN_ROAD), NULL); + GINT_TO_POINTER(ACTIVITY_GEN_ROAD), FALSE, NULL); } if (pterr->transform_result != pterr && pterr->transform_result != NULL && effect_cumulative_max(EFT_TRANSFORM_POSSIBLE, &for_terr) > 0) { choice_dialog_add(shl, _("Transform"), G_CALLBACK(set_city_workertask), - GINT_TO_POINTER(ACTIVITY_TRANSFORM), NULL); - } - - choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, NULL); + GINT_TO_POINTER(ACTIVITY_TRANSFORM), FALSE, NULL); + } + + choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, FALSE, NULL); choice_dialog_end(shl); g_signal_connect(shl, "destroy", G_CALLBACK(workertask_dlg_destroy), Modified: branches/S2_6/client/gui-gtk-3.0/dialogs.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/dialogs.c?rev=30573&r1=30572&r2=30573&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/dialogs.c (original) +++ branches/S2_6/client/gui-gtk-3.0/dialogs.c Thu Nov 12 15:58:12 2015 @@ -364,11 +364,12 @@ BV_SET(what_extras, what); choice_dialog_add(shl, get_infrastructure_text(what_extras), - G_CALLBACK(pillage_callback), GINT_TO_POINTER(what), - NULL); - } - - choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, NULL); + G_CALLBACK(pillage_callback), + GINT_TO_POINTER(what), + FALSE, NULL); + } + + choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, FALSE, NULL); choice_dialog_end(shl); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits