annotate libaudacious/util.c @ 1313:696315025220 trunk

[svn] Better, nenolod? :-p
author nemo
date Mon, 19 Jun 2006 14:33:54 -0700
parents 25f42f39c44c
children 4ecd967bfd8f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 #include <gtk/gtk.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 GtkWidget *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 xmms_show_message(const gchar * title, const gchar * text,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 const gchar * button_text, gboolean modal,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 GtkSignalFunc button_action, gpointer action_data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 {
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
14 GtkWidget *dialog;
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
15 GtkWidget *dialog_vbox, *dialog_hbox, *dialog_bbox;
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
16 GtkWidget *dialog_bbox_b1;
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
17 GtkWidget *dialog_textlabel;
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
18 GtkWidget *dialog_icon;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
20 dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
21 gtk_window_set_type_hint( GTK_WINDOW(dialog) , GDK_WINDOW_TYPE_HINT_DIALOG );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
22 gtk_window_set_modal( GTK_WINDOW(dialog) , modal );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
23 gtk_window_set_title( GTK_WINDOW(dialog) , title );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
24 gtk_container_set_border_width( GTK_CONTAINER(dialog) , 10 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
26 dialog_vbox = gtk_vbox_new( FALSE , 0 );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
27 dialog_hbox = gtk_hbox_new( FALSE , 0 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
29 /* icon */
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
30 dialog_icon = gtk_image_new_from_stock( GTK_STOCK_DIALOG_INFO , GTK_ICON_SIZE_DIALOG );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
31 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_icon , FALSE , FALSE , 2 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
33 /* label */
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
34 dialog_textlabel = gtk_label_new( text );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
35 /* gtk_label_set_selectable( GTK_LABEL(dialog_textlabel) , TRUE ); */
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
36 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_textlabel , TRUE , TRUE , 2 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
38 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_hbox , FALSE , FALSE , 2 );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
39 gtk_box_pack_start( GTK_BOX(dialog_vbox) , gtk_hseparator_new() , FALSE , FALSE , 4 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
41 dialog_bbox = gtk_hbutton_box_new();
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
42 gtk_button_box_set_layout( GTK_BUTTON_BOX(dialog_bbox) , GTK_BUTTONBOX_END );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
43 dialog_bbox_b1 = gtk_button_new_with_label( button_text );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
44 g_signal_connect_swapped( G_OBJECT(dialog_bbox_b1) , "clicked" ,
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
45 G_CALLBACK(gtk_widget_destroy) , dialog );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
46 if ( button_action )
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
47 g_signal_connect( G_OBJECT(dialog_bbox_b1) , "clicked" ,
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
48 button_action , action_data );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
49 GTK_WIDGET_SET_FLAGS( dialog_bbox_b1 , GTK_CAN_DEFAULT);
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
50 gtk_widget_grab_default( dialog_bbox_b1 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
52 gtk_container_add( GTK_CONTAINER(dialog_bbox) , dialog_bbox_b1 );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
53 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_bbox , FALSE , FALSE , 0 );
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
55 gtk_container_add( GTK_CONTAINER(dialog) , dialog_vbox );
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
56 gtk_widget_show_all(dialog);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57
863
25f42f39c44c [svn] new xmms_show_message look
giacomo
parents: 0
diff changeset
58 return dialog;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 xmms_check_realtime_priority(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 xmms_usleep(gint usec)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 g_usleep(usec);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 }