blob: da9a0a1e8a3d4a34ae3f920469e2b2c9bd04d363 [file] [log] [blame]
Stepan Salenikovichbd029582015-03-24 11:00:56 -04001/*
2 * Copyright (C) 2015 Savoir-Faire Linux Inc.
3 * 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.
18 *
19 * Additional permission under GNU GPL version 3 section 7:
20 *
21 * If you modify this program, or any covered work, by linking or
22 * combining it with the OpenSSL project's OpenSSL library (or a
23 * modified version of that library), containing parts covered by the
24 * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
25 * grants you additional permission to convey the resulting work.
26 * Corresponding Source for a non-source form of such a combination
27 * shall include the source code for the parts of OpenSSL used as well
28 * as that of the covered work.
29 */
30
31#include "dialogs.h"
32
33#include <gtk/gtk.h>
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -040034#include <glib/gi18n.h>
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040035#include <glib/gprintf.h>
36#include "config.h"
Stepan Salenikovichbd029582015-03-24 11:00:56 -040037
38GtkWidget *
39ring_dialog_working(GtkWidget *parent, const gchar *msg)
40{
41 GtkWidget *dialog = gtk_dialog_new();
42 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
Stepan Salenikovich83e187b2015-03-26 12:10:14 -040043 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
Stepan Salenikovichbd029582015-03-24 11:00:56 -040044
45 if (parent && GTK_IS_WIDGET(parent)) {
46 /* get parent window so we can center on it */
47 parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
48 if (gtk_widget_is_toplevel(parent)) {
49 gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
50 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
51 }
52 }
53
54 GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
55 gtk_box_set_spacing(GTK_BOX(content_area), 10);
Stepan Salenikovich83e187b2015-03-26 12:10:14 -040056 gtk_widget_set_size_request(content_area, 250, -1);
57 gtk_widget_set_margin_top(content_area, 25);
Stepan Salenikovichbd029582015-03-24 11:00:56 -040058
59 GtkWidget *message = NULL;
60 if (msg) {
61 message = gtk_label_new(msg);
62 } else {
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -040063 message = gtk_label_new(_("Working..."));
Stepan Salenikovichbd029582015-03-24 11:00:56 -040064 }
65
66 gtk_box_pack_start(GTK_BOX(content_area), message, FALSE, TRUE, 0);
67
68 GtkWidget *spinner = gtk_spinner_new();
69 gtk_spinner_start(GTK_SPINNER(spinner));
70
71 gtk_box_pack_start(GTK_BOX(content_area), spinner, FALSE, TRUE, 0);
72
73 gtk_widget_show_all(content_area);
74
75 return dialog;
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040076}
77
78void
79ring_about_dialog(GtkWidget *parent)
80{
81 /* get parent window */
82 if (parent && GTK_IS_WIDGET(parent))
83 parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
84
85 /* get logo */
86 GError *error = NULL;
87 GdkPixbuf* logo = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-logo-blue", &error);
88 if (logo == NULL) {
89 g_debug("Could not load logo: %s", error->message);
Stepan Salenikovich8a287fc2015-05-01 16:53:20 -040090 g_clear_error(&error);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040091 }
92
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -040093 gchar *name = g_strdup_printf(_("Gnome Ring v%d.%d.%d"), VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040094
95 const gchar *authors[] = {
Stepan Salenikovich84ef5002015-03-30 11:28:59 -040096 [0] = "Adrien Béraud",
97 [1] = "Alexandre Lision",
98 [2] = "Edric Milaret",
99 [3] = "Éloi Bail",
100 [4] = "Emmanuel Lepage-Vallée",
101 [5] = "Guillaume Roguez",
102 [6] = "Stepan Salenikovich",
103 [7] = "Based on the SFLPhone project",
104 [8] = NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400105 };
106
107 const gchar *artists[] = {
108 [0] = "Marianne Forget",
109 [1] = NULL,
110 };
111
112 gtk_show_about_dialog(
113 GTK_WINDOW(parent),
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400114 "program-name", name,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400115 "copyright", "© 2015 Savoir-faire Linux",
116 "license-type", GTK_LICENSE_GPL_3_0,
117 "logo", logo,
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -0400118 "version", C_("Do not translate the release name", "release: Samuel de Champlain"),
119 "comments", _("The GNOME client for Ring.\nRing is a secured and distributed communication software."),
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400120 "authors", authors,
121 "website", "http://www.ring.cx/",
122 "website-label", "www.ring.cx",
123 "artists", artists,
124 NULL
125 );
126
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400127 g_free(name);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400128}