GtkListBox: Remove add_to_scrolled()
Now that we automatically set up the focus_vadjustment we only need the adjustment to handle the page-up/down scroll length correctly. We use parent_set to automatically pick up the adjustment from a scrollable (i.e. viewport) parent which makes add_to_scrolled useless, so it can be removed.
This commit is contained in:
parent
17c559c429
commit
ecff28bb68
@ -160,6 +160,8 @@ static void gtk_list_box_real_move_cursor (GtkListBo
|
|||||||
gint count);
|
gint count);
|
||||||
static void gtk_list_box_real_refilter (GtkListBox *list_box);
|
static void gtk_list_box_real_refilter (GtkListBox *list_box);
|
||||||
static void gtk_list_box_finalize (GObject *obj);
|
static void gtk_list_box_finalize (GObject *obj);
|
||||||
|
static void gtk_list_box_real_parent_set (GtkWidget *widget,
|
||||||
|
GtkWidget *prev_parent);
|
||||||
|
|
||||||
|
|
||||||
static void gtk_list_box_real_get_preferred_height (GtkWidget *widget,
|
static void gtk_list_box_real_get_preferred_height (GtkWidget *widget,
|
||||||
@ -301,6 +303,7 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
|
|||||||
widget_class->get_preferred_width_for_height = gtk_list_box_real_get_preferred_width_for_height;
|
widget_class->get_preferred_width_for_height = gtk_list_box_real_get_preferred_width_for_height;
|
||||||
widget_class->size_allocate = gtk_list_box_real_size_allocate;
|
widget_class->size_allocate = gtk_list_box_real_size_allocate;
|
||||||
widget_class->drag_leave = gtk_list_box_real_drag_leave;
|
widget_class->drag_leave = gtk_list_box_real_drag_leave;
|
||||||
|
widget_class->parent_set = gtk_list_box_real_parent_set;
|
||||||
container_class->add = gtk_list_box_real_add;
|
container_class->add = gtk_list_box_real_add;
|
||||||
container_class->remove = gtk_list_box_real_remove;
|
container_class->remove = gtk_list_box_real_remove;
|
||||||
container_class->forall = gtk_list_box_real_forall_internal;
|
container_class->forall = gtk_list_box_real_forall_internal;
|
||||||
@ -519,8 +522,6 @@ gtk_list_box_set_adjustment (GtkListBox *list_box,
|
|||||||
if (priv->adjustment)
|
if (priv->adjustment)
|
||||||
g_object_unref (priv->adjustment);
|
g_object_unref (priv->adjustment);
|
||||||
priv->adjustment = adjustment;
|
priv->adjustment = adjustment;
|
||||||
gtk_container_set_focus_vadjustment (GTK_CONTAINER (list_box),
|
|
||||||
adjustment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkAdjustment *
|
GtkAdjustment *
|
||||||
@ -533,19 +534,22 @@ gtk_list_box_get_adjustment (GtkListBox *list_box)
|
|||||||
return priv->adjustment;
|
return priv->adjustment;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
gtk_list_box_add_to_scrolled (GtkListBox *list_box,
|
gtk_list_box_real_parent_set (GtkWidget *widget,
|
||||||
GtkScrolledWindow *scrolled)
|
GtkWidget *prev_parent)
|
||||||
{
|
{
|
||||||
g_return_if_fail (list_box != NULL);
|
GtkWidget *parent;
|
||||||
g_return_if_fail (scrolled != NULL);
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (list_box));
|
parent = gtk_widget_get_parent (widget);
|
||||||
gtk_list_box_set_adjustment (list_box,
|
|
||||||
gtk_scrolled_window_get_vadjustment (scrolled));
|
if (parent && GTK_IS_SCROLLABLE (parent))
|
||||||
|
{
|
||||||
|
adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (parent));
|
||||||
|
gtk_list_box_set_adjustment (GTK_LIST_BOX (widget), adjustment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_list_box_set_selection_mode (GtkListBox *list_box, GtkSelectionMode mode)
|
gtk_list_box_set_selection_mode (GtkListBox *list_box, GtkSelectionMode mode)
|
||||||
{
|
{
|
||||||
|
@ -133,9 +133,6 @@ void gtk_list_box_set_adjustment (GtkListBox
|
|||||||
GDK_AVAILABLE_IN_3_10
|
GDK_AVAILABLE_IN_3_10
|
||||||
GtkAdjustment *gtk_list_box_get_adjustment (GtkListBox *list_box);
|
GtkAdjustment *gtk_list_box_get_adjustment (GtkListBox *list_box);
|
||||||
GDK_AVAILABLE_IN_3_10
|
GDK_AVAILABLE_IN_3_10
|
||||||
void gtk_list_box_add_to_scrolled (GtkListBox *list_box,
|
|
||||||
GtkScrolledWindow *scrolled);
|
|
||||||
GDK_AVAILABLE_IN_3_10
|
|
||||||
void gtk_list_box_set_selection_mode (GtkListBox *list_box,
|
void gtk_list_box_set_selection_mode (GtkListBox *list_box,
|
||||||
GtkSelectionMode mode);
|
GtkSelectionMode mode);
|
||||||
GDK_AVAILABLE_IN_3_10
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
Loading…
Reference in New Issue
Block a user