blob: 657057c2eedc64844713b835c51f6db5059b6903 [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 Salenikovich24dcd5c2015-03-26 17:40:34 -040034#include <glib/gprintf.h>
35#include "config.h"
Stepan Salenikovichbd029582015-03-24 11:00:56 -040036
37GtkWidget *
38ring_dialog_working(GtkWidget *parent, const gchar *msg)
39{
40 GtkWidget *dialog = gtk_dialog_new();
41 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
Stepan Salenikovich83e187b2015-03-26 12:10:14 -040042 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
Stepan Salenikovichbd029582015-03-24 11:00:56 -040043
44 if (parent && GTK_IS_WIDGET(parent)) {
45 /* get parent window so we can center on it */
46 parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
47 if (gtk_widget_is_toplevel(parent)) {
48 gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
49 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
50 }
51 }
52
53 GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
54 gtk_box_set_spacing(GTK_BOX(content_area), 10);
Stepan Salenikovich83e187b2015-03-26 12:10:14 -040055 gtk_widget_set_size_request(content_area, 250, -1);
56 gtk_widget_set_margin_top(content_area, 25);
Stepan Salenikovichbd029582015-03-24 11:00:56 -040057
58 GtkWidget *message = NULL;
59 if (msg) {
60 message = gtk_label_new(msg);
61 } else {
62 message = gtk_label_new("Working...");
63 }
64
65 gtk_box_pack_start(GTK_BOX(content_area), message, FALSE, TRUE, 0);
66
67 GtkWidget *spinner = gtk_spinner_new();
68 gtk_spinner_start(GTK_SPINNER(spinner));
69
70 gtk_box_pack_start(GTK_BOX(content_area), spinner, FALSE, TRUE, 0);
71
72 gtk_widget_show_all(content_area);
73
74 return dialog;
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040075}
76
77void
78ring_about_dialog(GtkWidget *parent)
79{
80 /* get parent window */
81 if (parent && GTK_IS_WIDGET(parent))
82 parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
83
84 /* get logo */
85 GError *error = NULL;
86 GdkPixbuf* logo = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-logo-blue", &error);
87 if (logo == NULL) {
88 g_debug("Could not load logo: %s", error->message);
Stepan Salenikovich8a287fc2015-05-01 16:53:20 -040089 g_clear_error(&error);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040090 }
91
Stepan Salenikovich84ef5002015-03-30 11:28:59 -040092 gchar *name = g_strdup_printf("Gnome Ring v%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040093
94 const gchar *authors[] = {
Stepan Salenikovich84ef5002015-03-30 11:28:59 -040095 [0] = "Adrien Béraud",
96 [1] = "Alexandre Lision",
97 [2] = "Edric Milaret",
98 [3] = "Éloi Bail",
99 [4] = "Emmanuel Lepage-Vallée",
100 [5] = "Guillaume Roguez",
101 [6] = "Stepan Salenikovich",
102 [7] = "Based on the SFLPhone project",
103 [8] = NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400104 };
105
106 const gchar *artists[] = {
107 [0] = "Marianne Forget",
108 [1] = NULL,
109 };
110
111 gtk_show_about_dialog(
112 GTK_WINDOW(parent),
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400113 "program-name", name,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400114 "copyright", "© 2015 Savoir-faire Linux",
115 "license-type", GTK_LICENSE_GPL_3_0,
116 "logo", logo,
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400117 "version", "release: Samuel de Champlain",
118 "comments", "The GNOME client for Ring.\nRing is a secured and distributed communication software.",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400119 "authors", authors,
120 "website", "http://www.ring.cx/",
121 "website-label", "www.ring.cx",
122 "artists", artists,
123 NULL
124 );
125
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400126 g_free(name);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400127}