Stepan Salenikovich | bd02958 | 2015-03-24 11:00:56 -0400 | [diff] [blame] | 1 | /* |
| 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 Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 34 | #include <glib/gprintf.h> |
| 35 | #include "config.h" |
Stepan Salenikovich | bd02958 | 2015-03-24 11:00:56 -0400 | [diff] [blame] | 36 | |
| 37 | GtkWidget * |
| 38 | ring_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 Salenikovich | 83e187b | 2015-03-26 12:10:14 -0400 | [diff] [blame] | 42 | gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
Stepan Salenikovich | bd02958 | 2015-03-24 11:00:56 -0400 | [diff] [blame] | 43 | |
| 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 Salenikovich | 83e187b | 2015-03-26 12:10:14 -0400 | [diff] [blame] | 55 | gtk_widget_set_size_request(content_area, 250, -1); |
| 56 | gtk_widget_set_margin_top(content_area, 25); |
Stepan Salenikovich | bd02958 | 2015-03-24 11:00:56 -0400 | [diff] [blame] | 57 | |
| 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 Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void |
| 78 | ring_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); |
| 89 | g_error_free(error); |
| 90 | } |
| 91 | |
Stepan Salenikovich | 84ef500 | 2015-03-30 11:28:59 -0400 | [diff] [blame^] | 92 | gchar *name = g_strdup_printf("Gnome Ring v%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); |
Stepan Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 93 | |
| 94 | const gchar *authors[] = { |
Stepan Salenikovich | 84ef500 | 2015-03-30 11:28:59 -0400 | [diff] [blame^] | 95 | [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 Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | const gchar *artists[] = { |
| 107 | [0] = "Marianne Forget", |
| 108 | [1] = NULL, |
| 109 | }; |
| 110 | |
| 111 | gtk_show_about_dialog( |
| 112 | GTK_WINDOW(parent), |
Stepan Salenikovich | 84ef500 | 2015-03-30 11:28:59 -0400 | [diff] [blame^] | 113 | "program-name", name, |
Stepan Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 114 | "copyright", "© 2015 Savoir-faire Linux", |
| 115 | "license-type", GTK_LICENSE_GPL_3_0, |
| 116 | "logo", logo, |
Stepan Salenikovich | 84ef500 | 2015-03-30 11:28:59 -0400 | [diff] [blame^] | 117 | "version", "release: Samuel de Champlain", |
| 118 | "comments", "The GNOME client for Ring.\nRing is a secured and distributed communication software.", |
Stepan Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 119 | "authors", authors, |
| 120 | "website", "http://www.ring.cx/", |
| 121 | "website-label", "www.ring.cx", |
| 122 | "artists", artists, |
| 123 | NULL |
| 124 | ); |
| 125 | |
Stepan Salenikovich | 84ef500 | 2015-03-30 11:28:59 -0400 | [diff] [blame^] | 126 | g_free(name); |
Stepan Salenikovich | 24dcd5c | 2015-03-26 17:40:34 -0400 | [diff] [blame] | 127 | } |