summaryrefslogtreecommitdiffstats
path: root/widgets/src/glade-adaptor.c
blob: 866d7950c693847a41042f7612a5b37fc880b7e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Copyright (C) 2011  Red Hat, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Chris Lumens <clumens@redhat.com>
 */

/* This file contains code called by glade when it creates, reads, writes, or
 * otherwise manipulates anaconda-specific widgets.  Each function in this file
 * that glade should call must be referenced in a glade-widget-class stanza of
 * glade/AnacondaWidgets.xml.
 *
 * This file relies on a lot of halfway documented magic.  Good luck.
 */
#include <gladeui/glade-project.h>
#include <gladeui/glade-widget.h>
#include <gladeui/glade-widget-adaptor.h>

#include <gtk/gtk.h>

#include "BaseWindow.h"
#include "SpokeWindow.h"

void anaconda_standalone_window_post_create(GladeWidgetAdaptor *adaptor,
                                            GObject *object, GladeCreateReason reason) {
    GladeWidget *widget, *actionarea_widget;
    AnacondaBaseWindow *window;

    if (reason != GLADE_CREATE_USER)
        return;

    g_return_if_fail(ANACONDA_IS_BASE_WINDOW(object));

    widget = glade_widget_get_from_gobject(GTK_WIDGET(object));
    if (!widget)
        return;

    window = ANACONDA_BASE_WINDOW(object);
    actionarea_widget = glade_widget_get_from_gobject(anaconda_base_window_get_action_area(window));

    if (ANACONDA_IS_SPOKE_WINDOW(object))
        glade_widget_property_set(actionarea_widget, "size", 2);
    else
        glade_widget_property_set(actionarea_widget, "size", 3);
}

void anaconda_standalone_window_write_widget(GladeWidgetAdaptor *adaptor,
                                             GladeWidget *widget,
                                             GladeXmlContext *context, GladeXmlNode *node) {
    GladeProperty *startup_id_prop;

    if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
        return;

    /* Set a bogus startup-id in the output XML file.  This doesn't really seem
     * like it should be necessary, but glade will crash if I don't.
     */
    startup_id_prop = glade_widget_get_property(widget, "startup-id");
    glade_property_set(startup_id_prop, "filler");
    glade_property_write(startup_id_prop, context, node);

    /* Chain up and write the parent's properties */
    GWA_GET_CLASS (GTK_TYPE_WINDOW)->write_widget (adaptor, widget, context, node);
}