blob: 20e80ecc942b2cc3adecd598e1b683467aa0ee30 [file] [log] [blame]
Stepan Salenikovichbd029582015-03-24 11:00:56 -04001/*
Guillaume Roguezf8d75862017-07-19 11:28:22 -04002 * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
Stepan Salenikovichbd029582015-03-24 11:00:56 -04003 * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Stepan Salenikovichbd029582015-03-24 11:00:56 -040018 */
19
20#include "dialogs.h"
21
22#include <gtk/gtk.h>
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -040023#include <glib/gi18n.h>
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040024#include <glib/gprintf.h>
25#include "config.h"
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -040026#include "revision.h"
Stepan Salenikovichbd029582015-03-24 11:00:56 -040027
28GtkWidget *
29ring_dialog_working(GtkWidget *parent, const gchar *msg)
30{
31 GtkWidget *dialog = gtk_dialog_new();
32 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
Stepan Salenikovich83e187b2015-03-26 12:10:14 -040033 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
Stepan Salenikovichbd029582015-03-24 11:00:56 -040034
35 if (parent && GTK_IS_WIDGET(parent)) {
36 /* get parent window so we can center on it */
37 parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
38 if (gtk_widget_is_toplevel(parent)) {
39 gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
40 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
41 }
42 }
43
44 GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
45 gtk_box_set_spacing(GTK_BOX(content_area), 10);
Stepan Salenikovich83e187b2015-03-26 12:10:14 -040046 gtk_widget_set_size_request(content_area, 250, -1);
47 gtk_widget_set_margin_top(content_area, 25);
Stepan Salenikovichbd029582015-03-24 11:00:56 -040048
49 GtkWidget *message = NULL;
50 if (msg) {
51 message = gtk_label_new(msg);
52 } else {
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -040053 message = gtk_label_new(_("Working..."));
Stepan Salenikovichbd029582015-03-24 11:00:56 -040054 }
55
56 gtk_box_pack_start(GTK_BOX(content_area), message, FALSE, TRUE, 0);
57
58 GtkWidget *spinner = gtk_spinner_new();
59 gtk_spinner_start(GTK_SPINNER(spinner));
60
61 gtk_box_pack_start(GTK_BOX(content_area), spinner, FALSE, TRUE, 0);
62
63 gtk_widget_show_all(content_area);
64
65 return dialog;
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040066}
67
68void
69ring_about_dialog(GtkWidget *parent)
70{
71 /* get parent window */
72 if (parent && GTK_IS_WIDGET(parent))
73 parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
74
75 /* get logo */
76 GError *error = NULL;
77 GdkPixbuf* logo = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-logo-blue", &error);
78 if (logo == NULL) {
79 g_debug("Could not load logo: %s", error->message);
Stepan Salenikovich8a287fc2015-05-01 16:53:20 -040080 g_clear_error(&error);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040081 }
82
Guillaume Roguez1af28852016-11-02 19:26:20 -040083 gchar *version = g_strdup_printf(C_("Do not translate the release name nor the status (beta, final, ...)",
Anthony Léonard0c43e512017-07-18 09:40:39 -040084 "Liberté, Égalité, Fraternité - Version 1.0\nbuilt on %.25s"),
Guillaume Roguez1af28852016-11-02 19:26:20 -040085 RING_CLIENT_BUILD_DATE);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040086
87 const gchar *authors[] = {
Guillaume Roguez3ca693a2016-11-03 13:35:43 -040088 "Adrien Béraud",
Guillaume Roguezc87c63b2016-11-03 16:21:56 -040089 "Alexandr Sergheev",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -040090 "Alexandre Lision",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -040091 "Alexandre Viau",
92 "Aline Bonnet",
Guillaume Roguezc87c63b2016-11-03 16:21:56 -040093 "Andreas Traczyk",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -040094 "Anthony Léonard",
95 "Cyrille Béraud",
Dorina Mosku8b75a4c2016-11-10 15:49:44 -050096 "Dorina Mosku",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -040097 "Edric Milaret",
98 "Éloi Bail",
99 "Emmanuel Lepage-Vallée",
100 "Frédéric Guimont",
101 "Guillaume Roguez",
Guillaume Roguez2a6150d2017-07-19 18:24:47 -0400102 "Hadrien De Sousa",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400103 "Julien Grossholtz",
Anthony Léonard4f1f7602017-07-18 09:50:25 -0400104 "Kateryna Kostiuk",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400105 "Loïc Siret",
Sébastien Blin2edfbe22017-10-04 13:09:01 -0400106 "Marianne Forget",
107 "Michel Schmit",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400108 "Nicolas Jäger",
Anthony Léonard4f1f7602017-07-18 09:50:25 -0400109 "Nicolas Reynaud",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400110 "Olivier Gregoire",
111 "Olivier Soldano",
112 "Patrick Keroulas",
113 "Philippe Gorley",
114 "Romain Bertozzi",
Sébastien Blin2edfbe22017-10-04 13:09:01 -0400115 "Saher Azer",
Anthony Léonard4f1f7602017-07-18 09:50:25 -0400116 "Sébastien Blin",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400117 "Seva Ivanov",
Anthony Léonard4f1f7602017-07-18 09:50:25 -0400118 "Silbino Gonçalves Matado",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400119 "Simon Désaulniers",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400120 "Simon Zeni",
Sébastien Blin2edfbe22017-10-04 13:09:01 -0400121 "Stepan Salenikovich",
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400122 "Thibault Wittemberg",
123 "Based on the SFLPhone project",
124 NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400125 };
126
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400127 gtk_show_about_dialog(
128 GTK_WINDOW(parent),
Guillaume Roguezf32c2d92016-11-03 13:36:33 -0400129 "program-name", "",
Guillaume Roguezf8d75862017-07-19 11:28:22 -0400130 "copyright", "© 2017 Savoir-faire Linux",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400131 "license-type", GTK_LICENSE_GPL_3_0,
132 "logo", logo,
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400133 "version", version,
Stepan Salenikovichd4d19d62016-11-03 11:12:22 -0400134 "comments", _("The GNOME client for Ring.\nRing is free software for universal communication which respects the freedoms and privacy of its users."),
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400135 "authors", authors,
Adrien Beraud6dcc94c2017-07-12 11:22:28 -0400136 "website", "https://www.ring.cx/",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400137 "website-label", "www.ring.cx",
Stepan Salenikovichd080d6d2015-11-13 10:46:24 -0500138 "translator-credits", "https://www.transifex.com/savoirfairelinux/ring",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400139 NULL
140 );
141
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400142 g_free(version);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400143}