[gnome-builder/wip/chergert/perspective] git: start on clone support for genesis workflow
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/perspective] git: start on clone support for genesis workflow
- Date: Tue, 1 Dec 2015 00:26:32 +0000 (UTC)
commit 79268a4d17c0bf8f9d7bf7bf1dcfc7a6756b48f2
Author: Christian Hergert <chergert redhat com>
Date: Mon Nov 30 16:26:24 2015 -0800
git: start on clone support for genesis workflow
data/theme/Adwaita-shared.css | 8 +-
libide/genesis/ide-genesis-perspective.c | 15 ++-
plugins/git/Makefile.am | 12 ++
plugins/git/ide-git-clone-widget.c | 91 ++++++++++++++
plugins/git/ide-git-clone-widget.h | 32 +++++
plugins/git/ide-git-clone-widget.ui | 169 +++++++++++++++++++++++++++
plugins/git/ide-git-genesis-addin.c | 16 +++-
plugins/git/ide-git-resources.gresource.xml | 6 +
8 files changed, 342 insertions(+), 7 deletions(-)
---
diff --git a/data/theme/Adwaita-shared.css b/data/theme/Adwaita-shared.css
index 296443a..e2e1b99 100644
--- a/data/theme/Adwaita-shared.css
+++ b/data/theme/Adwaita-shared.css
@@ -82,9 +82,11 @@ layoutstack > box.vertical > box.header.notebook.horizontal > GtkEventBox > box.
}
-/* New project dialog */
-GbNewProjectDialog button.linked-on-right button {
- border-radius: 3px 0 0 3px;
+/* FileChooserButton|Entry */
+box.linked-on-right button {
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
+ border-right: 0px;
}
diff --git a/libide/genesis/ide-genesis-perspective.c b/libide/genesis/ide-genesis-perspective.c
index e62a7ae..20f6b46 100644
--- a/libide/genesis/ide-genesis-perspective.c
+++ b/libide/genesis/ide-genesis-perspective.c
@@ -51,6 +51,7 @@ ide_genesis_perspective_addin_added (PeasExtensionSet *set,
GtkBox *box;
GtkImage *image;
GtkLabel *label;
+ GtkWidget *widget;
g_assert (PEAS_IS_EXTENSION_SET (set));
g_assert (plugin_info != NULL);
@@ -59,13 +60,14 @@ ide_genesis_perspective_addin_added (PeasExtensionSet *set,
icon_name = ide_genesis_addin_get_icon_name (IDE_GENESIS_ADDIN (exten));
title = ide_genesis_addin_get_title (IDE_GENESIS_ADDIN (exten));
+ widget = ide_genesis_addin_get_widget (IDE_GENESIS_ADDIN (exten));
row = g_object_new (GTK_TYPE_LIST_BOX_ROW,
"visible", TRUE,
NULL);
box = g_object_new (GTK_TYPE_BOX,
"orientation", GTK_ORIENTATION_HORIZONTAL,
- "spacing", 12,
+ "spacing", 18,
"visible", TRUE,
NULL);
image = g_object_new (GTK_TYPE_IMAGE,
@@ -76,9 +78,10 @@ ide_genesis_perspective_addin_added (PeasExtensionSet *set,
NULL);
label = g_object_new (GTK_TYPE_LABEL,
"label", title,
+ "valign", GTK_ALIGN_BASELINE,
+ "visible", TRUE,
"wrap", TRUE,
"xalign", 0.0f,
- "visible", TRUE,
NULL);
g_object_set_data (G_OBJECT (row), "IDE_GENESIS_ADDIN", exten);
@@ -87,6 +90,9 @@ ide_genesis_perspective_addin_added (PeasExtensionSet *set,
gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (image));
gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (label));
gtk_container_add (GTK_CONTAINER (self->list_box), GTK_WIDGET (row));
+
+ if (widget != NULL)
+ gtk_container_add (GTK_CONTAINER (self->stack), widget);
}
static void
@@ -96,6 +102,7 @@ ide_genesis_perspective_addin_removed (PeasExtensionSet *set,
gpointer user_data)
{
IdeGenesisPerspective *self = user_data;
+ GtkWidget *widget;
GList *children;
GList *iter;
@@ -118,6 +125,10 @@ ide_genesis_perspective_addin_removed (PeasExtensionSet *set,
}
g_list_free (children);
+
+ widget = ide_genesis_addin_get_widget (IDE_GENESIS_ADDIN (exten));
+ if (widget != NULL)
+ gtk_container_remove (GTK_CONTAINER (self->stack), widget);
}
static void
diff --git a/plugins/git/Makefile.am b/plugins/git/Makefile.am
index e97d9bf..0202f70 100644
--- a/plugins/git/Makefile.am
+++ b/plugins/git/Makefile.am
@@ -12,6 +12,8 @@ dist_plugin_DATA = git.plugin
libgit_plugin_la_SOURCES = \
ide-git-buffer-change-monitor.c \
ide-git-buffer-change-monitor.h \
+ ide-git-clone-widget.c \
+ ide-git-clone-widget.h \
ide-git-genesis-addin.c \
ide-git-genesis-addin.h \
ide-git-plugin.c \
@@ -21,6 +23,10 @@ libgit_plugin_la_SOURCES = \
ide-git-vcs.h \
$(NULL)
+nodist_libgit_plugin_la_SOURCES = \
+ ide-git-resources.c \
+ ide-git-resources.h
+
libgit_plugin_la_CFLAGS = \
$(LIBIDE_CFLAGS) \
$(OPTIMIZE_CFLAGS) \
@@ -37,6 +43,12 @@ libgit_plugin_la_LDFLAGS = \
-export-regex peas_register_types \
$(NULL)
+glib_resources_c = ide-git-resources.c
+glib_resources_h = ide-git-resources.h
+glib_resources_xml = ide-git-resources.gresource.xml
+glib_resources_namespace = ide_git
+include $(top_srcdir)/build/autotools/Makefile.am.gresources
+
include $(top_srcdir)/plugins/Makefile.plugin
endif
diff --git a/plugins/git/ide-git-clone-widget.c b/plugins/git/ide-git-clone-widget.c
new file mode 100644
index 0000000..376c4e5
--- /dev/null
+++ b/plugins/git/ide-git-clone-widget.c
@@ -0,0 +1,91 @@
+/* ide-git-clone-widget.c
+ *
+ * Copyright (C) 2015 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ide-git-clone-widget.h"
+
+struct _IdeGitCloneWidget
+{
+ GtkBin parent_instance;
+};
+
+G_DEFINE_TYPE (IdeGitCloneWidget, ide_git_clone_widget, GTK_TYPE_BIN)
+
+enum {
+ PROP_0,
+ LAST_PROP
+};
+
+static GParamSpec *properties [LAST_PROP];
+
+static void
+ide_git_clone_widget_finalize (GObject *object)
+{
+ IdeGitCloneWidget *self = (IdeGitCloneWidget *)object;
+
+ G_OBJECT_CLASS (ide_git_clone_widget_parent_class)->finalize (object);
+}
+
+static void
+ide_git_clone_widget_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ IdeGitCloneWidget *self = IDE_GIT_CLONE_WIDGET (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_git_clone_widget_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ IdeGitCloneWidget *self = IDE_GIT_CLONE_WIDGET (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ide_git_clone_widget_class_init (IdeGitCloneWidgetClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->finalize = ide_git_clone_widget_finalize;
+ object_class->get_property = ide_git_clone_widget_get_property;
+ object_class->set_property = ide_git_clone_widget_set_property;
+
+ gtk_widget_class_set_css_name (widget_class, "gitclonewidget");
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/plugins/git/ide-git-clone-widget.ui");
+}
+
+static void
+ide_git_clone_widget_init (IdeGitCloneWidget *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/plugins/git/ide-git-clone-widget.h b/plugins/git/ide-git-clone-widget.h
new file mode 100644
index 0000000..53e6eed
--- /dev/null
+++ b/plugins/git/ide-git-clone-widget.h
@@ -0,0 +1,32 @@
+/* ide-git-clone-widget.h
+ *
+ * Copyright (C) 2015 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_GIT_CLONE_WIDGET_H
+#define IDE_GIT_CLONE_WIDGET_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_GIT_CLONE_WIDGET (ide_git_clone_widget_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeGitCloneWidget, ide_git_clone_widget, IDE, GIT_CLONE_WIDGET, GtkBin)
+
+G_END_DECLS
+
+#endif /* IDE_GIT_CLONE_WIDGET_H */
diff --git a/plugins/git/ide-git-clone-widget.ui b/plugins/git/ide-git-clone-widget.ui
new file mode 100644
index 0000000..6f7739b
--- /dev/null
+++ b/plugins/git/ide-git-clone-widget.ui
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.18 -->
+ <template class="IdeGitCloneWidget" parent="GtkBin">
+ <child>
+ <object class="GtkOverlay" id="page_clone_remote">
+ <property name="visible">true</property>
+ <child type="overlay">
+ <object class="GtkProgressBar" id="clone_progress">
+ <property name="valign">start</property>
+ <property name="fraction">0.0</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="osd"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="expand">true</property>
+ <property name="spacing">12</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkImage">
+ <property name="valign">center</property>
+ <property name="vexpand">true</property>
+ <property name="icon-name">builder-vcs-git</property>
+ <property name="pixel-size">192</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child type="center">
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="expand">true</property>
+ <property name="spacing">12</property>
+ <property name="visible">true</property>
+ <child type="center">
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <property name="halign">center</property>
+ <property name="hexpand">false</property>
+ <property name="valign">center</property>
+ <property name="vexpand">false</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkEntry" id="clone_uri_entry">
+ <property name="hexpand">true</property>
+ <property name="width-chars">35</property>
+ <property name="placeholder-text" translatable="yes">user
host:repository.git</property>
+ <property name="tooltip-text" translatable="yes">Enter the URL of your project's
source code repository.</property>
+ <property name="valign">baseline</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">true</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkFileChooserButton" id="clone_location_button">
+ <property name="action">select-folder</property>
+ <property name="hexpand">true</property>
+ <property name="local-only">true</property>
+ <property name="spacing">6</property>
+ <property name="valign">baseline</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="linked-on-right"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEntry" id="clone_location_entry">
+ <property name="hexpand">true</property>
+ <property name="placeholder-text" translatable="yes">Directory</property>
+ <property name="valign">baseline</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <property name="hexpand">true</property>
+ <property name="vexpand">true</property>
+ <property name="valign">center</property>
+ <property name="halign">end</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkLabel" id="clone_uri_label">
+ <property name="label" translatable="yes">Repository</property>
+ <property name="valign">baseline</property>
+ <property name="visible">true</property>
+ <property name="xalign">1.0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="clone_location_label">
+ <property name="label" translatable="yes">Location</property>
+ <property name="valign">baseline</property>
+ <property name="visible">true</property>
+ <property name="xalign">1.0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="clone_error_label">
+ <property name="valign">start</property>
+ <property name="vexpand">true</property>
+ <property name="visible">false</property>
+ <style>
+ <class name="error-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinner" id="clone_spinner">
+ <property name="vexpand">false</property>
+ <property name="active">true</property>
+ <property name="margin">24</property>
+ <property name="width-request">24</property>
+ <property name="height-request">24</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+ <object class="GtkSizeGroup">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="clone_location_label"/>
+ <widget name="clone_location_button"/>
+ <widget name="clone_uri_label"/>
+ <widget name="clone_uri_entry"/>
+ </widgets>
+ </object>
+</interface>
diff --git a/plugins/git/ide-git-genesis-addin.c b/plugins/git/ide-git-genesis-addin.c
index eb595f1..1cc812c 100644
--- a/plugins/git/ide-git-genesis-addin.c
+++ b/plugins/git/ide-git-genesis-addin.c
@@ -19,11 +19,14 @@
#include <glib/gi18n.h>
#include <ide.h>
+#include "ide-git-clone-widget.h"
#include "ide-git-genesis-addin.h"
struct _IdeGitGenesisAddin
{
- GObject parent_instance;
+ GObject parent_instance;
+
+ GtkWidget *clone_widget;
};
static void genesis_addin_iface_init (IdeGenesisAddinInterface *iface);
@@ -56,7 +59,16 @@ ide_git_genesis_addin_get_title (IdeGenesisAddin *addin)
static GtkWidget *
ide_git_genesis_addin_get_widget (IdeGenesisAddin *addin)
{
- return NULL;
+ IdeGitGenesisAddin *self = (IdeGitGenesisAddin *)addin;
+
+ g_assert (IDE_IS_GIT_GENESIS_ADDIN (self));
+
+ if (self->clone_widget == NULL)
+ self->clone_widget = g_object_new (IDE_TYPE_GIT_CLONE_WIDGET,
+ "visible", TRUE,
+ NULL);
+
+ return self->clone_widget;
}
static void
diff --git a/plugins/git/ide-git-resources.gresource.xml b/plugins/git/ide-git-resources.gresource.xml
new file mode 100644
index 0000000..2076b2c
--- /dev/null
+++ b/plugins/git/ide-git-resources.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/builder/plugins/git">
+ <file>ide-git-clone-widget.ui</file>
+ </gresource>
+</gresources>
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]