blob: 4cbdd865a8add47252007de35b6507197f385de0 [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");
84 gchar *version = g_strdup_printf(C_("Do not translate the release name", "release: Samuel de Champlain\nv%d.%d.%d - %.10s"),
85 VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, RING_CLIENT_REVISION);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040086
87 const gchar *authors[] = {
Stepan Salenikovichfd7763f2015-11-13 10:42:01 -050088 [0] = "Adrien Béraud",
89 [1] = "Alexandre Lision",
90 [2] = "Edric Milaret",
91 [3] = "Éloi Bail",
92 [4] = "Emmanuel Lepage-Vallée",
93 [5] = "Guillaume Roguez",
94 [6] = "Julien Grossholtz",
95 [7] = "Nicolas Jäger",
96 [8] = "Simon Désaulniers",
97 [9] = "Stepan Salenikovich",
98 [10] = "Based on the SFLPhone project",
99 [11] = NULL,
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400100 };
101
102 const gchar *artists[] = {
103 [0] = "Marianne Forget",
104 [1] = NULL,
105 };
106
107 gtk_show_about_dialog(
108 GTK_WINDOW(parent),
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400109 "program-name", name,
Stepan Salenikovichbe87d2c2016-01-25 14:14:34 -0500110 "copyright", "© 2016 Savoir-faire Linux",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400111 "license-type", GTK_LICENSE_GPL_3_0,
112 "logo", logo,
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400113 "version", version,
Stepan Salenikovicha1b8cb32015-09-11 14:58:35 -0400114 "comments", _("The GNOME client for Ring.\nRing is a secured and distributed communication software."),
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400115 "authors", authors,
116 "website", "http://www.ring.cx/",
117 "website-label", "www.ring.cx",
118 "artists", artists,
Stepan Salenikovichd080d6d2015-11-13 10:46:24 -0500119 "translator-credits", "https://www.transifex.com/savoirfairelinux/ring",
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400120 NULL
121 );
122
Stepan Salenikovich84ef5002015-03-30 11:28:59 -0400123 g_free(name);
Stepan Salenikoviche40e48d2015-09-17 18:38:25 -0400124 g_free(version);
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400125}