summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-10-19 09:19:47 -0700
committerMatthias Clasen <mclasen@redhat.com>2022-10-20 22:34:41 -0400
commitaac04a09956c2e733a16c01eb2a21214ebf54fb0 (patch)
treeed0684aa59fb31a0b3cbfa3b5f5a629e2f163197
parent8af191e52dc664ae32917cdb020c4d8be2f4094d (diff)
downloadgtk+-aac04a09956c2e733a16c01eb2a21214ebf54fb0.tar.gz
filechoosercell: Bind "item" and "selected" to cell
-rw-r--r--gtk/gtkfilechoosercell.c30
-rw-r--r--gtk/ui/gtkfilechooserwidget.ui30
2 files changed, 60 insertions, 0 deletions
diff --git a/gtk/gtkfilechoosercell.c b/gtk/gtkfilechoosercell.c
index b10c2cf02e..07d4dc7c9f 100644
--- a/gtk/gtkfilechoosercell.c
+++ b/gtk/gtkfilechoosercell.c
@@ -31,6 +31,8 @@ struct _GtkFileChooserCell
{
GtkWidget parent_instance;
+ GFileInfo *item;
+ gboolean selected;
guint position;
};
@@ -44,6 +46,8 @@ G_DEFINE_TYPE (GtkFileChooserCell, gtk_file_chooser_cell, GTK_TYPE_WIDGET)
enum
{
PROP_POSITION = 1,
+ PROP_SELECTED,
+ PROP_ITEM,
};
static void
@@ -126,6 +130,14 @@ gtk_file_chooser_cell_set_property (GObject *object,
self->position = g_value_get_uint (value);
break;
+ case PROP_SELECTED:
+ self->selected = g_value_get_boolean (value);
+ break;
+
+ case PROP_ITEM:
+ self->item = g_value_get_object (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -146,6 +158,14 @@ gtk_file_chooser_cell_get_property (GObject *object,
g_value_set_uint (value, self->position);
break;
+ case PROP_SELECTED:
+ g_value_set_boolean (value, self->selected);
+ break;
+
+ case PROP_ITEM:
+ g_value_set_object (value, self->item);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -168,6 +188,16 @@ gtk_file_chooser_cell_class_init (GtkFileChooserCellClass *klass)
0, G_MAXUINT, 0,
GTK_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_SELECTED,
+ g_param_spec_boolean ("selected", NULL, NULL,
+ FALSE,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_ITEM,
+ g_param_spec_object ("item", NULL, NULL,
+ G_TYPE_FILE_INFO,
+ GTK_PARAM_READWRITE));
+
gtk_widget_class_set_css_name (widget_class, I_("filelistcell"));
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index bfd4a0e9db..5a12539965 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -159,6 +159,12 @@
<binding name="position">
<lookup name="position">GtkListItem</lookup>
</binding>
+ <binding name="item">
+ <lookup name="item">GtkListItem</lookup>
+ </binding>
+ <binding name="selected">
+ <lookup name="selected">GtkListItem</lookup>
+ </binding>
<child>
<object class="GtkBox">
<binding name="tooltip-text">
@@ -216,6 +222,12 @@
<binding name="position">
<lookup name="position">GtkListItem</lookup>
</binding>
+ <binding name="item">
+ <lookup name="item">GtkListItem</lookup>
+ </binding>
+ <binding name="selected">
+ <lookup name="selected">GtkListItem</lookup>
+ </binding>
<child>
<object class="GtkInscription">
<property name="hexpand">1</property>
@@ -259,6 +271,12 @@
<binding name="position">
<lookup name="position">GtkListItem</lookup>
</binding>
+ <binding name="item">
+ <lookup name="item">GtkListItem</lookup>
+ </binding>
+ <binding name="selected">
+ <lookup name="selected">GtkListItem</lookup>
+ </binding>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
@@ -300,6 +318,12 @@
<binding name="position">
<lookup name="position">GtkListItem</lookup>
</binding>
+ <binding name="item">
+ <lookup name="item">GtkListItem</lookup>
+ </binding>
+ <binding name="selected">
+ <lookup name="selected">GtkListItem</lookup>
+ </binding>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
@@ -340,6 +364,12 @@
<binding name="position">
<lookup name="position">GtkListItem</lookup>
</binding>
+ <binding name="item">
+ <lookup name="item">GtkListItem</lookup>
+ </binding>
+ <binding name="selected">
+ <lookup name="selected">GtkListItem</lookup>
+ </binding>
<child>
<object class="GtkBox">
<property name="spacing">6</property>