diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-09-16 20:09:04 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-09-16 20:09:04 +0100 |
commit | 9e88c1ba97acde24dd8c22d3d1776f2760fceb4b (patch) | |
tree | 5ffacb413a1dd59596ecc30d240442a49560eb93 | |
parent | f1bb5569a06fbb256dbbffc900cfb3430d84ecb9 (diff) |
Un-virtualize mcd_mission_set_parent and make it library-internal
Plugins/subclasses shouldn't be manipulating the parent/child hierarchy!
-rw-r--r-- | doc/reference/libmissioncontrol-server/tmpl/mcd-mission.sgml | 9 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/mcd-mission-priv.h | 38 | ||||
-rw-r--r-- | src/mcd-mission.c | 17 | ||||
-rw-r--r-- | src/mcd-mission.h | 3 | ||||
-rw-r--r-- | src/mcd-operation.c | 5 |
6 files changed, 47 insertions, 26 deletions
diff --git a/doc/reference/libmissioncontrol-server/tmpl/mcd-mission.sgml b/doc/reference/libmissioncontrol-server/tmpl/mcd-mission.sgml index c6b3d862..7e4232d5 100644 --- a/doc/reference/libmissioncontrol-server/tmpl/mcd-mission.sgml +++ b/doc/reference/libmissioncontrol-server/tmpl/mcd-mission.sgml @@ -82,15 +82,6 @@ McdMission @mission: -<!-- ##### FUNCTION mcd_mission_set_parent ##### --> -<para> - -</para> - -@mission: -@parent: - - <!-- ##### FUNCTION mcd_mission_connect ##### --> <para> diff --git a/src/Makefile.am b/src/Makefile.am index a97bcb86..2616c6e6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -141,6 +141,7 @@ libmcd_convenience_la_SOURCES = \ mcd-misc.c \ mcd-misc.h \ mcd-mission.c \ + mcd-mission-priv.h \ mcd-operation.c \ mcd-controller.c \ mcd-master.c \ diff --git a/src/mcd-mission-priv.h b/src/mcd-mission-priv.h new file mode 100644 index 00000000..f90a2c89 --- /dev/null +++ b/src/mcd-mission-priv.h @@ -0,0 +1,38 @@ +/* vi: set et sw=4 ts=8 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */ +/* + * This file is part of mission-control + * + * Copyright (C) 2007 Nokia Corporation. + * + * Contact: Naba Kumar <naba.kumar@nokia.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef MCD_MISSION_PRIV_H +#define MCD_MISSION_PRIV_H + +#include "mcd-mission.h" + +G_BEGIN_DECLS + +G_GNUC_INTERNAL void _mcd_mission_set_parent (McdMission *mission, + McdMission *parent); + +G_END_DECLS + +#endif diff --git a/src/mcd-mission.c b/src/mcd-mission.c index e86fe904..ec05f79b 100644 --- a/src/mcd-mission.c +++ b/src/mcd-mission.c @@ -50,7 +50,7 @@ */ #include <glib/gi18n.h> -#include "mcd-mission.h" +#include "mcd-mission-priv.h" #include "mcd-enum-types.h" #define MCD_MISSION_PRIV(mission) (G_TYPE_INSTANCE_GET_PRIVATE ((mission), \ @@ -121,10 +121,10 @@ static void on_parent_abort (McdMission *parent, McdMission *mission) { DEBUG ("called"); - mcd_mission_set_parent (mission, NULL); + _mcd_mission_set_parent (mission, NULL); } -static void +void _mcd_mission_set_parent (McdMission * mission, McdMission * parent) { McdMissionPrivate *priv; @@ -209,7 +209,7 @@ _mcd_set_property (GObject * object, guint prop_id, const GValue * val, switch (prop_id) { case PROP_PARENT: - mcd_mission_set_parent (mission, g_value_get_object (val)); + _mcd_mission_set_parent (mission, g_value_get_object (val)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -251,8 +251,6 @@ mcd_mission_class_init (McdMissionClass * klass) klass->connect = _mcd_mission_connect; klass->disconnect = _mcd_mission_disconnect; - klass->set_parent = _mcd_mission_set_parent; - /* signals */ mcd_mission_signals[ABORT] = g_signal_new ("abort", @@ -329,13 +327,6 @@ mcd_mission_is_connected (McdMission * mission) return priv->connected; } -void -mcd_mission_set_parent (McdMission * mission, McdMission * parent) -{ - g_return_if_fail (MCD_IS_MISSION (mission)); - MCD_MISSION_GET_CLASS (mission)->set_parent (mission, parent); -} - McdMission * mcd_mission_get_parent (McdMission * mission) { diff --git a/src/mcd-mission.h b/src/mcd-mission.h index 4de8f51d..71fe510e 100644 --- a/src/mcd-mission.h +++ b/src/mcd-mission.h @@ -62,7 +62,7 @@ struct _McdMissionClass void (*abort_signal) (McdMission * mission); /* Virtual methods */ - void (*set_parent) (McdMission * mission, McdMission * parent); + void (*_former_set_parent) (void); void (*connect) (McdMission * mission); void (*disconnect) (McdMission * mission); @@ -83,7 +83,6 @@ gboolean mcd_mission_is_connected (McdMission * mission); McdMission *mcd_mission_get_parent (McdMission * mission); void mcd_mission_abort (McdMission * mission); -void mcd_mission_set_parent (McdMission * mission, McdMission * parent); void mcd_mission_connect (McdMission * mission); void mcd_mission_disconnect (McdMission * mission); diff --git a/src/mcd-operation.c b/src/mcd-operation.c index 78a19b66..2dd46a51 100644 --- a/src/mcd-operation.c +++ b/src/mcd-operation.c @@ -40,6 +40,7 @@ #include <glib/gi18n.h> #include "mcd-operation.h" +#include "mcd-mission-priv.h" #define MCD_OPERATION_PRIV(operation) (G_TYPE_INSTANCE_GET_PRIVATE ((operation), \ MCD_TYPE_OPERATION, \ @@ -170,7 +171,7 @@ _mcd_operation_take_mission (McdOperation * operation, McdMission * mission) McdOperationPrivate *priv = MCD_OPERATION_PRIV (operation); priv->missions = g_list_prepend (priv->missions, mission); - mcd_mission_set_parent (mission, MCD_MISSION (operation)); + _mcd_mission_set_parent (mission, MCD_MISSION (operation)); if (mcd_mission_is_connected (MCD_MISSION (operation))) mcd_mission_connect (mission); @@ -190,7 +191,7 @@ _mcd_operation_remove_mission (McdOperation * operation, McdMission * mission) _mcd_operation_disconnect_mission (mission, operation); priv->missions = g_list_remove (priv->missions, mission); - mcd_mission_set_parent (mission, NULL); + _mcd_mission_set_parent (mission, NULL); g_signal_emit_by_name (G_OBJECT (operation), "mission-removed", mission); |