static void set_mode (GisAccountPage *page, UmAccountMode mode) { GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page); if (priv->mode == mode) return; priv->mode = mode; gis_driver_set_account_mode (GIS_PAGE (page)->driver, mode); switch (mode) { case UM_LOCAL: gtk_stack_set_visible_child (GTK_STACK (priv->stack), priv->page_local); gis_account_page_local_shown (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local)); break; case UM_ENTERPRISE: gtk_stack_set_visible_child (GTK_STACK (priv->stack), priv->page_enterprise); gis_account_page_enterprise_shown (GIS_ACCOUNT_PAGE_ENTERPRISE (priv->page_enterprise)); break; default: g_assert_not_reached (); } update_page_validation (page); }
static gboolean page_validate (GisAccountPage *page) { GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page); switch (priv->mode) { case UM_LOCAL: return gis_account_page_local_validate (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local)); case UM_ENTERPRISE: return gis_account_page_enterprise_validate (GIS_ACCOUNT_PAGE_ENTERPRISE (priv->page_enterprise)); default: g_assert_not_reached (); } }
static void gis_account_page_enterprise_realize (GtkWidget *widget) { GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (widget); GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page); GtkWidget *gis_page; gis_page = gtk_widget_get_ancestor (widget, GIS_TYPE_PAGE); g_object_bind_property (gis_page, "small-screen", priv->image, "visible", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); GTK_WIDGET_CLASS (gis_account_page_enterprise_parent_class)->realize (widget); }
static gboolean gis_account_page_apply (GisPage *gis_page, GCancellable *cancellable) { GisAccountPage *page = GIS_ACCOUNT_PAGE (gis_page); GisAccountPagePrivate *priv = gis_account_page_get_instance_private (page); switch (priv->mode) { case UM_LOCAL: return gis_account_page_local_apply (GIS_ACCOUNT_PAGE_LOCAL (priv->page_local), gis_page); case UM_ENTERPRISE: return gis_account_page_enterprise_apply (GIS_ACCOUNT_PAGE_ENTERPRISE (priv->page_enterprise), cancellable, enterprise_apply_complete, page); default: g_assert_not_reached (); break; } }
static void gis_account_page_enterprise_dispose (GObject *object) { GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (object); GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page); if (priv->realmd_watch) g_bus_unwatch_name (priv->realmd_watch); priv->realmd_watch = 0; g_cancellable_cancel (priv->cancellable); g_clear_object (&priv->realm_manager); g_clear_object (&priv->realm); g_clear_object (&priv->cancellable); G_OBJECT_CLASS (gis_account_page_enterprise_parent_class)->dispose (object); }
static void gis_account_page_enterprise_constructed (GObject *object) { GisAccountPageEnterprise *page = GIS_ACCOUNT_PAGE_ENTERPRISE (object); GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page); G_OBJECT_CLASS (gis_account_page_enterprise_parent_class)->constructed (object); priv->act_client = act_user_manager_get_default (); priv->realmd_watch = g_bus_watch_name (G_BUS_TYPE_SYSTEM, "org.freedesktop.realmd", G_BUS_NAME_WATCHER_FLAGS_AUTO_START, on_realmd_appeared, on_realmd_disappeared, page, NULL); g_signal_connect (priv->join_dialog, "response", G_CALLBACK (on_join_response), page); g_signal_connect (priv->domain, "changed", G_CALLBACK (on_domain_changed), page); g_signal_connect (priv->login, "changed", G_CALLBACK (on_entry_changed), page); }