2
* * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>,
3
* * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com>
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
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.
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.
21
#include <glib/gstdio.h>
23
#include "rs-gui-functions.h"
26
gui_dialog_make_from_text(const gchar *stock_id, gchar *primary_text, gchar *secondary_text)
28
GtkWidget *secondary_label;
30
secondary_label = gtk_label_new (NULL);
31
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
32
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
33
gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
34
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
35
gtk_label_set_markup (GTK_LABEL (secondary_label), secondary_text);
37
return(gui_dialog_make_from_widget(stock_id, primary_text, secondary_label));
41
gui_dialog_make_from_widget(const gchar *stock_id, gchar *primary_text, GtkWidget *widget)
43
GtkWidget *dialog, *image, *hhbox, *vvbox;
44
GtkWidget *primary_label;
47
image = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_DIALOG);
48
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
49
dialog = gtk_dialog_new();
50
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
51
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14);
52
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
53
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
54
gtk_window_set_title (GTK_WINDOW (dialog), "");
55
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
56
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
58
primary_label = gtk_label_new (NULL);
59
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
60
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
61
gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
62
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
63
str = g_strconcat("<span weight=\"bold\" size=\"larger\">", primary_text, "</span>", NULL);
64
gtk_label_set_markup (GTK_LABEL (primary_label), str);
67
hhbox = gtk_hbox_new (FALSE, 12);
68
gtk_container_set_border_width (GTK_CONTAINER (hhbox), 5);
69
gtk_box_pack_start (GTK_BOX (hhbox), image, FALSE, FALSE, 0);
70
vvbox = gtk_vbox_new (FALSE, 12);
71
gtk_box_pack_start (GTK_BOX (hhbox), vvbox, FALSE, FALSE, 0);
72
gtk_box_pack_start (GTK_BOX (vvbox), primary_label, FALSE, FALSE, 0);
73
gtk_box_pack_start (GTK_BOX (vvbox), widget, FALSE, FALSE, 0);
74
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hhbox, FALSE, FALSE, 0);