[gnome-builder/wip/chergert/gobjgen] wip



commit 6c3de252b30af32228ee5820331a804454f52b20
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 21 01:08:48 2016 -0700

    wip

 configure.ac                                       |    2 +
 plugins/Makefile.am                                |    1 +
 plugins/gobject-templates/Makefile.am              |   40 +++
 plugins/gobject-templates/configure.ac             |   12 +
 plugins/gobject-templates/gbp-gobject-dialog.c     |  132 ++++++++++
 plugins/gobject-templates/gbp-gobject-dialog.h     |   34 +++
 plugins/gobject-templates/gbp-gobject-dialog.ui    |  274 ++++++++++++++++++++
 .../gbp-gobject-workbench-addin.c                  |  132 ++++++++++
 .../gbp-gobject-workbench-addin.h                  |   33 +++
 .../gobject-templates/gobject-templates-plugin.c   |   30 +++
 .../gobject-templates.gresource.xml                |    7 +
 plugins/gobject-templates/gobject-templates.plugin |    9 +
 plugins/gobject-templates/gtk/menus.ui             |   20 ++
 13 files changed, 726 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 62a6064..2d5c4a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -296,6 +296,7 @@ m4_include([plugins/gcc/configure.ac])
 m4_include([plugins/gettext/configure.ac])
 m4_include([plugins/git/configure.ac])
 m4_include([plugins/gnome-code-assistance/configure.ac])
+m4_include([plugins/gobject-templates/configure.ac])
 m4_include([plugins/hello-cpp/configure.ac])
 m4_include([plugins/html-completion/configure.ac])
 m4_include([plugins/html-preview/configure.ac])
@@ -620,5 +621,6 @@ echo ""
 echo " Templates"
 echo ""
 echo "  Autotools ............................ : ${enable_autotools_templates}"
+echo "  GObject .............................. : ${enable_gobject_templates}"
 echo ""
 
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 0827d68..db83ac5 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -18,6 +18,7 @@ SUBDIRS = \
        gettext \
        git \
        gnome-code-assistance \
+       gobject-templates \
        hello-cpp \
        html-completion \
        html-preview \
diff --git a/plugins/gobject-templates/Makefile.am b/plugins/gobject-templates/Makefile.am
new file mode 100644
index 0000000..9530f42
--- /dev/null
+++ b/plugins/gobject-templates/Makefile.am
@@ -0,0 +1,40 @@
+if ENABLE_GOBJECT_TEMPLATES
+
+DISTCLEANFILES =
+BUILT_SOURCES =
+CLEANFILES =
+EXTRA_DIST = $(plugin_DATA)
+
+plugindir = $(libdir)/gnome-builder/plugins
+plugin_LTLIBRARIES = libgobject-templates.la
+dist_plugin_DATA = gobject-templates.plugin
+
+libgobject_templates_la_SOURCES = \
+       gobject-templates-plugin.c \
+       gbp-gobject-dialog.c \
+       gbp-gobject-dialog.h \
+       gbp-gobject-workbench-addin.c \
+       gbp-gobject-workbench-addin.h \
+       $(NULL)
+
+nodist_libgobject_templates_la_SOURCES = \
+       resources.c \
+       resources.h
+
+libgobject_templates_la_CFLAGS = \
+       $(PLUGIN_CFLAGS) \
+       $(NULL)
+
+libgobject_templates_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+
+glib_resources_c = resources.c
+glib_resources_h = resources.h
+glib_resources_xml = gobject-templates.gresource.xml
+glib_resources_namespace = gbp_gobject_templates
+include $(top_srcdir)/build/autotools/Makefile.am.gresources
+
+include $(top_srcdir)/plugins/Makefile.plugin
+
+endif
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/gobject-templates/configure.ac b/plugins/gobject-templates/configure.ac
new file mode 100644
index 0000000..28a0a47
--- /dev/null
+++ b/plugins/gobject-templates/configure.ac
@@ -0,0 +1,12 @@
+# --enable-gobject-templates=yes/no
+AC_ARG_ENABLE([gobject-templates],
+              [AS_HELP_STRING([--enable-gobject-templates=@<:@yes/no@:>@],
+                              [Build with support for gobject templates.])],
+              [enable_gobject_templates=$enableval],
+              [enable_gobject_templates=yes])
+
+# for if ENABLE_GOBJECT_TEMPLATES in Makefile.am
+AM_CONDITIONAL(ENABLE_GOBJECT_TEMPLATES, test x$enable_gobject_templates != xno)
+
+# Ensure our makefile is generated by autoconf
+AC_CONFIG_FILES([plugins/gobject-templates/Makefile])
diff --git a/plugins/gobject-templates/gbp-gobject-dialog.c b/plugins/gobject-templates/gbp-gobject-dialog.c
new file mode 100644
index 0000000..46a4f21
--- /dev/null
+++ b/plugins/gobject-templates/gbp-gobject-dialog.c
@@ -0,0 +1,132 @@
+/* gbp-gobject-dialog.c
+ *
+ * Copyright (C) 2016 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/>.
+ */
+
+#define G_LOG_DOMAIN "gbp-gobject-dialog"
+
+#include <glib/gi18n.h>
+
+#include "gbp-gobject-dialog.h"
+
+struct _GbpGobjectDialog
+{
+  GtkDialog     parent_instance;
+
+  GFile        *directory;
+
+  GtkEntry     *name_entry;
+  GtkEntry     *namespace_entry;
+  GtkEntry     *classname_entry;
+  GtkTreeView  *properties_treeview;
+  GtkTreeView  *signals_treeview;
+};
+
+G_DEFINE_TYPE (GbpGobjectDialog, gbp_gobject_dialog, GTK_TYPE_DIALOG)
+
+enum {
+  PROP_0,
+  PROP_DIRECTORY,
+  N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+GtkWidget *
+gbp_gobject_dialog_new (void)
+{
+  return g_object_new (GBP_TYPE_GOBJECT_DIALOG,
+                       "use-header-bar", TRUE,
+                       NULL);
+}
+
+static void
+gbp_gobject_dialog_finalize (GObject *object)
+{
+  GbpGobjectDialog *self = (GbpGobjectDialog *)object;
+
+  g_clear_object (&self->directory);
+
+  G_OBJECT_CLASS (gbp_gobject_dialog_parent_class)->finalize (object);
+}
+
+static void
+gbp_gobject_dialog_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  GbpGobjectDialog *self = GBP_GOBJECT_DIALOG (object);
+
+  switch (prop_id)
+    {
+    case PROP_DIRECTORY:
+      g_value_set_object (value, self->directory);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gbp_gobject_dialog_set_property (GObject      *object,
+                                 guint         prop_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+  GbpGobjectDialog *self = GBP_GOBJECT_DIALOG (object);
+
+  switch (prop_id)
+    {
+    case PROP_DIRECTORY:
+      g_clear_object (&self->directory);
+      self->directory = g_value_dup_object (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+gbp_gobject_dialog_class_init (GbpGobjectDialogClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = gbp_gobject_dialog_finalize;
+  object_class->get_property = gbp_gobject_dialog_get_property;
+  object_class->set_property = gbp_gobject_dialog_set_property;
+
+  properties [PROP_DIRECTORY] =
+    g_param_spec_object ("directory",
+                         "Directory",
+                         "Directory",
+                         G_TYPE_FILE,
+                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, N_PROPS, properties);
+
+  gtk_widget_class_set_template_from_resource (widget_class,
+                                               
"/org/gnome/builder/plugins/gobject-templates/gbp-gobject-dialog.ui");
+}
+
+static void
+gbp_gobject_dialog_init (GbpGobjectDialog *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/plugins/gobject-templates/gbp-gobject-dialog.h b/plugins/gobject-templates/gbp-gobject-dialog.h
new file mode 100644
index 0000000..c2705bd
--- /dev/null
+++ b/plugins/gobject-templates/gbp-gobject-dialog.h
@@ -0,0 +1,34 @@
+/* gbp-gobject-dialog.h
+ *
+ * Copyright (C) 2016 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 GBP_GOBJECT_DIALOG_H
+#define GBP_GOBJECT_DIALOG_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_GOBJECT_DIALOG (gbp_gobject_dialog_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpGobjectDialog, gbp_gobject_dialog, GBP, GOBJECT_DIALOG, GtkDialog)
+
+GtkWidget *gbp_gobject_dialog_new (void);
+
+G_END_DECLS
+
+#endif /* GBP_GOBJECT_DIALOG_H */
diff --git a/plugins/gobject-templates/gbp-gobject-dialog.ui b/plugins/gobject-templates/gbp-gobject-dialog.ui
new file mode 100644
index 0000000..845c633
--- /dev/null
+++ b/plugins/gobject-templates/gbp-gobject-dialog.ui
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GbpGobjectDialog" parent="GtkDialog">
+    <property name="default-width">730</property>
+    <property name="title" translatable="yes">New GObject</property>
+    <child type="action">
+      <object class="GtkButton" id="button_cancel">
+        <property name="visible">true</property>
+        <property name="label" translatable="yes">Cancel</property>
+      </object>
+    </child>
+    <child type="action">
+      <object class="GtkButton" id="button_ok">
+        <property name="visible">true</property>
+        <property name="can-default">true</property>
+        <property name="label" translatable="yes">Create</property>
+        <style>
+          <class name="suggested-action"/>
+        </style>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="cancel">button_cancel</action-widget>
+      <action-widget response="ok">button_ok</action-widget>
+    </action-widgets>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="border-width">24</property>
+        <property name="spacing">12</property>
+
+        <!-- Language -->
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="spacing">10</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Language</property>
+                <property name="halign">end</property>
+                <property name="hexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkBox" id="language_box">
+                <property name="orientation">horizontal</property>
+                <property name="homogeneous">true</property>
+                <property name="visible">true</property>
+                <style>
+                  <class name="linked"/>
+                </style>
+                <child>
+                  <object class="GtkRadioButton" id="lang_c">
+                    <property name="draw-indicator">false</property>
+                    <property name="hexpand">true</property>
+                    <property name="label" translatable="yes">C</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="lang_cpp">
+                    <property name="draw-indicator">false</property>
+                    <property name="group">lang_c</property>
+                    <property name="hexpand">true</property>
+                    <property name="label" translatable="yes">C++</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="lang_python">
+                    <property name="draw-indicator">false</property>
+                    <property name="group">lang_c</property>
+                    <property name="hexpand">true</property>
+                    <property name="label" translatable="yes">Python</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="lang_vala">
+                    <property name="draw-indicator">false</property>
+                    <property name="group">lang_c</property>
+                    <property name="hexpand">true</property>
+                    <property name="label" translatable="yes">Vala</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <!-- Name -->
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="spacing">10</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Name</property>
+                <property name="halign">end</property>
+                <property name="hexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkEntry" id="name_entry">
+                <property name="visible">true</property>
+                <property name="width-chars">40</property>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <!-- Namespace -->
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="spacing">10</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Namespace</property>
+                <property name="halign">end</property>
+                <property name="hexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkEntry" id="namespace_entry">
+                <property name="visible">true</property>
+                <property name="width-chars">40</property>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <!-- Namespace -->
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="spacing">10</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Class</property>
+                <property name="halign">end</property>
+                <property name="hexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkEntry" id="class_entry">
+                <property name="visible">true</property>
+                <property name="width-chars">40</property>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <!-- Properties -->
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="spacing">10</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Properties</property>
+                <property name="halign">end</property>
+                <property name="hexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkBox" id="properties_switch_container">
+                <property name="visible">true</property>
+                <child>
+                  <object class="GtkSwitch" id="properties_switch">
+                    <property name="halign">start</property>
+                    <property name="valign">center</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton">
+                <property name="visible">true</property>
+                <property name="halign">start</property>
+                <property name="hexpand">true</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">list-add-symbolic</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+                <style>
+                  <class name="flat"/>
+                  <class name="image-button"/>
+                </style>
+              </object>
+              <packing>
+                <property name="pack-type">end</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+
+        <!-- Signals -->
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="spacing">10</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="label" translatable="yes">Signals</property>
+                <property name="halign">end</property>
+                <property name="hexpand">true</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkBox" id="signals_switch_container">
+                <property name="visible">true</property>
+                <child>
+                  <object class="GtkSwitch" id="signals_switch">
+                    <property name="halign">start</property>
+                    <property name="valign">center</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton">
+                <property name="visible">true</property>
+                <property name="halign">start</property>
+                <property name="hexpand">true</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">list-add-symbolic</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+                <style>
+                  <class name="flat"/>
+                  <class name="image-button"/>
+                </style>
+              </object>
+              <packing>
+                <property name="pack-type">end</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+
+      </object>
+    </child>
+  </template>
+  <object class="GtkSizeGroup">
+    <property name="mode">horizontal</property>
+    <widgets>
+      <widget name="language_box"/>
+      <widget name="name_entry"/>
+      <widget name="namespace_entry"/>
+      <widget name="class_entry"/>
+      <widget name="properties_switch_container"/>
+      <widget name="signals_switch_container"/>
+    </widgets>
+  </object>
+</interface>
diff --git a/plugins/gobject-templates/gbp-gobject-workbench-addin.c 
b/plugins/gobject-templates/gbp-gobject-workbench-addin.c
new file mode 100644
index 0000000..21905c6
--- /dev/null
+++ b/plugins/gobject-templates/gbp-gobject-workbench-addin.c
@@ -0,0 +1,132 @@
+/* gbp-gobject-workbench-addin.c
+ *
+ * Copyright (C) 2016 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/>.
+ */
+
+#define G_LOG_DOMAIN "gbp-gobject-workbench-addin"
+
+#include <glib/gi18n.h>
+
+#include "gbp-gobject-dialog.h"
+#include "gbp-gobject-workbench-addin.h"
+
+struct _GbpGobjectWorkbenchAddin
+{
+  GObject parent_instance;
+
+  IdeWorkbench *workbench;
+};
+
+static void workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface);
+
+G_DEFINE_TYPE_EXTENDED (GbpGobjectWorkbenchAddin, gbp_gobject_workbench_addin, G_TYPE_OBJECT, 0,
+                        G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN,
+                                               workbench_addin_iface_init))
+
+static void
+gbp_gobject_workbench_addin_class_init (GbpGobjectWorkbenchAddinClass *klass)
+{
+}
+
+static void
+gbp_gobject_workbench_addin_init (GbpGobjectWorkbenchAddin *self)
+{
+}
+
+static void
+dialog_response_cb (GbpGobjectWorkbenchAddin *self,
+                    gint                      response_id,
+                    GbpGobjectDialog         *dialog)
+{
+  g_assert (GBP_IS_GOBJECT_WORKBENCH_ADDIN (self));
+  g_assert (GBP_IS_GOBJECT_DIALOG (dialog));
+
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+new_gobject_activate (GSimpleAction *action,
+                      GVariant      *param,
+                      gpointer       user_data)
+{
+  GbpGobjectWorkbenchAddin *self = user_data;
+  GbpGobjectDialog *dialog;
+
+  g_assert (G_IS_SIMPLE_ACTION (action));
+  g_assert (param == NULL);
+  g_assert (GBP_IS_GOBJECT_WORKBENCH_ADDIN (self));
+
+  dialog = g_object_new (GBP_TYPE_GOBJECT_DIALOG,
+                         "modal", TRUE,
+                         "transient-for", self->workbench,
+                         "title", _("New GObject"),
+                         "use-header-bar", TRUE,
+                         NULL);
+
+  g_signal_connect_object (dialog,
+                           "response",
+                           G_CALLBACK (dialog_response_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
+gbp_gobject_workbench_addin_load (IdeWorkbenchAddin *addin,
+                                  IdeWorkbench      *workbench)
+{
+  GbpGobjectWorkbenchAddin *self = (GbpGobjectWorkbenchAddin *)addin;
+  g_autoptr(GSimpleActionGroup) group = NULL;
+  static const GActionEntry entries[] = {
+    { "new-gobject", new_gobject_activate },
+  };
+
+  g_assert (IDE_IS_WORKBENCH_ADDIN (self));
+  g_assert (IDE_IS_WORKBENCH (workbench));
+
+  self->workbench = workbench;
+
+  group = g_simple_action_group_new ();
+  g_action_map_add_action_entries (G_ACTION_MAP (group),
+                                   entries,
+                                   G_N_ELEMENTS (entries),
+                                   self);
+  gtk_widget_insert_action_group (GTK_WIDGET (workbench),
+                                  "gobject-templates",
+                                  G_ACTION_GROUP (group));
+}
+
+static void
+gbp_gobject_workbench_addin_unload (IdeWorkbenchAddin *addin,
+                                    IdeWorkbench      *workbench)
+{
+  GbpGobjectWorkbenchAddin *self = (GbpGobjectWorkbenchAddin *)addin;
+
+  g_assert (IDE_IS_WORKBENCH_ADDIN (self));
+  g_assert (IDE_IS_WORKBENCH (workbench));
+
+  self->workbench = NULL;
+
+  gtk_widget_insert_action_group (GTK_WIDGET (workbench), "gobject-templates", NULL);
+}
+
+static void
+workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface)
+{
+  iface->load = gbp_gobject_workbench_addin_load;
+  iface->unload = gbp_gobject_workbench_addin_unload;
+}
diff --git a/plugins/gobject-templates/gbp-gobject-workbench-addin.h 
b/plugins/gobject-templates/gbp-gobject-workbench-addin.h
new file mode 100644
index 0000000..9601914
--- /dev/null
+++ b/plugins/gobject-templates/gbp-gobject-workbench-addin.h
@@ -0,0 +1,33 @@
+/* gbp-gobject-workbench-addin.h
+ *
+ * Copyright (C) 2016 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 GBP_GOBJECT_WORKBENCH_ADDIN_H
+#define GBP_GOBJECT_WORKBENCH_ADDIN_H
+
+#include <ide.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_GOBJECT_WORKBENCH_ADDIN (gbp_gobject_workbench_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpGobjectWorkbenchAddin, gbp_gobject_workbench_addin, GBP, GOBJECT_WORKBENCH_ADDIN, 
GObject)
+
+G_END_DECLS
+
+#endif /* GBP_GOBJECT_WORKBENCH_ADDIN_H */
+
diff --git a/plugins/gobject-templates/gobject-templates-plugin.c 
b/plugins/gobject-templates/gobject-templates-plugin.c
new file mode 100644
index 0000000..7847786
--- /dev/null
+++ b/plugins/gobject-templates/gobject-templates-plugin.c
@@ -0,0 +1,30 @@
+/* gobject-templates-plugin.c
+ *
+ * Copyright (C) 2016 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.h>
+#include <libpeas/peas.h>
+
+#include "gbp-gobject-workbench-addin.h"
+
+void
+peas_register_types (PeasObjectModule *module)
+{
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_WORKBENCH_ADDIN,
+                                              GBP_TYPE_GOBJECT_WORKBENCH_ADDIN);
+}
diff --git a/plugins/gobject-templates/gobject-templates.gresource.xml 
b/plugins/gobject-templates/gobject-templates.gresource.xml
new file mode 100644
index 0000000..81a8f3e
--- /dev/null
+++ b/plugins/gobject-templates/gobject-templates.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/builder/plugins/gobject-templates">
+    <file compressed="true">gtk/menus.ui</file>
+    <file compressed="true">gbp-gobject-dialog.ui</file>
+  </gresource>
+</gresources>
diff --git a/plugins/gobject-templates/gobject-templates.plugin 
b/plugins/gobject-templates/gobject-templates.plugin
new file mode 100644
index 0000000..a24eb45
--- /dev/null
+++ b/plugins/gobject-templates/gobject-templates.plugin
@@ -0,0 +1,9 @@
+[Plugin]
+Module=gobject-templates
+Name=GObject Templates
+Description=Create new GObjects using templates
+Authors=Christian Hergert <christian hergert me>
+Copyright=Copyright © 2015 Christian Hergert
+Depends=project-tree-plugin
+Hidden=true
+Builtin=true
diff --git a/plugins/gobject-templates/gtk/menus.ui b/plugins/gobject-templates/gtk/menus.ui
new file mode 100644
index 0000000..37f3ebe
--- /dev/null
+++ b/plugins/gobject-templates/gtk/menus.ui
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <menu id="gb-project-tree-popup-menu">
+    <section id="gb-project-tree-new-section">
+      <submenu id="gb-project-tree-new-section-submenu">
+        <section id="gb-project-tree-new-gobject-section">
+          <attribute name="after">gb-project-tree-new-empty-file-section</attribute>
+          <item>
+            <attribute name="label" translatable="yes">_GObject Class</attribute>
+            <attribute name="action">gobject-templates.new-gobject</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">_GtkWidget Class</attribute>
+            <attribute name="action">gobject-templates.new-gtkwidget</attribute>
+          </item>
+        </section>
+      </submenu>
+    </section>
+  </menu>
+</interface>


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