0
|
1 #ifdef HAVE_CONFIG_H
|
|
2 # include "config.h"
|
|
3 #endif
|
|
4
|
|
5 #include <glib.h>
|
|
6 #include <gtk/gtk.h>
|
|
7
|
|
8
|
|
9 GtkWidget *
|
|
10 xmms_show_message(const gchar * title, const gchar * text,
|
|
11 const gchar * button_text, gboolean modal,
|
|
12 GtkSignalFunc button_action, gpointer action_data)
|
|
13 {
|
|
14 /* FIXME: improper border spacing, for some reason vbox and
|
|
15 * action_area not aligned, button_text totally ignored */
|
|
16
|
|
17 GtkWidget *dialog, *box, *button;
|
|
18 GtkWidget *scrolledwindow, *textview;
|
|
19 GtkTextBuffer *textbuffer;
|
|
20
|
|
21 dialog = gtk_dialog_new();
|
|
22 gtk_window_set_modal(GTK_WINDOW(dialog), modal);
|
|
23 gtk_window_set_title(GTK_WINDOW(dialog), title);
|
|
24 gtk_window_set_default_size(GTK_WINDOW(dialog), 460, 400);
|
|
25
|
|
26 box = GTK_DIALOG(dialog)->vbox;
|
|
27
|
|
28 scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
|
|
29 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
|
|
30 GTK_POLICY_AUTOMATIC,
|
|
31 GTK_POLICY_AUTOMATIC);
|
|
32 gtk_box_pack_start(GTK_BOX(box), scrolledwindow, TRUE, TRUE, 0);
|
|
33
|
|
34 textview = gtk_text_view_new();
|
|
35 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
|
|
36 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow),
|
|
37 textview);
|
|
38
|
|
39 textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
|
40 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textbuffer), text, -1);
|
|
41
|
|
42 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE,
|
|
43 GTK_RESPONSE_CLOSE);
|
|
44 g_signal_connect_swapped(button, "clicked",
|
|
45 G_CALLBACK(gtk_widget_destroy), dialog);
|
|
46 if (button_action)
|
|
47 g_signal_connect(button, "clicked", button_action, action_data);
|
|
48
|
|
49 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
|
50 gtk_widget_grab_default(button);
|
|
51
|
|
52 gtk_widget_show_all(dialog);
|
|
53
|
|
54 return dialog;
|
|
55 }
|
|
56
|
|
57 gboolean
|
|
58 xmms_check_realtime_priority(void)
|
|
59 {
|
|
60 return FALSE;
|
|
61 }
|
|
62
|
|
63 void
|
|
64 xmms_usleep(gint usec)
|
|
65 {
|
|
66 g_usleep(usec);
|
|
67 }
|