Commit 8b3f6490 authored by Christopher Davis's avatar Christopher Davis

app: Add "About" action

This creates an action that builds and shows an about
dialog for Social.
parent e72e595e
Pipeline #74056 passed with stage
in 10 minutes and 56 seconds
......@@ -102,6 +102,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="text" translatable="yes">About Social</property>
<property name="action_name">app.about</property>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -4,12 +4,6 @@ project(
license: 'GPLv3',
)
social_version = meson.project_version()
version_array = social_version.split('.')
social_major_version = version_array[0].to_int()
social_minor_version = version_array[1].to_int()
social_version_micro = version_array[2].to_int()
social_prefix = get_option('prefix')
social_bindir = join_paths(social_prefix, get_option('bindir'))
social_localedir = join_paths(social_prefix, get_option('localedir'))
......@@ -21,12 +15,20 @@ social_icondir = join_paths(social_datadir, 'icons')
if get_option('profile') == 'development'
profile = 'Devel'
name_prefix = '(Development) '
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
if vcs_tag == ''
version_suffix = '-devel'
else
version_suffix = '-@0@'.format (vcs_tag)
endif
else
profile = ''
name_prefix = ''
version_suffix = ''
endif
social_id = 'org.gnome.Social@0@'.format(profile)
social_version = meson.project_version() + version_suffix
# i18n = import('i18n')
gnome = import('gnome')
......
......@@ -179,9 +179,10 @@ impl App {
app.instance
.set_accels_for_action("app.quit", &["<Primary>q"]);
let weak_s = weak_super.clone();
action = gio::SimpleAction::new("logout", None);
action.connect_activate(move |_, _| {
weak_super.upgrade().map(|app| {
weak_s.upgrade().map(|app| {
passwords::delete_passwords();
loop {
if app.sender.send(Actions::ShowRegisterPage).is_ok() {
......@@ -190,7 +191,15 @@ impl App {
}
});
});
app.instance.add_action(&action)
app.instance.add_action(&action);
action = gio::SimpleAction::new("about", None);
action.connect_activate(move |_, _| {
weak_super.upgrade().map(|app| {
app.show_about();
});
});
app.instance.add_action(&action);
}
pub fn setup_channel(&self) -> glib::Continue {
......@@ -222,6 +231,34 @@ impl App {
glib::Continue(true)
}
pub fn show_about(&self) {
let window = self.instance.get_active_window();
let artists = vec!["Tobias Bernard"];
let authors = vec!["Christopher Davis <christopherdavis@gnome.org>"];
let dialog = gtk::AboutDialog::new();
dialog.set_artists(&artists);
dialog.set_authors(&authors);
dialog.set_comments("A federated microblogging client for GNOME");
dialog.set_license_type(gtk::License::Gpl30);
dialog.set_logo_icon_name(config::APP_ID);
dialog.set_wrap_license(true);
dialog.set_version(config::VERSION);
dialog.set_copyright(
format!("\u{A9} {} Christopher Davis, et al.", config::COPYRIGHT).as_str(),
);
window.map(|w| {
dialog.set_transient_for(&w);
dialog.set_modal(true);
});
dialog.connect_response(move |d, _| {
d.destroy();
});
dialog.show_all();
}
pub fn run() {
let application =
gtk::Application::new(Some(config::APP_ID), gio::ApplicationFlags::HANDLES_OPEN)
......
......@@ -22,3 +22,5 @@ pub static APP_ID: &'static str = @APP_ID@;
pub static PKGDATADIR: &'static str = @PKGDATADIR@;
pub static PROFILE: &'static str = @PROFILE@;
pub static NAME_PREFIX: &'static str = @NAME_PREFIX@;
pub static VERSION: &'static str = @VERSION@;
pub static COPYRIGHT: &'static str = @COPYRIGHT@;
......@@ -20,6 +20,8 @@ global_conf.set_quoted('APP_ID', social_id)
global_conf.set_quoted('PKGDATADIR', join_paths(social_prefix, social_pkgdatadir))
global_conf.set_quoted('PROFILE', profile)
global_conf.set_quoted('NAME_PREFIX', name_prefix)
global_conf.set_quoted('VERSION', social_version)
global_conf.set_quoted('COPYRIGHT', '2017-2019')
config = configure_file(
input: 'config.rs.in',
output: 'config.rs',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment