[gtk/assistant-cleanup: 3/3] Drop GtkAssistantPage::has-padding
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/assistant-cleanup: 3/3] Drop GtkAssistantPage::has-padding
- Date: Thu, 14 Feb 2019 20:10:48 +0000 (UTC)
commit d57dfb80a3d6a69294686baf6824060b7ff361aa
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 14 14:46:01 2019 -0500
Drop GtkAssistantPage::has-padding
This is causing us some internal complications, and
it is very easy to just add padding to the pages
yourself.
docs/reference/gtk/gtk4-sections.txt | 2 -
docs/reference/gtk/migrating-3to4.xml | 8 +++
gtk/gtkassistant.c | 101 ++--------------------------------
gtk/gtkassistant.h | 7 ---
tests/testassistant.c | 1 -
5 files changed, 14 insertions(+), 105 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index fd93df5a50..fd48280bed 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -233,8 +233,6 @@ gtk_assistant_set_page_title
gtk_assistant_get_page_title
gtk_assistant_set_page_complete
gtk_assistant_get_page_complete
-gtk_assistant_set_page_has_padding
-gtk_assistant_get_page_has_padding
gtk_assistant_add_action_widget
gtk_assistant_remove_action_widget
gtk_assistant_update_buttons_state
diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml
index 4fbafaa6a8..53e49c77b2 100644
--- a/docs/reference/gtk/migrating-3to4.xml
+++ b/docs/reference/gtk/migrating-3to4.xml
@@ -593,6 +593,14 @@
child properties to child meta objects.
</para>
</section>
+
+ <section>
+ <title>Adapt to changes in the GtkAssistant API</title>
+ <para>
+ The ::has-padding property is gone, and GtkAssistant no longer adds padding
+ to pages. You can easily do that yourself.
+ </para>
+ </section>
</section>
</chapter>
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index b78089e0fe..dab0968176 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -92,11 +92,9 @@ struct _GtkAssistantPage
GtkAssistantPageType type;
guint complete : 1;
guint complete_set : 1;
- guint has_padding : 1;
gchar *title;
- GtkWidget *box;
GtkWidget *page;
GtkWidget *regular_title;
GtkWidget *current_title;
@@ -217,7 +215,6 @@ static void
gtk_assistant_page_init (GtkAssistantPage *page)
{
page->type = GTK_ASSISTANT_PAGE_CONTENT;
- page->has_padding = TRUE;
}
static void
@@ -967,7 +964,7 @@ set_current_page (GtkAssistant *assistant,
gtk_window_set_title (GTK_WINDOW (assistant), priv->current_page->title);
- gtk_stack_set_visible_child (GTK_STACK (priv->content), priv->current_page->box);
+ gtk_stack_set_visible_child (GTK_STACK (priv->content), priv->current_page->page);
/* update buttons state, flow may have changed */
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
@@ -1280,16 +1277,6 @@ gtk_assistant_page_set_property (GObject *object,
}
break;
- case CHILD_PROP_HAS_PADDING:
- if (page->has_padding != g_value_get_boolean (value))
- {
- page->has_padding = g_value_get_boolean (value);
- if (page->box)
- g_object_set (page->box, "margin", page->has_padding ? 12 : 0, NULL);
- g_object_notify (G_OBJECT (page), "has-padding");
- }
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1322,10 +1309,6 @@ gtk_assistant_page_get_property (GObject *object,
g_value_set_boolean (value, page->complete);
break;
- case CHILD_PROP_HAS_PADDING:
- g_value_set_boolean (value, page->has_padding);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1401,7 +1384,7 @@ find_page (GtkAssistant *assistant,
while (child)
{
GtkAssistantPage *page_info = child->data;
- if (page_info->page == page || page_info->box == page)
+ if (page_info->page == page)
return child;
child = child->next;
@@ -1500,16 +1483,11 @@ gtk_assistant_remove (GtkContainer *container,
GtkWidget *page)
{
GtkAssistant *assistant = (GtkAssistant*) container;
- GtkWidget *box;
/* Forward this removal to the content stack */
- box = gtk_widget_get_parent (page);
- if (GTK_IS_BOX (box) &&
- assistant->priv->content != NULL &&
- gtk_widget_get_parent (box) == assistant->priv->content)
+ if (gtk_widget_get_parent (page) == assistant->priv->content)
{
- gtk_container_remove (GTK_CONTAINER (box), page);
- gtk_container_remove (GTK_CONTAINER (assistant->priv->content), box);
+ gtk_container_remove (GTK_CONTAINER (assistant->priv->content), page);
}
else
{
@@ -1791,7 +1769,6 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
page_info = g_object_new (GTK_TYPE_ASSISTANT_PAGE, NULL);
page_info->page = g_object_ref (page);
- page_info->has_padding = TRUE;
return gtk_assistant_add_page (assistant, page_info, position);
@@ -1806,7 +1783,6 @@ gtk_assistant_add_page (GtkAssistant *assistant,
GtkAssistantPrivate *priv = assistant->priv;
gint n_pages;
GtkStyleContext *context;
- GtkWidget *box;
GtkWidget *sibling;
char *name;
@@ -1854,18 +1830,10 @@ gtk_assistant_add_page (GtkAssistant *assistant,
gtk_box_insert_child_after (GTK_BOX (priv->sidebar), page_info->current_title, sibling);
gtk_box_insert_child_after (GTK_BOX (priv->sidebar), page_info->regular_title, sibling);
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_show (box);
- gtk_container_add (GTK_CONTAINER (box), page_info->page);
- g_object_set (box, "margin", 12, NULL);
- g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant);
-
- name = g_strdup_printf ("page%d", position);
- gtk_stack_add_named (GTK_STACK (priv->content), box, name);
+ name = g_strdup_printf ("%p", page_info->page);
+ gtk_stack_add_named (GTK_STACK (priv->content), page_info->page, name);
g_free (name);
- page_info->box = box;
-
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
{
update_buttons_state (assistant);
@@ -2203,63 +2171,6 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
return page_info->complete;
}
-/**
- * gtk_assistant_set_page_has_padding:
- * @assistant: a #GtkAssistant
- * @page: a page of @assistant
- * @has_padding: whether this page has padding
- *
- * Sets whether the assistant is adding padding around
- * the page.
- */
-void
-gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
- GtkWidget *page,
- gboolean has_padding)
-{
- GtkAssistantPage *page_info;
- GList *child;
-
- g_return_if_fail (GTK_IS_ASSISTANT (assistant));
- g_return_if_fail (GTK_IS_WIDGET (page));
-
- child = find_page (assistant, page);
-
- g_return_if_fail (child != NULL);
-
- page_info = (GtkAssistantPage*) child->data;
-
- g_object_set (page_info, "has-padding", has_padding, NULL);
-}
-
-/**
- * gtk_assistant_get_page_has_padding:
- * @assistant: a #GtkAssistant
- * @page: a page of @assistant
- *
- * Gets whether page has padding.
- *
- * Returns: %TRUE if @page has padding
- */
-gboolean
-gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
- GtkWidget *page)
-{
- GtkAssistantPage *page_info;
- GList *child;
-
- g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), FALSE);
- g_return_val_if_fail (GTK_IS_WIDGET (page), FALSE);
-
- child = find_page (assistant, page);
-
- g_return_val_if_fail (child != NULL, TRUE);
-
- page_info = (GtkAssistantPage*) child->data;
-
- return page_info->has_padding;
-}
-
/**
* gtk_assistant_update_buttons_state:
* @assistant: a #GtkAssistant
diff --git a/gtk/gtkassistant.h b/gtk/gtkassistant.h
index 164add62c8..533fc83e17 100644
--- a/gtk/gtkassistant.h
+++ b/gtk/gtkassistant.h
@@ -214,13 +214,6 @@ void gtk_assistant_update_buttons_state (GtkAssistant *assista
GDK_AVAILABLE_IN_ALL
void gtk_assistant_commit (GtkAssistant *assistant);
-GDK_AVAILABLE_IN_ALL
-void gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
- GtkWidget *page,
- gboolean has_padding);
-GDK_AVAILABLE_IN_ALL
-gboolean gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
- GtkWidget *page);
GDK_AVAILABLE_IN_ALL
GtkAssistantPage * gtk_assistant_get_page (GtkAssistant *assistant,
GtkWidget *child);
diff --git a/tests/testassistant.c b/tests/testassistant.c
index 70e02e6d13..ec3d3f9928 100644
--- a/tests/testassistant.c
+++ b/tests/testassistant.c
@@ -570,7 +570,6 @@ create_full_featured_assistant (GtkWidget *widget)
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Filechooser");
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
- gtk_assistant_set_page_has_padding (GTK_ASSISTANT (assistant), page, FALSE);
page = get_test_page ("Page 3");
gtk_widget_show (page);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]