Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for elementary OS 6 #15

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,44 @@ name: CI
on: [push, pull_request]

jobs:
lint:
flatpak:
name: Flatpak
runs-on: ubuntu-latest

strategy:
matrix:
arch: [x86_64, aarch64]
# Don't fail the whole workflow if one architecture fails
fail-fast: false

container:
image: valalang/lint
image: ghcr.io/elementary/flatpak-platform/runtime:6-${{ matrix.arch }}
options: --privileged

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU for aarch64 emulation
if: ${{ matrix.arch != 'x86_64' }}
uses: docker/setup-qemu-action@v1
with:
platforms: arm64

- name: Build
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
with:
bundle: com.github.manexim.messages.flatpak
manifest-path: com.github.manexim.messages.yml
run-tests: true
repository-name: appcenter
repository-url: https://flatpak.elementary.io/repo.flatpakrepo
cache-key: "flatpak-builder-${{ github.sha }}"
arch: ${{ matrix.arch }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lint
run: io.elementary.vala-lint -d .
- uses: actions/checkout@v2
- uses: elementary/actions/vala-lint@master
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*~
*.flatpak
build/
.flatpak-builder/
repo/
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build & Run",
"type": "shell",
"command": "./run.sh",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ These dependencies must be present before building:
- `valac (>=0.40)`
- `libgtk-3-dev`
- `libgranite-dev`
- `libhandy-1-dev`
- `libwebkit2gtk-4.0-dev`

### Building
Expand Down
21 changes: 21 additions & 0 deletions com.github.manexim.messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
app-id: com.github.manexim.messages
runtime: io.elementary.Platform
runtime-version: '6'
sdk: io.elementary.Sdk
command: com.github.manexim.messages
finish-args:
- '--share=ipc'
- '--socket=fallback-x11'
- '--socket=wayland'

- '--share=network'
- '--device=dri'

# needed for perfers-color-scheme
- '--system-talk-name=org.freedesktop.Accounts'
modules:
- name: messages
buildsystem: meson
sources:
- type: dir
path: .
5 changes: 5 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ foreach icon : shared_icons
join_paths('icons', 'share', icon + '.svg'),
install_dir: join_paths(get_option('datadir'), meson.project_name(), 'icons')
)

install_data(
join_paths('icons', 'share', icon + '.svg'),
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'scalable', 'apps')
)
endforeach

i18n.merge_file(
Expand Down
19 changes: 0 additions & 19 deletions debian/changelog

This file was deleted.

1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

17 changes: 0 additions & 17 deletions debian/control

This file was deleted.

7 changes: 0 additions & 7 deletions debian/copyright

This file was deleted.

29 changes: 0 additions & 29 deletions debian/rules

This file was deleted.

1 change: 0 additions & 1 deletion debian/source/format

This file was deleted.

3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ add_project_arguments(
language: 'c'
)

gtk_plus_3_dep = dependency('gtk+-3.0')
granite_dep = dependency('granite')
gtk_plus_3_dep = dependency('gtk+-3.0')
libhandy_dep = dependency('libhandy-1', version: '>=1.0.0')
webkit2gtk_4_dep = dependency('webkit2gtk-4.0')

subdir('data')
Expand Down
7 changes: 7 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

APP=com.github.manexim.messages

flatpak-builder --repo=repo --disable-rofiles-fuse build ${APP}.yml --force-clean
flatpak build-bundle repo ${APP}.flatpak --runtime-repo=https://flatpak.elementary.io/repo.flatpakrepo ${APP} master
flatpak-builder --run build ${APP}.yml ${APP}
34 changes: 34 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
* Copyright (c) 2020-2021 Manexim (https://github.com/manexim)
*
* 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 2 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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Marius Meisenzahl <[email protected]>
*/

public class Application : Granite.Application {
private static Application? _instance;
private MainWindow window;
Expand Down Expand Up @@ -32,6 +53,19 @@ public class Application : Granite.Application {
}

protected override void activate () {
var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();

gtk_settings.gtk_application_prefer_dark_theme = (
granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK
);

granite_settings.notify["prefers-color-scheme"].connect (() => {
gtk_settings.gtk_application_prefer_dark_theme = (
granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK
);
});

window = new MainWindow (this);

window.show_all ();
Expand Down
99 changes: 99 additions & 0 deletions src/Dialogs/MessengerAddDialog.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (c) 2021 Manexim (https://github.com/manexim)
*
* 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 2 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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Marius Meisenzahl <[email protected]>
*/

public class Dialogs.MessengerAddDialog : Granite.Dialog {
public Models.Messenger messenger { private get; construct set; }
private Gtk.Button create_button;

public MessengerAddDialog (Gtk.Window parent, Models.Messenger messenger) {
Object (
transient_for: parent,
messenger: messenger
);
}

construct {
var image = new Gtk.Image.from_gicon (Utilities.load_shared_icon (messenger.id), Gtk.IconSize.DND);

var name_label = new Granite.HeaderLabel (_("Name"));

var name_entry = new Gtk.Entry () {
hexpand = true,
text = messenger.name
};

var url_label = new Granite.HeaderLabel (_("URL"));

var url_entry = new Gtk.Entry () {
hexpand = true,
text = messenger.url
};

var form_grid = new Gtk.Grid () {
margin_start = margin_end = 12,
orientation = Gtk.Orientation.VERTICAL,
row_spacing = 3,
valign = Gtk.Align.CENTER,
vexpand = true
};
form_grid.add (image);
form_grid.add (name_label);
form_grid.add (name_entry);
form_grid.add (url_label);
form_grid.add (url_entry);
form_grid.show_all ();

deletable = false;
modal = true;
resizable= false;
width_request = 560;
window_position = Gtk.WindowPosition.CENTER_ON_PARENT;
get_content_area ().add (form_grid);

var cancel_button = add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
cancel_button.margin_bottom = 6;
cancel_button.margin_top = 14;

create_button = (Gtk.Button) add_button (_("Add"), Gtk.ResponseType.OK);
create_button.margin = 6;
create_button.margin_start = 0;
create_button.margin_top = 14;
create_button.can_default = true;
create_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);

response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.OK) {
string name = name_entry.text;
string url = url_entry.text;

var new_messenger = new Models.Messenger () {
id = messenger.id,
name = name,
url = url
};

Services.Messengers.get_default ().add (new_messenger);
}

destroy ();
});
}
}
Loading