Project

General

Profile

Feature #1116 ยป 0075-gtk4x-Implement-FcFCityRow-for-finddlg.c.patch

Marko Lindqvist, 11/15/2024 07:33 PM

View differences:

client/gui-gtk-5.0/cityrep.c
static GActionGroup *cityrep_group;
static GMenu *display_menu;
#define FC_TYPE_CITY_ROW (fc_city_row_get_type())
#define FC_TYPE_RCITY_ROW (fc_rcity_row_get_type())
G_DECLARE_FINAL_TYPE(FcCityRow, fc_city_row, FC, CITY_ROW, GObject)
G_DECLARE_FINAL_TYPE(FcRCityRow, fc_rcity_row, FC, RCITY_ROW, GObject)
struct _FcCityRow
struct _FcRCityRow
{
GObject parent_instance;
......
int city_id;
};
struct _FcCityClass
struct _FcRCityClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE(FcCityRow, fc_city_row, G_TYPE_OBJECT)
G_DEFINE_TYPE(FcRCityRow, fc_rcity_row, G_TYPE_OBJECT)
/**********************************************************************//**
Finalizing method for FcCityRow class
Finalizing method for FcRCityRow class
**************************************************************************/
static void fc_city_row_finalize(GObject *gobject)
static void fc_rcity_row_finalize(GObject *gobject)
{
FcCityRow *row = FC_CITY_ROW(gobject);
FcRCityRow *row = FC_RCITY_ROW(gobject);
free(row->columns);
row->columns = nullptr;
G_OBJECT_CLASS(fc_city_row_parent_class)->finalize(gobject);
G_OBJECT_CLASS(fc_rcity_row_parent_class)->finalize(gobject);
}
/**********************************************************************//**
Initialization method for FcCityRow class
Initialization method for FcRCityRow class
**************************************************************************/
static void
fc_city_row_class_init(FcCityRowClass *klass)
fc_rcity_row_class_init(FcRCityRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
object_class->finalize = fc_city_row_finalize;
object_class->finalize = fc_rcity_row_finalize;
}
/**********************************************************************//**
Initialization method for FcCityRow
Initialization method for FcRCityRow
**************************************************************************/
static void
fc_city_row_init(FcCityRow *self)
fc_rcity_row_init(FcRCityRow *self)
{
self->columns = fc_malloc(sizeof(char *) * NUM_CREPORT_COLS);
}
/**********************************************************************//**
FcCityRow creation method
FcRCityRow creation method
**************************************************************************/
static FcCityRow *fc_city_row_new(void)
static FcRCityRow *fc_rcity_row_new(void)
{
FcCityRow *result;
FcRCityRow *result;
result = g_object_new(FC_TYPE_CITY_ROW, nullptr);
result = g_object_new(FC_TYPE_RCITY_ROW, nullptr);
return result;
}
......
GtkListItem *list_item,
gpointer user_data)
{
FcCityRow *row;
FcRCityRow *row;
GtkWidget *child = gtk_list_item_get_child(list_item);
row = gtk_list_item_get_item(list_item);
......
/************************************************************************//**
Set the values of the city.
****************************************************************************/
static void city_store_set(FcCityRow *row, struct city *pcity)
static void city_store_set(FcRCityRow *row, struct city *pcity)
{
struct city_report_spec *spec;
char buf[64];
......
{
if (client_has_player()) {
city_list_iterate(client_player()->cities, pcity) {
FcCityRow *row = fc_city_row_new();
FcRCityRow *row = fc_rcity_row_new();
city_store_set(row, pcity);
g_list_store_append(G_LIST_STORE(store), row);
......
} else {
/* Global observer case. */
cities_iterate(pcity) {
FcCityRow *row = fc_city_row_new();
FcRCityRow *row = fc_rcity_row_new();
city_store_set(row, pcity);
g_list_store_append(G_LIST_STORE(store), row);
......
city_model_depr = city_report_dialog_store_new_depr();
city_store = g_list_store_new(FC_TYPE_CITY_ROW);
city_store = g_list_store_new(FC_TYPE_RCITY_ROW);
city_selection
= gtk_multi_selection_new(G_LIST_MODEL(city_store));
city_view = gtk_column_view_new(GTK_SELECTION_MODEL(city_selection));
client/gui-gtk-5.0/finddlg.c
static struct tile *pos;
#define FC_TYPE_FCITY_ROW (fc_fcity_row_get_type())
G_DECLARE_FINAL_TYPE(FcFCityRow, fc_fcity_row, FC, FCITY_ROW, GObject)
struct _FcFCityRow
{
GObject parent_instance;
char *clause;
};
struct _FcFCityClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE(FcFCityRow, fc_fcity_row, G_TYPE_OBJECT)
/**********************************************************************//**
Initialization method for FcFCityRow class
**************************************************************************/
static void
fc_fcity_row_class_init(FcFCityRowClass *klass)
{
}
/**********************************************************************//**
Initialization method for FcFCityRow
**************************************************************************/
static void
fc_fcity_row_init(FcFCityRow *self)
{
}
/**********************************************************************//**
FcFCityRow creation method
**************************************************************************/
#if 0
static FcFCityRow *fc_fcity_row_new(void)
{
FcFCityRow *result;
result = g_object_new(FC_TYPE_FCITY_ROW, nullptr);
return result;
}
#endif
/**********************************************************************//**
Popup the dialog 10% inside the main-window
**************************************************************************/
    (1-1/1)