annotate src/audlegacy/ui_about.c @ 4859:6df303facb72

on_about_window_expose(): avoid NULL-dereference Found with LLVM static analyzer.
author William Pitcock <nenolod@atheme.org>
date Thu, 16 Apr 2009 20:22:52 -0500
parents 7bf7f83a217e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4700
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
1 /*
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
2 * Audacious - Cross-platform multimedia player
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
3 * Copyright (C) 2005-2007 Audacious development team
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
4 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
5 * Based on BMP:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
6 * Copyright (C) 2003-2004 BMP development team
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
7 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
8 * Based on XMMS:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
10 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
14 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
18 * GNU General Public License for more details.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
19 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
22 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
25 */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
26
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
27 #ifdef HAVE_CONFIG_H
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
28 # include "config.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
29 #endif
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
30
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
31 #include "ui_credits.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
32
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
33 #include <glib.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
34 #include <glib/gi18n.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
35 #include <gtk/gtk.h>
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
36
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
37 #include "platform/smartinclude.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
38
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
39 static GtkWidget *about_window = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
40 static GdkPixbuf *about_pixbuf = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
41 static GdkPixmap *mask_pixmap_window1 = NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
42 *mask_pixmap_window2 = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
43 static GdkBitmap *mask_bitmap_window1 = NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
44 *mask_bitmap_window2 = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
45
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
46 static const gchar *audacious_brief = N_("<big><b>Audacious %s</b></big>\n\n"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
47 "Copyright (C) 2005-2008 Audacious Development Team");
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
48
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
49 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
50 on_about_window_expose(GtkWidget *widget, GdkEventExpose *expose, gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
51 {
4859
6df303facb72 on_about_window_expose(): avoid NULL-dereference
William Pitcock <nenolod@atheme.org>
parents: 4811
diff changeset
52 g_return_val_if_fail(widget != NULL, FALSE);
4700
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
53 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
54
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
55 gdk_window_set_back_pixmap(GDK_WINDOW(widget->window), mask_pixmap_window2, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
56 gdk_window_clear(GDK_WINDOW(widget->window));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
57
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
58 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
59 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
60
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
61 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
62 on_about_window_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
63 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
64 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
65
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
66 if (event->keyval == GDK_Escape)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
67 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
68 gtk_widget_hide(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
69 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
70
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
71 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
72 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
73
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
74 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
75 on_close_button_clicked (GtkWidget *widget, gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
76 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
77 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
78
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
79 gtk_widget_hide(about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
80
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
81 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
82 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
83
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
84 static gboolean
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
85 on_credits_button_clicked (GtkWidget *widget, gpointer data)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
86 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
87 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
88
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
89 show_credits_window();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
90
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
91 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
92 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
93
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
94 void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
95 show_about_window(void)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
96 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
97 GtkWidget *about_fixedbox;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
98 GtkWidget *close_button;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
99 GtkWidget *credits_button , *credits_button_hbox, *credits_button_image, *credits_button_label;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
100 GtkWidget *brief_label;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
101 gchar *filename = DATA_DIR G_DIR_SEPARATOR_S "images" G_DIR_SEPARATOR_S "about-logo.png";
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
102 gchar *text;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
103 PangoAttrList *brief_label_attrs;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
104 PangoAttribute *brief_label_foreground;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
105
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
106 if (about_window != NULL)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
107 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
108 gtk_window_present(GTK_WINDOW(about_window));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
109 return;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
110 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
111
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
112 about_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
113
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
114 g_signal_connect(about_window, "destroy",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
115 G_CALLBACK(gtk_widget_destroyed), &about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
116
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
117 gtk_widget_realize(about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
118
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
119 about_pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
120
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
121 gtk_widget_set_size_request(GTK_WIDGET (about_window),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
122 gdk_pixbuf_get_width (about_pixbuf),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
123 gdk_pixbuf_get_height (about_pixbuf));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
124
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
125 gtk_widget_set_app_paintable(about_window, TRUE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
126 gtk_window_set_title(GTK_WINDOW(about_window), _("About Audacious"));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
127 gtk_window_set_position(GTK_WINDOW(about_window), GTK_WIN_POS_CENTER);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
128 gtk_window_set_resizable(GTK_WINDOW(about_window), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
129 gtk_window_set_decorated(GTK_WINDOW(about_window), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
130
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
131 gdk_pixbuf_render_pixmap_and_mask(about_pixbuf,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
132 &mask_pixmap_window1,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
133 &mask_bitmap_window1,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
134 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
135
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
136 gdk_pixbuf_render_pixmap_and_mask(about_pixbuf,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
137 &mask_pixmap_window2,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
138 &mask_bitmap_window2,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
139 128);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
140
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
141 gtk_widget_add_events(about_window, GDK_ALL_EVENTS_MASK);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
142
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
143 g_signal_connect(about_window, "expose-event",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
144 G_CALLBACK(on_about_window_expose), &about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
145
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
146 g_signal_connect(about_window, "key-press-event",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
147 G_CALLBACK(on_about_window_key_press), &about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
148
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
149 gtk_widget_shape_combine_mask(GTK_WIDGET(about_window), mask_bitmap_window2, 0, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
150
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
151 /* GtkFixed hasn't got its GdkWindow, this means that it can be used to
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
152 display widgets while the logo below will be displayed anyway;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
153 however fixed positions are not that great, cause the button sizes may (will)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
154 vary depending on the gtk style used, so it's not possible to center
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
155 them unless a fixed width and heigth is forced (and this may bring to cutted
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
156 text if someone, i.e., uses a big font for gtk widgets);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
157 other types of container most likely have their GdkWindow, this simply
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
158 means that the logo must be drawn on the container widget, instead of the
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
159 window; otherwise, it won't be displayed correctly */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
160 about_fixedbox = gtk_fixed_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
161 gtk_container_add( GTK_CONTAINER(about_window) , about_fixedbox );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
162
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
163 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
164
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
165 g_signal_connect(close_button, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
166 G_CALLBACK(on_close_button_clicked), NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
167
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
168 gtk_fixed_put( GTK_FIXED(about_fixedbox) , close_button , 375 , 220 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
169 gtk_widget_set_size_request( close_button , 100 , -1 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
170
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
171 credits_button = gtk_button_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
172 credits_button_hbox = gtk_hbox_new( FALSE , 0 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
173 credits_button_image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_INFO , GTK_ICON_SIZE_BUTTON );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
174 gtk_misc_set_alignment( GTK_MISC(credits_button_image) , 1 , 0.5 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
175 credits_button_label = gtk_label_new( _("Credits") );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
176 gtk_misc_set_alignment( GTK_MISC(credits_button_label) , 0 , 0.5 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
177 gtk_box_pack_start( GTK_BOX(credits_button_hbox) , credits_button_image ,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
178 TRUE , TRUE , 2 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
179 gtk_box_pack_start( GTK_BOX(credits_button_hbox) , credits_button_label ,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
180 TRUE , TRUE , 2 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
181 gtk_container_add( GTK_CONTAINER(credits_button) , credits_button_hbox );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
182
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
183 g_signal_connect(credits_button, "clicked",
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
184 G_CALLBACK(on_credits_button_clicked), NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
185
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
186 gtk_fixed_put( GTK_FIXED(about_fixedbox) , credits_button , 25 , 220 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
187 gtk_widget_set_size_request( credits_button , 100 , -1 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
188
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
189 brief_label = gtk_label_new(NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
190 text = g_strdup_printf(_(audacious_brief), VERSION);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
191
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
192 brief_label_foreground = pango_attr_foreground_new(0, 0, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
193 brief_label_attrs = pango_attr_list_new();
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
194 pango_attr_list_insert(brief_label_attrs, brief_label_foreground);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
195
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
196 gtk_label_set_markup(GTK_LABEL(brief_label), text);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
197 gtk_label_set_justify(GTK_LABEL(brief_label), GTK_JUSTIFY_CENTER);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
198 gtk_label_set_attributes(GTK_LABEL(brief_label), brief_label_attrs);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
199 g_free(text);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
200
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
201 gtk_fixed_put(GTK_FIXED(about_fixedbox), brief_label, 20, 145);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
202 gtk_widget_set_size_request( brief_label , 460 , -1 );
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
203
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
204 gtk_widget_show_all(about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
205 gtk_window_present(GTK_WINDOW(about_window));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
206 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
207
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
208 void
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
209 hide_about_window(void)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
210 {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
211 g_return_if_fail(about_window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
212 gtk_widget_hide(GTK_WIDGET(about_window));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
213 }