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