Add about dialog

This commit is contained in:
Martijn Braam 2021-06-13 23:23:13 +02:00
parent 8e2c11d5e4
commit 295476c3f6
3 changed files with 22 additions and 4 deletions

View File

@ -229,9 +229,11 @@
</object>
</child>
<child>
<object class="GtkLabel">
<property name="can-focus">0</property>
<property name="label" translatable="yes">Settings aren't functional yet</property>
<object class="GtkButton">
<property name="label" translatable="yes">About</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="action-name">app.about</property>
</object>
</child>
</object>

View File

@ -1,4 +1,4 @@
project('megapixels', 'c')
project('megapixels', 'c', version: '1.1.0')
gnome = import('gnome')
gtkdep = dependency('gtk4')
@ -20,6 +20,8 @@ configure_file(
output: 'config.h',
configuration: conf)
add_global_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'c')
# Define DEBUG for debug builds only (debugoptimized is not included on this one)
if get_option('buildtype') == 'debug'
add_global_arguments('-DDEBUG', language: 'c')

View File

@ -456,6 +456,19 @@ run_capture_action(GSimpleAction *action, GVariant *param, gpointer user_data)
mp_io_pipeline_capture();
}
void
run_about_action(GSimpleAction *action, GVariant *param, GApplication *app)
{
gtk_show_about_dialog(NULL, "program-name", "Megapixels",
"title", "Megapixels",
"logo-icon-name", "org.postmarketos.Megapixels",
"comments", "The postmarketOS camera application",
"website", "https://sr.ht/~martijnbraam/megapixels",
"version", VERSION,
"license-type", GTK_LICENSE_GPL_3_0_ONLY,
NULL);
}
void
run_quit_action(GSimpleAction *action, GVariant *param, GApplication *app)
{
@ -889,6 +902,7 @@ activate(GtkApplication *app, gpointer data)
create_simple_action(app, "close-settings", G_CALLBACK(run_close_settings_action));
create_simple_action(app, "open-last", G_CALLBACK(run_open_last_action));
create_simple_action(app, "open-photos", G_CALLBACK(run_open_photos_action));
create_simple_action(app, "about", G_CALLBACK(run_about_action));
create_simple_action(app, "quit", G_CALLBACK(run_quit_action));
// Setup shortcuts