[gnome-builder/wip/gtk4-port] plugins/vcsui: show a menubutton for vcs selection
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/vcsui: show a menubutton for vcs selection
- Date: Sun, 17 Apr 2022 01:14:55 +0000 (UTC)
commit 85181e753db3753d90091356e79d92aacc1fb6f9
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 16 18:14:36 2022 -0700
plugins/vcsui: show a menubutton for vcs selection
This still needs the popover designed/created.
src/plugins/vcsui/gbp-vcsui-workspace-addin.c | 47 +++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
---
diff --git a/src/plugins/vcsui/gbp-vcsui-workspace-addin.c b/src/plugins/vcsui/gbp-vcsui-workspace-addin.c
index 6cea761d4..02856834a 100644
--- a/src/plugins/vcsui/gbp-vcsui-workspace-addin.c
+++ b/src/plugins/vcsui/gbp-vcsui-workspace-addin.c
@@ -33,7 +33,12 @@
struct _GbpVcsuiWorkspaceAddin
{
GObject parent_instance;
+
GbpVcsuiCloneWidget *clone;
+
+ GtkMenuButton *branch_button;
+ GtkLabel *branch_label;
+ IdeBindingGroup *vcs_bindings;
};
static void
@@ -62,6 +67,44 @@ gbp_vcsui_workspace_addin_load (IdeWorkspaceAddin *addin,
NULL),
100);
}
+ else if (IDE_IS_PRIMARY_WORKSPACE (workspace))
+ {
+ PanelStatusbar *statusbar;
+ IdeWorkbench *workbench;
+ GtkImage *image;
+ GtkBox *box;
+
+ statusbar = ide_workspace_get_statusbar (workspace);
+
+ box = g_object_new (GTK_TYPE_BOX,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "spacing", 3,
+ NULL);
+ image = g_object_new (GTK_TYPE_IMAGE,
+ "icon-name", "builder-vcs-branch-symbolic",
+ "pixel-size", 16,
+ NULL);
+ self->branch_label = g_object_new (GTK_TYPE_LABEL,
+ "xalign", .0f,
+ NULL);
+ gtk_box_append (box, GTK_WIDGET (image));
+ gtk_box_append (box, GTK_WIDGET (self->branch_label));
+
+ self->branch_button = g_object_new (GTK_TYPE_MENU_BUTTON,
+ "child", box,
+ "direction", GTK_ARROW_UP,
+ NULL);
+ panel_statusbar_add_prefix (statusbar, GTK_WIDGET (self->branch_button));
+
+ workbench = ide_workspace_get_workbench (workspace);
+ self->vcs_bindings = ide_binding_group_new ();
+ ide_binding_group_bind (self->vcs_bindings, "branch-name",
+ self->branch_label, "label",
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (workbench, "vcs",
+ self->vcs_bindings, "source",
+ G_BINDING_SYNC_CREATE);
+ }
IDE_EXIT;
}
@@ -82,6 +125,10 @@ gbp_vcsui_workspace_addin_unload (IdeWorkspaceAddin *addin,
GTK_WIDGET (self->clone));
self->clone = NULL;
}
+ else if (IDE_IS_PRIMARY_WORKSPACE (workspace))
+ {
+ g_clear_object (&self->vcs_bindings);
+ }
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]