Project

General

Profile

Feature #1174 ยป 0053-gtk4x-Implement-bind-create-for-diplodlg.c-clause-li.patch

Marko Lindqvist, 12/07/2024 03:47 AM

View differences:

client/gui-gtk-5.0/diplodlg.c
}
}
/**********************************************************************//**
Clause table cell bind function
**************************************************************************/
static void clause_factory_bind(GtkSignalListItemFactory *self,
GtkListItem *list_item,
gpointer user_data)
{
FcClauseRow *row;
GtkWidget *child = gtk_list_item_get_child(list_item);
row = gtk_list_item_get_item(list_item);
gtk_label_set_text(GTK_LABEL(child), row->clause);
}
/**********************************************************************//**
Clause table cell setup function
**************************************************************************/
static void clause_factory_setup(GtkSignalListItemFactory *self,
GtkListItem *list_item,
gpointer user_data)
{
gtk_list_item_set_child(list_item, gtk_label_new(""));
}
/************************************************************************//**
Setups diplomacy dialog widgets.
****************************************************************************/
......
struct sprite *flag_spr;
GtkListStore *store;
GtkCellRenderer *rend;
GtkListItemFactory *factory;
int i;
struct Diplomacy_dialog *pdialog;
char plr_buf[4 * MAX_LEN_NAME];
......
store = gtk_list_store_new(1, G_TYPE_STRING);
pdialog->store = store;
factory = gtk_signal_list_item_factory_new();
g_signal_connect(factory, "bind", G_CALLBACK(clause_factory_bind),
nullptr);
g_signal_connect(factory, "setup", G_CALLBACK(clause_factory_setup),
nullptr);
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_widget_set_hexpand(view, TRUE);
gtk_widget_set_vexpand(view, TRUE);
    (1-1/1)