Skip to content

Commit

Permalink
Merge pull request #28 from BrainBlasted/T639-consolidate-repos
Browse files Browse the repository at this point in the history
Consolidate GTK app Code.as / GitHub repos

Resolves T639
  • Loading branch information
thebaer committed Jul 26, 2019
2 parents 47d1bca + f7f1bfb commit 4a96bf2
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 21 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
22 changes: 16 additions & 6 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@ icon_sizes = ['16', '24', '32', '48', '64', '128']
foreach i : icon_sizes
install_data(
join_paths('icons', i, meson.project_name() + '.png'),
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps'
)
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps'),
rename: '@0@.png'.format(app_id)
)
endforeach

install_data('com.github.writeas.writeas-gtk.desktop',
install_dir: join_paths(get_option('datadir'), 'applications'))
install_data('com.github.writeas.writeas-gtk.appdata.xml',
install_dir: join_paths(get_option('datadir'), 'metainfo'))
data_conf = configuration_data()
data_conf.set('app_id', app_id)
configure_file(
input: 'writeas-gtk.desktop.in',
output: '@0@.desktop'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'applications')
)
configure_file(
input: 'writeas-gtk.appdata.xml.in',
output: '@0@.appdata.xml'.format(app_id),
configuration: data_conf,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<component type="desktop-application">
<id>com.github.writeas.writeas-gtk</id>
<id>@app_id@</id>
<project_license>GPL-3.0+</project_license>
<metadata_license>CC0</metadata_license>
<name>Write.as</name>
Expand Down Expand Up @@ -28,7 +28,7 @@
<update_contact>hello@write.as</update_contact>

<provides>
<binary>com.github.writeas.writeas-gtk</binary>
<binary>@app_id@</binary>
</provides>

<screenshots>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Type=Application
Name=Write.as
Comment=Publish a thought in seconds.
Exec=com.github.writeas.writeas-gtk
Icon=com.github.writeas.writeas-gtk
Exec=@app_id@
Icon=@app_id@
Terminal=false
MimeType=
Categories=GTK;Office;Publishing;
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ override_dh_auto_clean:

override_dh_auto_configure:
mkdir -p debian/build
cd debian/build && meson --prefix=/usr ../..
cd debian/build && meson --prefix=/usr ../.. -Dplatform=elementary

override_dh_auto_build:
cd debian/build && ninja -v && ninja build
Expand Down
18 changes: 14 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
project('com.github.writeas.writeas-gtk', ['vala', 'c'],
project('writeas-gtk', ['vala', 'c'],
version: '1.0.2',
license: 'GPL',
meson_version: '>=0.40.1')
meson_version: '>=0.46.0')

i18n = import('i18n')

build_platform = get_option('platform')
if build_platform == 'elementary'
app_id = 'com.github.writeas.writeas-gtk'
else
app_id = 'writeas-gtk'
endif

conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
configure_file(output: 'config.h', configuration: conf)
conf.set_quoted('GETTEXT_PACKAGE', app_id)
conf.set_quoted('APP_ID', app_id)
conf.set_quoted('BUILD_PLATFORM', build_platform)
config_h = configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')

run_target('build', command: 'meson/build-cli.sh')
Expand Down
2 changes: 1 addition & 1 deletion meson/build-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
exec_name=writeas

echo "Building $exec_name CLI..."
gb build github.com/writeas/writeas-cli/cmd/writeas
gb build github.com/writeas/writeas-cli/cmd/writeas &&
echo "Success."
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('platform', type: 'combo', choices: ['default', 'elementary'], value: 'default')
6 changes: 5 additions & 1 deletion src/application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

extern const string APP_ID;
extern const string BUILD_PLATFORM;

public class WriteAs.Application : Gtk.Application {
construct {
this.flags |= ApplicationFlags.HANDLES_OPEN;
Intl.setlocale(LocaleCategory.ALL, "");
Intl.textdomain("write.as");

application_id = "com.github.writeas.writeas-gtk.desktop";
application_id = APP_ID + ".desktop";
}

public override void activate() {
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
executable('com.github.writeas.writeas-gtk',
executable(app_id,
'application.vala',
'window.vala',
'Granite/Accels.vala',
Expand Down
11 changes: 8 additions & 3 deletions src/window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
stdout.printf("writeas-gtk v%s\n", version);

set_application(app);
icon_name = "com.github.writeas.writeas-gtk";
icon_name = APP_ID;
init_folder();
try {
open_file(draft_file());
Expand Down Expand Up @@ -135,8 +135,13 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {
header.show_close_button = true;
set_titlebar(header);

var icon_size = Gtk.IconSize.SMALL_TOOLBAR;
if (BUILD_PLATFORM == "elementary") {
icon_size = Gtk.IconSize.LARGE_TOOLBAR;
}

var publish_button = new Gtk.Button.from_icon_name("document-send",
Gtk.IconSize.LARGE_TOOLBAR);
icon_size);
publish_button.tooltip_markup = Granite.markup_accel_tooltip (
{"<Ctrl>Return"},
_("Publish to Write.as on the web")
Expand Down Expand Up @@ -168,7 +173,7 @@ public class WriteAs.MainWindow : Gtk.ApplicationWindow {

var fonts = new Gtk.MenuButton();
fonts.tooltip_text = _("Change document font");
fonts.image = new Gtk.Image.from_icon_name("font-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
fonts.image = new Gtk.Image.from_icon_name("font-x-generic", icon_size);
fonts.popup = new Gtk.Menu();
header.pack_start(fonts);

Expand Down

0 comments on commit 4a96bf2

Please sign in to comment.