[gnome-builder/wip/gtk4-port] libide/greeter: add helper to get page by name



commit 3989310e4a6f1cc2f69bda964d054cf63c695eca
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 1 00:02:17 2022 -0700

    libide/greeter: add helper to get page by name

 src/libide/greeter/ide-greeter-workspace.c | 18 ++++++++++++++++++
 src/libide/greeter/ide-greeter-workspace.h |  3 +++
 2 files changed, 21 insertions(+)
---
diff --git a/src/libide/greeter/ide-greeter-workspace.c b/src/libide/greeter/ide-greeter-workspace.c
index 724bcf7e3..e08404e0c 100644
--- a/src/libide/greeter/ide-greeter-workspace.c
+++ b/src/libide/greeter/ide-greeter-workspace.c
@@ -1003,3 +1003,21 @@ ide_greeter_workspace_remove_page (IdeGreeterWorkspace *self,
 
   gtk_stack_remove (self->pages, page);
 }
+
+/**
+ * ide_greeter_workspace_get_page_named:
+ * @self: a #IdeGreeterWorkspace
+ *
+ * Gets a page that was added, by it's name.
+ *
+ * Returns: (transfer none) (nullable): a #GtkWidget or %NULL
+ */
+GtkWidget *
+ide_greeter_workspace_get_page_named (IdeGreeterWorkspace *self,
+                                      const char          *page_name)
+{
+  g_return_val_if_fail (IDE_IS_GREETER_WORKSPACE (self), NULL);
+  g_return_val_if_fail (page_name != NULL, NULL);
+
+  return gtk_stack_get_child_by_name (self->pages, page_name);
+}
diff --git a/src/libide/greeter/ide-greeter-workspace.h b/src/libide/greeter/ide-greeter-workspace.h
index 4ec89df46..c31c32e59 100644
--- a/src/libide/greeter/ide-greeter-workspace.h
+++ b/src/libide/greeter/ide-greeter-workspace.h
@@ -74,6 +74,9 @@ IDE_AVAILABLE_IN_ALL
 void                 ide_greeter_workspace_set_page           (IdeGreeterWorkspace *self,
                                                                GtkWidget           *page);
 IDE_AVAILABLE_IN_ALL
+GtkWidget           *ide_greeter_workspace_get_page_named     (IdeGreeterWorkspace *self,
+                                                               const char          *page_name);
+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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]