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

« back to all changes in this revision

Viewing changes to panels/background/bg-source.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: Thomas Wood <thomas.wood@intel.com>
 
19
 *
 
20
 */
 
21
 
 
22
#include "bg-source.h"
 
23
#include "cc-background-item.h"
 
24
 
 
25
G_DEFINE_ABSTRACT_TYPE (BgSource, bg_source, G_TYPE_OBJECT)
 
26
 
 
27
#define SOURCE_PRIVATE(o) \
 
28
  (G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_SOURCE, BgSourcePrivate))
 
29
 
 
30
struct _BgSourcePrivate
 
31
{
 
32
  GtkListStore *store;
 
33
};
 
34
 
 
35
enum
 
36
{
 
37
  PROP_LISTSTORE = 1
 
38
};
 
39
 
 
40
 
 
41
static void
 
42
bg_source_get_property (GObject    *object,
 
43
                        guint       property_id,
 
44
                        GValue     *value,
 
45
                        GParamSpec *pspec)
 
46
{
 
47
  BgSource *source = BG_SOURCE (object);
 
48
 
 
49
  switch (property_id)
 
50
    {
 
51
    case PROP_LISTSTORE:
 
52
      g_value_set_object (value, bg_source_get_liststore (source));
 
53
      break;
 
54
 
 
55
    default:
 
56
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
57
    }
 
58
}
 
59
 
 
60
static void
 
61
bg_source_set_property (GObject      *object,
 
62
                        guint         property_id,
 
63
                        const GValue *value,
 
64
                        GParamSpec   *pspec)
 
65
{
 
66
  switch (property_id)
 
67
    {
 
68
    default:
 
69
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
70
    }
 
71
}
 
72
 
 
73
static void
 
74
bg_source_dispose (GObject *object)
 
75
{
 
76
  BgSourcePrivate *priv = BG_SOURCE (object)->priv;
 
77
 
 
78
  if (priv->store)
 
79
    {
 
80
      g_object_unref (priv->store);
 
81
      priv->store = NULL;
 
82
    }
 
83
 
 
84
  G_OBJECT_CLASS (bg_source_parent_class)->dispose (object);
 
85
}
 
86
 
 
87
static void
 
88
bg_source_finalize (GObject *object)
 
89
{
 
90
  G_OBJECT_CLASS (bg_source_parent_class)->finalize (object);
 
91
}
 
92
 
 
93
static void
 
94
bg_source_class_init (BgSourceClass *klass)
 
95
{
 
96
  GParamSpec *pspec;
 
97
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
98
 
 
99
  g_type_class_add_private (klass, sizeof (BgSourcePrivate));
 
100
 
 
101
  object_class->get_property = bg_source_get_property;
 
102
  object_class->set_property = bg_source_set_property;
 
103
  object_class->dispose = bg_source_dispose;
 
104
  object_class->finalize = bg_source_finalize;
 
105
 
 
106
  pspec = g_param_spec_object ("liststore",
 
107
                               "Liststore",
 
108
                               "Liststore used in the source",
 
109
                               GTK_TYPE_LIST_STORE,
 
110
                               G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
111
  g_object_class_install_property (object_class, PROP_LISTSTORE, pspec);
 
112
}
 
113
 
 
114
static void
 
115
bg_source_init (BgSource *self)
 
116
{
 
117
  BgSourcePrivate *priv;
 
118
 
 
119
  priv = self->priv = SOURCE_PRIVATE (self);
 
120
 
 
121
  priv->store = gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_OBJECT);
 
122
}
 
123
 
 
124
GtkListStore*
 
125
bg_source_get_liststore (BgSource *source)
 
126
{
 
127
  g_return_val_if_fail (BG_IS_SOURCE (source), NULL);
 
128
 
 
129
  return source->priv->store;
 
130
}