blob: a914f8979a391e887273b1e1adebe4c9717b1e88 [file] [log] [blame]
Stepan Salenikovichbd029582015-03-24 11:00:56 -04001/*
Stepan Salenikovichbe87d2c2016-01-25 14:14:34 -05002 * Copyright (C) 2015-2016 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, ...)",
Guillaume Roguezf32c2d92016-11-03 13:36:33 -040084 "Gaston Miron - Beta 2\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",
102 "Julien Grossholtz",
103 "Loïc Siret",
104 "Nicolas Jäger",
105 "Nicolas Reynaud"
106 "Olivier Gregoire",
107 "Olivier Soldano",
108 "Patrick Keroulas",
109 "Philippe Gorley",
110 "Romain Bertozzi",
111 "Seva Ivanov",
112 "Simon Désaulniers",
113 "Stepan Salenikovich",
114 "Simon Zeni",
115 "Thibault Wittemberg",
116 "Based on the SFLPhone project",
117 NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400118 };
119
120 const gchar *artists[] = {
Guillaume Roguez3ca693a2016-11-03 13:35:43 -0400121 "Marianne Forget",
122 NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400123 };
124
125 gtk_show_about_dialog(
126 GTK_WINDOW(parent),
Guillaume Roguezf32c2d92016-11-03 13:36:33 -0400127 "program-name", "",
Stepan Salenikovichbe87d2c2016-01-25 14:14:34 -0500128 "copyright", "© 2016 Savoir-faire Linux",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400129 "license-type", GTK_LICENSE_GPL_3_0,
130 "logo", logo,
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400131 "version", version,
Stepan Salenikovichd4d19d62016-11-03 11:12:22 -0400132 "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 -0400133 "authors", authors,
134 "website", "http://www.ring.cx/",
135 "website-label", "www.ring.cx",
136 "artists", artists,
Stepan Salenikovichd080d6d2015-11-13 10:46:24 -0500137 "translator-credits", "https://www.transifex.com/savoirfairelinux/ring",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400138 NULL
139 );
140
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400141 g_free(version);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400142}