history-box: compose with GtkBin instead of subclassing GtkStack
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
@@ -39,8 +39,9 @@
|
|||||||
#define CALLS_HISTORY_INCREASE_N_PAGES_THRESHOLD 2
|
#define CALLS_HISTORY_INCREASE_N_PAGES_THRESHOLD 2
|
||||||
|
|
||||||
struct _CallsHistoryBox {
|
struct _CallsHistoryBox {
|
||||||
GtkStack parent_instance;
|
GtkBin parent_instance;
|
||||||
|
|
||||||
|
GtkStack *stack;
|
||||||
GtkListBox *history;
|
GtkListBox *history;
|
||||||
GtkScrolledWindow *scrolled_window;
|
GtkScrolledWindow *scrolled_window;
|
||||||
GtkAdjustment *scroll_adjustment;
|
GtkAdjustment *scroll_adjustment;
|
||||||
@@ -54,7 +55,7 @@ struct _CallsHistoryBox {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (CallsHistoryBox, calls_history_box, GTK_TYPE_STACK);
|
G_DEFINE_TYPE (CallsHistoryBox, calls_history_box, GTK_TYPE_BIN);
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -80,7 +81,7 @@ on_model_changed (GListModel *model,
|
|||||||
else
|
else
|
||||||
child_name = "history";
|
child_name = "history";
|
||||||
|
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (self), child_name);
|
gtk_stack_set_visible_child_name (self->stack, child_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -256,6 +257,7 @@ calls_history_box_class_init (CallsHistoryBoxClass *klass)
|
|||||||
|
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/history-box.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Calls/ui/history-box.ui");
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, stack);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, history);
|
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, history);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, scrolled_window);
|
gtk_widget_class_bind_template_child (widget_class, CallsHistoryBox, scrolled_window);
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
#define CALLS_TYPE_HISTORY_BOX (calls_history_box_get_type ())
|
#define CALLS_TYPE_HISTORY_BOX (calls_history_box_get_type ())
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (CallsHistoryBox, calls_history_box, CALLS, HISTORY_BOX, GtkStack);
|
G_DECLARE_FINAL_TYPE (CallsHistoryBox, calls_history_box, CALLS, HISTORY_BOX, GtkBin);
|
||||||
|
|
||||||
CallsHistoryBox *calls_history_box_new (GListModel *model);
|
CallsHistoryBox *calls_history_box_new (GListModel *model);
|
||||||
|
|
||||||
|
@@ -2,7 +2,10 @@
|
|||||||
<!-- Generated with glade 3.22.0 -->
|
<!-- Generated with glade 3.22.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.22"/>
|
<requires lib="gtk+" version="3.22"/>
|
||||||
<template class="CallsHistoryBox" parent="GtkStack">
|
<template class="CallsHistoryBox" parent="GtkBin">
|
||||||
|
<child>
|
||||||
|
<object class="GtkStack" id="stack">
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="HdyStatusPage">
|
<object class="HdyStatusPage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -38,5 +41,7 @@
|
|||||||
<property name="name">history</property>
|
<property name="name">history</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</template>
|
</template>
|
||||||
</interface>
|
</interface>
|
||||||
|
Reference in New Issue
Block a user