Project

General

Profile

Feature #1352 ยป 0038-gui-gtk-3.22-Remove-trailing-spaces.patch

Marko Lindqvist, 05/02/2025 06:35 PM

View differences:

client/gui-gtk-3.22/action_dialog.c
if (gtk_tree_selection_get_selected(select, &model, &it)) {
gtk_tree_model_get(model, &it, 1, &(args->target_tech_id), -1);
gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_tech_shell),
GTK_RESPONSE_ACCEPT, TRUE);
} else {
args->target_tech_id = 0;
gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_tech_shell),
GTK_RESPONSE_ACCEPT, FALSE);
}
......
static void create_advances_list(struct player *pplayer,
struct player *pvictim,
struct action_data *args)
{
{
GtkWidget *sw, *label, *vbox, *view;
GtkListStore *store;
GtkCellRenderer *rend;
......
GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing(GTK_GRID(vbox), 6);
gtk_container_add(GTK_CONTAINER(label), vbox);
store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
......
"yalign", 0.5,
NULL);
gtk_container_add(GTK_CONTAINER(vbox), label);
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
GTK_SHADOW_ETCHED_IN);
......
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_widget_set_size_request(sw, -1, 200);
gtk_container_add(GTK_CONTAINER(vbox), sw);
/* Now populate the list */
......
gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_tech_shell),
GTK_RESPONSE_ACCEPT, FALSE);
gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(spy_tech_shell)));
g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), "changed",
G_CALLBACK(spy_advances_callback), args);
g_signal_connect(spy_tech_shell, "response",
G_CALLBACK(spy_advances_response), args);
args->target_tech_id = 0;
gtk_tree_view_focus(GTK_TREE_VIEW(view));
......
if (gtk_tree_selection_get_selected(select, &model, &it)) {
gtk_tree_model_get(model, &it, 1, &(args->target_building_id), -1);
gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_sabotage_shell),
GTK_RESPONSE_ACCEPT, TRUE);
} else {
args->target_building_id = -2;
gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_sabotage_shell),
GTK_RESPONSE_ACCEPT, FALSE);
}
......
static void create_improvements_list(struct player *pplayer,
struct city *pcity,
struct action_data *args)
{
{
GtkWidget *sw, *label, *vbox, *view;
GtkListStore *store;
GtkCellRenderer *rend;
......
GtkTreeIter it;
struct unit *actor_unit = game_unit_by_number(args->actor_unit_id);
spy_sabotage_shell = gtk_dialog_new_with_buttons(_("Sabotage Improvements"),
NULL, 0,
_("_Cancel"), GTK_RESPONSE_CANCEL,
......
GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing(GTK_GRID(vbox), 6);
gtk_container_add(GTK_CONTAINER(label), vbox);
store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
......
"yalign", 0.5,
NULL);
gtk_container_add(GTK_CONTAINER(vbox), label);
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
GTK_SHADOW_ETCHED_IN);
......
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 200);
gtk_container_add(GTK_CONTAINER(vbox), sw);
/* Now populate the list */
......
0, city_improvement_name_translation(pcity, pimprove),
1, improvement_number(pimprove),
-1);
}
}
} city_built_iterate_end;
if (action_prob_possible(actor_unit->client.act_prob_cache[
......
gtk_dialog_set_response_sensitive(GTK_DIALOG(spy_sabotage_shell),
GTK_RESPONSE_ACCEPT, FALSE);
gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(spy_sabotage_shell)));
g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), "changed",
......
G_CALLBACK(spy_improvements_response), args);
args->target_building_id = -2;
gtk_tree_view_focus(GTK_TREE_VIEW(view));
}
......
setup_dialog(shell, toplevel);
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(incite_response),
act_data(paction->id, actor->id,
pcity->id, 0, 0,
client/gui-gtk-3.22/chatline.c
const char *theinput;
theinput = gtk_entry_get_text(w);
if (*theinput) {
if (client_state() == C_S_RUNNING
&& GUI_GTK_OPTION(allied_chat_only)
......
return FALSE;
}
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW (text_view),
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y);
......
{
gint x, y;
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(text_view),
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(text_view),
GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y);
set_cursor_if_appropriate(GTK_TEXT_VIEW(text_view), x, y);
......
break; /* Not a valid link type case. */
}
tag = gtk_text_buffer_create_tag(buf, NULL,
tag = gtk_text_buffer_create_tag(buf, NULL,
"foreground-rgba", &pcolor->color,
"underline", PANGO_UNDERLINE_SINGLE,
NULL);
client/gui-gtk-3.22/choice_dialog.c
bbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL);
gtk_box_set_spacing(GTK_BOX(bbox), 2);
gtk_container_add(GTK_CONTAINER(vbox), bbox);
g_object_set_data(G_OBJECT(dshell), "bbox", bbox);
g_object_set_data(G_OBJECT(dshell), "nbuttons", GINT_TO_POINTER(0));
g_object_set_data(G_OBJECT(dshell), "hide", GINT_TO_POINTER(FALSE));
gtk_widget_show(vbox);
gtk_widget_show(dlabel);
return dshell;
}
......
void choice_dialog_end(GtkWidget *dshell)
{
GtkWidget *bbox;
bbox = g_object_get_data(G_OBJECT(dshell), "bbox");
gtk_widget_show_all(bbox);
gtk_widget_show(dshell);
gtk_widget_show(dshell);
}
/*******************************************************************//**
......
gchar *name;
dshell = choice_dialog_start(parent, dialogname, text);
va_start(args, text);
while ((name = va_arg(args, gchar *))) {
client/gui-gtk-3.22/citydlg.c
#include "tilespec.h"
/* client/agents */
#include "cma_fec.h"
#include "cma_fec.h"
/* client/gui-gtk-3.22 */
#include "choice_dialog.h"
......
}
/**********************************************************************//**
**** Production Page ****
**** Production Page ****
**************************************************************************/
static void create_and_append_worklist_page(struct city_dialog *pdialog)
{
......
}
/**********************************************************************//**
**** Misc. Settings Page ****
**** Misc. Settings Page ****
**************************************************************************/
static void create_and_append_settings_page(struct city_dialog *pdialog)
{
......
page = gtk_grid_new();
gtk_grid_set_column_spacing(GTK_GRID(page), 18);
gtk_container_set_border_width(GTK_CONTAINER(page), 8);
size = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
label = gtk_label_new_with_mnemonic(tab_title);
gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->notebook), page, label);
......
intl_slist(ARRAY_SIZE(misc_whichtab_label), misc_whichtab_label,
&misc_whichtab_label_done);
group = NULL;
for (i = 0; i < ARRAY_SIZE(misc_whichtab_label); i++) {
button = gtk_radio_button_new_with_mnemonic(group, misc_whichtab_label[i]);
......
gtk_list_store_clear(pdialog->overview.change_production_store);
targets_used
= collect_eventually_buildable_targets(targets, pdialog->pcity, FALSE);
= collect_eventually_buildable_targets(targets, pdialog->pcity, FALSE);
name_and_sort_items(targets, targets_used, items, FALSE, pcity);
for (item = 0; item < targets_used; item++) {
......
model =
gtk_tree_view_get_model(GTK_TREE_VIEW(pdialog->overview.improvement_list));
store = GTK_LIST_STORE(model);
targets_used = collect_already_built_targets(targets, pdialog->pcity);
name_and_sort_items(targets, targets_used, items, FALSE, pdialog->pcity);
gtk_list_store_clear(store);
gtk_list_store_clear(store);
for (item = 0; item < targets_used; item++) {
GdkPixbuf *pix;
......
i = 0;
unit_list_iterate(units, punit) {
struct unit_node *pnode;
pnode = unit_node_vector_get(nodes, i);
if (pnode) {
GtkWidget *cmd, *pix;
......
G_CALLBACK(unit_center_callback),
GINT_TO_POINTER(punit->id));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
item = gtk_menu_item_new_with_mnemonic(_("_Activate unit"));
g_signal_connect(item, "activate",
G_CALLBACK(unit_activate_callback),
......
struct city_dialog *pdialog = (struct city_dialog *) data;
pdialog->sell_id = improvement_number(pimprove);
int price;
if (!can_client_issue_orders()) {
return;
}
......
city_improvement_name_translation(pdialog->pcity, pimprove), price);
setup_dialog(shl, pdialog->shell);
pdialog->sell_shell = shl;
gtk_window_set_title(GTK_WINDOW(shl), _("Sell It!"));
gtk_window_set_position(GTK_WINDOW(shl), GTK_WIN_POS_CENTER_ON_PARENT);
g_signal_connect(shl, "response",
G_CALLBACK(sell_callback_response), pdialog);
gtk_window_present(GTK_WINDOW(shl));
}
......
city_sell_improvement(pdialog->pcity, pdialog->sell_id);
}
gtk_widget_destroy(w);
pdialog->sell_shell = NULL;
}
client/gui-gtk-3.22/cityrep.c
{
if (!city_dialog_shell) {
city_dialog_shell_is_modal = FALSE;
create_city_report_dialog(FALSE);
select_menu_cached = FALSE;
......
static void append_impr_or_unit_to_menu_item(GtkMenuItem *parent_item,
bool append_units,
bool append_wonders,
enum city_operation_type
city_operation,
enum city_operation_type
city_operation,
TestCityFunc test_func,
GCallback callback,
int size)
......
g_signal_connect(menu_item, "activate", callback,
GINT_TO_POINTER(cid_encode(target)));
}
for (i = 0; i < 3; i++) {
g_object_unref(group[i]);
}
gtk_widget_show_all(menu);
gtk_widget_set_sensitive(GTK_WIDGET(parent_item), (targets_used > 0));
......
static void sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer data)
{
struct sell_data *sd = (struct sell_data *) data;
struct sell_data *sd = (struct sell_data *) data;
struct city *pcity = city_model_get(model, iter);
if (NULL != pcity
......
struct universal target = cid_decode(GPOINTER_TO_INT(data));
GObject *parent = G_OBJECT(gtk_widget_get_parent(wdg));
TestCityFunc test_func = g_object_get_data(parent, "freeciv_test_func");
enum city_operation_type city_operation =
GPOINTER_TO_INT(g_object_get_data(parent, "freeciv_city_operation"));
enum city_operation_type city_operation
= GPOINTER_TO_INT(g_object_get_data(parent, "freeciv_city_operation"));
/* if this is not a city operation: */
/* If this is not a city operation: */
if (city_operation == CO_NONE) {
GtkTreeModel *model = GTK_TREE_MODEL(city_model);
ITree it;
......
menubar = gtk_aux_menu_bar_new();
gtk_container_add(GTK_CONTAINER(vbox), menubar);
item = gtk_menu_item_new_with_mnemonic(_("_Production"));
city_production_command = item;
gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
......
item = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
select_units_item =
gtk_menu_item_new_with_label(_("Available Units"));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), select_units_item);
client/gui-gtk-3.22/cma_fe.c
city_report_dialog_update();
}
gtk_widget_destroy(w);
pdialog->preset_remove_shell = NULL;
}
client/gui-gtk-3.22/connectdlg.c
/**********************************************************************//**
Close and destroy the dialog.
**************************************************************************/
void close_connection_dialog(void)
void close_connection_dialog(void)
{
}
client/gui-gtk-3.22/dialogs.c
gtk_grid_set_row_spacing(GTK_GRID(vbox), 2);
gtk_container_add(GTK_CONTAINER(shell->vbox), vbox);
headline_label = gtk_label_new(headline);
headline_label = gtk_label_new(headline);
gtk_container_add(GTK_CONTAINER(vbox), headline_label);
gtk_widget_set_name(headline_label, "notify_label");
......
void popup_connect_msg(const char *headline, const char *message)
{
GtkWidget *shell, *label;
shell = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(shell), headline);
setup_dialog(shell, toplevel);
......
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_container_add(GTK_CONTAINER(sw), list);
render = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes("Flag", render,
"pixbuf", 2, NULL);
......
{
GtkWidget *nation_list;
GtkWidget *group_name_label;
int i;
for (i = 0; i < nation_group_count(); i++) {
struct nation_group* group = (nation_group_by_number(i));
if (is_nation_group_hidden(group)) {
......
group_name_label);
}
}
nation_list = create_list_of_nations_in_group(NULL, nation_group_count());
/* Even this list can be empty if there are no pickable nations (due to
* a combination of start position and nationset restrictions). */
......
GtkWidget *text;
GtkWidget *notebook;
GtkWidget *sw;
GtkWidget *list;
GtkWidget *list;
GtkListStore *store;
GtkCellRenderer *render;
GtkTreeViewColumn *column;
......
}
races_notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(races_notebook), GTK_POS_LEFT);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(races_notebook), GTK_POS_LEFT);
gtk_grid_attach(GTK_GRID(nation_selection_list), races_notebook,
0, 2, 2, 1);
......
gtk_grid_set_row_spacing(GTK_GRID(table), 2);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
/* Leader. */
/* Leader. */
{
GtkListStore *model = gtk_list_store_new(1, G_TYPE_STRING);
client/gui-gtk-3.22/diplodlg.c
}
/************************************************************************//**
Popup the dialog 10% inside the main-window
Popup the dialog 10% inside the main-window
****************************************************************************/
static void popup_diplomacy_dialog(struct treaty *ptreaty, struct player *they,
struct player *initiator)
......
index = gtk_tree_path_get_indices(path);
i = 0;
i = 0;
clause_list_iterate(pdialog->treaty->clauses, pclause) {
if (i == index[0]) {
dsend_packet_diplomacy_remove_clause_req(&client.conn,
......
struct player *pgiver =
(struct player *) g_object_get_data(G_OBJECT(w), "plr");
int amount = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w));
if (amount >= 0 && amount <= pgiver->economic.gold) {
dsend_packet_diplomacy_create_clause_req(&client.conn,
player_number(pdialog->treaty->plr1),
client/gui-gtk-3.22/editgui.c
GtkCellRenderer *cell;
GdkPixbuf *pixbuf;
const struct editor_sprites *sprites;
eb = fc_calloc(1, sizeof(struct editbar));
hbox = gtk_grid_new();
......
struct editinfobox *ei;
int which, value;
enum editor_tool_type ett;
ei = editgui_get_editinfobox();
if (!ei) {
......
ei->size_spin_button = spin;
label = gtk_label_new(_("Size"));
gtk_container_add(GTK_CONTAINER(hbox), label);
hbox = gtk_grid_new();
gtk_grid_set_column_spacing(GTK_GRID(hbox), 8);
gtk_container_add(GTK_CONTAINER(vbox), hbox);
client/gui-gtk-3.22/editprop.c
return nation_hashes_are_equal(pva->data.v_nation_hash,
pvb->data.v_nation_hash);
case VALTYPE_GOV:
return pva->data.v_gov == pvb->data.v_gov;
return pva->data.v_gov == pvb->data.v_gov;
case VALTYPE_TILE_VISION_DATA:
if (!BV_ARE_EQUAL(pva->data.v_tile_vision->tile_known,
pvb->data.v_tile_vision->tile_known)) {
......
/************************************************************************//**
Replace the stored property value with a new one. The old value will
be freed if needed.
NB: Does NOT make a copy of 'pv'.
****************************************************************************/
static void propstate_set_value(struct propstate *ps,
......
pp = objprop_get_property_page(op);
value.data.v_const_string = gtk_entry_get_text(entry);
property_page_change_value(pp, op, &value);
property_page_change_value(pp, op, &value);
}
/************************************************************************//**
......
pp = objprop_get_property_page(op);
value.data.v_int = gtk_spin_button_get_value_as_int(spin);
property_page_change_value(pp, op, &value);
property_page_change_value(pp, op, &value);
}
/************************************************************************//**
......
according to the value of the bound object. If a stored modified value
exists, then check it against the object's current value and remove it
if they are equal.
If 'ob' is NULL, then clear the widget.
****************************************************************************/
static void objprop_refresh_widget(struct objprop *op,
......
if (pv && modified) {
struct propval *pv_mod;
pv_mod = objbind_get_modified_value(ob, op);
if (pv_mod) {
if (propval_equal(pv, pv_mod)) {
......
gtk_container_add(GTK_CONTAINER(hbox), button);
ev->panel_button = button;
/* Create the data store. */
switch (propid) {
......
struct extviewer *ev;
struct property_page *pp;
struct objprop *op;
ev = userdata;
if (!ev) {
return;
......
num_columns++;
gtype_array = fc_malloc(num_columns * sizeof(GType));
gtype_array[0] = G_TYPE_POINTER;
property_page_objprop_iterate(pp, op) {
if (objprop_show_in_listview(op)) {
gtype_array[col_id] = objprop_get_gtype(op);
......
gtk_grid_set_row_spacing(GTK_GRID(vbox2), 4);
gtk_container_set_border_width(GTK_CONTAINER(vbox2), 4);
gtk_container_add(GTK_CONTAINER(scrollwin), vbox2);
property_page_objprop_iterate(pp, op) {
if (!objprop_has_widget(op)) {
continue;
......
gtk_container_add(GTK_CONTAINER(hbox2), label);
entry = gtk_entry_new();
gtk_widget_set_tooltip_text(entry,
gtk_widget_set_tooltip_text(entry,
_("Enter a filter string to limit which properties are shown. "
"The filter is one or more text patterns separated by | "
"(\"or\") or & (\"and\"). The symbol & has higher precedence "
......
GtkTreeRowReference *rr;
GtkTreeModel *model;
GtkTreePath *path;
model = GTK_TREE_MODEL(pp->object_store);
property_page_objbind_iterate(pp, ob) {
client/gui-gtk-3.22/gotodlg.c
astr_init(&strs[i]);
if (air_text != NULL) {
astr_add(&strs[i],
astr_add(&strs[i],
/* TRANS: goto/airlift dialog. "Paris (airlift: 2/4)".
* A set of these appear in an "and"-separated list. */
_("%s (airlift: %s)"),
......
/* Finally, update the label. */
{
struct astring label = ASTRING_INIT, list = ASTRING_INIT;
astr_set(&label,
astr_set(&label,
/* TRANS: goto/airlift dialog. Current location of units; %s is an
* "and"-separated list of cities and associated info */
_("Currently in: %s"),
......
static void update_goto_dialog(GtkToggleButton *button)
{
bool nonempty = FALSE;
if (!client_has_player()) {
/* Case global observer. */
return;
client/gui-gtk-3.22/gui_main.c
static GtkWidget *more_arrow_pixmap_container;
static int unit_id_top;
static int unit_ids[MAX_NUM_UNITS_BELOW]; /* ids of the units icons in
static int unit_ids[MAX_NUM_UNITS_BELOW]; /* ids of the units icons in
* information display: (or 0) */
GtkTextView *main_message_area;
GtkTextBuffer *message_buffer = NULL;
......
/**********************************************************************//**
Print extra usage information, including one line help on each option,
to stderr.
to stderr.
**************************************************************************/
static void print_usage(void)
{
......
switch (arg) {
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_TAB_BACKWARD:
if (!gtk_widget_get_can_focus(w)) {
return FALSE;
}
......
return TRUE;
case GDK_KEY_KP_Begin:
case GDK_KEY_KP_5:
case GDK_KEY_KP_5:
case GDK_KEY_5:
key_recall_previous_focus_unit();
key_recall_previous_focus_unit();
return TRUE;
case GDK_KEY_Escape:
......
gtk_container_add(GTK_CONTAINER(unit_image_button), unit_image);
gtk_grid_attach(GTK_GRID(table), unit_image_button, 0, 0, 1, 1);
g_signal_connect(unit_image_button, "button_press_event",
G_CALLBACK(select_unit_image_callback),
G_CALLBACK(select_unit_image_callback),
GINT_TO_POINTER(-1));
if (!GUI_GTK_OPTION(small_display_layout)) {
......
|GDK_POINTER_MOTION_MASK);
gtk_container_add(GTK_CONTAINER(avbox), overview_scrolled_window);
gtk_container_add(GTK_CONTAINER(overview_scrolled_window),
gtk_container_add(GTK_CONTAINER(overview_scrolled_window),
overview_canvas);
g_signal_connect(overview_canvas, "draw",
G_CALLBACK(overview_canvas_draw), NULL);
......
break;
case 2:
w = flake_label;
flake_ebox = ebox;
flake_ebox = ebox;
break;
default:
case 3:
......
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
g_signal_connect(dialog, "response",
g_signal_connect(dialog, "response",
G_CALLBACK(quit_dialog_response), NULL);
g_signal_connect(dialog, "destroy",
G_CALLBACK(gtk_widget_destroyed), &dialog);
......
if (scr_height > 0) {
/* Adjust these options only if we do know the screen height. */
if (scr_height <= 480) {
/* Freeciv is practically unusable outside fullscreen mode in so
* small display */
client/gui-gtk-3.22/gui_stuff.c
}
/**********************************************************************//**
Return whether current itree item is selected
Return whether current itree item is selected
**************************************************************************/
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
{
......
}
dialog_list = g_list_remove(dialog_list, dlg);
/* Raise the return dialog set by gui_dialog_set_return_dialog() */
if (dlg->return_dialog_id != -1) {
GList *it;
......
}
}
}
if (dlg->title) {
free(dlg->title);
}
free(dlg);
}
......
{
struct gui_dialog *dlg = data;
/* emit response signal. */
/* Emit response signal. */
gui_dialog_response(dlg, GTK_RESPONSE_DELETE_EVENT);
/* do the destroy by default. */
/* Do the destroy by default. */
return FALSE;
}
......
{
GtkWidget* notebook;
int n;
notebook = dlg->v.tab.notebook;
n = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
if (gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), n)
!= dlg->v.tab.child) {
gui_dialog_set_return_dialog(dlg, NULL);
}
/* emit response signal. */
}
/* Emit response signal. */
gui_dialog_response(dlg, GTK_RESPONSE_DELETE_EVENT);
/* do the destroy by default. */
/* Do the destroy by default. */
return FALSE;
}
......
return;
}
dlg->type = GUI_DIALOG_WINDOW;
/* Create a new reference to the main widget, so it won't be
/* Create a new reference to the main widget, so it won't be
* destroyed in gtk_notebook_remove_page() */
g_object_ref(dlg->vbox);
......
gtk_window_set_default_size(GTK_WINDOW(dlg->v.window),
dlg->default_width,
dlg->default_height);
dlg->default_height);
gtk_widget_show_all(window);
}
......
*pdlg = dlg;
dlg->user_data = user_data;
dlg->title = NULL;
dlg->default_width = 200;
dlg->default_height = 300;
......
dlg->action_area = action_area;
dlg->response_callback = gui_dialog_destroyed;
dlg->id = dialog_id_counter;
dialog_id_counter++;
dlg->return_dialog_id = -1;
client/gui-gtk-3.22/helpdlg.c
if (!path) {
return;
}
gtk_tree_model_get(model, &it, 1, &pitem, -1);
if (help_history_pos >= 0
......
break;
case HELP_TEXT:
default:
/* it was a pure text item */
/* It was a pure text item */
gtk_text_buffer_set_text(help_text, pitem->text, -1);
gtk_widget_show(help_text_sw);
break;
client/gui-gtk-3.22/inputdlg.c
#include <stdio.h>
#include <gtk/gtk.h>
#include <gtk/gtk.h>
/* utility */
#include "fcintl.h"
......
/**********************************************************************//**
Create a popup with a text entry box and "OK" and "Cancel" buttons.
**************************************************************************/
GtkWidget *input_dialog_create(GtkWindow *parent, const char *dialogname,
GtkWidget *input_dialog_create(GtkWindow *parent, const char *dialogname,
const char *text, const char *postinputtest,
input_dialog_callback_t response_callback,
gpointer response_cli_data)
client/gui-gtk-3.22/inputdlg.h
typedef void (*input_dialog_callback_t)(gpointer response_cli_data,
gint response, const char *input);
GtkWidget *input_dialog_create(GtkWindow *parent, const char *dialogname,
GtkWidget *input_dialog_create(GtkWindow *parent, const char *dialogname,
const char *text, const char *postinputtest,
input_dialog_callback_t response_callback,
gpointer response_cli_data);
client/gui-gtk-3.22/inteldlg.c
notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(shell))), notebook);
/* overview tab. */
/* Overview tab. */
table = gtk_grid_new();
g_object_set(table, "margin", 6, NULL);
client/gui-gtk-3.22/mapctrl.c
Put the popup on a smart position, after the real size of the widget is
known: left of the cursor if within the right half of the map, and vice
versa; displace the popup so as not to obscure it by the mouse cursor;
stay always within the map if possible.
stay always within the map if possible.
**************************************************************************/
static void popupinfo_positioning_callback(GtkWidget *w, GtkAllocation *alloc,
static void popupinfo_positioning_callback(GtkWidget *w, GtkAllocation *alloc,
gpointer data)
{
struct tmousepos *mousepos = data;
......
&& clipboard_copy_production(ptile)) {
/* <SHIFT> + RMB on city/unit: Copy Production. */
/* If nothing to copy, fall through to rectangle selection. */
/* Already done the copy */
} else if (ev->state & GDK_CONTROL_MASK) {
/* <CONTROL> + RMB : Quickselect a land unit. */
client/gui-gtk-3.22/mapview.c
if (cursor_type == CURSOR_DEFAULT) {
gdk_window_set_cursor(root_window, NULL);
cursor_timer_id = 0;
return FALSE;
return FALSE;
}
gdk_window_set_cursor(root_window,
......
FIXME:
For now only two food, two gold one shield and two masks can be drawn per
unit, the proper way to do this is probably something like what Civ II does.
(One food/shield/mask drawn N times, possibly one top of itself. -- SKi
(One food/shield/mask drawn N times, possibly one top of itself. -- SKi
**************************************************************************/
void put_unit_image_city_overlays(struct unit *punit, GtkImage *p,
int height,
client/gui-gtk-3.22/menu.c
_("Leaving a local game will end it!"));
setup_dialog(dialog, toplevel);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
g_signal_connect(dialog, "response",
g_signal_connect(dialog, "response",
G_CALLBACK(leave_local_game_response), NULL);
gtk_window_present(GTK_WINDOW(dialog));
} else {
......
units_can_load(punits));
menu_entry_set_sensitive("UNIT_DEBOARD",
units_can_unload(&(wld.map), punits));
menu_entry_set_sensitive("UNIT_UNSENTRY",
menu_entry_set_sensitive("UNIT_UNSENTRY",
units_have_activity_on_tile(punits,
ACTIVITY_SENTRY));
menu_entry_set_sensitive("AUTO_WORKER",
......
extras = extra_type_list_by_cause(EC_IRRIGATION);
if (extra_type_list_size(extras) > 0) {
if (extra_type_list_size(extras) > 0) {
struct extra_type *tgt;
tgt = extra_type_list_get(extras, 0);
......
break;
}
} unit_list_iterate_end;
if (city_on_tile && units_can_do_action(punits, ACTION_JOIN_CITY,
TRUE)) {
menus_rename("BUILD_CITY",
client/gui-gtk-3.22/pages.c
static GtkWidget *scenario_filename;
static GtkWidget *scenario_version;
static GtkListStore *load_store, *scenario_store, *meta_store, *lan_store;
static GtkListStore *load_store, *scenario_store, *meta_store, *lan_store;
static GtkListStore *server_playerlist_store;
static GtkWidget *server_playerlist_view;
......
output_window_append(ftc_client, message);
log_error("%s", message);
/* Main thread will finalize the scan later (or even concurrently) -
/* Main thread will finalize the scan later (or even concurrently) -
* do not do anything here to cause double free or raze condition. */
}
......
Network connection state defines.
**************************************************************************/
enum connection_state {
LOGIN_TYPE,
NEW_PASSWORD_TYPE,
LOGIN_TYPE,
NEW_PASSWORD_TYPE,
ENTER_PASSWORD_TYPE,
WAITING_TYPE
};
......
sz_strlcpy(user_name, gtk_entry_get_text(GTK_ENTRY(network_login)));
sz_strlcpy(server_host, gtk_entry_get_text(GTK_ENTRY(network_host)));
server_port = atoi(gtk_entry_get_text(GTK_ENTRY(network_port)));
if (connect_to_server(user_name, server_host, server_port,
errbuf, sizeof(errbuf)) != -1) {
} else {
......
output_window_append(ftc_client, errbuf);
}
return;
return;
case NEW_PASSWORD_TYPE:
if (w != network_password) {
sz_strlcpy(fc_password,
......
send_packet_authentication_reply(&client.conn, &reply);
set_connection_state(WAITING_TYPE);
} else {
} else {
append_network_statusbar(_("Passwords don't match, enter password."),
TRUE);
......
spin = gtk_spin_button_new_with_range(1, MAX_NUM_PLAYERS, 1);
start_aifill_spin = spin;
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spin), 0);
gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin),
gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin),
GTK_UPDATE_IF_VALID);
if (server_optset != NULL) {
struct option *paifill = optset_option_by_name(server_optset, "aifill");
......
pregame_votebar = voteinfo_bar_new(TRUE);
}
gtk_container_add(GTK_CONTAINER(box), pregame_votebar);
toolkit_view = inputline_toolkit_view_new();
gtk_container_add(GTK_CONTAINER(box), toolkit_view);
......
g_signal_connect(view, "row-activated",
G_CALLBACK(load_callback), NULL);
sbox = gtk_grid_new();
gtk_widget_set_halign(sbox, GTK_ALIGN_CENTER);
gtk_orientable_set_orientation(GTK_ORIENTABLE(sbox),
client/gui-gtk-3.22/plrdlg.c
gtk_tree_model_get_value(model, a, PLR_DLG_COL_ID, &value);
player1 = player_by_number(g_value_get_int(&value));
g_value_unset(&value);
gtk_tree_model_get_value(model, b, PLR_DLG_COL_ID, &value);
player2 = player_by_number(g_value_get_int(&value));
g_value_unset(&value);
return player_dlg_columns[n].sort_func(player1, player2);
}
......
**************************************************************************/
static void toggle_dead_players(GtkCheckMenuItem* item, gpointer data)
{
gui_options.player_dlg_show_dead_players =
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item));
gui_options.player_dlg_show_dead_players
= gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item));
real_players_dialog_update(NULL);
}
client/gui-gtk-3.22/repodlgs.c
for (i = 0; i < URD_COL_NUM; i++) {
cols[i] = unit_report_columns[i].type;
}
return gtk_list_store_newv(URD_COL_NUM, cols);
}
......
upgradable = client_has_player()
&& NULL != can_upgrade_unittype(client_player(), utype);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
URD_COL_UTYPE_NAME, utype_name_translation(utype),
client/gui-gtk-3.22/sprite.c
cr = cairo_create(new->surface);
cairo_rectangle(cr, 0, 0, width, height);
cairo_clip(cr);
cairo_set_source_surface(cr, source->surface, -x, -y);
cairo_paint(cr);
if (mask) {
......
get_sprite_dimensions(src, &width, &height);
new->surface = cairo_surface_create_similar(src->surface,
new->surface = cairo_surface_create_similar(src->surface,
CAIRO_CONTENT_COLOR_ALPHA, new_w, new_h);
cr = cairo_create(new->surface);
client/gui-gtk-3.22/theme_dlg.c
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return load_theme;
}
client/gui-gtk-3.22/themes.c
/* File doesn't exist */
continue;
}
if (!S_ISREG(stat_result.st_mode)) {
/* Not a regular file */
continue;
}
/* Otherwise it's ok */
/* Increase array size if needed */
if (*count == t_size) {
theme_names = fc_realloc(theme_names, t_size * 2 * sizeof(char *));
client/gui-gtk-3.22/unitselect.c
const char *title,
enum unit_select_location_mode loc);
static GtkTreeStore *usdlg_tab_store_new(void);
static bool usdlg_tab_update(struct unit_select_dialog *pdialog,
static bool usdlg_tab_update(struct unit_select_dialog *pdialog,
struct usdata_hash *ushash,
enum unit_select_location_mode loc);
static void usdlg_tab_append_utype(GtkTreeStore *store,
......
ushash = usdlg_data_new(pdialog->ptile);
usdata_hash_lookup(ushash, utid, &data);
if (data != NULL
if (data != NULL
&& unit_list_size(data->units[loc][act]) != 0) {
unit_list_iterate(data->units[loc][act], punit) {
usdlg_cmd_exec_unit(punit, cmd);
client/gui-gtk-3.22/voteinfo_bar.c
{
enum client_vote_type vote;
struct voteinfo *vi;
vote = GPOINTER_TO_INT(userdata);
vi = voteinfo_queue_get_current(NULL);
client/gui-gtk-3.22/wldlg.c
gtk_list_store_set(worklists_store, &it,
0, global_worklist_name(pgwl),
1, global_worklist_id(pgwl),
-1);
-1);
} global_worklists_iterate_end;
}
......
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE);
worklists_list = list;
rend = gtk_cell_renderer_text_new();
g_object_set(rend, "editable", TRUE, NULL);
g_signal_connect(rend, "edited",
......
static void popdown_worklist(struct global_worklist *pgwl)
{
GtkWidget *shell;
if ((shell = get_worklist(global_worklist_id(pgwl)))) {
GtkWidget *parent;
......
if (!gtk_widget_is_sensitive(ptr->dst_view)) {
return;
}
src_model = GTK_TREE_MODEL(ptr->src);
dst_model = GTK_TREE_MODEL(ptr->dst);
......
gpointer data)
{
struct worklist_data *ptr;
ptr = data;
if (!gtk_widget_is_sensitive(ptr->dst_view)) {
return FALSE;
}
if ((ev->state & GDK_SHIFT_MASK) && ev->keyval == GDK_KEY_Insert) {
queue_prepend(ptr);
return TRUE;
......
if (gtk_tree_selection_count_selected_rows(selection) > 0) {
int num_rows = 0;
GtkTreeIter it;
gtk_widget_set_sensitive(ptr->up_cmd, TRUE);
gtk_widget_set_sensitive(ptr->down_cmd, TRUE);
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ptr->dst), &it)) {
......
} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(ptr->dst), &it));
}
if (num_rows > 1) {
gtk_widget_set_sensitive(ptr->remove_cmd, TRUE);
gtk_widget_set_sensitive(ptr->remove_cmd, TRUE);
} else {
gtk_widget_set_sensitive(ptr->remove_cmd, FALSE);
}
......
g_object_set_data(G_OBJECT(rend), "column", GINT_TO_POINTER(pos));
gtk_tree_view_insert_column_with_data_func(view,
i, titles[i], rend, cell_render_func, ppcity, NULL);
i, titles[i], rend, cell_render_func, ppcity, NULL);
col = gtk_tree_view_get_column(view, i);
if (pos >= 2) {
......
ptr->dst = dst_store;
ptr->future = FALSE;
/* create shell. */
/* Create shell. */
editor = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(editor), 6);
gtk_orientable_set_orientation(GTK_ORIENTABLE(editor),
    (1-1/1)