blob: 8b0dce379d8c14ca2ac09cf72329d7585835370e [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
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -040083 gchar *name = g_strdup_printf("Gnome Ring");
Guillaume Roguez1af28852016-11-02 19:26:20 -040084 gchar *version = g_strdup_printf(C_("Do not translate the release name nor the status (beta, final, ...)",
85 "release: Louis Riel - beta 2\nbuilt on %.25s"),
86 RING_CLIENT_BUILD_DATE);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040087
88 const gchar *authors[] = {
Stepan Salenikovichfd7763f2015-11-13 10:42:01 -050089 [0] = "Adrien Béraud",
90 [1] = "Alexandre Lision",
Stepan Salenikovich0aaeb632016-10-21 11:37:49 -040091 [2] = "Andreas Traczyk",
92 [3] = "Alexandre Viau",
93 [4] = "Aline Bonnet",
94 [5] = "Anthony Léonard",
95 [6] = "Edric Milaret",
96 [7] = "Éloi Bail",
97 [8] = "Emmanuel Lepage-Vallée",
98 [9] = "Guillaume Roguez",
99 [10] = "Julien Grossholtz",
100 [11] = "Loïc Siret",
101 [12] = "Nicolas Jäger",
102 [13] = "Olivier Gregoire",
103 [14] = "Olivier Soldano",
104 [15] = "Patrick Keroulas",
105 [16] = "Philippe Gorley",
106 [17] = "Seva Ivanov",
107 [18] = "Simon Désaulniers",
108 [19] = "Stepan Salenikovich",
109 [20] = "Simon Zeni",
110 [21] = "Thibault Wittemberg",
111 [22] = "Based on the SFLPhone project",
112 [23] = NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400113 };
114
115 const gchar *artists[] = {
116 [0] = "Marianne Forget",
117 [1] = NULL,
118 };
119
120 gtk_show_about_dialog(
121 GTK_WINDOW(parent),
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400122 "program-name", name,
Stepan Salenikovichbe87d2c2016-01-25 14:14:34 -0500123 "copyright", "© 2016 Savoir-faire Linux",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400124 "license-type", GTK_LICENSE_GPL_3_0,
125 "logo", logo,
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400126 "version", version,
Stepan Salenikovich19c44112016-10-21 11:18:33 -0400127 "comments", _("The GNOME client for GNU Ring.\nGNU Ring is free software for universal communication which respects the freedoms and privacy of its users."),
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400128 "authors", authors,
129 "website", "http://www.ring.cx/",
130 "website-label", "www.ring.cx",
131 "artists", artists,
Stepan Salenikovichd080d6d2015-11-13 10:46:24 -0500132 "translator-credits", "https://www.transifex.com/savoirfairelinux/ring",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400133 NULL
134 );
135
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400136 g_free(name);
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400137 g_free(version);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400138}