[gnome-builder] snippets: add chdr.snippets for header snippets.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] snippets: add chdr.snippets for header snippets.
- Date: Sun, 7 Sep 2014 05:16:49 +0000 (UTC)
commit 0918e8ac7cc9d0acd29e9831a444859b7d3fc86b
Author: Christian Hergert <christian hergert me>
Date: Sat Sep 6 21:30:50 2014 -0700
snippets: add chdr.snippets for header snippets.
Now we can use `gobject` for both the header and the source file.
src/resources/gnome-builder.gresource.xml | 5 +++
src/resources/snippets/c.snippets | 41 +----------------------------
src/resources/snippets/chdr.snippets | 39 +++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 40 deletions(-)
---
diff --git a/src/resources/gnome-builder.gresource.xml b/src/resources/gnome-builder.gresource.xml
index fedb42b..a21f385 100644
--- a/src/resources/gnome-builder.gresource.xml
+++ b/src/resources/gnome-builder.gresource.xml
@@ -2,9 +2,14 @@
<gresources>
<gresource prefix="/org/gnome/builder">
<file>css/builder.Adwaita.css</file>
+
<file>editor/uncrustify.c.cfg</file>
+
<file>keybindings/default.ini</file>
+
<file>snippets/c.snippets</file>
+ <file>snippets/chdr.snippets</file>
+
<file>ui/gb-devhelp-tab.ui</file>
<file>ui/gb-editor-tab.ui</file>
<file>ui/gb-workbench.ui</file>
diff --git a/src/resources/snippets/c.snippets b/src/resources/snippets/c.snippets
index c4723ce..f942ffb 100644
--- a/src/resources/snippets/c.snippets
+++ b/src/resources/snippets/c.snippets
@@ -69,46 +69,7 @@ snippet inc
#include "${1}"$0
snippet Inc
#include <${1}>$0
-snippet hobject
- #ifndef ${$1|functify|upper}_H
- #define ${$1|functify|upper}_H
-
- #include <${3:glib-object.h}>
-
- G_BEGIN_DECLS
-
- #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}
(${$1|functify}_get_type())
- #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}(obj)
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1))
- #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}_CONST(obj)
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1 const))
- #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}_CLASS(klass)
(G_TYPE_CHECK_CLASS_CAST ((klass), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1Class))
- #define ${$1|functify|namespace|upper}_IS_${$1|class|functify|upper}(obj)
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}))
- #define ${$1|functify|namespace|upper}_IS_${$1|class|functify|upper}_CLASS(klass)
(G_TYPE_CHECK_CLASS_TYPE ((klass), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}))
- #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}_GET_CLASS(obj)
(G_TYPE_INSTANCE_GET_CLASS ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1Class))
-
- typedef struct _$1 $1;
- typedef struct _$1Class $1Class;
- typedef struct _$1Private $1Private;
-
- struct _${1:MyObject}
- {
- ${2:GObject} parent;
-
- /*< private >*/
- $1Private *priv;
- };
-
- struct _$1Class
- {
- $2Class parent;
- };
-
- GType ${$1|functify}_get_type (void) G_GNUC_CONST;
- $1 *${$1|functify}_new (void);
- $0
- G_END_DECLS
-
- #endif /* ${$1|functify|upper}_H */
-snippet cobject
+snippet gobject
#include "${1}.h"
struct _${2:$1|camelize}Private
diff --git a/src/resources/snippets/chdr.snippets b/src/resources/snippets/chdr.snippets
new file mode 100644
index 0000000..9b72392
--- /dev/null
+++ b/src/resources/snippets/chdr.snippets
@@ -0,0 +1,39 @@
+snippet gobject
+ #ifndef ${$1|functify|upper}_H
+ #define ${$1|functify|upper}_H
+
+ #include <${3:glib-object.h}>
+
+ G_BEGIN_DECLS
+
+ #define ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}
(${$1|functify}_get_type())
+ #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}(obj)
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1))
+ #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}_CONST(obj)
(G_TYPE_CHECK_INSTANCE_CAST ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1 const))
+ #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}_CLASS(klass)
(G_TYPE_CHECK_CLASS_CAST ((klass), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1Class))
+ #define ${$1|functify|namespace|upper}_IS_${$1|class|functify|upper}(obj)
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}))
+ #define ${$1|functify|namespace|upper}_IS_${$1|class|functify|upper}_CLASS(klass)
(G_TYPE_CHECK_CLASS_TYPE ((klass), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}))
+ #define ${$1|functify|namespace|upper}_${$1|class|functify|upper}_GET_CLASS(obj)
(G_TYPE_INSTANCE_GET_CLASS ((obj), ${$1|functify|namespace|upper}_TYPE_${$1|class|functify|upper}, $1Class))
+
+ typedef struct _$1 $1;
+ typedef struct _$1Class $1Class;
+ typedef struct _$1Private $1Private;
+
+ struct _${1:MyObject}
+ {
+ ${2:GObject} parent;
+
+ /*< private >*/
+ $1Private *priv;
+ };
+
+ struct _$1Class
+ {
+ $2Class parent;
+ };
+
+ GType ${$1|functify}_get_type (void) G_GNUC_CONST;
+ $1 *${$1|functify}_new (void);
+ $0
+ G_END_DECLS
+
+ #endif /* ${$1|functify|upper}_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]