[gnome-builder/wip/gtk4-port: 226/736] plugins/greeter: partial port to GTK 4




commit 4911c11ec062d3904dca2fc382a2992cdfac13df
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 30 15:03:47 2022 -0700

    plugins/greeter: partial port to GTK 4
    
    This still doesn't wire up the clone surface additions, but that will
    get moved to vcsui plugin along with the clone surface.

 .../greeter/gbp-greeter-application-addin.c        | 34 ++++++++++++----------
 1 file changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/greeter/gbp-greeter-application-addin.c 
b/src/plugins/greeter/gbp-greeter-application-addin.c
index b4f0b6382..93f307f04 100644
--- a/src/plugins/greeter/gbp-greeter-application-addin.c
+++ b/src/plugins/greeter/gbp-greeter-application-addin.c
@@ -35,9 +35,9 @@ struct _GbpGreeterApplicationAddin
 };
 
 static void
-present_greeter_with_surface (GSimpleAction *action,
-                              GVariant      *param,
-                              gpointer       user_data)
+present_greeter_with_page (GSimpleAction *action,
+                           GVariant      *param,
+                           gpointer       user_data)
 {
   GbpGreeterApplicationAddin *self = user_data;
   g_autoptr(IdeWorkbench) workbench = NULL;
@@ -56,7 +56,7 @@ present_greeter_with_surface (GSimpleAction *action,
   ide_workbench_add_workspace (workbench, IDE_WORKSPACE (workspace));
 
   if (param != NULL && (name = g_variant_get_string (param, NULL)) && !ide_str_empty0 (name))
-    ide_workspace_set_visible_surface_name (IDE_WORKSPACE (workspace), name);
+    ide_greeter_workspace_set_page_name (workspace, name);
 
   ide_workbench_focus_workspace (workbench, IDE_WORKSPACE (workspace));
 }
@@ -72,7 +72,7 @@ new_window (GSimpleAction *action,
   g_assert (GBP_IS_GREETER_APPLICATION_ADDIN (self));
   g_assert (IDE_IS_APPLICATION (self->application));
 
-  present_greeter_with_surface (NULL, NULL, self);
+  present_greeter_with_page (NULL, NULL, self);
 }
 
 static void
@@ -86,7 +86,7 @@ clone_repo_cb (GSimpleAction *action,
   g_assert (GBP_IS_GREETER_APPLICATION_ADDIN (user_data));
 
   clone_param = g_variant_take_ref (g_variant_new_string ("clone"));
-  present_greeter_with_surface (NULL, clone_param, user_data);
+  present_greeter_with_page (NULL, clone_param, user_data);
 }
 
 static void
@@ -112,7 +112,7 @@ open_project (GSimpleAction *action,
 }
 
 static const GActionEntry actions[] = {
-  { "present-greeter-with-surface", present_greeter_with_surface, "s" },
+  { "present-greeter-with-page", present_greeter_with_page, "s" },
   { "open-project", open_project },
   { "clone-repo", clone_repo_cb },
   { "new-window", new_window },
@@ -171,19 +171,22 @@ gbp_greeter_application_addin_handle_command_line (IdeApplicationAddin     *addi
   if ((!g_application_command_line_get_is_remote (cmdline) && argc == 1) ||
       g_variant_dict_contains (dict, "greeter"))
     {
-      present_greeter_with_surface (NULL, NULL, addin);
+      present_greeter_with_page (NULL, NULL, addin);
       return;
     }
 
   /*
    * If the --clone=URI option was provided, switch the greeter to the
-   * clone surface and begin cloning.
+   * clone page and begin cloning.
    */
   if (dict != NULL && g_variant_dict_lookup (dict, "clone", "&s", &clone_uri))
     {
+#if 0
+      /* TODO: Move to vcsuti */
+
       IdeGreeterWorkspace *workspace;
       IdeWorkbench *workbench;
-      IdeSurface *surface;
+      GtkWidget *page;
 
       workbench = ide_workbench_new ();
       ide_application_add_workbench (self->application, workbench);
@@ -191,13 +194,14 @@ gbp_greeter_application_addin_handle_command_line (IdeApplicationAddin     *addi
       workspace = ide_greeter_workspace_new (self->application);
       ide_workbench_add_workspace (workbench, IDE_WORKSPACE (workspace));
 
-      surface = ide_workspace_get_surface_by_name (IDE_WORKSPACE (workspace), "clone");
-      ide_workspace_set_visible_surface (IDE_WORKSPACE (workspace), surface);
+      ide_greeter_workspace_set_page_name (workspace, "clone");
+      page = ide_greeter_workspace_get_page (workspace, clone);
 
-      if (IDE_IS_CLONE_SURFACE (surface))
-        ide_clone_surface_set_uri (IDE_CLONE_SURFACE (surface), clone_uri);
+      if (IDE_IS_CLONE_SURFACE (page))
+        ide_clone_surface_set_uri (IDE_CLONE_SURFACE (page), clone_uri);
 
       ide_workbench_focus_workspace (workbench, IDE_WORKSPACE (workspace));
+#endif
     }
 }
 
@@ -244,7 +248,7 @@ gbp_greeter_application_addin_activate (IdeApplicationAddin *addin,
   g_assert (IDE_IS_APPLICATION (app));
 
   if (!(window = gtk_application_get_active_window (GTK_APPLICATION (app))))
-    present_greeter_with_surface (NULL, NULL, addin);
+    present_greeter_with_page (NULL, NULL, addin);
 }
 
 static void


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