BonoboUIComponent missing preconditions
- From: Ettore Perazzoli <ettore ximian com>
- To: gnome-components-list gnome org
- Subject: BonoboUIComponent missing preconditions
- Date: 02 Jul 2001 07:04:12 -0400
Sigh. Any reason not to commit the attached patch? (I hope I got all
the checks right.)
--
Ettore
Index: bonobo/bonobo-ui-component.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-component.c,v
retrieving revision 1.45
diff -u -u -r1.45 bonobo-ui-component.c
--- bonobo/bonobo-ui-component.c 2001/06/26 17:35:07 1.45
+++ bonobo/bonobo-ui-component.c 2001/07/02 11:02:46
@@ -174,8 +174,10 @@
UIVerb *verb;
BonoboUIComponentPrivate *priv;
- g_return_if_fail (cname != NULL);
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (cname != NULL);
+ g_return_if_fail (fn != NULL);
priv = component->priv;
@@ -209,6 +211,11 @@
BonoboUIVerbFn fn,
gpointer user_data)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (cname != NULL);
+ g_return_if_fail (fn != NULL);
+
bonobo_ui_component_add_verb_full (
component, cname, fn, user_data, NULL);
}
@@ -258,6 +265,10 @@
{
RemoveInfo info;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (cname != NULL);
+
memset (&info, 0, sizeof (info));
info.by_name = TRUE;
@@ -279,6 +290,9 @@
{
RemoveInfo info;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
memset (&info, 0, sizeof (info));
info.by_func = TRUE;
@@ -300,6 +314,9 @@
{
RemoveInfo info;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
memset (&info, 0, sizeof (info));
info.by_data = TRUE;
@@ -328,9 +345,10 @@
UIListener *list;
BonoboUIComponentPrivate *priv;
- g_return_if_fail (fn != NULL);
- g_return_if_fail (id != NULL);
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (id != NULL);
+ g_return_if_fail (fn != NULL);
priv = component->priv;
@@ -363,6 +381,11 @@
BonoboUIListenerFn fn,
gpointer user_data)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (id != NULL);
+ g_return_if_fail (fn != NULL);
+
bonobo_ui_component_add_listener_full (
component, id, fn, user_data, NULL);
}
@@ -403,6 +426,10 @@
{
RemoveInfo info;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (cname != NULL);
+
memset (&info, 0, sizeof (info));
info.by_name = TRUE;
@@ -424,6 +451,10 @@
{
RemoveInfo info;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (fn != NULL);
+
memset (&info, 0, sizeof (info));
info.by_func = TRUE;
@@ -445,6 +476,9 @@
{
RemoveInfo info;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
memset (&info, 0, sizeof (info));
info.by_data = TRUE;
@@ -494,6 +528,7 @@
const char *name)
{
g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui_component), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
ui_component->priv->name = g_strdup (name);
@@ -513,6 +548,8 @@
{
BonoboUIComponent *component;
+ g_return_val_if_fail (name != NULL, NULL);
+
component = gtk_type_new (BONOBO_UI_COMPONENT_TYPE);
if (!component)
return NULL;
@@ -563,8 +600,9 @@
bonobo_ui_component_set_name (BonoboUIComponent *component,
const char *name)
{
- g_return_if_fail (name != NULL);
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (name != NULL);
g_free (component->priv->name);
component->priv->name = g_strdup (name);
@@ -579,6 +617,7 @@
const char *
bonobo_ui_component_get_name (BonoboUIComponent *component)
{
+ g_return_val_if_fail (component != NULL, NULL);
g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), NULL);
return component->priv->name;
@@ -604,6 +643,11 @@
const char *xml,
CORBA_Environment *ev)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (xml != NULL);
+
GET_CLASS (component)->xml_set (component, path, xml, ev);
}
@@ -618,6 +662,7 @@
char *name;
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
container = component->priv->container;
g_return_if_fail (container != CORBA_OBJECT_NIL);
@@ -662,6 +707,11 @@
{
char *str;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (node != NULL);
+
str = bonobo_ui_node_to_string (node, TRUE);
/* fprintf (stderr, "Merging '%s'\n", str); */
@@ -691,6 +741,11 @@
{
BonoboUINode *node;
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (xml != NULL);
+
if (!xml)
return;
@@ -723,6 +778,10 @@
gboolean recurse,
CORBA_Environment *ev)
{
+ g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), NULL);
+ g_return_val_if_fail (path != NULL, NULL);
+
return GET_CLASS (component)->xml_get (component, path, recurse, ev);
}
@@ -778,10 +837,14 @@
const char *path,
gboolean recurse,
CORBA_Environment *ev)
-{
+{
char *xml;
BonoboUINode *node;
+ g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), NULL);
+ g_return_val_if_fail (path != NULL, NULL);
+
xml = bonobo_ui_component_get (component, path, recurse, ev);
if (!xml)
@@ -812,6 +875,10 @@
const char *path,
CORBA_Environment *ev)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (path != NULL);
+
GET_CLASS (component)->xml_rm (component, path, ev);
}
@@ -870,7 +937,10 @@
CORBA_Environment *real_ev, tmp_ev;
Bonobo_UIContainer container;
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (path != NULL);
+
container = component->priv->container;
g_return_if_fail (container != CORBA_OBJECT_NIL);
@@ -912,8 +982,10 @@
Bonobo_Unknown ret;
Bonobo_UIContainer container;
- g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component),
- CORBA_OBJECT_NIL);
+ g_return_val_if_fail (component != NULL, CORBA_OBJECT_NIL);
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), CORBA_OBJECT_NIL);
+ g_return_val_if_fail (path != NULL, CORBA_OBJECT_NIL);
+
container = component->priv->container;
g_return_val_if_fail (container != CORBA_OBJECT_NIL,
CORBA_OBJECT_NIL);
@@ -954,8 +1026,9 @@
{
BonoboUIVerb *l;
- g_return_if_fail (list != NULL);
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (list != NULL);
bonobo_object_ref (BONOBO_OBJECT (component));
@@ -980,6 +1053,10 @@
bonobo_ui_component_add_verb_list (BonoboUIComponent *component,
BonoboUIVerb *list)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (list != NULL);
+
bonobo_ui_component_add_verb_list_with_data (component, list, NULL);
}
@@ -999,6 +1076,9 @@
bonobo_ui_component_freeze (BonoboUIComponent *component,
CORBA_Environment *ev)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
GET_CLASS (component)->freeze (component, ev);
}
@@ -1046,6 +1126,9 @@
bonobo_ui_component_thaw (BonoboUIComponent *component,
CORBA_Environment *ev)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
GET_CLASS (component)->thaw (component, ev);
}
@@ -1057,6 +1140,7 @@
Bonobo_UIContainer container;
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
container = component->priv->container;
g_return_if_fail (container != CORBA_OBJECT_NIL);
@@ -1097,6 +1181,12 @@
const char *value,
CORBA_Environment *opt_ev)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+ g_return_if_fail (path != NULL);
+ g_return_if_fail (prop != NULL);
+ g_return_if_fail (value != NULL);
+
if (prop && (!strcmp (prop, "label") || !strcmp (prop, "tip"))) {
char *encoded = bonobo_ui_util_encode_str (value);
GET_CLASS (component)->set_prop (component, path, prop, encoded, opt_ev);
@@ -1151,6 +1241,11 @@
{
char *txt;
+ g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), NULL);
+ g_return_val_if_fail (path != NULL, NULL);
+ g_return_val_if_fail (prop != NULL, NULL);
+
txt = GET_CLASS (component)->get_prop (component, path, prop, opt_ev);
if (prop && (!strcmp (prop, "label") || !strcmp (prop, "tip"))) {
@@ -1220,6 +1315,10 @@
const char *path,
CORBA_Environment *ev)
{
+ g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), FALSE);
+ g_return_val_if_fail (path != NULL, FALSE);
+
return GET_CLASS (component)->exists (component, path, ev);
}
@@ -1274,6 +1373,9 @@
const char *text,
CORBA_Environment *opt_ev)
{
+ g_return_if_fail (component != NULL);
+ g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
+
if (text == NULL ||
text [0] == '\0') { /* Remove what was there to reveal other msgs */
bonobo_ui_component_rm (component, "/status/main/*", opt_ev);
@@ -1300,6 +1402,7 @@
void
bonobo_ui_component_unset_container (BonoboUIComponent *component)
{
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
bonobo_object_ref (BONOBO_OBJECT (component));
@@ -1346,6 +1449,7 @@
{
Bonobo_UIContainer ref_cont;
+ g_return_if_fail (component != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
bonobo_object_ref (BONOBO_OBJECT (component));
@@ -1391,8 +1495,8 @@
Bonobo_UIContainer
bonobo_ui_component_get_container (BonoboUIComponent *component)
{
- g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component),
- CORBA_OBJECT_NIL);
+ g_return_val_if_fail (component != NULL, CORBA_OBJECT_NIL);
+ g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component), CORBA_OBJECT_NIL);
return component->priv->container;
}
@@ -1403,7 +1507,7 @@
GtkObjectClass *object_class = (GtkObjectClass *) klass;
BonoboUIComponentClass *uclass = BONOBO_UI_COMPONENT_CLASS (klass);
POA_Bonobo_UIComponent__epv *epv = &klass->epv;
-
+
bonobo_ui_component_parent_class = gtk_type_class (PARENT_TYPE);
object_class->destroy = bonobo_ui_component_destroy;
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.1077
diff -u -u -r1.1077 ChangeLog
--- ChangeLog 2001/06/26 23:22:40 1.1077
+++ ChangeLog 2001/07/02 11:02:57
@@ -1,3 +1,36 @@
+2001-07-02 Ettore Perazzoli <ettore ximian com>
+
+ * bonobo/bonobo-ui-component.c (bonobo_ui_component_get_prop): Add
+ preconditions.
+ (bonobo_ui_component_set_prop): Likewise.
+ (bonobo_ui_component_thaw): Likewise.
+ (bonobo_ui_component_remove_verb): Likewise.
+ (bonobo_ui_component_add_verb): Likewise.
+ (bonobo_ui_component_add_verb_full): Likewise.
+ (bonobo_ui_component_remove_verb_by_func): Likewise.
+ (bonobo_ui_component_remove_verb_by_data): Likewise.
+ (bonobo_ui_component_add_listener): Likewise.
+ (bonobo_ui_component_remove_listener_by_func): Likewise.
+ (bonobo_ui_component_remove_listener_by_data): Likewise.
+ (bonobo_ui_component_new): Likewise.
+ (bonobo_ui_component_set_name): Likewise.
+ (bonobo_ui_component_get_name): Likewise.
+ (bonobo_ui_component_set): Likewise.
+ (bonobo_ui_component_set_tree): Likewise.
+ (bonobo_ui_component_set_translate): Likewise.
+ (bonobo_ui_component_get): Likewise.
+ (bonobo_ui_component_get_tree): Likewise.
+ (bonobo_ui_component_rm): Likewise.
+ (bonobo_ui_component_object_set): Likewise.
+ (bonobo_ui_component_object_get): Likewise.
+ (bonobo_ui_component_add_verb_list_with_data): Likewise.
+ (bonobo_ui_component_add_verb_list): Likewise.
+ (bonobo_ui_component_freeze): Likewise.
+ (bonobo_ui_component_path_exists): Likewise.
+ (bonobo_ui_component_set_status): Likewise.
+ (bonobo_ui_component_set_container): Likewise.
+ (bonobo_ui_component_get_container): Likewise.
+
2001-06-26 Darin Adler <darin bentspoon com>
(not really back in town :-)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]