Commit 3748173b authored by Thomas Wood's avatar Thomas Wood

Add an example implementation of a settings panel

The example panel implements CcPanel and registers itself as extending the
panel extension point. It provides a simple "Hello World" message. The
example panel is not build by default, but enabled through a configure option.
parent a4073bdb
SUBDIRS = po libwindow-settings libgnome-control-center shell capplets \
font-viewer help docs
DIST_SUBDIRS = po libwindow-settings capplets font-viewer help shell typing-break
DIST_SUBDIRS = po libwindow-settings capplets font-viewer help shell typing-break examples
if HAVE_TYPING_BREAK
SUBDIRS += typing-break
endif
if BUILD_EXAMPLES
SUBDIRS += examples
endif
schemasdir = @GCONF_SCHEMA_FILE_DIR@
schemas_in_files = gnome-control-center.schemas.in
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
......
......@@ -295,6 +295,19 @@ AC_SUBST(PANEL_LIBS)
PANEL_LDFLAGS="-export_dynamic -avoid-version -module -no-undefined -export-symbols-regex '^g_io_module_(load|unload)'"
AC_SUBST(PANEL_LDFLAGS)
dnl ==============================================
dnl Example Panel
dnl ==============================================
AC_MSG_CHECKING([whether to build the example panel])
AC_ARG_ENABLE([examples],
AC_HELP_STRING([--enable-examples],
[enable the examples]),,
[enable_examples=no])
AC_MSG_RESULT([$enable_examples])
AM_CONDITIONAL(BUILD_EXAMPLES, test "x$enable_examples" = "xyes")
dnl =======================================
dnl Update Mime Database
......@@ -351,6 +364,8 @@ docs/Makefile
docs/reference/Makefile
docs/reference/libgnome-control-center/Makefile
docs/reference/libgnome-control-center/version.xml
examples/Makefile
examples/gnome-example-panel.desktop.in
font-viewer/Makefile
font-viewer/gnome-font-viewer.desktop.in
help/Makefile
......
INCLUDES = \
$(PANEL_CFLAGS) \
$(GNOMECC_CAPPLETS_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
$(NULL)
ccpanelsdir = $(PANELS_DIR)
ccpanels_LTLIBRARIES = libexample.la
libexample_la_SOURCES = \
example-module.c \
cc-example-panel.c \
cc-example-panel.h
libexample_la_LIBADD = $(PANEL_LIBS)
libexample_la_LDFLAGS = $(PANEL_LDFLAGS)
@INTLTOOL_DESKTOP_RULE@
desktopdir = $(datadir)/applications
desktop_in_files = gnome-example-panel.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
CLEANFILES = $(desktop_in_files) $(desktop_DATA)
-include $(top_srcdir)/git.mk
/*
* Copyright (C) 2010 Intel, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#include "cc-example-panel.h"
G_DEFINE_DYNAMIC_TYPE (CcExamplePanel, cc_example_panel, CC_TYPE_PANEL)
#define EXAMPLE_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_EXAMPLE_PANEL, CcExamplePanelPrivate))
struct _CcExamplePanelPrivate
{
gpointer dummy;
};
static void
cc_example_panel_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
cc_example_panel_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
cc_example_panel_dispose (GObject *object)
{
G_OBJECT_CLASS (cc_example_panel_parent_class)->dispose (object);
}
static void
cc_example_panel_finalize (GObject *object)
{
G_OBJECT_CLASS (cc_example_panel_parent_class)->finalize (object);
}
static void
cc_example_panel_class_init (CcExamplePanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (CcExamplePanelPrivate));
object_class->get_property = cc_example_panel_get_property;
object_class->set_property = cc_example_panel_set_property;
object_class->dispose = cc_example_panel_dispose;
object_class->finalize = cc_example_panel_finalize;
}
static void
cc_example_panel_class_finalize (CcExamplePanelClass *klass)
{
}
static void
cc_example_panel_init (CcExamplePanel *self)
{
GtkWidget *label;
self->priv = EXAMPLE_PANEL_PRIVATE (self);
label = gtk_label_new ("Hello World");
gtk_container_add (GTK_CONTAINER (self), label);
}
void
cc_example_panel_register (GIOModule *module)
{
cc_example_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_EXAMPLE_PANEL,
"gnome-example-panel.desktop", 0);
}
/*
* Copyright (C) 2010 Intel, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#ifndef _CC_EXAMPLE_PANEL_H
#define _CC_EXAMPLE_PANEL_H
#include <libgnome-control-center/cc-panel.h>
G_BEGIN_DECLS
#define CC_TYPE_EXAMPLE_PANEL cc_example_panel_get_type()
#define CC_EXAMPLE_PANEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CC_TYPE_EXAMPLE_PANEL, CcExamplePanel))
#define CC_EXAMPLE_PANEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CC_TYPE_EXAMPLE_PANEL, CcExamplePanelClass))
#define CC_IS_EXAMPLE_PANEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CC_TYPE_EXAMPLE_PANEL))
#define CC_IS_EXAMPLE_PANEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CC_TYPE_EXAMPLE_PANEL))
#define CC_EXAMPLE_PANEL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CC_TYPE_EXAMPLE_PANEL, CcExamplePanelClass))
typedef struct _CcExamplePanel CcExamplePanel;
typedef struct _CcExamplePanelClass CcExamplePanelClass;
typedef struct _CcExamplePanelPrivate CcExamplePanelPrivate;
struct _CcExamplePanel
{
CcPanel parent;
CcExamplePanelPrivate *priv;
};
struct _CcExamplePanelClass
{
CcPanelClass parent_class;
};
GType cc_example_panel_get_type (void) G_GNUC_CONST;
void cc_example_panel_register (GIOModule *module);
G_END_DECLS
#endif /* _CC_EXAMPLE_PANEL_H */
/*
* Copyright (C) 2010 Intel, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#include <config.h>
#include "cc-example-panel.h"
#include <glib/gi18n.h>
void
g_io_module_load (GIOModule *module)
{
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
/* register the panel */
cc_example_panel_register (module);
}
void
g_io_module_unload (GIOModule *module)
{
}
[Desktop Entry]
_Name=Example Panel
_Comment=Example preferences panel
Exec=gnome-example-properties
Icon=application-x-executable
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Settings;DesktopSettings;
OnlyShowIn=GNOME;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment