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

« back to all changes in this revision

Viewing changes to panels/mouse/cc-mouse-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
 * Authors: Thomas Wood <thomas.wood@intel.com>
 
19
 *          Rodrigo Moya <rodrigo@gnome.org>
 
20
 *
 
21
 */
 
22
 
 
23
#include "cc-mouse-panel.h"
 
24
#include "gnome-mouse-properties.h"
 
25
#include <gtk/gtk.h>
 
26
 
 
27
G_DEFINE_DYNAMIC_TYPE (CcMousePanel, cc_mouse_panel, CC_TYPE_PANEL)
 
28
 
 
29
#define MOUSE_PANEL_PRIVATE(o) \
 
30
  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_MOUSE_PANEL, CcMousePanelPrivate))
 
31
 
 
32
struct _CcMousePanelPrivate
 
33
{
 
34
  GtkBuilder *builder;
 
35
  GtkWidget  *widget;
 
36
};
 
37
 
 
38
 
 
39
static void
 
40
cc_mouse_panel_get_property (GObject    *object,
 
41
                             guint       property_id,
 
42
                             GValue     *value,
 
43
                             GParamSpec *pspec)
 
44
{
 
45
  switch (property_id)
 
46
    {
 
47
    default:
 
48
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
49
    }
 
50
}
 
51
 
 
52
static void
 
53
cc_mouse_panel_set_property (GObject      *object,
 
54
                             guint         property_id,
 
55
                             const GValue *value,
 
56
                             GParamSpec   *pspec)
 
57
{
 
58
  switch (property_id)
 
59
    {
 
60
    default:
 
61
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
62
    }
 
63
}
 
64
 
 
65
static void
 
66
cc_mouse_panel_dispose (GObject *object)
 
67
{
 
68
  CcMousePanelPrivate *priv = CC_MOUSE_PANEL (object)->priv;
 
69
 
 
70
  if (priv->widget)
 
71
    {
 
72
      gnome_mouse_properties_dispose (priv->widget);
 
73
      priv->widget = NULL;
 
74
    }
 
75
 
 
76
  if (priv->builder)
 
77
    {
 
78
      g_object_unref (priv->builder);
 
79
      priv->builder = NULL;
 
80
    }
 
81
 
 
82
  G_OBJECT_CLASS (cc_mouse_panel_parent_class)->dispose (object);
 
83
}
 
84
 
 
85
static void
 
86
cc_mouse_panel_class_init (CcMousePanelClass *klass)
 
87
{
 
88
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
89
 
 
90
  g_type_class_add_private (klass, sizeof (CcMousePanelPrivate));
 
91
 
 
92
  object_class->get_property = cc_mouse_panel_get_property;
 
93
  object_class->set_property = cc_mouse_panel_set_property;
 
94
  object_class->dispose = cc_mouse_panel_dispose;
 
95
}
 
96
 
 
97
static void
 
98
cc_mouse_panel_class_finalize (CcMousePanelClass *klass)
 
99
{
 
100
}
 
101
 
 
102
static void
 
103
cc_mouse_panel_init (CcMousePanel *self)
 
104
{
 
105
  CcMousePanelPrivate *priv;
 
106
  GtkWidget *prefs_widget;
 
107
  GError *error = NULL;
 
108
 
 
109
  priv = self->priv = MOUSE_PANEL_PRIVATE (self);
 
110
 
 
111
  priv->builder = gtk_builder_new ();
 
112
 
 
113
  gtk_builder_add_from_file (priv->builder,
 
114
                             GNOMECC_UI_DIR "/gnome-mouse-properties.ui",
 
115
                             &error);
 
116
  if (error != NULL)
 
117
    {
 
118
      g_warning ("Error loading UI file: %s", error->message);
 
119
      return;
 
120
    }
 
121
 
 
122
  priv->widget = gnome_mouse_properties_init (priv->builder);
 
123
 
 
124
  prefs_widget = (GtkWidget*) gtk_builder_get_object (priv->builder,
 
125
                                                      "prefs_widget");
 
126
 
 
127
  gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
 
128
}
 
129
 
 
130
void
 
131
cc_mouse_panel_register (GIOModule *module)
 
132
{
 
133
  cc_mouse_panel_register_type (G_TYPE_MODULE (module));
 
134
  g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
 
135
                                  CC_TYPE_MOUSE_PANEL,
 
136
                                  "mouse", 0);
 
137
}
 
138