[gnome-builder/wip/gtk4-port: 209/1774] libide/greeter: follow stack naming semantics for pages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 209/1774] libide/greeter: follow stack naming semantics for pages
- Date: Mon, 11 Jul 2022 22:31:02 +0000 (UTC)
commit 89116db5482edb74a9e9ae82d87707a25894dff6
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 30 14:59:14 2022 -0700
libide/greeter: follow stack naming semantics for pages
src/libide/greeter/ide-greeter-workspace.c | 43 +++++++++++++++++++++++++++---
src/libide/greeter/ide-greeter-workspace.h | 7 +++++
2 files changed, 46 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/greeter/ide-greeter-workspace.c b/src/libide/greeter/ide-greeter-workspace.c
index c8d288594..f2f2818e2 100644
--- a/src/libide/greeter/ide-greeter-workspace.c
+++ b/src/libide/greeter/ide-greeter-workspace.c
@@ -300,7 +300,7 @@ ide_greeter_workspace_constructed (GObject *object)
self);
/* Ensure that no plugin changed our page */
- ide_greeter_workspace_set_page (self, "overview");
+ ide_greeter_workspace_set_page_name (self, "overview");
gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
}
@@ -415,7 +415,7 @@ ide_greeter_workspace_open_project (IdeGreeterWorkspace *self,
else
{
ide_clone_page_set_uri (self->clone_page, vcs_uri);
- ide_greeter_workspace_set_page (self, "clone");
+ ide_greeter_workspace_set_page_name (self, "clone");
return;
}
}
@@ -459,7 +459,7 @@ ide_greeter_workspace_click_pressed_cb (IdeGreeterWorkspace *self,
g_assert (IDE_IS_GREETER_WORKSPACE (self));
g_assert (GTK_IS_GESTURE_CLICK (gesture));
- ide_greeter_workspace_set_page (self, "overview");
+ ide_greeter_workspace_set_page_name (self, "overview");
}
static void
@@ -876,9 +876,44 @@ ide_greeter_workspace_set_selection_mode (IdeGreeterWorkspace *self,
}
}
+/**
+ * ide_greeter_workspace_get_page:
+ *
+ * Returns: (transfer none) (nullable): the current page, or %NULL if not
+ * page has been added yet.
+ */
+GtkWidget *
+ide_greeter_workspace_get_page (IdeGreeterWorkspace *self)
+{
+ g_return_val_if_fail (IDE_IS_GREETER_WORKSPACE (self), NULL);
+
+ return gtk_stack_get_visible_child (self->pages);
+}
+
void
ide_greeter_workspace_set_page (IdeGreeterWorkspace *self,
- const char *name)
+ GtkWidget *page)
+{
+ g_return_if_fail (IDE_IS_GREETER_WORKSPACE (self));
+ g_return_if_fail (!page || GTK_IS_WIDGET (page));
+
+ if (page != NULL)
+ gtk_stack_set_visible_child (self->pages, page);
+ else
+ gtk_stack_set_visible_child_name (self->pages, "overview");
+}
+
+const char *
+ide_greeter_workspace_get_page_name (IdeGreeterWorkspace *self)
+{
+ g_return_val_if_fail (IDE_IS_GREETER_WORKSPACE (self), NULL);
+
+ return gtk_stack_get_visible_child_name (self->pages);
+}
+
+void
+ide_greeter_workspace_set_page_name (IdeGreeterWorkspace *self,
+ const char *name)
{
g_return_if_fail (IDE_IS_GREETER_WORKSPACE (self));
diff --git a/src/libide/greeter/ide-greeter-workspace.h b/src/libide/greeter/ide-greeter-workspace.h
index 4e893cb02..7ebc4d673 100644
--- a/src/libide/greeter/ide-greeter-workspace.h
+++ b/src/libide/greeter/ide-greeter-workspace.h
@@ -61,7 +61,14 @@ IDE_AVAILABLE_IN_ALL
void ide_greeter_workspace_open_project (IdeGreeterWorkspace *self,
IdeProjectInfo *project_info);
IDE_AVAILABLE_IN_ALL
+GtkWidget *ide_greeter_workspace_get_page (IdeGreeterWorkspace *self);
+IDE_AVAILABLE_IN_ALL
void ide_greeter_workspace_set_page (IdeGreeterWorkspace *self,
+ GtkWidget *page);
+IDE_AVAILABLE_IN_ALL
+const char *ide_greeter_workspace_get_page_name (IdeGreeterWorkspace *self);
+IDE_AVAILABLE_IN_ALL
+void ide_greeter_workspace_set_page_name (IdeGreeterWorkspace *self,
const char *name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]