Added custom psppire-selector widget.
[pspp-builds.git] / glade / dialog.c
1 #include <glib.h>
2 #include <gtk/gtk.h>
3
4 #include "psppire-dialog.h"
5
6 #include <glade-gtk.h>
7
8
9 void GLADEGTK_API
10 glade_psppire_dialog_post_create (GladeWidgetAdaptor *adaptor,
11                                   GObject            *object,
12                                   GladeCreateReason   reason)
13 {
14   GladeWidget *widget ;
15
16   GladeWidget  *box_widget;
17
18   PsppireDialog    *dialog = PSPPIRE_DIALOG (object);
19
20   g_return_if_fail (PSPPIRE_IS_DIALOG (dialog));
21
22   widget = glade_widget_get_from_gobject (GTK_WIDGET (dialog));
23   if (!widget)
24     return;
25
26
27   if (reason == GLADE_CREATE_USER)
28     {
29       /* HIG complient border-width defaults on dialogs */
30       glade_widget_property_set (widget, "border-width", 5);
31     }
32
33   box_widget = glade_widget_adaptor_create_internal
34     (widget, G_OBJECT(dialog->box),
35      "hbox", "dialog", FALSE, reason);
36
37   /* These properties are controlled by the GtkDialog style properties:
38    * "content-area-border", "button-spacing" and "action-area-border",
39    * so we must disable their use.
40    */
41   glade_widget_remove_property (box_widget, "border-width");
42
43   /* Only set these on the original create. */
44   if (reason == GLADE_CREATE_USER)
45     {
46
47       /* HIG complient spacing defaults on dialogs */
48       glade_widget_property_set (box_widget, "spacing", 2);
49
50       glade_widget_property_set (box_widget, "size", 2);
51
52     }
53
54
55   /* set a reasonable default size for a dialog */
56   gtk_window_set_default_size (GTK_WINDOW (dialog), 320, 260);
57
58 }
59
60
61 GtkWidget *
62 glade_psppire_dialog_get_internal_child (GladeWidgetAdaptor  *adaptor,
63                                          PsppireDialog       *dialog,
64                                          const gchar         *name)
65 {
66 #if DEBUGGING
67   g_print ("%s\n", __FUNCTION__);
68 #endif
69
70   g_assert (0 == strcmp (name, "hbox"));
71
72   return dialog->box;
73 }
74
75
76
77 void
78 glade_psppire_dialog_set_property (GladeWidgetAdaptor *adaptor,
79                                    GObject            *object,
80                                    const gchar        *id,
81                                    const GValue       *value)
82 {
83 #if DEBUGGING
84   g_print ("%s(%p) Type=\"%s\" Id=\"%s\"\n", __FUNCTION__, object,
85            G_OBJECT_TYPE_NAME( object ),
86            id);
87 #endif
88
89   GWA_GET_CLASS (GTK_TYPE_WINDOW)->set_property (adaptor, object,
90                                                  id, value);
91 }
92
93
94
95 GList *
96 glade_psppire_dialog_get_children (GladeWidgetAdaptor  *adaptor,
97                                    PsppireDialog  *dialog)
98 {
99   GList *list = NULL;
100
101   g_return_val_if_fail (PSPPIRE_IS_DIALOG (dialog), NULL);
102
103   list = glade_util_container_get_all_children (GTK_CONTAINER (dialog));
104
105   return list;
106 }