mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-01 00:11:29 +00:00
Merge branch 'assistant-cleanup' into 'master'
Assistant cleanup See merge request GNOME/gtk!581
This commit is contained in:
commit
74d6d81db9
@ -233,8 +233,6 @@ gtk_assistant_set_page_title
|
|||||||
gtk_assistant_get_page_title
|
gtk_assistant_get_page_title
|
||||||
gtk_assistant_set_page_complete
|
gtk_assistant_set_page_complete
|
||||||
gtk_assistant_get_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_add_action_widget
|
||||||
gtk_assistant_remove_action_widget
|
gtk_assistant_remove_action_widget
|
||||||
gtk_assistant_update_buttons_state
|
gtk_assistant_update_buttons_state
|
||||||
|
@ -593,6 +593,14 @@
|
|||||||
child properties to child meta objects.
|
child properties to child meta objects.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</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>
|
</section>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkimage.h"
|
#include "gtkimage.h"
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtknotebook.h"
|
#include "gtkstack.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtksettings.h"
|
#include "gtksettings.h"
|
||||||
#include "gtksizegroup.h"
|
#include "gtksizegroup.h"
|
||||||
@ -92,11 +92,9 @@ struct _GtkAssistantPage
|
|||||||
GtkAssistantPageType type;
|
GtkAssistantPageType type;
|
||||||
guint complete : 1;
|
guint complete : 1;
|
||||||
guint complete_set : 1;
|
guint complete_set : 1;
|
||||||
guint has_padding : 1;
|
|
||||||
|
|
||||||
gchar *title;
|
gchar *title;
|
||||||
|
|
||||||
GtkWidget *box;
|
|
||||||
GtkWidget *page;
|
GtkWidget *page;
|
||||||
GtkWidget *regular_title;
|
GtkWidget *regular_title;
|
||||||
GtkWidget *current_title;
|
GtkWidget *current_title;
|
||||||
@ -217,7 +215,6 @@ static void
|
|||||||
gtk_assistant_page_init (GtkAssistantPage *page)
|
gtk_assistant_page_init (GtkAssistantPage *page)
|
||||||
{
|
{
|
||||||
page->type = GTK_ASSISTANT_PAGE_CONTENT;
|
page->type = GTK_ASSISTANT_PAGE_CONTENT;
|
||||||
page->has_padding = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -281,13 +278,6 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
|
|||||||
P_("Whether all required fields on the page have been filled out"),
|
P_("Whether all required fields on the page have been filled out"),
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
||||||
g_object_class_install_property (object_class,
|
|
||||||
CHILD_PROP_HAS_PADDING,
|
|
||||||
g_param_spec_boolean ("has-padding",
|
|
||||||
P_("Has padding"),
|
|
||||||
P_("Whether the assistant adds padding around the page"),
|
|
||||||
TRUE,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
|
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
CHILD_PROP_CHILD,
|
CHILD_PROP_CHILD,
|
||||||
g_param_spec_object ("child",
|
g_param_spec_object ("child",
|
||||||
@ -967,7 +957,7 @@ set_current_page (GtkAssistant *assistant,
|
|||||||
|
|
||||||
gtk_window_set_title (GTK_WINDOW (assistant), priv->current_page->title);
|
gtk_window_set_title (GTK_WINDOW (assistant), priv->current_page->title);
|
||||||
|
|
||||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->content), page_num);
|
gtk_stack_set_visible_child (GTK_STACK (priv->content), priv->current_page->page);
|
||||||
|
|
||||||
/* update buttons state, flow may have changed */
|
/* update buttons state, flow may have changed */
|
||||||
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
|
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
|
||||||
@ -1280,16 +1270,6 @@ gtk_assistant_page_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1322,10 +1302,6 @@ gtk_assistant_page_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, page->complete);
|
g_value_set_boolean (value, page->complete);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHILD_PROP_HAS_PADDING:
|
|
||||||
g_value_set_boolean (value, page->has_padding);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1348,13 +1324,15 @@ gtk_assistant_destroy (GtkWidget *widget)
|
|||||||
|
|
||||||
if (priv->content)
|
if (priv->content)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook;
|
GList *children, *l;
|
||||||
GtkWidget *page;
|
|
||||||
|
|
||||||
/* Remove all pages from the content notebook. */
|
children = gtk_container_get_children (GTK_CONTAINER (priv->content));
|
||||||
notebook = (GtkNotebook *) priv->content;
|
for (l = children; l; l = l->next)
|
||||||
while ((page = gtk_notebook_get_nth_page (notebook, 0)) != NULL)
|
{
|
||||||
gtk_container_remove ((GtkContainer *) notebook, page);
|
GtkWidget *page = l->data;
|
||||||
|
gtk_container_remove (GTK_CONTAINER (priv->content), page);
|
||||||
|
}
|
||||||
|
g_list_free (children);
|
||||||
|
|
||||||
/* Our GtkAssistantPage list should be empty now. */
|
/* Our GtkAssistantPage list should be empty now. */
|
||||||
g_warn_if_fail (priv->pages == NULL);
|
g_warn_if_fail (priv->pages == NULL);
|
||||||
@ -1399,7 +1377,7 @@ find_page (GtkAssistant *assistant,
|
|||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
GtkAssistantPage *page_info = child->data;
|
GtkAssistantPage *page_info = child->data;
|
||||||
if (page_info->page == page || page_info->box == page)
|
if (page_info->page == page)
|
||||||
return child;
|
return child;
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
@ -1498,16 +1476,11 @@ gtk_assistant_remove (GtkContainer *container,
|
|||||||
GtkWidget *page)
|
GtkWidget *page)
|
||||||
{
|
{
|
||||||
GtkAssistant *assistant = (GtkAssistant*) container;
|
GtkAssistant *assistant = (GtkAssistant*) container;
|
||||||
GtkWidget *box;
|
|
||||||
|
|
||||||
/* Forward this removal to the content notebook */
|
/* Forward this removal to the content stack */
|
||||||
box = gtk_widget_get_parent (page);
|
if (gtk_widget_get_parent (page) == assistant->priv->content)
|
||||||
if (GTK_IS_BOX (box) &&
|
|
||||||
assistant->priv->content != NULL &&
|
|
||||||
gtk_widget_get_parent (box) == assistant->priv->content)
|
|
||||||
{
|
{
|
||||||
gtk_container_remove (GTK_CONTAINER (box), page);
|
gtk_container_remove (GTK_CONTAINER (assistant->priv->content), page);
|
||||||
gtk_container_remove (GTK_CONTAINER (assistant->priv->content), box);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1789,7 +1762,6 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
|
|||||||
|
|
||||||
page_info = g_object_new (GTK_TYPE_ASSISTANT_PAGE, NULL);
|
page_info = g_object_new (GTK_TYPE_ASSISTANT_PAGE, NULL);
|
||||||
page_info->page = g_object_ref (page);
|
page_info->page = g_object_ref (page);
|
||||||
page_info->has_padding = TRUE;
|
|
||||||
|
|
||||||
return gtk_assistant_add_page (assistant, page_info, position);
|
return gtk_assistant_add_page (assistant, page_info, position);
|
||||||
|
|
||||||
@ -1804,8 +1776,8 @@ gtk_assistant_add_page (GtkAssistant *assistant,
|
|||||||
GtkAssistantPrivate *priv = assistant->priv;
|
GtkAssistantPrivate *priv = assistant->priv;
|
||||||
gint n_pages;
|
gint n_pages;
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
GtkWidget *box;
|
|
||||||
GtkWidget *sibling;
|
GtkWidget *sibling;
|
||||||
|
char *name;
|
||||||
|
|
||||||
page_info->regular_title = gtk_label_new (page_info->title);
|
page_info->regular_title = gtk_label_new (page_info->title);
|
||||||
page_info->current_title = gtk_label_new (page_info->title);
|
page_info->current_title = gtk_label_new (page_info->title);
|
||||||
@ -1851,15 +1823,9 @@ 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->current_title, sibling);
|
||||||
gtk_box_insert_child_after (GTK_BOX (priv->sidebar), page_info->regular_title, sibling);
|
gtk_box_insert_child_after (GTK_BOX (priv->sidebar), page_info->regular_title, sibling);
|
||||||
|
|
||||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
name = g_strdup_printf ("%p", page_info->page);
|
||||||
gtk_widget_show (box);
|
gtk_stack_add_named (GTK_STACK (priv->content), page_info->page, name);
|
||||||
gtk_container_add (GTK_CONTAINER (box), page_info->page);
|
g_free (name);
|
||||||
g_object_set (box, "margin", 12, NULL);
|
|
||||||
g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant);
|
|
||||||
|
|
||||||
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), box, NULL, position);
|
|
||||||
|
|
||||||
page_info->box = box;
|
|
||||||
|
|
||||||
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
|
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
|
||||||
{
|
{
|
||||||
@ -2198,63 +2164,6 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
|
|||||||
return page_info->complete;
|
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:
|
* gtk_assistant_update_buttons_state:
|
||||||
* @assistant: a #GtkAssistant
|
* @assistant: a #GtkAssistant
|
||||||
@ -2545,6 +2454,14 @@ gtk_assistant_pages_new (GtkAssistant *assistant)
|
|||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_assistant_get_pages:
|
||||||
|
* @assistant: a #GtkAssistant
|
||||||
|
*
|
||||||
|
* Gets a list model of the assistant pages.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): A list model of the pages.
|
||||||
|
*/
|
||||||
GListModel *
|
GListModel *
|
||||||
gtk_assistant_get_pages (GtkAssistant *assistant)
|
gtk_assistant_get_pages (GtkAssistant *assistant)
|
||||||
{
|
{
|
||||||
|
@ -214,13 +214,6 @@ void gtk_assistant_update_buttons_state (GtkAssistant *assista
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_assistant_commit (GtkAssistant *assistant);
|
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
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkAssistantPage * gtk_assistant_get_page (GtkAssistant *assistant,
|
GtkAssistantPage * gtk_assistant_get_page (GtkAssistant *assistant,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
|
@ -18,10 +18,8 @@
|
|||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="hexpand">1</property>
|
<property name="hexpand">1</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkNotebook" id="content">
|
<object class="GtkStack" id="content">
|
||||||
<property name="can-focus">1</property>
|
<property name="can-focus">1</property>
|
||||||
<property name="show-tabs">0</property>
|
|
||||||
<property name="show-border">0</property>
|
|
||||||
<property name="vexpand">1</property>
|
<property name="vexpand">1</property>
|
||||||
<signal name="remove" handler="assistant_remove_page_cb" swapped="no"/>
|
<signal name="remove" handler="assistant_remove_page_cb" swapped="no"/>
|
||||||
<child type="tab"/>
|
<child type="tab"/>
|
||||||
|
@ -570,7 +570,6 @@ create_full_featured_assistant (GtkWidget *widget)
|
|||||||
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
|
gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
|
||||||
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Filechooser");
|
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page, "Filechooser");
|
||||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), page, TRUE);
|
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");
|
page = get_test_page ("Page 3");
|
||||||
gtk_widget_show (page);
|
gtk_widget_show (page);
|
||||||
|
@ -298,6 +298,7 @@ test_create (void)
|
|||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION (2, 58, 0) /* g_list_store_splice() is broken before 2.58 */
|
||||||
static void
|
static void
|
||||||
test_changes (void)
|
test_changes (void)
|
||||||
{
|
{
|
||||||
@ -332,7 +333,9 @@ test_changes (void)
|
|||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION (2, 59, 0) /* g_list_store_get_item() has overflow issues before */
|
||||||
static void
|
static void
|
||||||
test_selection (void)
|
test_selection (void)
|
||||||
{
|
{
|
||||||
@ -383,7 +386,9 @@ test_selection (void)
|
|||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION (2, 59, 0) /* g_list_store_get_item() has overflow issues before */
|
||||||
static void
|
static void
|
||||||
test_autoselect (void)
|
test_autoselect (void)
|
||||||
{
|
{
|
||||||
@ -483,7 +488,9 @@ test_autoselect_toggle (void)
|
|||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION (2, 59, 0) /* g_list_store_get_item() has overflow issues before */
|
||||||
static void
|
static void
|
||||||
test_can_unselect (void)
|
test_can_unselect (void)
|
||||||
{
|
{
|
||||||
@ -514,7 +521,9 @@ test_can_unselect (void)
|
|||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION (2, 59, 0) /* g_list_store_get_item() has overflow issues before */
|
||||||
static int
|
static int
|
||||||
sort_inverse (gconstpointer a, gconstpointer b, gpointer data)
|
sort_inverse (gconstpointer a, gconstpointer b, gpointer data)
|
||||||
{
|
{
|
||||||
@ -549,6 +558,7 @@ test_persistence (void)
|
|||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_query_range (GtkSelectionModel *selection)
|
check_query_range (GtkSelectionModel *selection)
|
||||||
|
Loading…
Reference in New Issue
Block a user