diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui new file mode 100644 index 0000000..ca92d48 --- /dev/null +++ b/data/gtk/menus.ui @@ -0,0 +1,17 @@ + + + + +
+ + _About + app.about + + + _Quit + app.quit + <Primary>q + +
+
+
diff --git a/data/teleport.gresource.xml b/data/teleport.gresource.xml index 1b5e3b0..a6750ff 100644 --- a/data/teleport.gresource.xml +++ b/data/teleport.gresource.xml @@ -1,6 +1,7 @@ + gtk/menus.ui window.ui settings.ui remote_list.ui diff --git a/src/teleport-app.c b/src/teleport-app.c index ff67e44..0b4cea9 100644 --- a/src/teleport-app.c +++ b/src/teleport-app.c @@ -14,10 +14,14 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . -*/ + */ #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "teleport-app.h" #include "teleport-peer.h" #include "teleport-window.h" @@ -44,6 +48,11 @@ static void open_folder_callback (GSimpleAction *simple, GVariant *parameter, gpointer user_data); + +static void teleport_app_show_about (GSimpleAction *simple, + GVariant *parameter, + gpointer user_data); + static void teleport_app_quit (GSimpleAction *simple, GVariant *parameter, gpointer user_data); @@ -59,6 +68,7 @@ static GActionEntry app_entries[] = { "do-nothing", do_nothing_callback, "as", NULL, NULL }, { "open-file", open_file_callback, "as", NULL, NULL }, { "open-folder", open_folder_callback, "as", NULL, NULL }, + { "about", teleport_app_show_about }, { "quit", teleport_app_quit } }; @@ -323,6 +333,54 @@ teleport_app_class_init (TeleportAppClass *class) G_TYPE_STRING); } +static void +teleport_app_show_about (GSimpleAction *simple, + GVariant *parameter, + gpointer user_data) +{ + TeleportAppPrivate *priv = TELEPORT_APP (user_data)->priv; + char *copyright; + GDateTime *date; + int created_year = 2017; + + static const gchar *authors[] = { + "Julian Sparber ", + NULL + }; + + static const gchar *artists[] = { + "Tobias Bernard ", + NULL + }; + + date = g_date_time_new_now_local (); + + if (g_date_time_get_year (date) <= created_year) + { + copyright = g_strdup_printf (("Copyright \xC2\xA9 %d " + "The Teleport authors"), created_year); + } + else + { + copyright = g_strdup_printf (("Copyright \xC2\xA9 %d\xE2\x80\x93%d " + "The Telport authors"), created_year, g_date_time_get_year (date)); + } + + gtk_show_about_dialog (GTK_WINDOW (priv->window), + "program-name", ("Teleport"), + "version", VERSION, + "copyright", copyright, + "license-type", GTK_LICENSE_AGPL_3_0, + "authors", authors, + "artists", artists, + "logo-icon-name", "com.frac_tion.teleport", + "translator-credits", ("translator-credits"), + NULL); + g_free (copyright); + g_date_time_unref (date); +} + + static void teleport_app_quit (GSimpleAction *simple, GVariant *parameter,