summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2010-02-26 12:02:25 +0000
committerThomas Wood <thomas.wood@intel.com>2010-02-26 12:02:25 +0000
commit027f0e155254e110675faabe132ca4cb02341150 (patch)
tree8c4567c9cde157f718c03ed9249ab4373a50bb79
parent16b135172c9742ab9ec9d0c76c672273d3ad81c2 (diff)
downloadgnome-control-center-027f0e155254e110675faabe132ca4cb02341150.tar.gz
Add a "shell" property to CcPanel
The shell property on CcPanel allows panels to access the shell they are parented in. This means panels can switch the user to a new panel if required.
-rw-r--r--libgnome-control-center-extension/Makefile.am1
-rw-r--r--libgnome-control-center-extension/cc-panel.c34
-rw-r--r--libgnome-control-center-extension/cc-panel.h4
-rw-r--r--libgnome-control-center-extension/cc-shell.h (renamed from shell/cc-shell.h)0
-rw-r--r--shell/Makefile.am1
-rw-r--r--shell/cc-shell.c4
6 files changed, 42 insertions, 2 deletions
diff --git a/libgnome-control-center-extension/Makefile.am b/libgnome-control-center-extension/Makefile.am
index 19854b2b4..fde871bb6 100644
--- a/libgnome-control-center-extension/Makefile.am
+++ b/libgnome-control-center-extension/Makefile.am
@@ -23,6 +23,7 @@ lib_LTLIBRARIES = libgnome-control-center-extension.la
libgnome_control_center_extension_include_HEADERS = \
cc-page.h \
cc-panel.h \
+ cc-shell.h \
$(NULL)
libgnome_control_center_extension_la_SOURCES = \
diff --git a/libgnome-control-center-extension/cc-panel.c b/libgnome-control-center-extension/cc-panel.c
index 29783abc1..b8b755158 100644
--- a/libgnome-control-center-extension/cc-panel.c
+++ b/libgnome-control-center-extension/cc-panel.c
@@ -40,6 +40,7 @@ struct CcPanelPrivate
gboolean is_active;
CcPage *current_page;
+ CcShell *shell;
};
enum {
@@ -49,6 +50,7 @@ enum {
PROP_CATEGORY,
PROP_CURRENT_LOCATION,
PROP_CURRENT_PAGE,
+ PROP_SHELL,
};
enum {
@@ -107,6 +109,16 @@ _cc_panel_set_current_page (CcPanel *panel,
}
static void
+_cc_panel_set_shell (CcPanel *panel,
+ CcShell *shell)
+{
+ CcPanelPrivate *priv = panel->priv;
+
+ priv->shell = shell;
+}
+
+
+static void
cc_panel_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -126,6 +138,9 @@ cc_panel_set_property (GObject *object,
case PROP_CURRENT_PAGE:
_cc_panel_set_current_page (self, g_value_get_object (value));
break;
+ case PROP_SHELL:
+ _cc_panel_set_shell (self, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -152,6 +167,9 @@ cc_panel_get_property (GObject *object,
case PROP_CURRENT_PAGE:
g_value_set_object (value, self->priv->current_page);
break;
+ case PROP_SHELL:
+ g_value_set_object (value, self->priv->shell);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -212,6 +230,7 @@ cc_panel_constructor (GType type,
static void
cc_panel_class_init (CcPanelClass *klass)
{
+ GParamSpec *pspec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = cc_panel_get_property;
@@ -256,6 +275,15 @@ cc_panel_class_init (CcPanelClass *klass)
CC_TYPE_PAGE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ pspec = g_param_spec_object ("shell",
+ "Shell",
+ "Shell",
+ CC_TYPE_SHELL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
+ | G_PARAM_CONSTRUCT_ONLY);
+
+ g_object_class_install_property (object_class, PROP_SHELL, pspec);
+
}
static void
@@ -282,3 +310,9 @@ cc_panel_finalize (GObject *object)
G_OBJECT_CLASS (cc_panel_parent_class)->finalize (object);
}
+
+CcShell *
+cc_panel_get_shell (CcPanel *panel)
+{
+ return panel->priv->shell;
+}
diff --git a/libgnome-control-center-extension/cc-panel.h b/libgnome-control-center-extension/cc-panel.h
index e3187997c..49d865dc5 100644
--- a/libgnome-control-center-extension/cc-panel.h
+++ b/libgnome-control-center-extension/cc-panel.h
@@ -24,6 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
+#include "cc-shell.h"
G_BEGIN_DECLS
@@ -59,6 +60,9 @@ gboolean cc_panel_is_active (CcPanel *panel);
void cc_panel_set_active (CcPanel *panel,
gboolean is_active);
+CcShell* cc_panel_get_shell (CcPanel *panel);
+
+
G_END_DECLS
#endif /* __CC_PANEL_H */
diff --git a/shell/cc-shell.h b/libgnome-control-center-extension/cc-shell.h
index b973021d9..b973021d9 100644
--- a/shell/cc-shell.h
+++ b/libgnome-control-center-extension/cc-shell.h
diff --git a/shell/Makefile.am b/shell/Makefile.am
index c47d3e44d..ca614137b 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -12,7 +12,6 @@ bin_PROGRAMS = gnome-control-center
gnome_control_center_SOURCES = \
control-center.c \
cc-shell.c \
- cc-shell.h \
shell-search-renderer.c \
shell-search-renderer.h \
$(NULL)
diff --git a/shell/cc-shell.c b/shell/cc-shell.c
index d108a0e6e..713a734ca 100644
--- a/shell/cc-shell.c
+++ b/shell/cc-shell.c
@@ -172,7 +172,9 @@ load_panel_plugins (CcShell *shell)
extension = l->data;
g_debug ("Found extension: %s %d", g_io_extension_get_name (extension), g_io_extension_get_priority (extension));
- panel = g_object_new (g_io_extension_get_type (extension), NULL);
+ panel = g_object_new (g_io_extension_get_type (extension),
+ "shell", shell,
+ NULL);
g_object_get (panel, "id", &id, NULL);
g_hash_table_insert (priv->panels, g_strdup (id), g_object_ref (panel));
g_debug ("id: '%s'", id);