forked from AuroraMiddleware/gtk
listboxrow: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't provide much useful functionality anymore. See #2681
This commit is contained in:
parent
b8d1a9eb0d
commit
12ecbd1508
@ -228,7 +228,7 @@ selected_context_changed (GtkListBox *list, IconBrowserWindow *win)
|
|||||||
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (win->search), FALSE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (win->search), FALSE);
|
||||||
|
|
||||||
label = gtk_bin_get_child (GTK_BIN (row));
|
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
||||||
win->current_context = g_object_get_data (G_OBJECT (label), "context");
|
win->current_context = g_object_get_data (G_OBJECT (label), "context");
|
||||||
gtk_tree_model_filter_refilter (win->filter_model);
|
gtk_tree_model_filter_refilter (win->filter_model);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "gtk/gtklistbox.h"
|
#include "gtk/gtklistbox.h"
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkListBoxRowAccessible, gtk_list_box_row_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
|
G_DEFINE_TYPE (GtkListBoxRowAccessible, gtk_list_box_row_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_box_row_accessible_init (GtkListBoxRowAccessible *accessible)
|
gtk_list_box_row_accessible_init (GtkListBoxRowAccessible *accessible)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "gtkactionhelperprivate.h"
|
#include "gtkactionhelperprivate.h"
|
||||||
#include "gtkadjustmentprivate.h"
|
#include "gtkadjustmentprivate.h"
|
||||||
|
#include "gtkbinlayout.h"
|
||||||
#include "gtkbuildable.h"
|
#include "gtkbuildable.h"
|
||||||
#include "gtkcssnodeprivate.h"
|
#include "gtkcssnodeprivate.h"
|
||||||
#include "gtkgestureclick.h"
|
#include "gtkgestureclick.h"
|
||||||
@ -156,6 +157,7 @@ struct _GtkListBoxClass
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
GtkWidget *child;
|
||||||
GSequenceIter *iter;
|
GSequenceIter *iter;
|
||||||
GtkWidget *header;
|
GtkWidget *header;
|
||||||
GtkActionHelper *action_helper;
|
GtkActionHelper *action_helper;
|
||||||
@ -197,6 +199,7 @@ enum {
|
|||||||
ROW_PROP_0,
|
ROW_PROP_0,
|
||||||
ROW_PROP_ACTIVATABLE,
|
ROW_PROP_ACTIVATABLE,
|
||||||
ROW_PROP_SELECTABLE,
|
ROW_PROP_SELECTABLE,
|
||||||
|
ROW_PROP_CHILD,
|
||||||
|
|
||||||
/* actionable properties */
|
/* actionable properties */
|
||||||
ROW_PROP_ACTION_NAME,
|
ROW_PROP_ACTION_NAME,
|
||||||
@ -211,13 +214,16 @@ static GtkBuildableIface *parent_buildable_iface;
|
|||||||
|
|
||||||
static void gtk_list_box_buildable_interface_init (GtkBuildableIface *iface);
|
static void gtk_list_box_buildable_interface_init (GtkBuildableIface *iface);
|
||||||
|
|
||||||
|
static void gtk_list_box_row_buildable_iface_init (GtkBuildableIface *iface);
|
||||||
static void gtk_list_box_row_actionable_iface_init (GtkActionableInterface *iface);
|
static void gtk_list_box_row_actionable_iface_init (GtkActionableInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkListBox, gtk_list_box, GTK_TYPE_CONTAINER,
|
G_DEFINE_TYPE_WITH_CODE (GtkListBox, gtk_list_box, GTK_TYPE_CONTAINER,
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||||
gtk_list_box_buildable_interface_init))
|
gtk_list_box_buildable_interface_init))
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkListBoxRow, gtk_list_box_row, GTK_TYPE_BIN,
|
G_DEFINE_TYPE_WITH_CODE (GtkListBoxRow, gtk_list_box_row, GTK_TYPE_WIDGET,
|
||||||
G_ADD_PRIVATE (GtkListBoxRow)
|
G_ADD_PRIVATE (GtkListBoxRow)
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||||
|
gtk_list_box_row_buildable_iface_init )
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIONABLE, gtk_list_box_row_actionable_iface_init))
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIONABLE, gtk_list_box_row_actionable_iface_init))
|
||||||
|
|
||||||
static void gtk_list_box_apply_filter_all (GtkListBox *box);
|
static void gtk_list_box_apply_filter_all (GtkListBox *box);
|
||||||
@ -328,6 +334,29 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
|||||||
static GParamSpec *row_properties[LAST_ROW_PROPERTY] = { NULL, };
|
static GParamSpec *row_properties[LAST_ROW_PROPERTY] = { NULL, };
|
||||||
static guint row_signals[ROW__LAST_SIGNAL] = { 0 };
|
static guint row_signals[ROW__LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
|
static GtkBuildableIface *parent_row_buildable_iface;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_list_box_row_buildable_add_child (GtkBuildable *buildable,
|
||||||
|
GtkBuilder *builder,
|
||||||
|
GObject *child,
|
||||||
|
const gchar *type)
|
||||||
|
{
|
||||||
|
if (GTK_IS_WIDGET (child))
|
||||||
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (buildable), GTK_WIDGET (child));
|
||||||
|
else
|
||||||
|
parent_row_buildable_iface->add_child (buildable, builder, child, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_list_box_row_buildable_iface_init (GtkBuildableIface *iface)
|
||||||
|
{
|
||||||
|
parent_row_buildable_iface = g_type_interface_peek_parent (iface);
|
||||||
|
|
||||||
|
iface->add_child = gtk_list_box_row_buildable_add_child;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_list_box_new:
|
* gtk_list_box_new:
|
||||||
*
|
*
|
||||||
@ -2605,7 +2634,7 @@ gtk_list_box_insert (GtkListBox *box,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
row = GTK_LIST_BOX_ROW (gtk_list_box_row_new ());
|
row = GTK_LIST_BOX_ROW (gtk_list_box_row_new ());
|
||||||
gtk_container_add (GTK_CONTAINER (row), child);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), child);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->sort_func != NULL)
|
if (box->sort_func != NULL)
|
||||||
@ -2851,6 +2880,42 @@ gtk_list_box_row_new (void)
|
|||||||
return g_object_new (GTK_TYPE_LIST_BOX_ROW, NULL);
|
return g_object_new (GTK_TYPE_LIST_BOX_ROW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_list_box_row_set_child:
|
||||||
|
* @row: a #GtkListBoxRow
|
||||||
|
* @child: (allow-none): the child widget
|
||||||
|
*
|
||||||
|
* Sets the child widget of @self.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_list_box_row_set_child (GtkListBoxRow *row,
|
||||||
|
GtkWidget *child)
|
||||||
|
{
|
||||||
|
GtkListBoxRowPrivate *priv = ROW_PRIV (row);
|
||||||
|
|
||||||
|
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||||
|
|
||||||
|
priv->child = child;
|
||||||
|
if (child)
|
||||||
|
gtk_widget_set_parent (child, GTK_WIDGET (row));
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (row), row_properties[ROW_PROP_CHILD]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_list_box_row_get_child:
|
||||||
|
* @row: a #GtkListBoxRow
|
||||||
|
*
|
||||||
|
* Gets the child widget of @row.
|
||||||
|
*
|
||||||
|
* Returns: (nullable) (transfer none): the child widget of @row
|
||||||
|
*/
|
||||||
|
GtkWidget *
|
||||||
|
gtk_list_box_row_get_child (GtkListBoxRow *row)
|
||||||
|
{
|
||||||
|
return ROW_PRIV (row)->child;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_box_row_set_focus (GtkListBoxRow *row)
|
gtk_list_box_row_set_focus (GtkListBoxRow *row)
|
||||||
{
|
{
|
||||||
@ -2868,9 +2933,7 @@ gtk_list_box_row_focus (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkListBoxRow *row = GTK_LIST_BOX_ROW (widget);
|
GtkListBoxRow *row = GTK_LIST_BOX_ROW (widget);
|
||||||
gboolean had_focus = FALSE;
|
gboolean had_focus = FALSE;
|
||||||
GtkWidget *child;
|
GtkWidget *child = ROW_PRIV (row)->child;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
||||||
|
|
||||||
g_object_get (widget, "has-focus", &had_focus, NULL);
|
g_object_get (widget, "has-focus", &had_focus, NULL);
|
||||||
if (had_focus)
|
if (had_focus)
|
||||||
@ -3233,6 +3296,9 @@ gtk_list_box_row_get_property (GObject *obj,
|
|||||||
case ROW_PROP_ACTION_TARGET:
|
case ROW_PROP_ACTION_TARGET:
|
||||||
g_value_set_variant (value, gtk_action_helper_get_action_target_value (ROW_PRIV (row)->action_helper));
|
g_value_set_variant (value, gtk_action_helper_get_action_target_value (ROW_PRIV (row)->action_helper));
|
||||||
break;
|
break;
|
||||||
|
case ROW_PROP_CHILD:
|
||||||
|
g_value_set_object (value, gtk_list_box_row_get_child (row));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -3261,6 +3327,9 @@ gtk_list_box_row_set_property (GObject *obj,
|
|||||||
case ROW_PROP_ACTION_TARGET:
|
case ROW_PROP_ACTION_TARGET:
|
||||||
gtk_list_box_row_set_action_target_value (GTK_ACTIONABLE (row), g_value_get_variant (value));
|
gtk_list_box_row_set_action_target_value (GTK_ACTIONABLE (row), g_value_get_variant (value));
|
||||||
break;
|
break;
|
||||||
|
case ROW_PROP_CHILD:
|
||||||
|
gtk_list_box_row_set_child (row, g_value_get_object (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -3307,6 +3376,7 @@ gtk_list_box_row_dispose (GObject *object)
|
|||||||
GtkListBoxRowPrivate *priv = ROW_PRIV (row);
|
GtkListBoxRowPrivate *priv = ROW_PRIV (row);
|
||||||
|
|
||||||
g_clear_object (&priv->action_helper);
|
g_clear_object (&priv->action_helper);
|
||||||
|
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_list_box_row_parent_class)->dispose (object);
|
G_OBJECT_CLASS (gtk_list_box_row_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
@ -3333,8 +3403,6 @@ gtk_list_box_row_class_init (GtkListBoxRowClass *klass)
|
|||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE);
|
|
||||||
|
|
||||||
object_class->get_property = gtk_list_box_row_get_property;
|
object_class->get_property = gtk_list_box_row_get_property;
|
||||||
object_class->set_property = gtk_list_box_row_set_property;
|
object_class->set_property = gtk_list_box_row_set_property;
|
||||||
object_class->finalize = gtk_list_box_row_finalize;
|
object_class->finalize = gtk_list_box_row_finalize;
|
||||||
@ -3391,11 +3459,20 @@ gtk_list_box_row_class_init (GtkListBoxRowClass *klass)
|
|||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
|
row_properties[ROW_PROP_CHILD] =
|
||||||
|
g_param_spec_object ("child",
|
||||||
|
P_("Child"),
|
||||||
|
P_("The child widget"),
|
||||||
|
GTK_TYPE_WIDGET,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, LAST_ROW_PROPERTY, row_properties);
|
g_object_class_install_properties (object_class, LAST_ROW_PROPERTY, row_properties);
|
||||||
|
|
||||||
g_object_class_override_property (object_class, ROW_PROP_ACTION_NAME, "action-name");
|
g_object_class_override_property (object_class, ROW_PROP_ACTION_NAME, "action-name");
|
||||||
g_object_class_override_property (object_class, ROW_PROP_ACTION_TARGET, "action-target");
|
g_object_class_override_property (object_class, ROW_PROP_ACTION_TARGET, "action-target");
|
||||||
|
|
||||||
|
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||||
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE);
|
||||||
gtk_widget_class_set_css_name (widget_class, I_("row"));
|
gtk_widget_class_set_css_name (widget_class, I_("row"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#error "Only <gtk/gtk.h> can be included directly."
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtk/gtkbin.h>
|
#include <gtk/gtkcontainer.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ typedef struct _GtkListBoxRowClass GtkListBoxRowClass;
|
|||||||
|
|
||||||
struct _GtkListBoxRow
|
struct _GtkListBoxRow
|
||||||
{
|
{
|
||||||
GtkBin parent_instance;
|
GtkWidget parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +58,7 @@ struct _GtkListBoxRow
|
|||||||
*/
|
*/
|
||||||
struct _GtkListBoxRowClass
|
struct _GtkListBoxRowClass
|
||||||
{
|
{
|
||||||
GtkBinClass parent_class;
|
GtkWidgetClass parent_class;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
|
|
||||||
@ -129,6 +129,13 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
GType gtk_list_box_row_get_type (void) G_GNUC_CONST;
|
GType gtk_list_box_row_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_list_box_row_new (void);
|
GtkWidget* gtk_list_box_row_new (void);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_list_box_row_set_child (GtkListBoxRow *row,
|
||||||
|
GtkWidget *child);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
GtkWidget *gtk_list_box_row_get_child (GtkListBoxRow *row);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget* gtk_list_box_row_get_header (GtkListBoxRow *row);
|
GtkWidget* gtk_list_box_row_get_header (GtkListBoxRow *row);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
@ -365,7 +365,7 @@ gtk_shortcuts_window_add_section (GtkShortcutsWindow *self,
|
|||||||
"xalign", 0.5f,
|
"xalign", 0.5f,
|
||||||
NULL);
|
NULL);
|
||||||
g_object_set_data (G_OBJECT (section), "gtk-shortcuts-title", label);
|
g_object_set_data (G_OBJECT (section), "gtk-shortcuts-title", label);
|
||||||
gtk_container_add (GTK_CONTAINER (row), GTK_WIDGET (label));
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), GTK_WIDGET (label));
|
||||||
gtk_container_add (GTK_CONTAINER (priv->list_box), GTK_WIDGET (row));
|
gtk_container_add (GTK_CONTAINER (priv->list_box), GTK_WIDGET (row));
|
||||||
|
|
||||||
update_title_stack (self);
|
update_title_stack (self);
|
||||||
|
@ -194,7 +194,7 @@ update_row (GtkStackSidebar *self,
|
|||||||
"visible", &visible,
|
"visible", &visible,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
item = gtk_bin_get_child (GTK_BIN (row));
|
item = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
||||||
gtk_label_set_text (GTK_LABEL (item), title);
|
gtk_label_set_text (GTK_LABEL (item), title);
|
||||||
|
|
||||||
gtk_widget_set_visible (row, visible && title != NULL);
|
gtk_widget_set_visible (row, visible && title != NULL);
|
||||||
@ -231,7 +231,7 @@ add_child (guint position,
|
|||||||
gtk_widget_set_halign (item, GTK_ALIGN_START);
|
gtk_widget_set_halign (item, GTK_ALIGN_START);
|
||||||
gtk_widget_set_valign (item, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (item, GTK_ALIGN_CENTER);
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (row), item);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), item);
|
||||||
|
|
||||||
page = g_list_model_get_item (G_LIST_MODEL (self->pages), position);
|
page = g_list_model_get_item (G_LIST_MODEL (self->pages), position);
|
||||||
update_row (self, page, row);
|
update_row (self, page, row);
|
||||||
|
@ -88,7 +88,7 @@ add_action (GtkInspectorActions *sl,
|
|||||||
|
|
||||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
|
|
||||||
label = gtk_label_new (name);
|
label = gtk_label_new (name);
|
||||||
gtk_widget_add_css_class (label, "cell");
|
gtk_widget_add_css_class (label, "cell");
|
||||||
|
@ -122,7 +122,7 @@ create_controller_widget (gpointer item,
|
|||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
gtk_widget_set_margin_start (box, 10);
|
gtk_widget_set_margin_start (box, 10);
|
||||||
gtk_widget_set_margin_end (box, 10);
|
gtk_widget_set_margin_end (box, 10);
|
||||||
gtk_widget_set_margin_top (box, 10);
|
gtk_widget_set_margin_top (box, 10);
|
||||||
|
@ -184,7 +184,7 @@ add_check_row (GtkInspectorGeneral *gen,
|
|||||||
gtk_container_add (GTK_CONTAINER (box), check);
|
gtk_container_add (GTK_CONTAINER (box), check);
|
||||||
|
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||||
|
|
||||||
gtk_widget_set_hexpand (box, FALSE);
|
gtk_widget_set_hexpand (box, FALSE);
|
||||||
@ -227,7 +227,7 @@ add_label_row (GtkInspectorGeneral *gen,
|
|||||||
gtk_container_add (GTK_CONTAINER (box), label);
|
gtk_container_add (GTK_CONTAINER (box), label);
|
||||||
|
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||||
|
|
||||||
gtk_widget_set_hexpand (box, FALSE);
|
gtk_widget_set_hexpand (box, FALSE);
|
||||||
|
@ -999,7 +999,7 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
|
|
||||||
column = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
column = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_size_group_add_widget (wt->priv->type_size_group, column);
|
gtk_size_group_add_widget (wt->priv->type_size_group, column);
|
||||||
|
@ -529,7 +529,7 @@ gtk_inspector_prop_list_create_row (GtkInspectorPropList *pl,
|
|||||||
g_object_set_data (G_OBJECT (row), "pspec", prop);
|
g_object_set_data (G_OBJECT (row), "pspec", prop);
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
|
|
||||||
label = gtk_label_new (prop->name);
|
label = gtk_label_new (prop->name);
|
||||||
gtk_widget_add_css_class (label, "cell");
|
gtk_widget_add_css_class (label, "cell");
|
||||||
|
@ -307,7 +307,7 @@ create_widget_for_render_node (gpointer row_item,
|
|||||||
node = gtk_render_node_paintable_get_render_node (GTK_RENDER_NODE_PAINTABLE (paintable));
|
node = gtk_render_node_paintable_get_render_node (GTK_RENDER_NODE_PAINTABLE (paintable));
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
|
|
||||||
/* expander */
|
/* expander */
|
||||||
depth = gtk_tree_list_row_get_depth (row_item);
|
depth = gtk_tree_list_row_get_depth (row_item);
|
||||||
|
@ -214,7 +214,7 @@ add_widget (GtkInspectorSizeGroups *sl,
|
|||||||
gtk_widget_set_margin_bottom (label, 10);
|
gtk_widget_set_margin_bottom (label, 10);
|
||||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||||
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||||
gtk_container_add (GTK_CONTAINER (row), label);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), label);
|
||||||
gtk_container_add (GTK_CONTAINER (listbox), row);
|
gtk_container_add (GTK_CONTAINER (listbox), row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ add_row (GtkContainer *box,
|
|||||||
"xalign", 0.0,
|
"xalign", 0.0,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (row), label);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), label);
|
||||||
gtk_container_add (box, row);
|
gtk_container_add (box, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<requires lib="gtk+" version="3.16"/>
|
<requires lib="gtk+" version="3.16"/>
|
||||||
<template class="GtkPlacesViewRow" parent="GtkListBoxRow">
|
<template class="GtkPlacesViewRow" parent="GtkListBoxRow">
|
||||||
<property name="width-request">100</property>
|
<property name="width-request">100</property>
|
||||||
<child>
|
<property name="child">
|
||||||
<object class="GtkBox" id="box">
|
<object class="GtkBox" id="box">
|
||||||
<property name="margin-start">12</property>
|
<property name="margin-start">12</property>
|
||||||
<property name="margin-end">12</property>
|
<property name="margin-end">12</property>
|
||||||
@ -79,6 +79,6 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</template>
|
</template>
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<style>
|
<style>
|
||||||
<class name="sidebar-row"/>
|
<class name="sidebar-row"/>
|
||||||
</style>
|
</style>
|
||||||
<child>
|
<property name="child">
|
||||||
<object class="GtkRevealer" id="revealer">
|
<object class="GtkRevealer" id="revealer">
|
||||||
<property name="reveal-child">1</property>
|
<property name="reveal-child">1</property>
|
||||||
<signal name="notify::child-revealed" handler="on_child_revealed"/>
|
<signal name="notify::child-revealed" handler="on_child_revealed"/>
|
||||||
@ -67,6 +67,6 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</property>
|
||||||
</template>
|
</template>
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -51,7 +51,7 @@ row_new (const gchar* text, gint sort_id) {
|
|||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
{
|
{
|
||||||
row->label = gtk_label_new (text);
|
row->label = gtk_label_new (text);
|
||||||
gtk_container_add (GTK_CONTAINER (row), row->label);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row->label);
|
||||||
gtk_widget_show (row->label);
|
gtk_widget_show (row->label);
|
||||||
}
|
}
|
||||||
row->sort_id = sort_id;
|
row->sort_id = sort_id;
|
||||||
@ -317,14 +317,14 @@ main (int argc, char *argv[])
|
|||||||
gtk_container_add (GTK_CONTAINER (row_vbox), row_hbox);
|
gtk_container_add (GTK_CONTAINER (row_vbox), row_hbox);
|
||||||
check = gtk_check_button_new ();
|
check = gtk_check_button_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (row_vbox), check);
|
gtk_container_add (GTK_CONTAINER (row_vbox), check);
|
||||||
gtk_container_add (GTK_CONTAINER (row), row_vbox);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), row_vbox);
|
||||||
gtk_container_add (GTK_CONTAINER (list), row);
|
gtk_container_add (GTK_CONTAINER (list), row);
|
||||||
|
|
||||||
row = row_new (NULL, 0);
|
row = row_new (NULL, 0);
|
||||||
button = gtk_button_new_with_label ("focusable row");
|
button = gtk_button_new_with_label ("focusable row");
|
||||||
gtk_widget_set_hexpand (button, FALSE);
|
gtk_widget_set_hexpand (button, FALSE);
|
||||||
gtk_widget_set_halign (button, GTK_ALIGN_START);
|
gtk_widget_set_halign (button, GTK_ALIGN_START);
|
||||||
gtk_container_add (GTK_CONTAINER (row), button);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), button);
|
||||||
gtk_container_add (GTK_CONTAINER (list), row);
|
gtk_container_add (GTK_CONTAINER (list), row);
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
@ -68,7 +68,7 @@ create_row (const gchar *text)
|
|||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
g_object_set (box, "margin-start", 10, "margin-end", 10, NULL);
|
g_object_set (box, "margin-start", 10, "margin-end", 10, NULL);
|
||||||
label = gtk_label_new (text);
|
label = gtk_label_new (text);
|
||||||
gtk_container_add (GTK_CONTAINER (row), box);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||||
gtk_widget_set_hexpand (label, TRUE);
|
gtk_widget_set_hexpand (label, TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER (box), label);
|
gtk_container_add (GTK_CONTAINER (box), label);
|
||||||
gtk_container_add (GTK_CONTAINER (box), image);
|
gtk_container_add (GTK_CONTAINER (box), image);
|
||||||
@ -91,7 +91,7 @@ on_row_activated (GtkListBox *self,
|
|||||||
GtkWidget *child)
|
GtkWidget *child)
|
||||||
{
|
{
|
||||||
const char *id;
|
const char *id;
|
||||||
id = g_object_get_data (G_OBJECT (gtk_bin_get_child (GTK_BIN (child))), "id");
|
id = g_object_get_data (G_OBJECT (gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (child))), "id");
|
||||||
g_message ("Row activated %p: %s", child, id);
|
g_message ("Row activated %p: %s", child, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ populate_list (GtkListBox *list)
|
|||||||
gtk_widget_set_margin_top (label, 10);
|
gtk_widget_set_margin_top (label, 10);
|
||||||
gtk_widget_set_margin_bottom (label, 10);
|
gtk_widget_set_margin_bottom (label, 10);
|
||||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||||
gtk_container_add (GTK_CONTAINER (row), label);
|
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), label);
|
||||||
gtk_container_add (GTK_CONTAINER (list), row);
|
gtk_container_add (GTK_CONTAINER (list), row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,10 @@ sort_list (GtkListBoxRow *row1,
|
|||||||
|
|
||||||
(*count)++;
|
(*count)++;
|
||||||
|
|
||||||
label1 = gtk_bin_get_child (GTK_BIN (row1));
|
label1 = gtk_list_box_row_get_child (row1);
|
||||||
n1 = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label1), "data"));
|
n1 = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label1), "data"));
|
||||||
|
|
||||||
label2 = gtk_bin_get_child (GTK_BIN (row2));
|
label2 = gtk_list_box_row_get_child (row2);
|
||||||
n2 = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label2), "data"));
|
n2 = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label2), "data"));
|
||||||
|
|
||||||
return (n1 - n2);
|
return (n1 - n2);
|
||||||
@ -34,7 +34,7 @@ check_sorted (GtkListBox *list)
|
|||||||
{
|
{
|
||||||
row = l->data;
|
row = l->data;
|
||||||
n1 = n2;
|
n1 = n2;
|
||||||
label = gtk_bin_get_child (GTK_BIN (row));
|
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
||||||
n2 = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
|
n2 = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
|
||||||
g_assert_cmpint (n1, <=, n2);
|
g_assert_cmpint (n1, <=, n2);
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ filter_func (GtkListBoxRow *row,
|
|||||||
|
|
||||||
(*count)++;
|
(*count)++;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (row));
|
child = gtk_list_box_row_get_child (row);
|
||||||
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "data"));
|
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "data"));
|
||||||
|
|
||||||
return (i % 2) == 0;
|
return (i % 2) == 0;
|
||||||
@ -356,7 +356,7 @@ header_func (GtkListBoxRow *row,
|
|||||||
|
|
||||||
(*count)++;
|
(*count)++;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (row));
|
child = gtk_list_box_row_get_child (row);
|
||||||
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "data"));
|
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "data"));
|
||||||
|
|
||||||
if (i % 2 == 0)
|
if (i % 2 == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user