cell renderer combo: Drop the priv pointer

This commit is contained in:
Matthias Clasen 2019-05-26 20:12:40 -04:00
parent b55f1b4c8f
commit ebc2bb9a2f

View File

@ -54,9 +54,6 @@ typedef struct _GtkCellRendererComboClass GtkCellRendererComboClass;
struct _GtkCellRendererCombo
{
GtkCellRendererText parent;
/*< private >*/
GtkCellRendererComboPrivate *priv;
};
struct _GtkCellRendererComboClass
@ -215,10 +212,7 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass)
static void
gtk_cell_renderer_combo_init (GtkCellRendererCombo *self)
{
GtkCellRendererComboPrivate *priv;
self->priv = gtk_cell_renderer_combo_get_instance_private (self);
priv = self->priv;
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (self);
priv->model = NULL;
priv->text_column = -1;
@ -249,7 +243,7 @@ static void
gtk_cell_renderer_combo_finalize (GObject *object)
{
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
GtkCellRendererComboPrivate *priv = cell->priv;
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (cell);
if (priv->model)
{
@ -267,7 +261,7 @@ gtk_cell_renderer_combo_get_property (GObject *object,
GParamSpec *pspec)
{
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
GtkCellRendererComboPrivate *priv = cell->priv;
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (cell);
switch (prop_id)
{
@ -293,7 +287,7 @@ gtk_cell_renderer_combo_set_property (GObject *object,
GParamSpec *pspec)
{
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (object);
GtkCellRendererComboPrivate *priv = cell->priv;
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (cell);
switch (prop_id)
{
@ -349,17 +343,14 @@ static void
gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
gpointer data)
{
GtkCellRendererCombo *cell = GTK_CELL_RENDERER_COMBO (data);
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (cell);
const gchar *path;
gchar *new_text = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
GtkCellRendererCombo *cell;
GtkEntry *entry;
gboolean canceled;
GtkCellRendererComboPrivate *priv;
cell = GTK_CELL_RENDERER_COMBO (data);
priv = cell->priv;
if (priv->focus_out_id > 0)
{
@ -421,12 +412,10 @@ find_text (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
GtkCellRendererComboPrivate *priv;
SearchData *search_data = (SearchData *)data;
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (search_data->cell);
gchar *text, *cell_text;
priv = search_data->cell->priv;
gtk_tree_model_get (model, iter, priv->text_column, &text, -1);
g_object_get (GTK_CELL_RENDERER_TEXT (search_data->cell),
"text", &cell_text,
@ -452,22 +441,17 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GtkCellRendererCombo *cell_combo;
GtkCellRendererText *cell_text;
GtkCellRendererCombo *cell_combo = GTK_CELL_RENDERER_COMBO (cell);
GtkCellRendererComboPrivate *priv = gtk_cell_renderer_combo_get_instance_private (cell_combo);
GtkWidget *combo;
SearchData search_data;
GtkCellRendererComboPrivate *priv;
gboolean editable;
gchar *text;
cell_text = GTK_CELL_RENDERER_TEXT (cell);
g_object_get (cell_text, "editable", &editable, NULL);
g_object_get (cell, "editable", &editable, NULL);
if (editable == FALSE)
return NULL;
cell_combo = GTK_CELL_RENDERER_COMBO (cell);
priv = cell_combo->priv;
if (priv->text_column < 0)
return NULL;
@ -480,7 +464,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo),
priv->text_column);
g_object_get (cell_text, "text", &text, NULL);
g_object_get (cell, "text", &text, NULL);
if (text)
gtk_editable_set_text (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (combo))), text);
g_free (text);