Commit b9dd4551 authored by Julian Sparber's avatar Julian Sparber

[feat] add about dialog

parent 20b51dd7
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">app.about</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
</interface>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<gresources> <gresources>
<gresource prefix="/com/frac_tion/teleport"> <gresource prefix="/com/frac_tion/teleport">
<file alias="gtk/menus.ui">gtk/menus.ui</file>
<file preprocess="xml-stripblanks">window.ui</file> <file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">settings.ui</file> <file preprocess="xml-stripblanks">settings.ui</file>
<file preprocess="xml-stripblanks">remote_list.ui</file> <file preprocess="xml-stripblanks">remote_list.ui</file>
......
...@@ -14,10 +14,14 @@ ...@@ -14,10 +14,14 @@
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "teleport-app.h" #include "teleport-app.h"
#include "teleport-peer.h" #include "teleport-peer.h"
#include "teleport-window.h" #include "teleport-window.h"
...@@ -44,6 +48,11 @@ static void open_folder_callback (GSimpleAction *simple, ...@@ -44,6 +48,11 @@ static void open_folder_callback (GSimpleAction *simple,
GVariant *parameter, GVariant *parameter,
gpointer user_data); gpointer user_data);
static void teleport_app_show_about (GSimpleAction *simple,
GVariant *parameter,
gpointer user_data);
static void teleport_app_quit (GSimpleAction *simple, static void teleport_app_quit (GSimpleAction *simple,
GVariant *parameter, GVariant *parameter,
gpointer user_data); gpointer user_data);
...@@ -59,6 +68,7 @@ static GActionEntry app_entries[] = ...@@ -59,6 +68,7 @@ static GActionEntry app_entries[] =
{ "do-nothing", do_nothing_callback, "as", NULL, NULL }, { "do-nothing", do_nothing_callback, "as", NULL, NULL },
{ "open-file", open_file_callback, "as", NULL, NULL }, { "open-file", open_file_callback, "as", NULL, NULL },
{ "open-folder", open_folder_callback, "as", NULL, NULL }, { "open-folder", open_folder_callback, "as", NULL, NULL },
{ "about", teleport_app_show_about },
{ "quit", teleport_app_quit } { "quit", teleport_app_quit }
}; };
...@@ -323,6 +333,54 @@ teleport_app_class_init (TeleportAppClass *class) ...@@ -323,6 +333,54 @@ teleport_app_class_init (TeleportAppClass *class)
G_TYPE_STRING); 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 <julian@sparber.net>",
NULL
};
static const gchar *artists[] = {
"Tobias Bernard <tbernard@gnome.org>",
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 static void
teleport_app_quit (GSimpleAction *simple, teleport_app_quit (GSimpleAction *simple,
GVariant *parameter, GVariant *parameter,
......
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