Skip to content

Commit

Permalink
rename gtk -> gtk3 and swifty-gtk4 -> gtk4
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince781 committed Mar 28, 2022
1 parent c60d3bf commit 565b137
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 124 deletions.
19 changes: 5 additions & 14 deletions templates/gtk/meson.build
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
project('${PROJECT_NAME}', 'vala', 'c',
version: '${PROJECT_VERSION}')

deps = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('gtk+-3.0')
]
project(
'${PROJECT_NAME}',
'vala', 'c',
version: '${PROJECT_VERSION}'
)

add_project_arguments(['--enable-experimental'], language: 'vala')

subdir('src')
subdir('ui')

executable('${PROGRAM_NAME}',
[src, resources],
dependencies: deps,
vala_args: [resource_args])
File renamed without changes.
36 changes: 28 additions & 8 deletions templates/gtk/src/MainWindow.vala
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
[GtkTemplate (ui = "/org/gnome/${PROGRAM_NAME}/main-window.ui")]
class Starter.MainWindow : Gtk.ApplicationWindow {
[GtkChild] unowned Gtk.Label text;

[GtkCallback]
private void button_clicked () {
text.label = "clicked!";
}
public class ${NAMESPACE}.MainWindow : Gtk.ApplicationWindow {
// GLib.ListStore clocks_list_store;
public MainWindow (Gtk.Application app) {
Object (application: app);

this.default_height = 400;
this.default_width = 600;

var header = new Gtk.HeaderBar ();
this.set_titlebar (header);

var label = new Gtk.Label ("Hello World!");
label.hexpand = label.vexpand = true;

var button = new Gtk.Button.with_label ("Click Me!");

button.clicked.connect (() => {
var str = label.label;
var temp_str = str.reverse ();
label.label = temp_str;
});

var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
box.append (label);
box.append (button);

this.child = box;
}
}
21 changes: 17 additions & 4 deletions templates/gtk/src/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
src = files([
'App.vala',
'MainWindow.vala'
])
sources = files(
'Main.vala',
'MainWindow.vala',
)

dependencies = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('gtk4'),
]

executable(
'${PROGRAM_NAME}',
sources,
dependencies: dependencies,
install: true
)
39 changes: 24 additions & 15 deletions templates/gtk/template.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
{
"description": "a starter GTK3 app",
"variables": {
"PROGRAM_NAME": {
"summary": "the name of the program",
"default": "/${PROJECT_NAME}/\\w+/\\L\\0\\E/\\W+/-/",
"pattern": "^[[:word:]-]+$"
}
"description": "a starter GTK4 app",
"variables": {
"PROGRAM_NAME": {
"summary": "the name of the program",
"default": "/${PROJECT_NAME}/\\w+/\\L\\0\\E/\\W+/-/",
"pattern": "^[[:word:]-]+$"
},
"templates": [
"meson.build",
"README.md",
"src/App.vala",
"src/MainWindow.vala",
"ui/main-window.ui",
"ui/resources.xml"
]
"NAMESPACE": {
"summary": "the namespace to use for the application",
"default": "/${PROJECT_NAME}/\\w+/\\u\\0/(\\w)?\\W+(\\w)?(\\w*)/\\1\\u\\2\\L\\3\\E/^\\w/\\u\\0/",
"pattern": "^[A-Za-z_]\\w*$"
},
"APP_ID": {
"summary": "the application ID",
"default": "com.${USERNAME}.${NAMESPACE}",
"pattern": "^\\w+(\\.\\w+)*$"
}
},
"templates": [
"meson.build",
"README.md",
"src/Main.vala",
"src/MainWindow.vala",
"src/meson.build"
]
}
File renamed without changes.
18 changes: 18 additions & 0 deletions templates/gtk3/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
project('${PROJECT_NAME}', 'vala', 'c',
version: '${PROJECT_VERSION}')

deps = [
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('gtk+-3.0')
]

add_project_arguments(['--enable-experimental'], language: 'vala')

subdir('src')
subdir('ui')

executable('${PROGRAM_NAME}',
[src, resources],
dependencies: deps,
vala_args: [resource_args])
File renamed without changes.
9 changes: 9 additions & 0 deletions templates/gtk3/src/MainWindow.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[GtkTemplate (ui = "/org/gnome/${PROGRAM_NAME}/main-window.ui")]
class Starter.MainWindow : Gtk.ApplicationWindow {
[GtkChild] unowned Gtk.Label text;

[GtkCallback]
private void button_clicked () {
text.label = "clicked!";
}
}
4 changes: 4 additions & 0 deletions templates/gtk3/src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src = files([
'App.vala',
'MainWindow.vala'
])
18 changes: 18 additions & 0 deletions templates/gtk3/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"description": "a starter GTK3 app",
"variables": {
"PROGRAM_NAME": {
"summary": "the name of the program",
"default": "/${PROJECT_NAME}/\\w+/\\L\\0\\E/\\W+/-/",
"pattern": "^[[:word:]-]+$"
}
},
"templates": [
"meson.build",
"README.md",
"src/App.vala",
"src/MainWindow.vala",
"ui/main-window.ui",
"ui/resources.xml"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion templates/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
install_subdir('eos', install_dir: templates_dir)
install_subdir('gnome', install_dir: templates_dir)
install_subdir('gtk', install_dir: templates_dir)
install_subdir('gtk3', install_dir: templates_dir)
install_subdir('lib', install_dir: templates_dir)
install_subdir('new', install_dir: templates_dir)
install_subdir('swifty-gtk4', install_dir: templates_dir)
29 changes: 0 additions & 29 deletions templates/swifty-gtk4/Sources/MainWindow.vala

This file was deleted.

17 changes: 0 additions & 17 deletions templates/swifty-gtk4/Sources/meson.build

This file was deleted.

9 changes: 0 additions & 9 deletions templates/swifty-gtk4/meson.build

This file was deleted.

27 changes: 0 additions & 27 deletions templates/swifty-gtk4/template.json

This file was deleted.

0 comments on commit 565b137

Please sign in to comment.