forked from AuroraMiddleware/gtk
GtkAssistant: Redo page margins
Instead of having padding outside the notebook containing all pages, put each page in an extra box and add the padding there. This is in preparation for allowing pages without padding.
This commit is contained in:
parent
cfd85dee03
commit
6cc65260f4
@ -1109,8 +1109,8 @@ on_page_notify_visibility (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
assistant_remove_page_cb (GtkNotebook *notebook,
|
||||
GtkWidget *page,
|
||||
assistant_remove_page_cb (GtkNotebook *notebook,
|
||||
GtkWidget *page,
|
||||
GtkAssistant *assistant)
|
||||
{
|
||||
GtkAssistantPrivate *priv = assistant->priv;
|
||||
@ -1118,6 +1118,15 @@ assistant_remove_page_cb (GtkNotebook *notebook,
|
||||
GList *page_node;
|
||||
GList *element;
|
||||
|
||||
if (GTK_IS_BOX (page))
|
||||
{
|
||||
GList *children;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (page));
|
||||
page = GTK_WIDGET (children->data);
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
element = find_page (assistant, page);
|
||||
if (!element)
|
||||
return;
|
||||
@ -1445,12 +1454,14 @@ gtk_assistant_remove (GtkContainer *container,
|
||||
GtkWidget *page)
|
||||
{
|
||||
GtkAssistant *assistant = (GtkAssistant*) container;
|
||||
GtkWidget *box;
|
||||
|
||||
/* Forward this removal to the content notebook */
|
||||
if (gtk_widget_get_parent (page) == assistant->priv->content)
|
||||
box = gtk_widget_get_parent (page);
|
||||
if (gtk_widget_get_parent (box) == assistant->priv->content)
|
||||
{
|
||||
container = (GtkContainer *) assistant->priv->content;
|
||||
gtk_container_remove (container, page);
|
||||
gtk_container_remove (container, box);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1743,6 +1754,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
|
||||
GtkAssistantPage *page_info;
|
||||
gint n_pages;
|
||||
GtkStyleContext *context;
|
||||
GtkWidget *box;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
|
||||
@ -1785,7 +1797,12 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
|
||||
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->regular_title, 2 * position);
|
||||
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->current_title, 2 * position + 1);
|
||||
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), page, NULL, position);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_show (box);
|
||||
gtk_box_pack_start (GTK_BOX (box), page, TRUE, TRUE, 0);
|
||||
g_object_set (box, "margin", 12, NULL);
|
||||
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), box, NULL, position);
|
||||
|
||||
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user