Mercurial > audlegacy
annotate audacious/about.c @ 2112:81c744358bab trunk
[svn] - improved logic for extension assist
author | nenolod |
---|---|
date | Tue, 12 Dec 2006 19:51:25 -0800 |
parents | f18a5b617c34 |
children | 86f0443d0de2 |
rev | line source |
---|---|
0 | 1 /* XMMS - Cross-platform multimedia player |
2 * Copyright (C) 1998-2003 Peter Alm, Mikael Alm, Olle Hallnas, | |
3 * Thomas Nilsson and 4Front Technologies | |
4 * Copyright (C) 2000-2003 Haavard Kvaalen | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
1460 | 7 * it under the terms of the GNU General Public License as published by |
2105
f18a5b617c34
[svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents:
1895
diff
changeset
|
8 * the Free Software Foundation; under version 2 of the License. |
0 | 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 | |
1459 | 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
0 | 18 */ |
19 | |
20 #ifdef HAVE_CONFIG_H | |
21 # include "config.h" | |
22 #endif | |
23 | |
471 | 24 #include "credits.h" |
0 | 25 |
26 #include <glib.h> | |
27 #include <glib/gi18n.h> | |
28 #include <gtk/gtk.h> | |
29 | |
1640 | 30 #include "platform/smartinclude.h" |
31 | |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
32 static GtkWidget *about_window = NULL; |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
33 static GdkPixbuf *about_pixbuf = NULL; |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
34 static GdkPixmap *mask_pixmap_window1 = NULL, |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
35 *mask_pixmap_window2 = NULL; |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
36 static GdkBitmap *mask_bitmap_window1 = NULL, |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
37 *mask_bitmap_window2 = NULL; |
529 | 38 |
39 static const gchar *audacious_brief = "<big><b>Audacious %s</b></big>\n\n" | |
945 | 40 "Copyright (C) 2005-2006 Audacious Development Team"; |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
41 |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
42 static gboolean |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
43 on_about_window_expose(GtkWidget *widget, GdkEventExpose *expose, gpointer data) |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
44 { |
504 | 45 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE); |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
46 |
504 | 47 gdk_window_set_back_pixmap(GDK_WINDOW(widget->window), mask_pixmap_window2, 0); |
48 gdk_window_clear(GDK_WINDOW(widget->window)); | |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
49 |
504 | 50 return FALSE; |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
51 } |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
52 |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
53 static gboolean |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
54 on_about_window_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data) |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
55 { |
504 | 56 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE); |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
57 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
58 if (event->keyval == GDK_Escape) |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
59 { |
504 | 60 gtk_widget_hide(widget); |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
61 } |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
62 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
63 return FALSE; |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
64 } |
0 | 65 |
504 | 66 static gboolean |
67 on_close_button_clicked (GtkWidget *widget, gpointer data) | |
68 { | |
69 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE); | |
70 | |
71 gtk_widget_hide(about_window); | |
72 | |
73 return FALSE; | |
74 } | |
75 | |
76 static gboolean | |
77 on_credits_button_clicked (GtkWidget *widget, gpointer data) | |
78 { | |
79 g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE); | |
80 | |
81 show_credits_window(); | |
82 | |
83 return FALSE; | |
84 } | |
85 | |
0 | 86 void |
87 show_about_window(void) | |
88 { | |
502 | 89 GtkWidget *about_fixedbox; |
90 GtkWidget *close_button; | |
510 | 91 GtkWidget *credits_button , *credits_button_hbox, *credits_button_image, *credits_button_label; |
529 | 92 GtkWidget *brief_label; |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
93 gchar *filename = DATA_DIR G_DIR_SEPARATOR_S "images" G_DIR_SEPARATOR_S "about-logo.png"; |
529 | 94 gchar *text; |
95 PangoAttrList *brief_label_attrs; | |
96 PangoAttribute *brief_label_foreground; | |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
97 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
98 if (about_window != NULL) |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
99 { |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
100 gtk_window_present(GTK_WINDOW(about_window)); |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
101 return; |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
102 } |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
103 |
1895
4ab001eeef36
[svn] - make sure the proper wmclass is being set here.
nenolod
parents:
1754
diff
changeset
|
104 about_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
1086
e2dbacdab58a
[svn] - About window should be set to 'always on top'
nhjm449
parents:
945
diff
changeset
|
105 |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
106 g_signal_connect(about_window, "destroy", |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
107 G_CALLBACK(gtk_widget_destroyed), &about_window); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
108 |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
109 gtk_widget_realize(about_window); |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
110 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
111 about_pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
0 | 112 |
504 | 113 gtk_widget_set_size_request(GTK_WIDGET (about_window), |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
114 gdk_pixbuf_get_width (about_pixbuf), |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
115 gdk_pixbuf_get_height (about_pixbuf)); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
116 |
504 | 117 gtk_widget_set_app_paintable(about_window, TRUE); |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
118 gtk_window_set_title(GTK_WINDOW(about_window), _("About Audacious")); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
119 gtk_window_set_position(GTK_WINDOW(about_window), GTK_WIN_POS_CENTER); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
120 gtk_window_set_resizable(GTK_WINDOW(about_window), FALSE); |
505 | 121 gtk_window_set_decorated(GTK_WINDOW(about_window), FALSE); |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
122 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
123 gdk_pixbuf_render_pixmap_and_mask(about_pixbuf, |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
124 &mask_pixmap_window1, |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
125 &mask_bitmap_window1, |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
126 0); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
127 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
128 gdk_pixbuf_render_pixmap_and_mask(about_pixbuf, |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
129 &mask_pixmap_window2, |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
130 &mask_bitmap_window2, |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
131 128); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
132 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
133 gtk_widget_add_events(about_window, GDK_ALL_EVENTS_MASK); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
134 |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
135 g_signal_connect(about_window, "expose-event", |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
136 G_CALLBACK(on_about_window_expose), &about_window); |
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
137 |
474
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
138 g_signal_connect(about_window, "key-press-event", |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
139 G_CALLBACK(on_about_window_key_press), &about_window); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
140 |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
141 gtk_widget_shape_combine_mask(GTK_WIDGET(about_window), mask_bitmap_window2, 0, 0); |
f3b46533da81
[svn] Experimental about box stuff... doesnt work right yet. Work in progress!
nenolod
parents:
471
diff
changeset
|
142 |
502 | 143 /* GtkFixed hasn't got its GdkWindow, this means that it can be used to |
144 display widgets while the logo below will be displayed anyway; | |
513 | 145 however fixed positions are not that great, cause the button sizes may (will) |
502 | 146 vary depending on the gtk style used, so it's not possible to center |
513 | 147 them unless a fixed width and heigth is forced (and this may bring to cutted |
502 | 148 text if someone, i.e., uses a big font for gtk widgets); |
149 other types of container most likely have their GdkWindow, this simply | |
150 means that the logo must be drawn on the container widget, instead of the | |
151 window; otherwise, it won't be displayed correctly */ | |
152 about_fixedbox = gtk_fixed_new(); | |
153 gtk_container_add( GTK_CONTAINER(about_window) , about_fixedbox ); | |
154 | |
155 close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
504 | 156 |
157 g_signal_connect(close_button, "clicked", | |
158 G_CALLBACK(on_close_button_clicked), NULL); | |
159 | |
529 | 160 gtk_fixed_put( GTK_FIXED(about_fixedbox) , close_button , 375 , 220 ); |
513 | 161 gtk_widget_set_size_request( close_button , 100 , -1 ); |
502 | 162 |
510 | 163 credits_button = gtk_button_new(); |
164 credits_button_hbox = gtk_hbox_new( FALSE , 0 ); | |
165 credits_button_image = gtk_image_new_from_stock( GTK_STOCK_DIALOG_INFO , GTK_ICON_SIZE_BUTTON ); | |
513 | 166 gtk_misc_set_alignment( GTK_MISC(credits_button_image) , 1 , 0.5 ); |
511 | 167 credits_button_label = gtk_label_new( _("Credits") ); |
513 | 168 gtk_misc_set_alignment( GTK_MISC(credits_button_label) , 0 , 0.5 ); |
510 | 169 gtk_box_pack_start( GTK_BOX(credits_button_hbox) , credits_button_image , |
513 | 170 TRUE , TRUE , 2 ); |
510 | 171 gtk_box_pack_start( GTK_BOX(credits_button_hbox) , credits_button_label , |
513 | 172 TRUE , TRUE , 2 ); |
510 | 173 gtk_container_add( GTK_CONTAINER(credits_button) , credits_button_hbox ); |
504 | 174 |
175 g_signal_connect(credits_button, "clicked", | |
176 G_CALLBACK(on_credits_button_clicked), NULL); | |
177 | |
529 | 178 gtk_fixed_put( GTK_FIXED(about_fixedbox) , credits_button , 25 , 220 ); |
513 | 179 gtk_widget_set_size_request( credits_button , 100 , -1 ); |
504 | 180 |
529 | 181 brief_label = gtk_label_new(NULL); |
182 text = g_strdup_printf(_(audacious_brief), VERSION); | |
183 | |
184 brief_label_foreground = pango_attr_foreground_new(0, 0, 0); | |
185 brief_label_attrs = pango_attr_list_new(); | |
186 pango_attr_list_insert(brief_label_attrs, brief_label_foreground); | |
187 | |
188 gtk_label_set_markup(GTK_LABEL(brief_label), text); | |
189 gtk_label_set_justify(GTK_LABEL(brief_label), GTK_JUSTIFY_CENTER); | |
190 gtk_label_set_attributes(GTK_LABEL(brief_label), brief_label_attrs); | |
191 g_free(text); | |
192 | |
547 | 193 gtk_fixed_put(GTK_FIXED(about_fixedbox), brief_label, 20, 145); |
194 gtk_widget_set_size_request( brief_label , 460 , -1 ); | |
529 | 195 |
502 | 196 gtk_widget_show_all(about_window); |
475
cd5793de075c
[svn] More progress towards the about window, no more background being overwritten... we were forgetting to tell X that the window was paintable.
nenolod
parents:
474
diff
changeset
|
197 gtk_window_present(GTK_WINDOW(about_window)); |
0 | 198 } |