annotate libaudacious/util.c @ 681:4ad3a5fe48bf trunk

[svn] - Slay an unused variable warning here.
author nenolod
date Fri, 24 Feb 2006 23:57:41 -0800
parents cb178e5ad177
children 25f42f39c44c
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 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 /* FIXME: improper border spacing, for some reason vbox and
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * action_area not aligned, button_text totally ignored */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 GtkWidget *dialog, *box, *button;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 GtkWidget *scrolledwindow, *textview;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 GtkTextBuffer *textbuffer;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 dialog = gtk_dialog_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 gtk_window_set_modal(GTK_WINDOW(dialog), modal);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 gtk_window_set_title(GTK_WINDOW(dialog), title);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 gtk_window_set_default_size(GTK_WINDOW(dialog), 460, 400);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 box = GTK_DIALOG(dialog)->vbox;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 GTK_POLICY_AUTOMATIC,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 GTK_POLICY_AUTOMATIC);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 gtk_box_pack_start(GTK_BOX(box), scrolledwindow, TRUE, TRUE, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 textview = gtk_text_view_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 textview);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textbuffer), text, -1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 GTK_RESPONSE_CLOSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 g_signal_connect_swapped(button, "clicked",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 G_CALLBACK(gtk_widget_destroy), dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 if (button_action)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 g_signal_connect(button, "clicked", button_action, action_data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 gtk_widget_grab_default(button);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 gtk_widget_show_all(dialog);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 return dialog;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 xmms_check_realtime_priority(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 xmms_usleep(gint usec)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 g_usleep(usec);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 }