ergtkbusydialog.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <gtk/gtk.h>
00030
00031
00032
00033
00034 #include "ergtk_log.h"
00035 #include "ergtkbusydialog.h"
00036
00037
00038 G_DEFINE_TYPE (erGtkBusyDialog, ergtk_busy_dialog, GTK_TYPE_DIALOG)
00039
00040
00041 static void ergtk_busy_dialog_class_init (erGtkBusyDialogClass *klass)
00042 {
00043
00044
00045 }
00046
00047
00048 static void ergtk_busy_dialog_init (erGtkBusyDialog *dialog)
00049 {
00050
00051 GtkWidget *vbox;
00052 GtkWidget *eventbox;
00053 GdkPixbuf *pixbuf;
00054
00055 g_return_if_fail(ERGTK_IS_BUSY_DIALOG(dialog));
00056
00057
00058 gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
00059 gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
00060 gtk_window_set_title (GTK_WINDOW (dialog), "");
00061 gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
00062 gtk_window_set_decorated(GTK_WINDOW (dialog), FALSE);
00063 gtk_window_set_accept_focus(GTK_WINDOW(dialog), FALSE);
00064 gtk_widget_realize(GTK_WIDGET(dialog));
00065 gdk_window_set_decorations(GTK_WIDGET(dialog)->window, GDK_DECOR_BORDER);
00066
00067
00068 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
00069
00070
00071 gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
00072 gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
00073 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG(dialog)->vbox), 2);
00074 gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area), 5);
00075
00076
00077
00078 vbox = gtk_vbox_new (FALSE, 12);
00079 gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
00080 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox), vbox, TRUE, TRUE, 0);
00081 gtk_widget_show(vbox);
00082
00083
00084
00085 pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "dialog-busy", 48, 0, NULL);
00086 dialog->image = gtk_image_new_from_pixbuf(pixbuf);
00087 gtk_box_pack_start (GTK_BOX (vbox), dialog->image, FALSE, FALSE, 25);
00088 gtk_widget_show(dialog->image);
00089
00090
00091
00092 eventbox = gtk_event_box_new();
00093 gtk_widget_set_size_request(eventbox, 400, 1);
00094 gtk_box_pack_start (GTK_BOX (vbox), eventbox, FALSE, FALSE, 0);
00095 gtk_widget_show(eventbox);
00096
00097
00098
00099 dialog->label = gtk_label_new (NULL);
00100 gtk_label_set_line_wrap (GTK_LABEL (dialog->label), FALSE);
00101 gtk_label_set_selectable (GTK_LABEL (dialog->label), FALSE);
00102 gtk_label_set_justify (GTK_LABEL (dialog->label), GTK_JUSTIFY_CENTER);
00103 gtk_box_pack_start (GTK_BOX (vbox), dialog->label, FALSE, FALSE, 0);
00104 gtk_widget_show(dialog->label);
00105 }
00106
00107
00108 GtkWidget *ergtk_busy_dialog_new (const gchar *label_text)
00109 {
00110 erGtkBusyDialog *dialog;
00111
00112 LOGPRINTF("entry");
00113
00114 dialog = g_object_new (ERGTK_TYPE_BUSY_DIALOG, NULL);
00115
00116 if (label_text)
00117 {
00118 gtk_label_set_text (GTK_LABEL (dialog->label), label_text);
00119 }
00120
00121 return GTK_WIDGET (dialog);
00122 }