#include "gtkintl.h"
#include "gtkprivate.h"
+#include "gtkbuildable.h"
#include "gtkalias.h"
static AtkObject *gtk_assistant_get_accessible (GtkWidget *widget);
+static void gtk_assistant_buildable_interface_init (GtkBuildableIface *iface);
+static GObject *gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname);
+static gboolean gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ GMarkupParser *parser,
+ gpointer *data);
+static void gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ gpointer user_data);
+
+
enum
{
CHILD_PROP_0,
static guint signals [LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (GtkAssistant, gtk_assistant, GTK_TYPE_WINDOW)
+G_DEFINE_TYPE_WITH_CODE (GtkAssistant, gtk_assistant, GTK_TYPE_WINDOW,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_assistant_buildable_interface_init))
static void
* @assistant: the #GtkAssistant
* @page: the current page
*
- * The ::prepared signal is emitted when a new page is set as the assistant's
- * current page, before making the new page visible. A handler for this signal
+ * The ::prepare signal is emitted when a new page is set as the assistant's
+ * current page, before making the new page visible. A handler for this signal
* can do any preparation which are necessary before showing @page.
*
* Since: 2.10
* @assistant: the @GtkAssistant
*
* The ::apply signal is emitted when the apply button is clicked. The default
- * behavior of the #GtkAssistant is to switch to the page after the current page,
- * unless the current page is the last one.
+ * behavior of the #GtkAssistant is to switch to the page after the current
+ * page, unless the current page is the last one.
*
- * A handler for the ::apply signal should carry out the actions for which the
- * wizard has collected data. If the action takes a long time to complete, you
- * might consider to put a page of type GTK_ASSISTANT_PAGE_PROGRESS after the
- * confirmation page and handle this operation within the ::prepare signal of
- * the progress page.
+ * A handler for the ::apply signal should carry out the actions for which
+ * the wizard has collected data. If the action takes a long time to complete,
+ * you might consider to put a page of type %GTK_ASSISTANT_PAGE_PROGRESS
+ * after the confirmation page and handle this operation within the
+ * #GtkAssistant::prepare signal of the progress page.
*
* Since: 2.10
*/
*
* The ::close signal is emitted either when the close button of
* a summary page is clicked, or when the apply button in the last
- * page in the flow (of type GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
+ * page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
*
* Since: 2.10
*/
/**
* GtkAssistant:page-type:
*
- * The type of the assistant page.
+ * The type of the assistant page.
*
* Since: 2.10
*/
/**
* GtkAssistant:title:
*
- * The title that is displayed in the page header.
+ * The title that is displayed in the page header.
*
* If title and header-image are both %NULL, no header is displayed.
*
/**
* GtkAssistant:header-image:
*
- * The image that is displayed next to the page.
+ * The image that is displayed next to the page.
*
* Set this to %NULL to make the sidebar disappear.
*
page_info = g_list_nth_data (priv->pages, page_num);
count++;
-
- g_assert (page_info);
}
/* make the last button visible if we can skip multiple
- * pages and end on a confirmation or summary page
+ * pages and end on a confirmation or summary page
*/
- if (count > 1 &&
+ if (count > 1 && page_info &&
(page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
{
priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
+ gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
gtk_widget_push_composite_child ();
{
GtkWidget *assistant;
- assistant = g_object_new (GTK_TYPE_ASSISTANT,
- "border-width", 12,
- NULL);
+ assistant = g_object_new (GTK_TYPE_ASSISTANT, NULL);
+
return assistant;
}
* @assistant: a #GtkAssistant
* @page: a page of @assistant
*
- * Gets whether @page is complete..
+ * Gets whether @page is complete.
*
* Return value: %TRUE if @page is complete.
*
GtkWidget *widget, *child;
gint n_pages;
AtkObject *obj;
+ const gchar *title;
widget = GTK_ACCESSIBLE (accessible)->widget;
if (!widget)
return NULL;
else if (index < n_pages)
{
- GtkAssistantPage *page = g_list_nth_data (priv->pages, index / 2);
+ GtkAssistantPage *page = g_list_nth_data (priv->pages, index);
child = page->page;
+ title = gtk_assistant_get_page_title (assistant, child);
}
else if (index == n_pages)
{
child = priv->action_area;
+ title = NULL;
}
else
return NULL;
obj = gtk_widget_get_accessible (child);
+ if (title)
+ atk_object_set_name (obj, title);
+
return g_object_ref (obj);
}
GType derived_type;
GTypeQuery query;
GType derived_atk_type;
-
+
derived_type = g_type_parent (GTK_TYPE_ASSISTANT);
factory = atk_registry_get_factory (atk_get_default_registry (),
derived_type);
derived_atk_type = atk_object_factory_get_accessible_type (factory);
g_type_query (derived_atk_type, &query);
-
- type = g_type_register_static_simple (derived_atk_type,
- I_("GtkAssistantAccessible"),
+
+ type = g_type_register_static_simple (derived_atk_type,
+ I_("GtkAssistantAccessible"),
query.class_size,
(GClassInitFunc) gtk_assistant_accessible_class_init,
query.instance_size,
g_return_val_if_fail (GTK_IS_ASSISTANT (obj), NULL);
- accessible = g_object_new (gtk_assistant_accessible_get_type (), NULL);
+ accessible = g_object_new (gtk_assistant_accessible_get_type (), NULL);
atk_object_initialize (accessible, obj);
-
+
return accessible;
}
{
static GType type = 0;
- if (!type)
+ if (!type)
{
- type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
+ type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
I_("GtkAssistantAccessibleFactory"),
sizeof (AtkObjectFactoryClass),
(GClassInitFunc) gtk_assistant_accessible_factory_class_init,
sizeof (AtkObjectFactory),
NULL, 0);
}
-
+
return type;
}
{
static gboolean first_time = TRUE;
- if (first_time)
+ if (first_time)
{
AtkObjectFactory *factory;
AtkRegistry *registry;
- GType derived_type;
- GType derived_atk_type;
+ GType derived_type;
+ GType derived_atk_type;
/*
* Figure out whether accessibility is enabled by looking at the
derived_atk_type = atk_object_factory_get_accessible_type (factory);
if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
{
- atk_registry_set_factory_type (registry,
+ atk_registry_set_factory_type (registry,
GTK_TYPE_ASSISTANT,
gtk_assistant_accessible_factory_get_type ());
}
}
+static GtkBuildableIface *parent_buildable_iface;
+
+static void
+gtk_assistant_buildable_interface_init (GtkBuildableIface *iface)
+{
+ parent_buildable_iface = g_type_interface_peek_parent (iface);
+ iface->get_internal_child = gtk_assistant_buildable_get_internal_child;
+ iface->custom_tag_start = gtk_assistant_buildable_custom_tag_start;
+ iface->custom_finished = gtk_assistant_buildable_custom_finished;
+}
+
+static GObject *
+gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname)
+{
+ if (strcmp (childname, "action_area") == 0)
+ return G_OBJECT (GTK_ASSISTANT (buildable)->priv->action_area);
+
+ return parent_buildable_iface->get_internal_child (buildable,
+ builder,
+ childname);
+}
+
+gboolean
+gtk_assistant_buildable_custom_tag_start (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ GMarkupParser *parser,
+ gpointer *data)
+{
+ return parent_buildable_iface->custom_tag_start (buildable, builder, child,
+ tagname, parser, data);
+}
+
+static void
+gtk_assistant_buildable_custom_finished (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ gpointer user_data)
+{
+ parent_buildable_iface->custom_finished (buildable, builder, child,
+ tagname, user_data);
+}
+
+
#define __GTK_ASSISTANT_C__
#include "gtkaliasdef.c"