~kroq-gar78/ubuntu/precise/gnome-control-center/fix-885947

« back to all changes in this revision

Viewing changes to panels/region/cc-region-panel.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Josselin Mouette, Michael Biebl
  • Date: 2011-12-16 23:55:34 UTC
  • mfrom: (0.3.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 215.
  • Revision ID: package-import@ubuntu.com-20111216235534-ruwoeyk079c01omq
Tags: 1:3.2.2-2
[ Josselin Mouette ]
* Recommend cups-pk-helper. Closes: #622688.

[ Michael Biebl ]
* Add Recommends on mesa-utils. The glxinfo utilitity is required to show
  details about the graphics card.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include "gnome-region-panel-xkb.h"
26
26
#include "gnome-region-panel-lang.h"
27
 
 
28
 
#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s))
 
27
#include "gnome-region-panel-formats.h"
 
28
#include "gnome-region-panel-system.h"
29
29
 
30
30
G_DEFINE_DYNAMIC_TYPE (CcRegionPanel, cc_region_panel, CC_TYPE_PANEL)
31
31
 
35
35
        GtkBuilder *builder;
36
36
};
37
37
 
 
38
enum {
 
39
        PROP_0,
 
40
        PROP_ARGV
 
41
};
 
42
 
 
43
enum {
 
44
        LANGUAGE_PAGE,
 
45
        FORMATS_PAGE,
 
46
        LAYOUTS_PAGE,
 
47
        SYSTEM_PAGE
 
48
};
38
49
 
39
50
static void
40
 
cc_region_panel_get_property (GObject * object,
41
 
                                guint property_id,
42
 
                                GValue * value, GParamSpec * pspec)
 
51
cc_region_panel_set_page (CcRegionPanel *panel,
 
52
                          const char    *page)
43
53
{
44
 
        switch (property_id) {
45
 
        default:
46
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
47
 
                                                   pspec);
48
 
        }
 
54
        GtkWidget *notebook;
 
55
        int page_num;
 
56
 
 
57
        if (g_strcmp0 (page, "formats") == 0)
 
58
                page_num = FORMATS_PAGE;
 
59
        else if (g_strcmp0 (page, "layouts") == 0)
 
60
                page_num = LAYOUTS_PAGE;
 
61
        else if (g_strcmp0 (page, "system") == 0)
 
62
                page_num = SYSTEM_PAGE;
 
63
        else
 
64
                page_num = LANGUAGE_PAGE;
 
65
 
 
66
        notebook = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder, "region_notebook"));
 
67
        gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), page_num);
49
68
}
50
69
 
51
70
static void
52
71
cc_region_panel_set_property (GObject * object,
53
 
                                guint property_id,
54
 
                                const GValue * value, GParamSpec * pspec)
 
72
                              guint property_id,
 
73
                              const GValue * value,
 
74
                              GParamSpec * pspec)
55
75
{
 
76
        CcRegionPanel *self;
 
77
 
 
78
        self = CC_REGION_PANEL (object);
 
79
 
56
80
        switch (property_id) {
 
81
        case PROP_ARGV: {
 
82
                gchar **args;
 
83
 
 
84
                args = g_value_get_boxed (value);
 
85
 
 
86
                if (args && args[0]) {
 
87
                        cc_region_panel_set_page (self, args[0]);
 
88
                }
 
89
                break;
 
90
        }
57
91
        default:
58
92
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
59
93
                                                   pspec);
61
95
}
62
96
 
63
97
static void
64
 
cc_region_panel_dispose (GObject * object)
 
98
cc_region_panel_finalize (GObject * object)
65
99
{
66
 
        CcRegionPanelPrivate *priv = CC_REGION_PANEL (object)->priv;
67
 
 
68
 
        if (priv->builder) {
69
 
                GtkBuilder *dialog = priv->builder;
70
 
                gtk_widget_destroy (WID ("region_notebook"));
71
 
                g_object_unref (priv->builder);
72
 
                priv->builder = NULL;
73
 
        }
74
 
 
75
 
        G_OBJECT_CLASS (cc_region_panel_parent_class)->dispose (object);
 
100
        CcRegionPanel *panel;
 
101
 
 
102
        panel = CC_REGION_PANEL (object);
 
103
 
 
104
        if (panel->priv && panel->priv->builder)
 
105
                g_object_unref (panel->priv->builder);
 
106
 
 
107
        G_OBJECT_CLASS (cc_region_panel_parent_class)->finalize (object);
76
108
}
77
109
 
78
110
static void
82
114
 
83
115
        g_type_class_add_private (klass, sizeof (CcRegionPanelPrivate));
84
116
 
85
 
        object_class->get_property = cc_region_panel_get_property;
86
117
        object_class->set_property = cc_region_panel_set_property;
87
 
        object_class->dispose = cc_region_panel_dispose;
 
118
        object_class->finalize = cc_region_panel_finalize;
 
119
 
 
120
        g_object_class_override_property (object_class, PROP_ARGV, "argv");
88
121
}
89
122
 
90
123
static void
120
153
 
121
154
        setup_xkb_tabs (priv->builder);
122
155
        setup_language (priv->builder);
 
156
        setup_formats (priv->builder);
 
157
        setup_system (priv->builder);
123
158
}
124
159
 
125
160
void