From ab90fb6c765cb46c47551b966d4db1f98c6dd3d5 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 2 Jun 2023 04:14:40 +0300 Subject: [PATCH 34/34] gtk4: Clear out tabs from the source files Some other touches to the style while going the files through See osdn #48138 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/action_dialog.c | 61 ++++++++------- client/gui-gtk-4.0/chatline.c | 16 ++-- client/gui-gtk-4.0/chatline.h | 2 +- client/gui-gtk-4.0/citydlg.c | 62 +++++++-------- client/gui-gtk-4.0/cityrep.c | 38 +++++----- client/gui-gtk-4.0/dialogs.c | 45 +++++------ client/gui-gtk-4.0/diplodlg.c | 14 ++-- client/gui-gtk-4.0/diplodlg.h | 4 +- client/gui-gtk-4.0/editprop.c | 8 +- client/gui-gtk-4.0/finddlg.c | 19 ++--- client/gui-gtk-4.0/finddlg.h | 4 +- client/gui-gtk-4.0/graphics.c | 2 +- client/gui-gtk-4.0/graphics.h | 4 +- client/gui-gtk-4.0/gui_main.c | 29 ++++--- client/gui-gtk-4.0/gui_main.h | 14 ++-- client/gui-gtk-4.0/gui_stuff.c | 15 ++-- client/gui-gtk-4.0/gui_stuff.h | 2 +- client/gui-gtk-4.0/happiness.c | 8 +- client/gui-gtk-4.0/inteldlg.c | 34 ++++----- client/gui-gtk-4.0/inteldlg.h | 2 +- client/gui-gtk-4.0/mapview.c | 43 ++++++----- client/gui-gtk-4.0/mapview.h | 2 +- client/gui-gtk-4.0/pages.c | 118 +++++++++++++++-------------- client/gui-gtk-4.0/pages.h | 2 +- client/gui-gtk-4.0/plrdlg.c | 26 +++---- client/gui-gtk-4.0/plrdlg.h | 2 +- client/gui-gtk-4.0/repodlgs.c | 13 ++-- client/gui-gtk-4.0/repodlgs.h | 2 +- client/gui-gtk-4.0/wldlg.c | 6 +- client/gui-gtk-4.0/wldlg.h | 4 +- 30 files changed, 307 insertions(+), 294 deletions(-) diff --git a/client/gui-gtk-4.0/action_dialog.c b/client/gui-gtk-4.0/action_dialog.c index 2632783e4f..fcf46e8f41 100644 --- a/client/gui-gtk-4.0/action_dialog.c +++ b/client/gui-gtk-4.0/action_dialog.c @@ -89,7 +89,7 @@ struct action_data { int target_extra_id; }; -/* TODO: maybe this should be in the dialog itself? */ +/* TODO: Maybe this should be in the dialog itself? */ static struct action_data *act_sel_dialog_data; /**********************************************************************//** @@ -312,7 +312,7 @@ static void simple_action_callback(GtkWidget *w, gpointer data) break; case ASTK_EXTRA: case ASTK_EXTRA_NOT_THERE: - /* TODO: validate if the extra is there? */ + /* TODO: Validate if the extra is there? */ sub_target = args->target_extra_id; if (NULL == extra_by_number(sub_target)) { /* Did the ruleset change? */ @@ -435,7 +435,6 @@ static void found_city_callback(GtkWidget *w, gpointer data) static void upgrade_callback(GtkWidget *w, gpointer data) { struct unit *punit; - struct action_data *args = act_sel_dialog_data; if ((punit = game_unit_by_number(args->actor_unit_id)) @@ -571,8 +570,8 @@ static void spy_advances_callback(GtkTreeSelection *select, Create spy's tech stealing dialog **************************************************************************/ static void create_advances_list(struct player *pplayer, - struct player *pvictim, - struct action_data *args) + struct player *pvictim, + struct action_data *args) { GtkWidget *sw, *frame, *label, *vgrid, *view; GtkListStore *store; @@ -589,7 +588,7 @@ static void create_advances_list(struct player *pplayer, setup_dialog(spy_tech_shell, toplevel); gtk_dialog_set_default_response(GTK_DIALOG(spy_tech_shell), - GTK_RESPONSE_ACCEPT); + GTK_RESPONSE_ACCEPT); frame = gtk_frame_new(_("Select Advance to Steal")); gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(spy_tech_shell))), frame); @@ -610,7 +609,7 @@ static void create_advances_list(struct player *pplayer, rend = gtk_cell_renderer_text_new(); col = gtk_tree_view_column_new_with_attributes(NULL, rend, - "text", 0, NULL); + "text", 0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); label = g_object_new(GTK_TYPE_LABEL, @@ -633,7 +632,7 @@ static void create_advances_list(struct player *pplayer, gtk_grid_attach(GTK_GRID(vgrid), sw, 0, 1, 1, 1); /* Now populate the list */ - if (pvictim) { /* you don't want to know what lag can do -- Syela */ + if (pvictim) { /* You don't want to know what lag can do -- Syela */ const struct research *presearch = research_get(pplayer); const struct research *vresearch = research_get(pvictim); GtkTreeIter it; @@ -644,14 +643,14 @@ static void create_advances_list(struct player *pplayer, game.info.tech_steal_allow_holes) && research_invention_state(vresearch, i) == TECH_KNOWN && research_invention_state(presearch, i) != TECH_KNOWN) { - gtk_list_store_append(store, &it); + gtk_list_store_append(store, &it); - g_value_init(&value, G_TYPE_STRING); + g_value_init(&value, G_TYPE_STRING); g_value_set_static_string(&value, research_advance_name_translation (presearch, i)); - gtk_list_store_set_value(store, &it, 0, &value); - g_value_unset(&value); - gtk_list_store_set(store, &it, 1, i, -1); + gtk_list_store_set_value(store, &it, 0, &value); + g_value_unset(&value); + gtk_list_store_set(store, &it, 1, i, -1); } } advance_index_iterate_end; @@ -757,8 +756,8 @@ static void spy_improvements_callback(GtkTreeSelection *select, gpointer data) Creates spy's building sabotaging dialog **************************************************************************/ static void create_improvements_list(struct player *pplayer, - struct city *pcity, - struct action_data *args) + struct city *pcity, + struct action_data *args) { GtkWidget *sw, *frame, *label, *vgrid, *view; GtkListStore *store; @@ -776,7 +775,7 @@ static void create_improvements_list(struct player *pplayer, setup_dialog(spy_sabotage_shell, toplevel); gtk_dialog_set_default_response(GTK_DIALOG(spy_sabotage_shell), - GTK_RESPONSE_ACCEPT); + GTK_RESPONSE_ACCEPT); frame = gtk_frame_new(_("Select Improvement to Sabotage")); gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(spy_sabotage_shell))), frame); @@ -797,7 +796,7 @@ static void create_improvements_list(struct player *pplayer, rend = gtk_cell_renderer_text_new(); col = gtk_tree_view_column_new_with_attributes(NULL, rend, - "text", 0, NULL); + "text", 0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); label = g_object_new(GTK_TYPE_LABEL, @@ -883,9 +882,9 @@ static void spy_steal_popup_shared(GtkWidget *w, gpointer data) pvictim = city_owner(pvcity); } -/* it is concievable that pvcity will not be found, because something -has happened to the city during latency. Therefore we must initialize -pvictim to NULL and account for !pvictim in create_advances_list. -- Syela */ +/* It is concievable that pvcity will not be found, because something + has happened to the city during latency. Therefore we must initialize + pvictim to NULL and account for !pvictim in create_advances_list. -- Syela */ /* FIXME: Don't discard the second tech choice dialog. */ if (!spy_tech_shell) { @@ -1197,7 +1196,7 @@ static void act_sel_wait_callback(GtkWidget *w, gpointer data) key_unit_wait(); - /* the dialog was destroyed when key_unit_wait() resulted in + /* The dialog was destroyed when key_unit_wait() resulted in * action_selection_close() being called. */ free(args); @@ -1514,37 +1513,37 @@ void popup_action_selection(struct unit *actor_unit, if (target_unit != NULL && unit_list_size(target_tile->units) > 1) { - action_button_map[BUTTON_NEW_UNIT_TGT] = - choice_dialog_get_number_of_buttons(shl); + action_button_map[BUTTON_NEW_UNIT_TGT] + = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("Change unit target"), (GCallback)act_sel_new_unit_tgt_callback, GINT_TO_POINTER(ACTION_NONE), TRUE, NULL); } if (target_extra != NULL) { - action_button_map[BUTTON_NEW_EXTRA_TGT] = - choice_dialog_get_number_of_buttons(shl); + action_button_map[BUTTON_NEW_EXTRA_TGT] + = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("Change extra target"), (GCallback)act_sel_new_extra_tgt_callback, GINT_TO_POINTER(ACTION_NONE), TRUE, NULL); } - action_button_map[BUTTON_LOCATION] = - choice_dialog_get_number_of_buttons(shl); + action_button_map[BUTTON_LOCATION] + = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("Show Location"), (GCallback)act_sel_location_callback, GINT_TO_POINTER(ACTION_NONE), TRUE, NULL); - action_button_map[BUTTON_WAIT] = - choice_dialog_get_number_of_buttons(shl); + action_button_map[BUTTON_WAIT] + = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("_Wait"), (GCallback)act_sel_wait_callback, GINT_TO_POINTER(ACTION_NONE), TRUE, NULL); - action_button_map[BUTTON_CANCEL] = - choice_dialog_get_number_of_buttons(shl); + action_button_map[BUTTON_CANCEL] + = choice_dialog_get_number_of_buttons(shl); choice_dialog_add(shl, _("_Cancel"), (GCallback)act_sel_cancel_callback, GINT_TO_POINTER(ACTION_NONE), diff --git a/client/gui-gtk-4.0/chatline.c b/client/gui-gtk-4.0/chatline.c index be05b50107..65a9b1fa6d 100644 --- a/client/gui-gtk-4.0/chatline.c +++ b/client/gui-gtk-4.0/chatline.c @@ -314,7 +314,7 @@ static bool chatline_autocomplete(GtkEditable *editable) return FALSE; } - /* Part 2: compare with player and user names. */ + /* Part 2: Compare with player and user names. */ num = check_player_or_user_name(p, name, MAX_MATCHES); if (1 == num) { gtk_editable_delete_text(editable, pos - prefix_len, pos); @@ -339,6 +339,7 @@ static bool chatline_autocomplete(GtkEditable *editable) } g_free(chars); + return TRUE; } @@ -761,7 +762,7 @@ void set_message_buffer_view_link_handlers(GtkWidget *view) controller = GTK_EVENT_CONTROLLER(gtk_event_controller_motion_new()); g_signal_connect(controller, "motion", - G_CALLBACK(chat_pointer_motion), NULL); + G_CALLBACK(chat_pointer_motion), NULL); gtk_widget_add_controller(view, controller); } @@ -871,7 +872,7 @@ void apply_text_tag(const struct text_tag *ptag, GtkTextBuffer *buf, "underline", PANGO_UNDERLINE_SINGLE, NULL); - /* Type 0 is reserved for non-link tags. So, add 1 to the + /* Type 0 is reserved for non-link tags. So, add 1 to the * type value. */ g_object_set_data(G_OBJECT(tag), "type", GINT_TO_POINTER(text_tag_link_type(ptag) + 1)); @@ -884,7 +885,7 @@ void apply_text_tag(const struct text_tag *ptag, GtkTextBuffer *buf, } /**********************************************************************//** - Appends the string to the chat output window. The string should be + Appends the string to the chat output window. The string should be inserted on its own line, although it will have no newline. **************************************************************************/ void real_output_window_append(const char *astring, @@ -1003,7 +1004,7 @@ bool chatline_is_scrolled_to_bottom(void) Scrolls the pregame and in-game chat windows all the way to the bottom. Why do we do it in such a convuluted fasion rather than calling - chatline_scroll_to_bottom directly from toplevel_configure? + chatline_scroll_to_bottom() directly from toplevel_configure? Because the widget is not at its final size yet when the configure event occurs. **************************************************************************/ @@ -1012,6 +1013,7 @@ static gboolean chatline_scroll_callback(gpointer data) chatline_scroll_to_bottom(FALSE); /* Not delayed this time! */ *((guint *) data) = 0; + return FALSE; /* Remove this idle function. */ } @@ -1121,8 +1123,8 @@ static void color_selected(GtkDialog *dialog, gint res, gpointer data) color_set(entry, color_target, NULL, data); } else if (res == GTK_RESPONSE_OK) { /* Apply the new color. */ - GtkColorChooser *chooser = - GTK_COLOR_CHOOSER(g_object_get_data(G_OBJECT(dialog), "chooser")); + GtkColorChooser *chooser + = GTK_COLOR_CHOOSER(g_object_get_data(G_OBJECT(dialog), "chooser")); GdkRGBA new_color; gtk_color_chooser_get_rgba(chooser, &new_color); diff --git a/client/gui-gtk-4.0/chatline.h b/client/gui-gtk-4.0/chatline.h index 47e08e1af2..46d5f80c7a 100644 --- a/client/gui-gtk-4.0/chatline.h +++ b/client/gui-gtk-4.0/chatline.h @@ -39,4 +39,4 @@ void apply_text_tag(const struct text_tag *ptag, GtkTextBuffer *buf, ft_offset_t text_start_offset, const char *text); void scroll_if_necessary(GtkTextView *textview, GtkTextMark *scroll_target); -#endif /* FC__CHATLINE_H */ +#endif /* FC__CHATLINE_H */ diff --git a/client/gui-gtk-4.0/citydlg.c b/client/gui-gtk-4.0/citydlg.c index e90b8313ce..676fc56fce 100644 --- a/client/gui-gtk-4.0/citydlg.c +++ b/client/gui-gtk-4.0/citydlg.c @@ -82,7 +82,7 @@ enum citydlg_response { CDLGR_UNITS, CDLGR_PREV, CDLGR_NEXT }; struct city_dialog; -/* get 'struct dialog_list' and related function */ +/* Get 'struct dialog_list' and related function */ #define SPECLIST_TAG dialog #define SPECLIST_TYPE struct city_dialog #include "speclist.h" @@ -100,7 +100,7 @@ struct unit_node { GtkEventController *right; }; -/* get 'struct unit_node' and related function */ +/* Get 'struct unit_node' and related function */ #define SPECVEC_TAG unit_node #define SPECVEC_TYPE struct unit_node #include "specvec.h" @@ -113,7 +113,7 @@ struct unit_node { enum { OVERVIEW_PAGE, WORKLIST_PAGE, HAPPINESS_PAGE, CMA_PAGE, SETTINGS_PAGE, STICKY_PAGE, - NUM_PAGES /* the number of pages in city dialog notebook + NUM_PAGES /* The number of pages in city dialog notebook * must match the entries in misc_whichtab_label[] */ }; @@ -122,11 +122,11 @@ enum { INFO_LUXURY, INFO_SCIENCE, INFO_GRANARY, INFO_GROWTH, INFO_CORRUPTION, INFO_WASTE, INFO_CULTURE, INFO_POLLUTION, INFO_ILLNESS, INFO_STEAL, INFO_AIRLIFT, - NUM_INFO_FIELDS /* number of fields in city_info panel + NUM_INFO_FIELDS /* Number of fields in city_info panel * must match entries in output_label[] */ }; -/* minimal size for the city map scrolling windows*/ +/* Minimal size for the city map scrolling windows */ #define CITY_MAP_MIN_SIZE_X 200 #define CITY_MAP_MIN_SIZE_Y 150 @@ -256,9 +256,9 @@ static void city_dialog_update_information(GtkWidget **info_label, static void city_dialog_update_map(struct city_dialog *pdialog); static void city_dialog_update_building(struct city_dialog *pdialog); static void city_dialog_update_improvement_list(struct city_dialog - *pdialog); + *pdialog); static void city_dialog_update_supported_units(struct city_dialog - *pdialog); + *pdialog); static void city_dialog_update_present_units(struct city_dialog *pdialog); static void city_dialog_update_prev_next(void); @@ -317,7 +317,7 @@ static void sell_callback(struct impr_type *pimprove, gpointer data); static void sell_callback_response(GtkWidget *w, gint response, gpointer data); static void impr_callback(GtkTreeView *view, GtkTreePath *path, - GtkTreeViewColumn *col, gpointer data); + GtkTreeViewColumn *col, gpointer data); static void rename_callback(GtkWidget * w, gpointer data); static void rename_popup_callback(gpointer data, gint response, @@ -380,8 +380,8 @@ void reset_city_dialogs(void) dialog_list_iterate(dialog_list, pdialog) { /* There's no reasonable way to resize a GtkImage, so we don't try. - Instead we just redraw the overview within the existing area. The - player has to close and reopen the dialog to fix this. */ + Instead we just redraw the overview within the existing area. + The player has to close and reopen the dialog to fix this. */ city_dialog_update_map(pdialog); } dialog_list_iterate_end; @@ -783,7 +783,7 @@ static GtkWidget *create_city_info_table(struct city_dialog *pdialog, break; } gtk_widget_set_margin_end(label, 5); - gtk_widget_set_name(label, "city_label"); /* for font style? */ + gtk_widget_set_name(label, "city_label"); /* For font style? */ gtk_widget_set_halign(label, GTK_ALIGN_START); gtk_widget_set_valign(label, GTK_ALIGN_CENTER); gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1); @@ -813,7 +813,7 @@ static GtkWidget *create_city_info_table(struct city_dialog *pdialog, gtk_widget_add_controller(label, controller); info_label[i] = label; - gtk_widget_set_name(label, "city_label"); /* ditto */ + gtk_widget_set_name(label, "city_label"); /* Ditto */ gtk_widget_set_halign(label, GTK_ALIGN_START); gtk_widget_set_valign(label, GTK_ALIGN_CENTER); @@ -1449,7 +1449,7 @@ static void create_and_append_settings_page(struct city_dialog *pdialog) pdialog->misc.new_citizens_radio[i] = button; gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1); g_signal_connect(button, "toggled", - G_CALLBACK(cityopt_callback), pdialog); + G_CALLBACK(cityopt_callback), pdialog); group = button; } @@ -1475,7 +1475,7 @@ static void create_and_append_settings_page(struct city_dialog *pdialog) pdialog->misc.whichtab_radio[i] = button; gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1); g_signal_connect(button, "toggled", - G_CALLBACK(misc_whichtab_callback), GINT_TO_POINTER(i)); + G_CALLBACK(misc_whichtab_callback), GINT_TO_POINTER(i)); group = button; } @@ -1495,7 +1495,7 @@ static void create_and_append_settings_page(struct city_dialog *pdialog) pdialog->misc.rename_command = button; gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1); g_signal_connect(button, "clicked", - G_CALLBACK(rename_callback), pdialog); + G_CALLBACK(rename_callback), pdialog); gtk_widget_set_sensitive(button, can_client_issue_orders()); @@ -1504,7 +1504,7 @@ static void create_and_append_settings_page(struct city_dialog *pdialog) pdialog->misc.disband_on_settler = button; gtk_grid_attach(GTK_GRID(vgrid), button, 0, grid_row++, 1, 1); g_signal_connect(button, "toggled", - G_CALLBACK(cityopt_callback), pdialog); + G_CALLBACK(cityopt_callback), pdialog); /* We choose which page to popup by default */ gtk_check_button_set_active(GTK_CHECK_BUTTON @@ -2249,9 +2249,9 @@ static void city_dialog_update_supported_units(struct city_dialog *pdialog) pnode->right = controller; if (city_owner(pdialog->pcity) != client.conn.playing) { - gtk_widget_set_sensitive(cmd, FALSE); + gtk_widget_set_sensitive(cmd, FALSE); } else { - gtk_widget_set_sensitive(cmd, TRUE); + gtk_widget_set_sensitive(cmd, TRUE); } gtk_widget_set_visible(pix, TRUE); @@ -2371,9 +2371,9 @@ static void city_dialog_update_present_units(struct city_dialog *pdialog) pnode->right = controller; if (city_owner(pdialog->pcity) != client.conn.playing) { - gtk_widget_set_sensitive(cmd, FALSE); + gtk_widget_set_sensitive(cmd, FALSE); } else { - gtk_widget_set_sensitive(cmd, TRUE); + gtk_widget_set_sensitive(cmd, TRUE); } gtk_widget_set_visible(pix, TRUE); @@ -2420,8 +2420,8 @@ static void city_dialog_update_prev_next(void) } else { dialog_list_iterate(dialog_list, pdialog) { if (city_owner(pdialog->pcity) == client.conn.playing) { - gtk_widget_set_sensitive(GTK_WIDGET(pdialog->prev_command), TRUE); - gtk_widget_set_sensitive(GTK_WIDGET(pdialog->next_command), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(pdialog->prev_command), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(pdialog->next_command), TRUE); } } dialog_list_iterate_end; } @@ -2788,7 +2788,7 @@ static void supported_unit_activate_close_callback(GSimpleAction *action, struct city_dialog *pdialog = get_city_dialog(pcity); if (NULL != pdialog) { - close_city_dialog(pdialog); + close_city_dialog(pdialog); } } } @@ -2815,7 +2815,7 @@ static void present_unit_activate_close_callback(GSimpleAction *action, struct city_dialog *pdialog = get_city_dialog(pcity); if (NULL != pdialog) { - close_city_dialog(pdialog); + close_city_dialog(pdialog); } } } @@ -2969,7 +2969,7 @@ static gboolean citizens_callback(GtkGestureClick *gesture, int n_press, len = (city_size_get(pcity) - 1) * pdialog->cwidth + tlen; if (x > len) { - /* no citizen that far to the right */ + /* No citizen that far to the right */ return FALSE; } citnum = MIN(city_size_get(pcity) - 1, x / pdialog->cwidth); @@ -3059,8 +3059,8 @@ static void popup_workertask_dlg(struct city *pcity, struct tile *ptile) workertask_req.loc = ptile; shl = choice_dialog_start(GTK_WINDOW(toplevel), - _("What Action to Request"), - _("Select autosettler activity:")); + _("What Action to Request"), + _("Select autosettler activity:")); ptask = worker_task_list_get(pcity->task_reqs, 0); if (ptask != NULL) { @@ -3116,7 +3116,7 @@ static void popup_workertask_dlg(struct city *pcity, struct tile *ptile) choice_dialog_end(shl); g_signal_connect(shl, "destroy", G_CALLBACK(workertask_dlg_destroy), - NULL); + NULL); } } @@ -3237,7 +3237,7 @@ static void buy_callback(GtkWidget *w, gpointer data) gtk_window_set_title(GTK_WINDOW(shell), _("Buy It!")); gtk_dialog_set_default_response(GTK_DIALOG(shell), GTK_RESPONSE_NO); g_signal_connect(shell, "response", G_CALLBACK(buy_callback_response), - pdialog); + pdialog); gtk_window_present(GTK_WINDOW(shell)); } else { shell = gtk_message_dialog_new(NULL, @@ -3307,7 +3307,7 @@ static void sell_callback(struct impr_type *pimprove, gpointer data) gtk_window_set_title(GTK_WINDOW(shl), _("Sell It!")); g_signal_connect(shl, "response", - G_CALLBACK(sell_callback_response), pdialog); + G_CALLBACK(sell_callback_response), pdialog); gtk_window_present(GTK_WINDOW(shl)); } @@ -3579,7 +3579,7 @@ static void switch_city_callback(GtkWidget *w, gpointer data) for (j = 1; j < size; j++) { struct city *other_pcity = city_list_get(client.conn.playing->cities, - (i + dir * j + size) % size); + (i + dir * j + size) % size); struct city_dialog *other_pdialog = get_city_dialog(other_pcity); fc_assert_ret(other_pdialog != pdialog); diff --git a/client/gui-gtk-4.0/cityrep.c b/client/gui-gtk-4.0/cityrep.c index 71fa7e77f6..273e64932d 100644 --- a/client/gui-gtk-4.0/cityrep.c +++ b/client/gui-gtk-4.0/cityrep.c @@ -78,7 +78,7 @@ enum city_operation_type { static void create_city_report_dialog(bool make_modal); static void city_activated_callback(GtkTreeView *view, GtkTreePath *path, - GtkTreeViewColumn *col, gpointer data); + GtkTreeViewColumn *col, gpointer data); static void city_command_callback(struct gui_dialog *dlg, int response, gpointer data); @@ -356,16 +356,16 @@ static void append_impr_or_unit_to_menu(GMenu *menu, data = (struct city **)g_ptr_array_free(selected, FALSE); targets_used = collect_production_targets(targets, data, num_selected, append_units, - append_wonders, TRUE, test_func); + append_wonders, TRUE, test_func); g_free(data); } else { targets_used = collect_production_targets(targets, NULL, 0, append_units, - append_wonders, FALSE, - test_func); + append_wonders, FALSE, + test_func); } name_and_sort_items(targets, targets_used, items, - city_operation != CO_NONE, NULL); + city_operation != CO_NONE, NULL); for (i = 0; i < 4; i++) { row[i] = buf[i]; @@ -410,7 +410,7 @@ static void append_impr_or_unit_to_menu(GMenu *menu, for (i = 0; i < 3; i++) { if (row[i][0] == '\0') { - continue; + continue; } if (city_operation == CO_SELL && i != 0) { @@ -442,7 +442,7 @@ static void append_impr_or_unit_to_menu(GMenu *menu, gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); g_signal_connect(menu_item, "activate", callback, - GINT_TO_POINTER(cid_encode(target))); + GINT_TO_POINTER(cid_encode(target))); #endif /* MENUS_GTK3 */ } @@ -526,7 +526,7 @@ static void worklist_next_impr_or_unit_iterate(GtkTreeModel *model, if (NULL != pcity) { (void) city_queue_insert(pcity, 1, &target); } - /* perhaps should warn the user if not successful? */ + /* Perhaps should warn the user if not successful? */ } /************************************************************************//** @@ -598,23 +598,23 @@ static void select_impr_or_unit_callback(GSimpleAction *action, switch (city_operation) { case CO_LAST: gtk_tree_selection_selected_foreach(city_selection, - worklist_last_impr_or_unit_iterate, - GINT_TO_POINTER(cid_encode(target))); + worklist_last_impr_or_unit_iterate, + GINT_TO_POINTER(cid_encode(target))); break; case CO_CHANGE: gtk_tree_selection_selected_foreach(city_selection, - impr_or_unit_iterate, - GINT_TO_POINTER(cid_encode(target))); + impr_or_unit_iterate, + GINT_TO_POINTER(cid_encode(target))); break; case CO_FIRST: gtk_tree_selection_selected_foreach(city_selection, - worklist_first_impr_or_unit_iterate, - GINT_TO_POINTER(cid_encode(target))); + worklist_first_impr_or_unit_iterate, + GINT_TO_POINTER(cid_encode(target))); break; case CO_NEXT: gtk_tree_selection_selected_foreach(city_selection, - worklist_next_impr_or_unit_iterate, - GINT_TO_POINTER(cid_encode(target))); + worklist_next_impr_or_unit_iterate, + GINT_TO_POINTER(cid_encode(target))); break; case CO_NEXT_TO_LAST: foreach_func = worklist_next_to_last_impr_or_unit_iterate; @@ -740,7 +740,7 @@ static void select_governor_callback(GSimpleAction *action, } if (select) { - itree_select(city_selection, &it); + itree_select(city_selection, &it); } } } else { @@ -2008,7 +2008,9 @@ void hilite_cities_from_canvas(void) ITree it; GtkTreeModel *model; - if (!city_dialog_shell) return; + if (!city_dialog_shell) { + return; + } model = GTK_TREE_MODEL(city_model); diff --git a/client/gui-gtk-4.0/dialogs.c b/client/gui-gtk-4.0/dialogs.c index b1c775cbb5..c18725a0de 100644 --- a/client/gui-gtk-4.0/dialogs.c +++ b/client/gui-gtk-4.0/dialogs.c @@ -88,8 +88,8 @@ static void races_leader_callback(void); static void races_sex_callback(GtkWidget *w, gpointer data); static void races_style_callback(GtkTreeSelection *select, gpointer data); static gboolean races_selection_func(GtkTreeSelection *select, - GtkTreeModel *model, GtkTreePath *path, - gboolean selected, gpointer data); + GtkTreeModel *model, GtkTreePath *path, + gboolean selected, gpointer data); static int selected_nation; static int selected_sex; @@ -130,7 +130,7 @@ void popup_notify_dialog(const char *caption, const char *headline, sw = gtk_scrolled_window_new(); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); label = gtk_label_new(lines); gtk_widget_set_hexpand(label, TRUE); gtk_widget_set_vexpand(label, TRUE); @@ -190,7 +190,7 @@ static void notify_connect_msg_response(GtkWidget *w, gint response) /**********************************************************************//** Popup a dialog to display information about an event that has a - specific location. The user should be given the option to goto that + specific location. The user should be given the option to goto that location. **************************************************************************/ void popup_notify_goto_dialog(const char *headline, const char *lines, @@ -288,10 +288,10 @@ void popup_revolution_dialog(struct government *government) if (0 > client.conn.playing->revolution_finishes) { if (!shell) { shell = gtk_message_dialog_new(NULL, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_YES_NO, - _("You say you wanna revolution?")); + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_YES_NO, + _("You say you wanna revolution?")); gtk_window_set_title(GTK_WINDOW(shell), _("Revolution!")); setup_dialog(shell, toplevel); @@ -299,7 +299,7 @@ void popup_revolution_dialog(struct government *government) G_CALLBACK(widget_destroyed), &shell); } g_signal_connect(shell, "response", - G_CALLBACK(revolution_response), government); + G_CALLBACK(revolution_response), government); gtk_window_present(GTK_WINDOW(shell)); } else { @@ -416,6 +416,7 @@ static GtkTreePath *path_to_nation_on_list(Nation_type_id nation, break; } } while (gtk_tree_model_iter_next(model, &iter)); + return path; } } @@ -584,7 +585,7 @@ static void select_nation(int nation, gtk_check_button_set_active(GTK_CHECK_BUTTON(races_sex[0]), TRUE); /* City style */ { - GtkTreeSelection* select + GtkTreeSelection *select = gtk_tree_view_get_selection(GTK_TREE_VIEW(races_style_list)); gtk_tree_selection_unselect_all(select); @@ -609,7 +610,7 @@ static void select_nation(int nation, the group has no nations) If group == NULL, create a list of all nations **************************************************************************/ -static GtkWidget* create_list_of_nations_in_group(struct nation_group* group, +static GtkWidget *create_list_of_nations_in_group(struct nation_group *group, int index) { GtkWidget *sw = NULL; @@ -1419,7 +1420,7 @@ static void races_response(GtkWidget *w, gint response, gpointer data) GTK_ENTRY(gtk_combo_box_get_child(GTK_COMBO_BOX(races_leader))))); /* Perform a minimum of sanity test on the name. */ - /* This could call is_allowed_player_name if it were available. */ + /* This could call is_allowed_player_name() if it were available. */ if (strlen(s) == 0) { output_window_append(ftc_client, _("You must type a legal name.")); return; @@ -1431,8 +1432,8 @@ static void races_response(GtkWidget *w, gint response, gpointer data) selected_style); } else if (response == GTK_RESPONSE_NO) { dsend_packet_nation_select_req(&client.conn, - player_number(races_player), - -1, FALSE, "", 0); + player_number(races_player), + -1, FALSE, "", 0); } popdown_races_dialog(); @@ -1466,8 +1467,8 @@ void popup_upgrade_dialog(struct unit_list *punits) if (!get_units_upgrade_info(buf, sizeof(buf), punits)) { shell = gtk_message_dialog_new(NULL, 0, - GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, - "%s", buf); + GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, + "%s", buf); gtk_window_set_title(GTK_WINDOW(shell), _("Upgrade Unit!")); setup_dialog(shell, toplevel); g_signal_connect(shell, "response", G_CALLBACK(gtk_window_destroy), @@ -1475,8 +1476,8 @@ void popup_upgrade_dialog(struct unit_list *punits) gtk_window_present(GTK_WINDOW(shell)); } else { shell = gtk_message_dialog_new(NULL, 0, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - "%s", buf); + GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + "%s", buf); gtk_window_set_title(GTK_WINDOW(shell), _("Upgrade Obsolete Units")); setup_dialog(shell, toplevel); gtk_dialog_set_default_response(GTK_DIALOG(shell), GTK_RESPONSE_YES); @@ -1484,7 +1485,7 @@ void popup_upgrade_dialog(struct unit_list *punits) /* FIXME: Should not block */ if (blocking_dialog(shell) == GTK_RESPONSE_YES) { unit_list_iterate(punits, punit) { - request_unit_upgrade(punit); + request_unit_upgrade(punit); } unit_list_iterate_end; } gtk_window_destroy(GTK_WINDOW(shell)); @@ -1505,7 +1506,7 @@ void popup_disband_dialog(struct unit_list *punits) if (!get_units_disband_info(buf, sizeof(buf), punits)) { shell = gtk_message_dialog_new(NULL, 0, - GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, + GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", buf); gtk_window_set_title(GTK_WINDOW(shell), _("Disband Units")); setup_dialog(shell, toplevel); @@ -1514,7 +1515,7 @@ void popup_disband_dialog(struct unit_list *punits) gtk_window_present(GTK_WINDOW(shell)); } else { shell = gtk_message_dialog_new(NULL, 0, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", buf); gtk_window_set_title(GTK_WINDOW(shell), _("Disband Units")); setup_dialog(shell, toplevel); @@ -1534,7 +1535,7 @@ void popup_disband_dialog(struct unit_list *punits) /**********************************************************************//** This function is called when the client disconnects or the game is - over. It should close all dialog windows for that game. + over. It should close all dialog windows for that game. **************************************************************************/ void popdown_all_game_dialogs(void) { diff --git a/client/gui-gtk-4.0/diplodlg.c b/client/gui-gtk-4.0/diplodlg.c index deb877b572..bdfd824f98 100644 --- a/client/gui-gtk-4.0/diplodlg.c +++ b/client/gui-gtk-4.0/diplodlg.c @@ -237,7 +237,7 @@ static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they, gui_dialog_present(pdialog->dialog); /* We initated the meeting - Make the tab active */ if (initiator == client_player()) { - /* we have to raise the diplomacy meeting tab as well as the selected + /* We have to raise the diplomacy meeting tab as well as the selected * meeting. */ fc_assert_ret(dipl_main != NULL); gui_dialog_raise(dipl_main->dialog); @@ -592,10 +592,10 @@ static void row_callback(GtkTreeView *view, GtkTreePath *path, clause_list_iterate(pdialog->treaty->clauses, pclause) { if (i == index[0]) { dsend_packet_diplomacy_remove_clause_req(&client.conn, - player_number(pdialog->treaty->plr1), - player_number(pclause->from), - pclause->type, - pclause->value); + player_number(pdialog->treaty->plr1), + player_number(pclause->from), + pclause->type, + pclause->value); return; } i++; @@ -1054,8 +1054,8 @@ static void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog) if (blank) { gtk_list_store_append(store, &it); gtk_list_store_set(store, &it, 0, - _("--- This treaty is blank. " - "Please add some clauses. ---"), -1); + _("--- This treaty is blank. " + "Please add some clauses. ---"), -1); } pixbuf = get_thumb_pixbuf(pdialog->treaty->accept0); diff --git a/client/gui-gtk-4.0/diplodlg.h b/client/gui-gtk-4.0/diplodlg.h index 22a5cb1103..2170db73d1 100644 --- a/client/gui-gtk-4.0/diplodlg.h +++ b/client/gui-gtk-4.0/diplodlg.h @@ -15,10 +15,10 @@ #include -/* include */ +/* client/include */ #include "diplodlg_g.h" void diplomacy_dialog_init(void); void diplomacy_dialog_done(void); -#endif /* FC__DIPLODLG_H */ +#endif /* FC__DIPLODLG_H */ diff --git a/client/gui-gtk-4.0/editprop.c b/client/gui-gtk-4.0/editprop.c index 7f0b35ff79..d920a76cab 100644 --- a/client/gui-gtk-4.0/editprop.c +++ b/client/gui-gtk-4.0/editprop.c @@ -1206,6 +1206,7 @@ static bool propval_equal(struct propval *pva, improvement_iterate(pimprove) { int id, vatb, vbtb; + id = improvement_index(pimprove); vatb = pva->data.v_built[id].turn; vbtb = pvb->data.v_built[id].turn; @@ -3964,8 +3965,8 @@ static void extviewer_refresh_widgets(struct extviewer *ev, case OPID_PLAYER_NATION: { - enum barbarian_type barbarian_type = - nation_barbarian_type(pv->data.v_nation); + enum barbarian_type barbarian_type + = nation_barbarian_type(pv->data.v_nation); gtk_list_store_clear(store); nations_iterate(pnation) { @@ -5397,6 +5398,7 @@ static void property_page_fill_widgets(struct property_page *pp) if (gtk_tree_model_get_iter_first(model, &iter)) { GtkTreeSelection *sel; + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pp->object_view)); gtk_tree_selection_select_iter(sel, &iter); } @@ -6166,7 +6168,7 @@ static bool property_editor_add_page(struct property_editor *pe, ****************************************************************************/ static struct property_page * property_editor_get_page(struct property_editor *pe, - enum editor_object_type objtype) + enum editor_object_type objtype) { if (!pe || !(objtype < NUM_OBJTYPES)) { return NULL; diff --git a/client/gui-gtk-4.0/finddlg.c b/client/gui-gtk-4.0/finddlg.c index 6d09f485f8..8bf6da15b5 100644 --- a/client/gui-gtk-4.0/finddlg.c +++ b/client/gui-gtk-4.0/finddlg.c @@ -84,7 +84,7 @@ void popup_find_dialog(void) store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), - 0, GTK_SORT_ASCENDING); + 0, GTK_SORT_ASCENDING); find_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(find_view)); @@ -94,7 +94,7 @@ void popup_find_dialog(void) renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(NULL, renderer, - "text", 0, NULL); + "text", 0, NULL); gtk_tree_view_column_set_sort_order(column, GTK_SORT_ASCENDING); gtk_tree_view_append_column(GTK_TREE_VIEW(find_view), column); @@ -105,22 +105,22 @@ void popup_find_dialog(void) gtk_widget_set_margin_top(sw, 2); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); + GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), find_view); gtk_widget_set_hexpand(GTK_WIDGET(find_view), TRUE); gtk_widget_set_vexpand(GTK_WIDGET(find_view), TRUE); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", find_view, - "label", _("Ci_ties:"), - "xalign", 0.0, "yalign", 0.5, NULL); + "use-underline", TRUE, + "mnemonic-widget", find_view, + "label", _("Ci_ties:"), + "xalign", 0.0, "yalign", 0.5, NULL); gui_dialog_add_content_widget(find_dialog_shell, label); gui_dialog_add_content_widget(find_dialog_shell, sw); g_signal_connect(selection, "changed", - G_CALLBACK(find_selection_callback), store); + G_CALLBACK(find_selection_callback), store); update_find_dialog(store); gtk_tree_view_focus(GTK_TREE_VIEW(find_view)); @@ -174,10 +174,11 @@ static void find_response(struct gui_dialog *dlg, int response, gpointer data) gtk_tree_model_get(model, &it, 1, &pcity, -1); if (pcity) { - pos = pcity->tile; + pos = pcity->tile; } } } + gui_dialog_destroy(dlg); } diff --git a/client/gui-gtk-4.0/finddlg.h b/client/gui-gtk-4.0/finddlg.h index 79b514bbfc..ce41d68164 100644 --- a/client/gui-gtk-4.0/finddlg.h +++ b/client/gui-gtk-4.0/finddlg.h @@ -16,6 +16,6 @@ /* client */ #include "finddlg_g.h" -/* nothing to add */ +/* Nothing to add */ -#endif /* FC__FINDDLG_H */ +#endif /* FC__FINDDLG_H */ diff --git a/client/gui-gtk-4.0/graphics.c b/client/gui-gtk-4.0/graphics.c index 9610bf04c2..3858ec0387 100644 --- a/client/gui-gtk-4.0/graphics.c +++ b/client/gui-gtk-4.0/graphics.c @@ -90,7 +90,7 @@ void load_cursors(void) for (frame = 0; frame < NUM_CURSOR_FRAMES; frame++) { int hot_x, hot_y; struct sprite *sprite - = get_cursor_sprite(tileset, cursor, &hot_x, &hot_y, frame); + = get_cursor_sprite(tileset, cursor, &hot_x, &hot_y, frame); GdkPixbuf *pixbuf = sprite_get_pixbuf(sprite); GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf); diff --git a/client/gui-gtk-4.0/graphics.h b/client/gui-gtk-4.0/graphics.h index 0f22ebd7dc..3e66311a6b 100644 --- a/client/gui-gtk-4.0/graphics.h +++ b/client/gui-gtk-4.0/graphics.h @@ -26,7 +26,7 @@ extern struct sprite *intro_gfx_sprite; /* This name is to avoid a naming conflict with a global 'cursors' - * variable in GTK+-2.6. See PR#12459. */ + * variable in GTK+-2.6. See PR#12459. */ extern GdkCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; -#endif /* FC__GRAPHICS_H */ +#endif /* FC__GRAPHICS_H */ diff --git a/client/gui-gtk-4.0/gui_main.c b/client/gui-gtk-4.0/gui_main.c index 6a9d507557..e06cb34692 100644 --- a/client/gui-gtk-4.0/gui_main.c +++ b/client/gui-gtk-4.0/gui_main.c @@ -170,8 +170,8 @@ GtkTextView *main_message_area; GtkTextBuffer *message_buffer = NULL; static GtkWidget *allied_chat_toggle_button; -static enum Display_color_type display_color_type; /* practically unused */ -static gint timer_id; /* ditto */ +static enum Display_color_type display_color_type; /* Practically unused */ +static gint timer_id; /* Ditto */ static GIOChannel *srv_channel; static guint srv_id; gint cur_x, cur_y; @@ -265,7 +265,7 @@ static gboolean timer_callback(gpointer data) **************************************************************************/ static void print_usage(void) { - /* add client-specific usage information here */ + /* Add client-specific usage information here */ fc_fprintf(stderr, _("gtk4-client gui-specific options are:\n")); @@ -340,12 +340,12 @@ static void toplevel_focus(GtkWidget *w, GtkDirectionType arg, case GTK_DIR_TAB_BACKWARD: if (!gtk_widget_get_can_focus(w)) { - return; + return; } if (!gtk_widget_is_focus(w)) { - gtk_widget_grab_focus(w); - return; + gtk_widget_grab_focus(w); + return; } break; @@ -1579,10 +1579,10 @@ static void setup_widgets(void) sw = gtk_scrolled_window_new(); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), - TRUE); + TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, - GTK_POLICY_ALWAYS); + GTK_POLICY_ALWAYS); gtk_grid_attach(GTK_GRID(vgrid), sw, 0, grid_row++, 1, 1); label = gtk_label_new(_("Chat")); @@ -2050,7 +2050,7 @@ static void activate_gui(GtkApplication *app, gpointer data) tileset_init(tileset); tileset_load_tiles(tileset); - /* keep the icon of the executable on Windows (see PR#36491) */ + /* Keep the icon of the executable on Windows (see PR#36491) */ #ifndef FREECIV_MSWINDOWS { /* Only call this after tileset_load_tiles is called. */ @@ -2289,7 +2289,7 @@ static gboolean get_net_input(GIOChannel *source, GIOCondition condition, Set socket writability state **************************************************************************/ static void set_wait_for_writable_socket(struct connection *pc, - bool socket_writable) + bool socket_writable) { static bool previous_state = FALSE; @@ -2375,10 +2375,10 @@ void popup_quit_dialog(void) if (!dialog) { dialog = gtk_message_dialog_new(NULL, - 0, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_YES_NO, - _("Are you sure you want to quit?")); + 0, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_YES_NO, + _("Are you sure you want to quit?")); setup_dialog(dialog, toplevel); g_signal_connect(dialog, "response", @@ -2487,7 +2487,6 @@ static void apply_reqtree_text_font(struct option *poption) **************************************************************************/ void options_extra_init(void) { - struct option *poption; #define option_var_set_callback(var, callback) \ diff --git a/client/gui-gtk-4.0/gui_main.h b/client/gui-gtk-4.0/gui_main.h index ab27c5ab15..d75c4cd50f 100644 --- a/client/gui-gtk-4.0/gui_main.h +++ b/client/gui-gtk-4.0/gui_main.h @@ -33,7 +33,7 @@ extern PangoFontDescription *reqtree_text_style; #define single_tile_pixmap (mapview.single_tile->pixmap) -extern GtkTextView * main_message_area; +extern GtkTextView * main_message_area; extern GtkWidget * text_scrollbar; extern GtkWidget * toplevel; extern GtkWidget * top_vbox; @@ -44,7 +44,7 @@ extern GtkWidget * bulb_label; extern GtkWidget * sun_label; extern GtkWidget * flake_label; extern GtkWidget * government_label; -extern GtkWidget * econ_widget; +extern GtkWidget * econ_widget; extern GtkWidget * map_canvas; /* GtkDrawingArea */ extern GtkWidget * overview_canvas; /* GtkDrawingArea */ extern GtkWidget * overview_scrolled_window; /* GtkScrolledWindow */ @@ -56,12 +56,12 @@ extern GtkWidget * unit_info_frame; extern GtkWidget * map_horizontal_scrollbar; extern GtkWidget * map_vertical_scrollbar; -extern GtkWidget * toplevel_tabs; -extern GtkWidget * top_notebook; +extern GtkWidget * toplevel_tabs; +extern GtkWidget * top_notebook; extern GtkWidget * map_widget; -extern GtkWidget * bottom_notebook; -extern GtkWidget * right_notebook; -extern GtkTextBuffer * message_buffer; +extern GtkWidget * bottom_notebook; +extern GtkWidget * right_notebook; +extern GtkTextBuffer * message_buffer; extern int overview_canvas_store_width; extern int overview_canvas_store_height; diff --git a/client/gui-gtk-4.0/gui_stuff.c b/client/gui-gtk-4.0/gui_stuff.c index 19d38768d3..de66a177d3 100644 --- a/client/gui-gtk-4.0/gui_stuff.c +++ b/client/gui-gtk-4.0/gui_stuff.c @@ -79,8 +79,8 @@ GtkWidget *icon_label_button_new(const gchar *icon_name, } /**********************************************************************//** - Changes the label (with mnemonic) on an existing stockbutton. See - gtk_stockbutton_new. + Changes the label (with mnemonic) on an existing stockbutton. + See gtk_stockbutton_new(). **************************************************************************/ void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text) { @@ -88,10 +88,10 @@ void gtk_stockbutton_set_label(GtkWidget *button, const gchar *label_text) } /**********************************************************************//** - Returns gettext-converted list of n strings. The individual strings - in the list are as returned by gettext(). In case of no NLS, the strings + Returns gettext-converted list of n strings. The individual strings + in the list are as returned by gettext(). In case of no NLS, the strings will be the original strings, so caller should ensure that the originals - persist for as long as required. (For no NLS, still allocate the + persist for as long as required. (For no NLS, still allocate the list, for consistency.) (This is not directly gui/gtk related, but it fits in here @@ -215,6 +215,7 @@ gint gtk_tree_selection_get_row(GtkTreeSelection *selection) row = idx[0]; gtk_tree_path_free(path); } + return row; } @@ -375,10 +376,10 @@ static gint gui_dialog_delete_tab_handler(struct gui_dialog* dlg) 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; } diff --git a/client/gui-gtk-4.0/gui_stuff.h b/client/gui-gtk-4.0/gui_stuff.h index d64d4f4540..ddb31be039 100644 --- a/client/gui-gtk-4.0/gui_stuff.h +++ b/client/gui-gtk-4.0/gui_stuff.h @@ -27,7 +27,7 @@ void fc_gtk_widget_hide(GtkWidget *hide, void *data); void intl_slist(int n, const char **s, bool *done); -/* the standard GTK+ 2.0 API is braindamaged. this is slightly better! */ +/* The standard GTK+ 2.0 API is braindamaged. this is slightly better! */ typedef struct { diff --git a/client/gui-gtk-4.0/happiness.c b/client/gui-gtk-4.0/happiness.c index 5b01b030b2..ae0a3c6dd0 100644 --- a/client/gui-gtk-4.0/happiness.c +++ b/client/gui-gtk-4.0/happiness.c @@ -39,11 +39,11 @@ #include "happiness.h" #include "mapview.h" -/* semi-arbitrary number that controls the width of the happiness widget */ +/* Semi-arbitrary number that controls the width of the happiness widget */ #define HAPPINESS_PIX_WIDTH 30 -#define FEELING_WIDTH (HAPPINESS_PIX_WIDTH * tileset_small_sprite_width(tileset)) -#define FEELING_HEIGHT (tileset_small_sprite_height(tileset)) +#define FEELING_WIDTH (HAPPINESS_PIX_WIDTH * tileset_small_sprite_width(tileset)) +#define FEELING_HEIGHT (tileset_small_sprite_height(tileset)) #define NUM_HAPPINESS_MODIFIERS 6 @@ -210,7 +210,7 @@ static struct happiness_dialog *create_happiness_dialog(struct city *pcity, GtkWidget *pic; GtkEventController *controller; - /* Set spacing between lines of citizens*/ + /* Set spacing between lines of citizens */ /* Happiness labels */ label = gtk_label_new(happiness_label_str[i]); diff --git a/client/gui-gtk-4.0/inteldlg.c b/client/gui-gtk-4.0/inteldlg.c index 55b118cdea..e10005cd6d 100644 --- a/client/gui-gtk-4.0/inteldlg.c +++ b/client/gui-gtk-4.0/inteldlg.c @@ -273,7 +273,7 @@ static struct intel_dialog *create_intel_dialog(struct player *p) gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM); gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(shell))), notebook); - /* overview tab. */ + /* Overview tab. */ table = gtk_grid_new(); gtk_widget_set_margin_bottom(table, 6); gtk_widget_set_margin_end(table, 6); @@ -304,7 +304,7 @@ static struct intel_dialog *create_intel_dialog(struct player *p) } } - /* diplomacy tab. */ + /* Diplomacy tab. */ pdialog->diplstates = gtk_tree_store_new(1, G_TYPE_STRING); view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdialog->diplstates)); @@ -333,7 +333,7 @@ static struct intel_dialog *create_intel_dialog(struct player *p) gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); label = gtk_label_new_with_mnemonic(_("_Diplomacy")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label); @@ -359,12 +359,12 @@ static struct intel_dialog *create_intel_dialog(struct player *p) rend = gtk_cell_renderer_toggle_new(); col = gtk_tree_view_column_new_with_attributes(NULL, rend, - "active", 0, NULL); + "active", 0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); rend = gtk_cell_renderer_text_new(); col = gtk_tree_view_column_new_with_attributes(NULL, rend, - "text", 1, NULL); + "text", 1, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); sw = gtk_scrolled_window_new(); @@ -372,7 +372,7 @@ static struct intel_dialog *create_intel_dialog(struct player *p) gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); label = gtk_label_new_with_mnemonic(_("_Techs")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label); @@ -418,7 +418,7 @@ static struct intel_wonder_dialog *create_intel_wonder_dialog(struct player *p) pdialog->rule = gtk_label_new("-"); - /* columns: 0 - wonder name, 1 - location (city/unknown/lost), + /* Columns: 0 - wonder name, 1 - location (city/unknown/lost), * 2 - strikethrough (for lost or obsolete), * 3 - font weight (great wonders in bold) */ pdialog->wonders = gtk_list_store_new(4, G_TYPE_STRING, @@ -491,13 +491,13 @@ void update_intel_dialog(struct player *p) bool embassy_knowledge = global_observer || team_has_embassy(me->team, p); bool trade_knowledge = global_observer || p == me || could_intel_with_player(me, p); - /* window title. */ + /* Window title. */ gchar *title = g_strdup_printf(_("Foreign Intelligence: %s Empire"), - nation_adjective_for_player(p)); + nation_adjective_for_player(p)); gtk_window_set_title(GTK_WINDOW(pdialog->shell), title); g_free(title); - /* diplomacy tab. */ + /* Diplomacy tab. */ gtk_tree_store_clear(pdialog->diplstates); for (i = 0; i < ARRAY_SIZE(diplstates); i++) { @@ -518,18 +518,18 @@ void update_intel_dialog(struct player *p) GValue v = { 0, }; if (other == p || !other->is_alive) { - continue; + continue; } state = player_diplstate_get(p, other); gtk_tree_store_append(pdialog->diplstates, &it, - &diplstates[state->type]); + &diplstates[state->type]); g_value_init(&v, G_TYPE_STRING); g_value_set_static_string(&v, player_name(other)); gtk_tree_store_set_value(pdialog->diplstates, &it, 0, &v); g_value_unset(&v); } players_iterate_end; - /* techs tab. */ + /* Techs tab. */ gtk_list_store_clear(pdialog->techs); mresearch = research_get(client_player()); @@ -549,7 +549,7 @@ void update_intel_dialog(struct player *p) } } advance_index_iterate_end; - /* table labels. */ + /* Table labels. */ for (i = 0; i < ARRAY_SIZE(pdialog->table_labels); i++) { if (pdialog->table_labels[i]) { struct city *pcity; @@ -612,7 +612,7 @@ void update_intel_dialog(struct player *p) break; case A_UNSET: if (embassy_knowledge) { - /* TRANS: missing value */ + /* TRANS: Missing value */ buf = g_strdup(_("(none)")); } else { buf = g_strdup(_("(Unknown)")); @@ -639,7 +639,7 @@ void update_intel_dialog(struct player *p) if (buf) { gtk_label_set_text(GTK_LABEL(pdialog->table_labels[i]), buf); - g_free(buf); + g_free(buf); } } } @@ -709,7 +709,7 @@ void update_intel_wonder_dialog(struct player *p) 0, improvement_name_translation(impr), 1, cityname, 2, is_lost, - /* font weight: great wonders in bold */ + /* Font weight: great wonders in bold */ 3, is_great_wonder(impr) ? 700 : 400, -1); } diff --git a/client/gui-gtk-4.0/inteldlg.h b/client/gui-gtk-4.0/inteldlg.h index 06db9e8435..1100d63ab0 100644 --- a/client/gui-gtk-4.0/inteldlg.h +++ b/client/gui-gtk-4.0/inteldlg.h @@ -23,4 +23,4 @@ void popup_intel_wonder_dialog(struct player *p); void update_intel_wonder_dialog(struct player *p); void close_intel_wonder_dialog(struct player *p); -#endif /* FC__INTELDLG_H */ +#endif /* FC__INTELDLG_H */ diff --git a/client/gui-gtk-4.0/mapview.c b/client/gui-gtk-4.0/mapview.c index 6a579558cc..3e92c86343 100644 --- a/client/gui-gtk-4.0/mapview.c +++ b/client/gui-gtk-4.0/mapview.c @@ -33,7 +33,7 @@ /* common */ #include "game.h" -#include "government.h" /* government_graphic() */ +#include "government.h" /* government_graphic() */ #include "map.h" #include "nation.h" #include "player.h" @@ -264,7 +264,7 @@ void update_mouse_cursor(enum cursor_type new_cursor_type) /**********************************************************************//** Update the information label which gives info on the current unit and the - square under the current unit, for specified unit. Note that in practice + square under the current unit, for specified unit. Note that in practice punit is always the focus unit. Clears label if punit is NULL. Also updates the cursor for the map_canvas (this is related because the @@ -278,10 +278,10 @@ void update_unit_info_label(struct unit_list *punits) label = gtk_frame_get_label_widget(GTK_FRAME(unit_info_frame)); gtk_label_set_text(GTK_LABEL(label), - get_unit_info_label_text1(punits)); + get_unit_info_label_text1(punits)); gtk_label_set_text(GTK_LABEL(unit_info_label), - get_unit_info_label_text2(punits, 0)); + get_unit_info_label_text2(punits, 0)); update_unit_pix_label(punits); } @@ -296,7 +296,7 @@ GdkPixbuf *get_thumb_pixbuf(int onoff) /**********************************************************************//** Set information for the indicator icons typically shown in the main - client window. The parameters tell which sprite to use for the + client window. The parameters tell which sprite to use for the indicator. **************************************************************************/ void set_indicator_icons(struct sprite *bulb, struct sprite *sol, @@ -348,6 +348,7 @@ struct canvas *get_overview_window(void) if (can_client_change_view()) { gtk_widget_queue_draw(overview_canvas); } + return NULL; } @@ -414,10 +415,10 @@ void map_canvas_draw(GtkDrawingArea *w, cairo_t *cr, int width, int height, gpointer data) { if (can_client_change_view() && !map_is_empty() && !mapview_is_frozen()) { - /* First we mark the area to be updated as dirty. Then we unqueue + /* First we mark the area to be updated as dirty. Then we unqueue * any pending updates, to make sure only the most up-to-date data * is written (otherwise drawing bugs happen when old data is copied - * to screen). Then we draw all changed areas to the screen. */ + * to screen). Then we draw all changed areas to the screen. */ update_animation(); unqueue_mapview_updates(FALSE); cairo_set_source_surface(cr, mapview.store->surface, 0, 0); @@ -446,8 +447,8 @@ void dirty_all(void) } /**********************************************************************//** - Flush all regions that have been previously marked as dirty. See - dirty_rect and dirty_all. This function is generally called after we've + Flush all regions that have been previously marked as dirty. See + dirty_rect() and dirty_all(). This function is generally called after we've processed a batch of drawing operations. **************************************************************************/ void flush_dirty(void) @@ -548,9 +549,9 @@ void pixmap_put_overlay_tile(GdkSurface *pixmap, float zoom, Only used for isometric view. **************************************************************************/ void pixmap_put_overlay_tile_draw(struct canvas *pcanvas, - int canvas_x, int canvas_y, - struct sprite *ssprite, - bool fog) + int canvas_x, int canvas_y, + struct sprite *ssprite, + bool fog) { cairo_t *cr; int sswidth, ssheight; @@ -622,7 +623,7 @@ void pixmap_put_overlay_tile_draw(struct canvas *pcanvas, } /**********************************************************************//** - Draws a cross-hair overlay on a tile + Draws a cross-hair overlay on a tile **************************************************************************/ void put_cross_overlay_tile(struct tile *ptile) { @@ -632,8 +633,8 @@ void put_cross_overlay_tile(struct tile *ptile) GtkNative *nat = gtk_widget_get_native(map_canvas); pixmap_put_overlay_tile(gtk_native_get_surface(nat), map_zoom, - canvas_x / map_zoom, canvas_y / map_zoom, - get_attention_crosshair_sprite(tileset)); + canvas_x / map_zoom, canvas_y / map_zoom, + get_attention_crosshair_sprite(tileset)); } } @@ -696,11 +697,11 @@ void update_map_canvas_scrollbars_size(void) map_vadj); g_signal_connect(map_hadj, "value_changed", - G_CALLBACK(scrollbar_jump_callback), - GINT_TO_POINTER(TRUE)); + G_CALLBACK(scrollbar_jump_callback), + GINT_TO_POINTER(TRUE)); g_signal_connect(map_vadj, "value_changed", - G_CALLBACK(scrollbar_jump_callback), - GINT_TO_POINTER(FALSE)); + G_CALLBACK(scrollbar_jump_callback), + GINT_TO_POINTER(FALSE)); } /**********************************************************************//** @@ -758,7 +759,7 @@ void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h) } /**********************************************************************//** - This function is called when the tileset is changed. + This function is called when the tileset has changed. **************************************************************************/ void tileset_changed(void) { @@ -768,7 +769,7 @@ void tileset_changed(void) blank_max_unit_size(); editgui_tileset_changed(); - /* keep the icon of the executable on Windows (see PR#36491) */ + /* Keep the icon of the executable on Windows (see PR#36491) */ #ifndef FREECIV_MSWINDOWS { /* Only call this after tileset_load_tiles is called. */ diff --git a/client/gui-gtk-4.0/mapview.h b/client/gui-gtk-4.0/mapview.h index 7702eefca2..543009aff6 100644 --- a/client/gui-gtk-4.0/mapview.h +++ b/client/gui-gtk-4.0/mapview.h @@ -59,4 +59,4 @@ void mapview_freeze(void); void mapview_thaw(void); bool mapview_is_frozen(void); -#endif /* FC__MAPVIEW_H */ +#endif /* FC__MAPVIEW_H */ diff --git a/client/gui-gtk-4.0/pages.c b/client/gui-gtk-4.0/pages.c index 07e92d58ee..863232f297 100644 --- a/client/gui-gtk-4.0/pages.c +++ b/client/gui-gtk-4.0/pages.c @@ -880,6 +880,7 @@ static void clear_network_statusbar(void) txt = g_queue_pop_head(statusbar_queue); free(txt); } + gtk_label_set_text(GTK_LABEL(statusbar), ""); } @@ -1066,15 +1067,15 @@ static void connect_callback(GtkWidget *w, gpointer data) sz_strlcpy(reply.password, gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(network_confirm_password)))); if (strncmp(reply.password, fc_password, MAX_LEN_NAME) == 0) { - fc_password[0] = '\0'; - send_packet_authentication_reply(&client.conn, &reply); + fc_password[0] = '\0'; + send_packet_authentication_reply(&client.conn, &reply); - set_connection_state(WAITING_TYPE); + set_connection_state(WAITING_TYPE); } else { - append_network_statusbar(_("Passwords don't match, enter password."), + append_network_statusbar(_("Passwords don't match, enter password."), TRUE); - set_connection_state(NEW_PASSWORD_TYPE); + set_connection_state(NEW_PASSWORD_TYPE); } } return; @@ -1096,9 +1097,9 @@ static void connect_callback(GtkWidget *w, gpointer data) Connect on list item double-click. **************************************************************************/ static void network_activate_callback(GtkTreeView *view, - GtkTreePath *arg1, - GtkTreeViewColumn *arg2, - gpointer data) + GtkTreePath *arg1, + GtkTreeViewColumn *arg2, + gpointer data) { connect_callback(NULL, data); } @@ -1261,7 +1262,7 @@ GtkWidget *create_network_page(void) gtk_widget_set_margin_bottom(sw, 4); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sw, label); @@ -1312,7 +1313,7 @@ GtkWidget *create_network_page(void) gtk_widget_set_margin_bottom(sw, 4); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); if (GUI_GTK_OPTION(metaserver_tab_first)) { gtk_notebook_prepend_page(GTK_NOTEBOOK(notebook), sw, label); @@ -1342,12 +1343,12 @@ GtkWidget *create_network_page(void) gtk_grid_attach(GTK_GRID(table), network_host, 1, 0, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", network_host, - "label", _("_Host:"), - "xalign", 0.0, - "yalign", 0.5, - NULL); + "use-underline", TRUE, + "mnemonic-widget", network_host, + "label", _("_Host:"), + "xalign", 0.0, + "yalign", 0.5, + NULL); network_host_label = label; gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1); @@ -1357,12 +1358,12 @@ GtkWidget *create_network_page(void) gtk_grid_attach(GTK_GRID(table), network_port, 1, 1, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", network_port, - "label", _("_Port:"), - "xalign", 0.0, - "yalign", 0.5, - NULL); + "use-underline", TRUE, + "mnemonic-widget", network_port, + "label", _("_Port:"), + "xalign", 0.0, + "yalign", 0.5, + NULL); network_port_label = label; gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1); @@ -1373,12 +1374,12 @@ GtkWidget *create_network_page(void) gtk_grid_attach(GTK_GRID(table), network_login, 1, 3, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", network_login, - "label", _("_Login:"), - "xalign", 0.0, - "yalign", 0.5, - NULL); + "use-underline", TRUE, + "mnemonic-widget", network_login, + "label", _("_Login:"), + "xalign", 0.0, + "yalign", 0.5, + NULL); gtk_widget_set_margin_top(label, 10); network_login_label = label; gtk_grid_attach(GTK_GRID(table), label, 0, 3, 1, 1); @@ -1390,12 +1391,12 @@ GtkWidget *create_network_page(void) gtk_grid_attach(GTK_GRID(table), network_password, 1, 4, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", network_password, - "label", _("Pass_word:"), - "xalign", 0.0, - "yalign", 0.5, - NULL); + "use-underline", TRUE, + "mnemonic-widget", network_password, + "label", _("Pass_word:"), + "xalign", 0.0, + "yalign", 0.5, + NULL); network_password_label = label; gtk_grid_attach(GTK_GRID(table), label, 0, 4, 1, 1); @@ -1406,12 +1407,12 @@ GtkWidget *create_network_page(void) gtk_grid_attach(GTK_GRID(table), network_confirm_password, 1, 5, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", network_confirm_password, - "label", _("Conf_irm Password:"), - "xalign", 0.0, - "yalign", 0.5, - NULL); + "use-underline", TRUE, + "mnemonic-widget", network_confirm_password, + "label", _("Conf_irm Password:"), + "xalign", 0.0, + "yalign", 0.5, + NULL); network_confirm_password_label = label; gtk_grid_attach(GTK_GRID(table), label, 0, 5, 1, 1); @@ -1433,7 +1434,7 @@ GtkWidget *create_network_page(void) sw = gtk_scrolled_window_new(); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); gtk_box_append(GTK_BOX(hbox), sw); @@ -1618,7 +1619,7 @@ static void ai_skill_callback(GtkWidget *w, gpointer data) } /* HACK: sometimes when creating the ruleset combo the value is set without - * the user's control. In this case we don't want to do a /read. */ + * the user's control. In this case we don't want to do a /read. */ static bool no_ruleset_callback = FALSE; /**********************************************************************//** @@ -1832,8 +1833,8 @@ static void show_conn_popup(struct player *pplayer, struct connection *pconn) /* Show popup. */ popup = gtk_message_dialog_new(NULL, 0, - GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, - "%s", buf); + GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, + "%s", buf); gtk_window_set_title(GTK_WINDOW(popup), _("Player/conn info")); setup_dialog(popup, toplevel); g_signal_connect(popup, "response", G_CALLBACK(gtk_window_destroy), NULL); @@ -2769,6 +2770,7 @@ GtkWidget *create_start_page(void) GTK_UPDATE_IF_VALID); if (server_optset != NULL) { struct option *paifill = optset_option_by_name(server_optset, "aifill"); + if (paifill) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), option_int_get(paifill)); @@ -2780,8 +2782,8 @@ GtkWidget *create_start_page(void) gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", spin, + "use-underline", TRUE, + "mnemonic-widget", spin, /* TRANS: Keep individual lines short */ "label", _("Number of _Players\n(including AI):"), "xalign", 0.0, @@ -2807,8 +2809,8 @@ GtkWidget *create_start_page(void) gtk_grid_attach(GTK_GRID(table), ai_lvl_combobox, 1, 1, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", ai_lvl_combobox, + "use-underline", TRUE, + "mnemonic-widget", ai_lvl_combobox, "label", _("AI Skill _Level:"), "xalign", 0.0, "yalign", 0.5, @@ -2822,8 +2824,8 @@ GtkWidget *create_start_page(void) gtk_grid_attach(GTK_GRID(table), ruleset_combo, 1, 2, 1, 1); label = g_object_new(GTK_TYPE_LABEL, - "use-underline", TRUE, - "mnemonic-widget", GTK_COMBO_BOX_TEXT(ruleset_combo), + "use-underline", TRUE, + "mnemonic-widget", GTK_COMBO_BOX_TEXT(ruleset_combo), "label", _("Ruleset:"), "xalign", 0.0, "yalign", 0.5, @@ -3072,7 +3074,7 @@ GtkWidget *create_load_page(void) gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(sw), 300); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); gtk_grid_attach(GTK_GRID(sbox), sw, 0, sbox_row++, 1, 1); @@ -3114,11 +3116,11 @@ static void scenario_list_callback(void) if (gtk_tree_selection_get_selected(scenario_selection, NULL, &it)) { gtk_tree_model_get(GTK_TREE_MODEL(scenario_store), &it, - 2, &description, -1); + 2, &description, -1); gtk_tree_model_get(GTK_TREE_MODEL(scenario_store), &it, - 3, &authors, -1); + 3, &authors, -1); gtk_tree_model_get(GTK_TREE_MODEL(scenario_store), &it, - 1, &filename, -1); + 1, &filename, -1); gtk_tree_model_get(GTK_TREE_MODEL(scenario_store), &it, 4, &ver, -1); filename = skip_to_basename(filename); @@ -3368,7 +3370,7 @@ GtkWidget *create_scenario_page(void) sw = gtk_scrolled_window_new(); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), view); gtk_grid_attach(GTK_GRID(sbox), sw, 0, 0, 1, 2); @@ -3383,7 +3385,7 @@ GtkWidget *create_scenario_page(void) sw = gtk_scrolled_window_new(); gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw), TRUE); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), text); text = gtk_text_view_new(); @@ -3706,7 +3708,7 @@ void mapimg_client_save(const char *filename) } /**********************************************************************//** - Set the list of available rulesets. The default ruleset should be + Set the list of available rulesets. The default ruleset should be "default", and if the user changes this then set_ruleset() should be called. **************************************************************************/ @@ -3726,7 +3728,7 @@ void set_rulesets(int num_rulesets, char **rulesets) no_ruleset_callback = TRUE; - /* HACK: server should tell us the current ruleset. */ + /* HACK: Server should tell us the current ruleset. */ gtk_combo_box_set_active(GTK_COMBO_BOX(ruleset_combo), def_idx); no_ruleset_callback = FALSE; diff --git a/client/gui-gtk-4.0/pages.h b/client/gui-gtk-4.0/pages.h index b58d8a3651..1db5aef97a 100644 --- a/client/gui-gtk-4.0/pages.h +++ b/client/gui-gtk-4.0/pages.h @@ -41,4 +41,4 @@ void ai_fill_changed_by_server(int aifill); void destroy_server_scans(void); -#endif /* FC__PAGES_H */ +#endif /* FC__PAGES_H */ diff --git a/client/gui-gtk-4.0/plrdlg.c b/client/gui-gtk-4.0/plrdlg.c index fb1650a60a..43ecb0831f 100644 --- a/client/gui-gtk-4.0/plrdlg.c +++ b/client/gui-gtk-4.0/plrdlg.c @@ -655,10 +655,10 @@ void create_players_dialog(void) g_object_set(renderer, "style-set", TRUE, "weight-set", TRUE, NULL); col = gtk_tree_view_column_new_with_attributes(pcol->title, renderer, - "text", i, - "style", PLR_DLG_COL_STYLE, - "weight", PLR_DLG_COL_WEIGHT, - NULL); + "text", i, + "style", PLR_DLG_COL_STYLE, + "weight", PLR_DLG_COL_WEIGHT, + NULL); gtk_tree_view_column_set_sort_column_id(col, i); break; case COL_RIGHT_TEXT: @@ -666,10 +666,10 @@ void create_players_dialog(void) g_object_set(renderer, "style-set", TRUE, "weight-set", TRUE, NULL); col = gtk_tree_view_column_new_with_attributes(pcol->title, renderer, - "text", i, - "style", PLR_DLG_COL_STYLE, - "weight", PLR_DLG_COL_WEIGHT, - NULL); + "text", i, + "style", PLR_DLG_COL_STYLE, + "weight", PLR_DLG_COL_WEIGHT, + NULL); gtk_tree_view_column_set_sort_column_id(col, i); g_object_set(renderer, "xalign", 1.0, NULL); gtk_tree_view_column_set_alignment(col, 1.0); @@ -748,7 +748,7 @@ GdkPixbuf *get_flag(const struct nation_type *nation) flag = get_nation_flag_sprite(tileset, nation); - /* calculate the bounding box ... */ + /* Calculate the bounding box ... */ sprite_get_bounding_box(flag, &x0, &y0, &x1, &y1); fc_assert_ret_val(x0 != -1, NULL); @@ -759,10 +759,10 @@ GdkPixbuf *get_flag(const struct nation_type *nation) w = (x1 - x0) + 1; h = (y1 - y0) + 1; - /* if the flag is smaller then 5 x 5, something is wrong */ + /* If the flag is smaller then 5 x 5, something is wrong */ fc_assert_ret_val(w >= MIN_DIMENSION && h >= MIN_DIMENSION, NULL); - /* croping */ + /* Croping */ im = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); if (im != NULL) { GdkPixbuf *pixbuf = sprite_get_pixbuf(flag); @@ -772,7 +772,7 @@ GdkPixbuf *get_flag(const struct nation_type *nation) g_object_unref(G_OBJECT(pixbuf)); } - /* and finally store the scaled flag pixbuf in the static flags array */ + /* Finally store the scaled flag pixbuf in the static flags array */ return im; } @@ -974,7 +974,7 @@ void players_war_callback(GSimpleAction *action, GVariant *parameter, diplstate_type_translated_name(newstate)); } - /* can be any pact clause */ + /* Can be any pact clause */ confirm_cancel_pact(CLAUSE_CEASEFIRE, plrno, astr_to_str(&title), astr_to_str(&question)); } diff --git a/client/gui-gtk-4.0/plrdlg.h b/client/gui-gtk-4.0/plrdlg.h index 1be2ffa3cd..a626bc3359 100644 --- a/client/gui-gtk-4.0/plrdlg.h +++ b/client/gui-gtk-4.0/plrdlg.h @@ -24,4 +24,4 @@ GdkPixbuf *create_player_icon(const struct player *plr); extern struct gui_dialog *players_dialog_shell; -#endif /* FC__PLRDLG_H */ +#endif /* FC__PLRDLG_H */ diff --git a/client/gui-gtk-4.0/repodlgs.c b/client/gui-gtk-4.0/repodlgs.c index ff0a482c5e..454fd13ba2 100644 --- a/client/gui-gtk-4.0/repodlgs.c +++ b/client/gui-gtk-4.0/repodlgs.c @@ -267,7 +267,7 @@ static gboolean science_diagram_right_button_up(GtkGestureClick *gesture, static void science_diagram_update(GtkDrawingArea *widget, cairo_t *cr, int width, int height, gpointer data) { - /* FIXME: this currently redraws everything! */ + /* FIXME: This currently redraws everything! */ struct canvas canvas = FC_STATIC_CANVAS_INIT; struct reqtree *reqtree = g_object_get_data(G_OBJECT(widget), "reqtree"); int rtwidth, rtheight; @@ -824,7 +824,7 @@ enum economy_report_columns { ERD_COL_COUNT, ERD_COL_COST, ERD_COL_TOTAL_COST, - ERD_COL_EMPTY, /* will make an empty space for scroll bar */ + ERD_COL_EMPTY, /* Will make an empty space for scroll bar */ /* Not visible. */ ERD_COL_IS_IMPROVEMENT, @@ -873,12 +873,12 @@ economy_report_column_name(enum economy_report_columns col) /* TRANS: Upkeep total, count*cost. */ return _("U Total"); case ERD_COL_EMPTY: - /* empty space for scrollbar*/ + /* Empty space for scrollbar*/ return " "; case ERD_COL_IS_IMPROVEMENT: case ERD_COL_CID: case ERD_COL_NUM: - break; /* no more columns will be displayed after reaching this */ + break; /* No more columns will be displayed after reaching this */ } return NULL; @@ -1023,6 +1023,7 @@ static void economy_report_command_callback(struct gui_dialog *pdialog, || (ERD_RES_SELL_REDUNDANT == response))) { bool redundant = (ERD_RES_SELL_REDUNDANT == response); gint count; + gtk_tree_model_get(model, &iter, redundant ? ERD_COL_REDUNDANT : ERD_COL_COUNT, &count, -1); @@ -1117,6 +1118,7 @@ static void economy_report_selection_callback(GtkTreeSelection *selection, { bool can_sell = can_sell_building(selected.value.building); gint redundant; + gtk_tree_model_get(model, &iter, ERD_COL_REDUNDANT, &redundant, -1); gui_dialog_set_response_sensitive(pdialog, ERD_RES_SELL_REDUNDANT, @@ -1197,6 +1199,7 @@ static void economy_report_init(struct economy_report *preport) #endif } else { bool is_redundant = (i == ERD_COL_REDUNDANT); + renderer = gtk_cell_renderer_text_new(); if (is_redundant) { /* Special treatment: hide "Redundant" column for units */ @@ -1327,7 +1330,7 @@ enum units_report_columns { URD_COL_SHIELD, URD_COL_FOOD, URD_COL_GOLD, - URD_COL_EMPTY, /* empty space for scrollbar */ + URD_COL_EMPTY, /* Empty space for scrollbar */ /* Not visible. */ URD_COL_TEXT_WEIGHT, diff --git a/client/gui-gtk-4.0/repodlgs.h b/client/gui-gtk-4.0/repodlgs.h index 20ecfcbfb4..3d9809afd8 100644 --- a/client/gui-gtk-4.0/repodlgs.h +++ b/client/gui-gtk-4.0/repodlgs.h @@ -20,4 +20,4 @@ void science_report_dialog_popdown(void); void economy_report_dialog_popdown(void); void units_report_dialog_popdown(void); -#endif /* FC__REPODLGS_H */ +#endif /* FC__REPODLGS_H */ diff --git a/client/gui-gtk-4.0/wldlg.c b/client/gui-gtk-4.0/wldlg.c index 7fd5ff513d..9c8acbb39d 100644 --- a/client/gui-gtk-4.0/wldlg.c +++ b/client/gui-gtk-4.0/wldlg.c @@ -1558,11 +1558,11 @@ void refresh_worklist(GtkWidget *editor) gtk_tree_path_free(path); } - /* refresh target worklist. */ + /* Refresh target worklist. */ model = GTK_TREE_MODEL(ptr->dst); exists = gtk_tree_model_get_iter_first(model, &it); - /* dance around worklist braindamage. */ + /* Dance around worklist braindamage. */ if (ptr->pcity != NULL) { city_get_queue(ptr->pcity, &queue); } else { @@ -1640,7 +1640,7 @@ static void commit_worklist(struct worklist_data *ptr) gint id; struct universal univ; - /* oops, the player has a worklist longer than what we can store. */ + /* Oops, the player has a worklist longer than what we can store. */ if (i >= MAX_LEN_WORKLIST) { break; } diff --git a/client/gui-gtk-4.0/wldlg.h b/client/gui-gtk-4.0/wldlg.h index 7e6cd239bf..0ada9d9252 100644 --- a/client/gui-gtk-4.0/wldlg.h +++ b/client/gui-gtk-4.0/wldlg.h @@ -25,10 +25,10 @@ #include "wldlg_g.h" -/* the global worklist view. */ +/* The global worklist view. */ void popup_worklists_report(void); -/* an individual worklist. */ +/* An individual worklist. */ GtkWidget *create_worklist(void); void reset_city_worklist(GtkWidget *editor, struct city *pcity); void refresh_worklist(GtkWidget *editor); -- 2.39.2