~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: Bazaar Package Importer
  • Author(s): Rodrigo Moya
  • Date: 2011-05-17 10:47:27 UTC
  • mfrom: (0.1.11 experimental) (1.1.45 upstream)
  • Revision ID: james.westby@ubuntu.com-20110517104727-lqel6m8vhfw5jby1
Tags: 1:3.0.1.1-1ubuntu1
* Rebase on Debian, remaining Ubuntu changes:
* debian/control:
  - Build-Depend on hardening-wrapper, dpkg-dev and dh-autoreconf
  - Add dependency on ubuntu-system-service
  - Remove dependency on gnome-icon-theme-symbolic
  - Move dependency on apg, gnome-icon-theme-symbolic and accountsservice to
    be a Recommends: until we get them in main
* debian/rules:
  - Use autoreconf
  - Add binary-post-install rule for gnome-control-center-data
  - Run dh-autoreconf
* debian/gnome-control-center.dirs:
* debian/gnome-control-center.links:
  - Add a link to the control center shell for indicators
* debian/patches/00_disable-nm.patch:
  - Temporary patch to disable building with NetworkManager until we get
    the new one in the archive
* debian/patches/01_git_remove_gettext_calls.patch:
  - Remove calls to AM_GNU_GETTEXT, IT_PROG_INTLTOOL should be enough
* debian/patches/01_git_kill_warning.patch:
  - Kill warning
* debian/patches/50_ubuntu_systemwide_prefs.patch:
  - Ubuntu specific proxy preferences
* debian/patches/51_ubuntu_system_keyboard.patch:
  - Implement the global keyboard spec at https://wiki.ubuntu.com/DefaultKeyboardSettings

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Intel, Inc
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 *
 
18
 * Author: Sergey Udaltsov <svu@gnome.org>
 
19
 *
 
20
 */
 
21
 
 
22
#include "cc-region-panel.h"
 
23
#include <gtk/gtk.h>
 
24
 
 
25
#include "gnome-region-panel-xkb.h"
 
26
#include "gnome-region-panel-lang.h"
 
27
 
 
28
#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s))
 
29
 
 
30
G_DEFINE_DYNAMIC_TYPE (CcRegionPanel, cc_region_panel, CC_TYPE_PANEL)
 
31
 
 
32
#define REGION_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_REGION_PANEL, CcRegionPanelPrivate))
 
33
 
 
34
struct _CcRegionPanelPrivate {
 
35
        GtkBuilder *builder;
 
36
};
 
37
 
 
38
 
 
39
static void
 
40
cc_region_panel_get_property (GObject * object,
 
41
                                guint property_id,
 
42
                                GValue * value, GParamSpec * pspec)
 
43
{
 
44
        switch (property_id) {
 
45
        default:
 
46
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
 
47
                                                   pspec);
 
48
        }
 
49
}
 
50
 
 
51
static void
 
52
cc_region_panel_set_property (GObject * object,
 
53
                                guint property_id,
 
54
                                const GValue * value, GParamSpec * pspec)
 
55
{
 
56
        switch (property_id) {
 
57
        default:
 
58
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
 
59
                                                   pspec);
 
60
        }
 
61
}
 
62
 
 
63
static void
 
64
cc_region_panel_dispose (GObject * object)
 
65
{
 
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);
 
76
}
 
77
 
 
78
static void
 
79
cc_region_panel_class_init (CcRegionPanelClass * klass)
 
80
{
 
81
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
82
 
 
83
        g_type_class_add_private (klass, sizeof (CcRegionPanelPrivate));
 
84
 
 
85
        object_class->get_property = cc_region_panel_get_property;
 
86
        object_class->set_property = cc_region_panel_set_property;
 
87
        object_class->dispose = cc_region_panel_dispose;
 
88
}
 
89
 
 
90
static void
 
91
cc_region_panel_class_finalize (CcRegionPanelClass * klass)
 
92
{
 
93
}
 
94
 
 
95
static void
 
96
cc_region_panel_init (CcRegionPanel * self)
 
97
{
 
98
        CcRegionPanelPrivate *priv;
 
99
        GtkWidget *prefs_widget;
 
100
        GError *error = NULL;
 
101
 
 
102
        priv = self->priv = REGION_PANEL_PRIVATE (self);
 
103
 
 
104
        priv->builder = gtk_builder_new ();
 
105
 
 
106
        gtk_builder_add_from_file (priv->builder,
 
107
                                   GNOMECC_UI_DIR "/gnome-region-panel.ui",
 
108
                                   &error);
 
109
        if (error != NULL) {
 
110
                g_warning ("Error loading UI file: %s", error->message);
 
111
                g_error_free (error);
 
112
                return;
 
113
        }
 
114
 
 
115
        prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
 
116
                                                             "region_notebook");
 
117
        gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);
 
118
 
 
119
        gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
 
120
 
 
121
        setup_xkb_tabs (priv->builder);
 
122
        setup_language (priv->builder);
 
123
}
 
124
 
 
125
void
 
126
cc_region_panel_register (GIOModule * module)
 
127
{
 
128
        cc_region_panel_register_type (G_TYPE_MODULE (module));
 
129
        g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
 
130
                                        CC_TYPE_REGION_PANEL,
 
131
                                        "region", 0);
 
132
}