dialogs.c 4.63 KB
Newer Older
1
/*
2
 *  Copyright (C) 2015-2019 Savoir-faire Linux Inc.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *  Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
 */

#include "dialogs.h"

#include <gtk/gtk.h>
23
#include <glib/gi18n.h>
24 25
#include <glib/gprintf.h>
#include "config.h"
26
#include "revision.h"
27 28

GtkWidget *
29
dialog_working(GtkWidget *parent, const gchar *msg)
30 31 32
{
    GtkWidget *dialog = gtk_dialog_new();
    gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
33
    gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
34 35 36 37 38 39 40 41 42 43 44 45

    if (parent && GTK_IS_WIDGET(parent)) {
        /* get parent window so we can center on it */
        parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
        if (gtk_widget_is_toplevel(parent)) {
            gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
            gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
        }
    }

    GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
    gtk_box_set_spacing(GTK_BOX(content_area), 10);
46 47
    gtk_widget_set_size_request(content_area, 250, -1);
    gtk_widget_set_margin_top(content_area, 25);
48 49 50 51 52

    GtkWidget *message = NULL;
    if (msg) {
        message = gtk_label_new(msg);
    } else {
53
        message = gtk_label_new(_("Working…"));
54 55 56 57 58 59 60 61 62 63 64 65
    }

    gtk_box_pack_start(GTK_BOX(content_area), message, FALSE, TRUE, 0);

    GtkWidget *spinner = gtk_spinner_new();
    gtk_spinner_start(GTK_SPINNER(spinner));

    gtk_box_pack_start(GTK_BOX(content_area), spinner, FALSE, TRUE, 0);

    gtk_widget_show_all(content_area);

    return dialog;
66 67 68
}

void
69
about_dialog(GtkWidget *parent)
70 71 72 73 74 75 76
{
    /* get parent window */
    if (parent && GTK_IS_WIDGET(parent))
        parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));

    /* get logo */
    GError *error = NULL;
77
    GdkPixbuf* logo = gdk_pixbuf_new_from_resource("/net/jami/JamiGnome/jami-logo-blue", &error);
78 79
    if (logo == NULL) {
        g_debug("Could not load logo: %s", error->message);
80
        g_clear_error(&error);
81 82
    }

83
    gchar *version = g_strdup_printf(C_("Do not translate the release name nor the status (beta, final, ...)",
84
                                        "\"Free as in Freedom\"\nbuilt on %.25s"),
85
                                     CLIENT_BUILD_DATE);
86 87

    const gchar *authors[] = {
Guillaume Roguez's avatar
Guillaume Roguez committed
88
        "Adrien Béraud",
Guillaume Roguez's avatar
Guillaume Roguez committed
89
        "Alexandr Sergheev",
Guillaume Roguez's avatar
Guillaume Roguez committed
90 91 92
        "Alexandre Lision",
        "Alexandre Viau",
        "Aline Bonnet",
Guillaume Roguez's avatar
Guillaume Roguez committed
93
        "Andreas Traczyk",
Guillaume Roguez's avatar
Guillaume Roguez committed
94 95
        "Anthony Léonard",
        "Cyrille Béraud",
96
        "Dorina Mosku",
Guillaume Roguez's avatar
Guillaume Roguez committed
97 98 99 100 101
        "Edric Milaret",
        "Éloi Bail",
        "Emmanuel Lepage-Vallée",
        "Frédéric Guimont",
        "Guillaume Roguez",
Guillaume Roguez's avatar
Guillaume Roguez committed
102
        "Hadrien De Sousa",
103
        "Hugo Lefeuvre",
Guillaume Roguez's avatar
Guillaume Roguez committed
104
        "Julien Grossholtz",
105
        "Kateryna Kostiuk",
Guillaume Roguez's avatar
Guillaume Roguez committed
106
        "Loïc Siret",
107
        "Marianne Forget",
108
        "Maxim Cournoyer",
109
        "Michel Schmit",
Guillaume Roguez's avatar
Guillaume Roguez committed
110
        "Nicolas Jäger",
111
        "Nicolas Reynaud",
Guillaume Roguez's avatar
Guillaume Roguez committed
112 113 114
        "Olivier Gregoire",
        "Olivier Soldano",
        "Patrick Keroulas",
115
        "Pierre Duchemin",
Guillaume Roguez's avatar
Guillaume Roguez committed
116 117
        "Philippe Gorley",
        "Romain Bertozzi",
118
        "Saher Azer",
119
        "Sébastien Blin",
Guillaume Roguez's avatar
Guillaume Roguez committed
120
        "Seva Ivanov",
121
        "Silbino Gonçalves Matado",
Guillaume Roguez's avatar
Guillaume Roguez committed
122 123
        "Simon Désaulniers",
        "Simon Zeni",
124
        "Stepan Salenikovich",
Guillaume Roguez's avatar
Guillaume Roguez committed
125 126 127
        "Thibault Wittemberg",
        "Based on the SFLPhone project",
        NULL,
128 129 130 131
    };

    gtk_show_about_dialog(
        GTK_WINDOW(parent),
132
        "program-name", "",
133
        "copyright", "© 2019 Savoir-faire Linux",
134 135
        "license-type", GTK_LICENSE_GPL_3_0,
        "logo", logo,
136
        "version", version,
137
        "comments", _("The GNOME client for Jami.\nJami is free software for universal communication which respects the freedoms and privacy of its users."),
138
        "authors", authors,
139 140
        "website", "https://jami.net/",
        "website-label", "jami.net",
141
        "translator-credits", "https://www.transifex.com/savoirfairelinux/jami",
142 143 144
        NULL
    );

145
    g_free(version);
146
}