Commit b4fdb6db authored by Thomas Wood's avatar Thomas Wood

Add libgnome-control-center with two new classes: CcShell and CcPanel

CcShell is an abstract class that represents an instance of a control
center shell. It provides access to some of the properties of the shell
that panels will need to read or change. When a panel is created it has an
instance of CcShell available that represents the current shell.

CcPanel is an abstract class used to implement panels for the shell. A
panel contains a collection of related settings that are displayed within
the shell window.
parent eb0e3e77
SUBDIRS = po libwindow-settings capplets font-viewer help
SUBDIRS = po libwindow-settings libgnome-control-center capplets font-viewer \
help docs
DIST_SUBDIRS = po libwindow-settings capplets font-viewer help libslab shell typing-break
if HAVE_LIBSLAB_DEPS
......@@ -50,7 +51,7 @@ EXTRA_DIST = \
MAINTAINERS \
gnome-doc-utils.make
DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper --disable-update-mimedb
DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper --disable-update-mimedb --enable-gtk-doc
GITIGNOREFILES=m4
......
......@@ -24,4 +24,6 @@ if ! which gnome-autogen.sh ; then
exit 1
fi
gtkdocize || exit 1
REQUIRED_AUTOMAKE_VERSION=1.9 . gnome-autogen.sh
AC_INIT([gnome-control-center], [2.31.1],
m4_define([gnome_control_center_version], 2.31.1)
AC_INIT([gnome-control-center], [gnome_control_center_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-control-center])
AC_CONFIG_MACRO_DIR([m4])
......@@ -314,6 +315,12 @@ AC_ARG_ENABLE(update-mimedb,
enable_update_mimedb=yes)
AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)
# check for gtk-doc
GTK_DOC_CHECK([1.9])
CONTROL_CENTER_VERSION=gnome_control_center_version
AC_SUBST(CONTROL_CENTER_VERSION)
AC_CONFIG_FILES([
Makefile
......@@ -347,9 +354,15 @@ capplets/network/Makefile
capplets/network/gnome-network-properties.desktop.in
capplets/windows/Makefile
capplets/windows/window-properties.desktop.in
docs/Makefile
docs/reference/Makefile
docs/reference/libgnome-control-center/Makefile
docs/reference/libgnome-control-center/version.xml
font-viewer/Makefile
font-viewer/gnome-font-viewer.desktop.in
help/Makefile
libgnome-control-center/Makefile
libgnome-control-center/libgnome-control-center.pc
libwindow-settings/Makefile
libwindow-settings/gnome-window-settings-2.0.pc
po/Makefile.in
......
SUBDIRS=reference
-include $(top_srcdir)/git.mk
SUBDIRS=libgnome-control-center
-include $(top_srcdir)/git.mk
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=libgnome-control-center
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
#DOC_MODULE_VERSION=2
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# Directories containing the source code, relative to $(srcdir).
# gtk-doc will search all .c and .h files beneath these paths
# for inline comments documenting functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk ../../../gdk
DOC_SOURCE_DIR=../../../libgnome-control-center
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-mkhtml
MKHTML_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/libgnome-control-center/*.h
CFILE_GLOB=$(top_srcdir)/libgnome-control-center/*.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS=$(CAPPLET_CFLAGS)
GTKDOC_LIBS=$(CAPPLET_LIBS) $(top_builddir)/libgnome-control-center/libgnome-control-center.la
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST += version.xml.in
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
#DISTCLEANFILES +=
# Comment this out if you want your docs-status tested during 'make check'
if ENABLE_GTK_DOC
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
#TESTS = $(GTKDOC_CHECK)
endif
-include $(top_srcdir)/git.mk
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<book id="index">
<bookinfo>
<title>libgnome-control-center Reference Manual</title>
<releaseinfo>
for libgnome-control-center &version;.
<!--
The latest version of this documentation can be found on-line at
<ulink role="online-location" url="http://[SERVER]/libgnome-control-center/index.html">http://[SERVER]/libgnome-control-center/</ulink>.
-->
</releaseinfo>
</bookinfo>
<chapter>
<title>libgnome-control-center</title>
<xi:include href="xml/cc-shell.xml"/>
<xi:include href="xml/cc-panel.xml"/>
</chapter>
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>
<SECTION>
<FILE>cc-shell</FILE>
<TITLE>CcShell</TITLE>
CcShell
CcShellClass
cc_shell_get_active_panel
cc_shell_set_active_panel
cc_shell_set_active_panel_from_id
<SUBSECTION Standard>
CC_SHELL
CC_IS_SHELL
CC_TYPE_SHELL
cc_shell_get_type
CC_SHELL_CLASS
CC_IS_SHELL_CLASS
CC_SHELL_GET_CLASS
<SUBSECTION Private>
CcShellPrivate
</SECTION>
<SECTION>
<FILE>cc-panel</FILE>
<TITLE>CcPanel</TITLE>
CcPanel
CcPanelClass
cc_panel_get_id
cc_panel_get_shell
cc_panel_get_display_name
cc_panel_set_display_name
cc_panel_get_active
cc_panel_set_active
<SUBSECTION Standard>
CC_PANEL
CC_IS_PANEL
CC_TYPE_PANEL
cc_panel_get_type
CC_PANEL_CLASS
CC_IS_PANEL_CLASS
CC_PANEL_GET_CLASS
<SUBSECTION Private>
CcPanelPrivate
</SECTION>
NULL =
uidir = $(pkgdatadir)/ui
INCLUDES = \
$(CAPPLET_CFLAGS) \
$(NULL)
lib_LTLIBRARIES = libgnome-control-center.la
libgnome_control_center_include_HEADERS = \
cc-panel.h \
cc-shell.h \
$(NULL)
libgnome_control_center_la_SOURCES = \
cc-panel.c \
cc-panel.h \
cc-shell.c \
cc-shell.h \
$(NULL)
libgnome_control_center_la_LDFLAGS = \
no-undefined \
$(NULL)
libgnome_control_center_la_LIBADD = \
$(CAPPLET_LIBS) \
$(NULL)
libgnome_control_center_la_LIBTOOLFLAGS = --tag=disable-static
libgnome_control_center_includedir = $(includedir)/gnome-control-center-1/libgnome-control-center
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA=libgnome-control-center.pc
EXTRA_DIST = \
libgnome-control-center.pc.in \
$(NULL)
AM_CPPFLAGS = \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DUIDIR="\"$(uidir)\"" \
-DMENUDIR="\"$(menudir)\""
-include $(top_srcdir)/git.mk
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2010 Red Hat, Inc.
* 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.
*
* Authors: William Jon McCann <jmccann@redhat.com>
* Thomas Wood <thomas.wood@intel.com>
*
*/
/**
* SECTION:cc-panel
* @short_description: An abstract class for Control Center panels
*
* CcPanel is an abstract class used to implement panels for the shell. A
* panel contains a collection of related settings that are displayed within
* the shell window.
*/
#include "config.h"
#include "cc-panel.h"
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#define CC_PANEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_PANEL, CcPanelPrivate))
struct CcPanelPrivate
{
gchar *id;
gchar *display_name;
gchar *category;
gchar *current_location;
gboolean is_active;
CcShell *shell;
};
enum
{
PROP_ID = 1,
PROP_DISPLAY_NAME,
PROP_SHELL,
PROP_ACTIVE
};
G_DEFINE_ABSTRACT_TYPE (CcPanel, cc_panel, GTK_TYPE_ALIGNMENT)
static void
cc_panel_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
CcPanel *panel;
panel = CC_PANEL (object);
switch (prop_id)
{
case PROP_ID:
/* construct only property */
g_free (panel->priv->id);
panel->priv->id = g_value_dup_string (value);
break;
case PROP_DISPLAY_NAME:
cc_panel_set_display_name (panel, g_value_get_string (value));
break;
case PROP_SHELL:
/* construct only property */
panel->priv->shell = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
cc_panel_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
CcPanel *panel;
panel = CC_PANEL (object);
switch (prop_id)
{
case PROP_ID:
g_value_set_string (value, panel->priv->id);
break;
case PROP_DISPLAY_NAME:
g_value_set_string (value, panel->priv->display_name);
break;
case PROP_SHELL:
g_value_set_object (value, panel->priv->shell);
break;
case PROP_ACTIVE:
g_value_set_boolean (value, panel->priv->is_active);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
cc_panel_finalize (GObject *object)
{
CcPanel *panel;
g_return_if_fail (object != NULL);
g_return_if_fail (CC_IS_PANEL (object));
panel = CC_PANEL (object);
g_free (panel->priv->id);
g_free (panel->priv->display_name);
G_OBJECT_CLASS (cc_panel_parent_class)->finalize (object);
}
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;
object_class->set_property = cc_panel_set_property;
object_class->finalize = cc_panel_finalize;
g_type_class_add_private (klass, sizeof (CcPanelPrivate));
pspec = g_param_spec_string ("id",
"id",
"Unique id of the Panel",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_ID, pspec );
pspec = g_param_spec_string ("display-name",
"display name",
"Display name of the Panel",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DISPLAY_NAME, pspec);
pspec = g_param_spec_object ("shell",
"Shell",
"Shell the Panel resides in",
CC_TYPE_SHELL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
| G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_SHELL, pspec);
pspec = g_param_spec_boolean ("active",
"Active",
"Whether the panel is currently the active"
" panel of the shell",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_ACTIVE, pspec);
}
static void
cc_panel_init (CcPanel *panel)
{
panel->priv = CC_PANEL_GET_PRIVATE (panel);
}
/**
* cc_panel_get_shell:
* @panel: A #CcPanel
*
* Get the shell that the panel resides in
*
* Returns: a #CcShell
*/
CcShell *
cc_panel_get_shell (CcPanel *panel)
{
return panel->priv->shell;
}
/**
* cc_panel_get_id:
* @panel: A #CcPanel
*
* Get the value of the #CcPanel:id property
*
* Returns: value of the id property, owned by the panel
*/
const gchar*
cc_panel_get_id (CcPanel *panel)
{
g_return_val_if_fail (CC_IS_PANEL (panel), NULL);
return panel->priv->id;
}
/**
* cc_panel_get_active:
* @panel: A #CcPanel
*
* Get the current value of the #CcPanel:active property
*
* Returns: #TRUE if the panel is marked as active
*/
gboolean
cc_panel_get_active (CcPanel *panel)
{
g_return_val_if_fail (CC_IS_PANEL (panel), FALSE);
return panel->priv->is_active;
}
/**
* cc_panel_set_active:
* @panel: A #CcPanel
* @is_active: #TRUE if the panel is now active
*
* Mark the panel as active. This should only be called by CcShell
* implementations.
*
*/
void
cc_panel_set_active (CcPanel *panel,
gboolean is_active)
{
g_return_if_fail (CC_IS_PANEL (panel));
if (panel->priv->is_active != is_active)
{
gtk_widget_queue_resize (GTK_WIDGET (panel));
g_object_notify (G_OBJECT (panel), "active");
}
}
/**
* cc_panel_set_display_name:
* @panel: A #CcPanel
* @display_name: Display name of the panel
*
* Set the value of the #CcPanel:display-name property.
*
*/
void
cc_panel_set_display_name (CcPanel *panel,
const gchar *display_name)
{
g_return_if_fail (CC_IS_PANEL (panel));
g_return_if_fail (display_name != NULL);
g_free (panel->priv->display_name);
panel->priv->display_name = g_strdup (display_name);
}
/**
* cc_panel_get_display_name:
* @panel: A #CcPanel
*
* Get the value of the #CcPanel:display-name property.
*
* Returns: the display name, owned by the panel
*/
const gchar*
cc_panel_get_display_name (CcPanel *panel)
{
g_return_val_if_fail (CC_IS_PANEL (panel), NULL);
return panel->priv->display_name;
}
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2010 Red Hat, Inc.
* 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.
*
* Authors: William Jon McCann <jmccann@redhat.com>
* Thomas Wood <thomas.wood@intel.com>
*/
#ifndef __CC_PANEL_H
#define __CC_PANEL_H
#include <glib-object.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define CC_TYPE_PANEL (cc_panel_get_type ())
#define CC_PANEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CC_TYPE_PANEL, CcPanel))
#define CC_PANEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CC_TYPE_PANEL, CcPanelClass))
#define CC_IS_PANEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CC_TYPE_PANEL))
#define CC_IS_PANEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CC_TYPE_PANEL))
#define CC_PANEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CC_TYPE_PANEL, CcPanelClass))
typedef struct CcPanelPrivate CcPanelPrivate;
typedef struct _CcPanel CcPanel;
typedef struct _CcPanelClass CcPanelClass;
/* cc-shell.h requires CcPanel, so make sure it is defined first */
#include "cc-shell.h"
/**
* CcPanel:
*
* The contents of this struct are private should not be accessed directly.
*/
struct _CcPanel
{
/*< private >*/
GtkAlignment parent;
CcPanelPrivate *priv;
};
/**
* CcPanelClass:
*
* The contents of this struct are private should not be accessed directly.
*/
struct _CcPanelClass
{
/*< private >*/
GtkAlignmentClass parent_class;
};
GType cc_panel_get_type (void);
const gchar* cc_panel_get_id (CcPanel *panel);
CcShell* cc_panel_get_shell (CcPanel *panel);
const gchar* cc_panel_get_display_name (CcPanel *panel);
void cc_panel_set_display_name (CcPanel *panel,
const gchar *display_name);
gboolean cc_panel_get_active (CcPanel *panel);
void cc_panel_set_active (CcPanel *panel,
gboolean is_active);
G_END_DECLS
#endif /* __CC_PANEL_H */
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (c) 2010 Intel, Inc.
*
* The Control Center 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.
*
* The Control Center 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 the Control Center; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Thomas Wood <thos@gnome.org>
*/
/**
* SECTION:cc-shell
* @short_description: Abstract class representing the Control Center shell
*
* CcShell is an abstract class that represents an instance of a control
* center shell. It provides access to some of the properties of the shell
* that panels will need to read or change. When a panel is created it has an
* instance of CcShell available that represents the current shell.
*/
#include "cc-shell.h"
#include "cc-panel.h"
G_DEFINE_ABSTRACT_TYPE (CcShell, cc_shell, G_TYPE_OBJECT)
#define SHELL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL, CcShellPrivate))
struct _CcShellPrivate
{
CcPanel *active_panel;
};
enum
{
PROP_ACTIVE_PANEL = 1
};
static void
cc_shell_get_property (GObject *object,
guint property_id,