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