Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[gsupplicant] Added new macros. JB#41874
  gsupplicant_bss_remove_all_handlers
  gsupplicant_interface_remove_all_handlers
  gsupplicant_network_remove_all_handlers
  gsupplicant_remove_all_handlers
  • Loading branch information
monich committed Oct 20, 2018
1 parent e23a610 commit cdb0b71
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 42 deletions.
17 changes: 10 additions & 7 deletions include/gsupplicant.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -115,14 +115,14 @@ gsupplicant_unref(

gulong
gsupplicant_add_handler(
GSupplicant* self,
GSupplicant* supplicant,
GSUPPLICANT_PROPERTY prop,
GSupplicantFunc fn,
void* data);

gulong
gsupplicant_add_property_changed_handler(
GSupplicant* self,
GSupplicant* supplicant,
GSUPPLICANT_PROPERTY property,
GSupplicantPropertyFunc fn,
void* data);
Expand Down Expand Up @@ -179,6 +179,9 @@ gsupplicant_keymgmt_suite_name(
guint keymgmt_suites,
guint* keymgmt_suite);

#define gsupplicant_remove_all_handlers(supplicant, ids) \
gsupplicant_remove_handlers(supplicant, ids, G_N_ELEMENTS(ids))

G_END_DECLS

#endif /* GSUPPLICANT_H */
Expand Down
13 changes: 8 additions & 5 deletions include/gsupplicant_bss.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -206,6 +206,9 @@ gsupplicant_bss_connect(
GSupplicantBSSStringResultFunc fn,
void* data);

#define gsupplicant_bss_remove_all_handlers(bss, ids) \
gsupplicant_bss_remove_handlers(bss, ids, G_N_ELEMENTS(ids))

G_END_DECLS

#endif /* GSUPPLICANT_BSS_H */
Expand Down
13 changes: 8 additions & 5 deletions include/gsupplicant_interface.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -439,6 +439,9 @@ G_INLINE_FUNC const char*
gsupplicant_interface_get_state_name(GSupplicantInterface* iface)
{ return iface ? gsupplicant_interface_state_name(iface->state) : NULL; }

#define gsupplicant_interface_remove_all_handlers(iface, ids) \
gsupplicant_interface_remove_handlers(iface, ids, G_N_ELEMENTS(ids))

G_END_DECLS

#endif /* GSUPPLICANT_INTERFACE_H */
Expand Down
13 changes: 8 additions & 5 deletions include/gsupplicant_network.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2018 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -112,9 +112,12 @@ gsupplicant_network_remove_handlers(

gboolean
gsupplicant_network_set_enabled(
GSupplicantNetwork* self,
GSupplicantNetwork* network,
gboolean enabled);

#define gsupplicant_network_remove_all_handlers(network, ids) \
gsupplicant_network_remove_handlers(network, ids, G_N_ELEMENTS(ids))

G_END_DECLS

#endif /* GSUPPLICANT_NETWORK_H */
Expand Down
14 changes: 7 additions & 7 deletions src/gsupplicant_bss.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -1450,8 +1450,8 @@ gsupplicant_bss_dispose(
g_object_unref(priv->proxy);
priv->proxy = NULL;
}
gsupplicant_interface_remove_handlers(self->iface, priv->iface_handler_id,
G_N_ELEMENTS(priv->iface_handler_id));
gsupplicant_interface_remove_all_handlers(self->iface,
priv->iface_handler_id);
G_OBJECT_CLASS(SUPER_CLASS)->dispose(object);
}

Expand Down
12 changes: 6 additions & 6 deletions src/gsupplicant_interface.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2018 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -1145,8 +1145,8 @@ gsupplicant_interface_add_network_call_dispose(
{
/* May be invoked twice */
if (call->network) {
gsupplicant_network_remove_handlers(call->network,
call->network_event_id, G_N_ELEMENTS(call->network_event_id));
gsupplicant_network_remove_all_handlers(call->network,
call->network_event_id);
gsupplicant_network_unref(call->network);
call->network = NULL;
}
Expand Down
14 changes: 7 additions & 7 deletions src/gsupplicant_network.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2018 Jolla Ltd.
* Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -718,8 +718,8 @@ gsupplicant_network_dispose(
g_object_unref(priv->proxy);
priv->proxy = NULL;
}
gsupplicant_interface_remove_handlers(self->iface, priv->iface_handler_id,
G_N_ELEMENTS(priv->iface_handler_id));
gsupplicant_interface_remove_all_handlers(self->iface,
priv->iface_handler_id);
G_OBJECT_CLASS(SUPER_CLASS)->dispose(object);
}

Expand Down

0 comments on commit cdb0b71

Please sign in to comment.