summaryrefslogtreecommitdiff
path: root/src/trg-about-window.c
blob: 266118398f3fcac30c89c25b77772068768d0e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * transmission-remote-gtk - A GTK RPC client to Transmission
 * Copyright (C) 2011  Alan Fitton

 * 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 2 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.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <json-glib/json-glib.h>

#include "dispatch.h"
#include "trg-about-window.h"
#include "util.h"

GtkWidget *trg_about_window_new(GtkWindow * parent)
{
    GtkWidget *dialog;
    GdkPixbuf *logo;
    gchar *licenseText = NULL;

    const gchar *trgAuthors[] = { "Alan Fitton <alan@eth0.org.uk>", NULL };

    dialog = gtk_about_dialog_new();
    gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
    gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);

    logo =
        gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
                                 PACKAGE_NAME, 48,
                                 GTK_ICON_LOOKUP_USE_BUILTIN, NULL);

    if (logo != NULL) {
        gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), logo);
        g_object_unref(logo);
    }

    if (g_file_get_contents(TRGLICENSE, &licenseText, NULL, NULL)) {
        gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dialog),
                                     licenseText);
    } else {
        gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dialog), "GPL2");
    }

    gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), PACKAGE_NAME);
    gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog),
                                 PACKAGE_VERSION);
    gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),
                                   "(C) 2011 Alan Fitton");
    gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog),
                                  _
                                  ("A remote client to transmission-daemon."));

    gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog),
                                 "http://code.google.com/p/transmission-remote-gtk/");
    gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(dialog),
                                       "http://code.google.com/p/transmission-remote-gtk/");

    gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), trgAuthors);
    /*gtk_about_dialog_set_documenters(GTK_ABOUT_DIALOG(dialog), documenters); */
    gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog),
                                            "translations kindly contributed by\n\n"
                                            "* Julian Held (German)\n"
                                            "* Youn sok Choi (Korean)\n"
                                            "* Piotr (Polish)\n"
                                            "* Y3AVD (Russian)");

    g_free(licenseText);

    return dialog;
}