Commit 150bf7ca authored by Chris Aillon's avatar Chris Aillon Committed by Chris Aillon
Browse files

2005-10-14 Christopher Aillon <caillon@redhat.com>

	* gnome/libnm_glib/libnm_glib.c:
	* gnome/libnm_glib/libnm_glib.h:
	Use guint instead of gint for callback IDs.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1022 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 8a0de324
2005-10-14 Christopher Aillon <caillon@redhat.com>
* gnome/libnm_glib/libnm_glib.c:
* gnome/libnm_glib/libnm_glib.h:
Use guint instead of gint for callback IDs.
2005-10-12 Christopher Aillon <caillon@redhat.com> 2005-10-12 Christopher Aillon <caillon@redhat.com>
* gnome/applet/applet.c: * gnome/applet/applet.c:
......
...@@ -44,14 +44,14 @@ struct libnm_glib_ctx ...@@ -44,14 +44,14 @@ struct libnm_glib_ctx
GSList * callbacks; GSList * callbacks;
GMutex * callbacks_lock; GMutex * callbacks_lock;
gint callback_id_last; guint callback_id_last;
libnm_glib_state nm_state; libnm_glib_state nm_state;
}; };
typedef struct libnm_glib_callback typedef struct libnm_glib_callback
{ {
gint id; guint id;
GMainContext * gmain_ctx; GMainContext * gmain_ctx;
libnm_glib_ctx * libnm_glib_ctx; libnm_glib_ctx * libnm_glib_ctx;
libnm_glib_callback_func func; libnm_glib_callback_func func;
...@@ -487,16 +487,16 @@ libnm_glib_state libnm_glib_get_network_state (const libnm_glib_ctx *ctx) ...@@ -487,16 +487,16 @@ libnm_glib_state libnm_glib_get_network_state (const libnm_glib_ctx *ctx)
} }
gint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func func, gpointer user_data, GMainContext *g_main_ctx) guint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func func, gpointer user_data, GMainContext *g_main_ctx)
{ {
libnm_glib_callback *callback = NULL; libnm_glib_callback *callback = NULL;
g_return_val_if_fail (ctx != NULL, -1); g_return_val_if_fail (ctx != NULL, 0);
g_return_val_if_fail (func != NULL, -1); g_return_val_if_fail (func != NULL, 0);
callback = g_malloc0 (sizeof (libnm_glib_callback)); callback = g_malloc0 (sizeof (libnm_glib_callback));
callback->id = ctx->callback_id_last++; callback->id = ++ (ctx->callback_id_last);
callback->func = func; callback->func = func;
callback->gmain_ctx = g_main_ctx; callback->gmain_ctx = g_main_ctx;
callback->libnm_glib_ctx = ctx; callback->libnm_glib_ctx = ctx;
...@@ -511,12 +511,12 @@ gint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func ...@@ -511,12 +511,12 @@ gint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func
} }
void libnm_glib_unregister_callback (libnm_glib_ctx *ctx, gint id) void libnm_glib_unregister_callback (libnm_glib_ctx *ctx, guint id)
{ {
GSList *elem; GSList *elem;
g_return_if_fail (ctx != NULL); g_return_if_fail (ctx != NULL);
g_return_if_fail (id < 0); g_return_if_fail (id > 0);
g_mutex_lock (ctx->callbacks_lock); g_mutex_lock (ctx->callbacks_lock);
elem = ctx->callbacks; elem = ctx->callbacks;
......
...@@ -48,8 +48,8 @@ void libnm_glib_shutdown (libnm_glib_ctx *ctx); ...@@ -48,8 +48,8 @@ void libnm_glib_shutdown (libnm_glib_ctx *ctx);
libnm_glib_state libnm_glib_get_network_state (const libnm_glib_ctx *ctx); libnm_glib_state libnm_glib_get_network_state (const libnm_glib_ctx *ctx);
gint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func func, gpointer user_data, GMainContext *g_main_ctx); guint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func func, gpointer user_data, GMainContext *g_main_ctx);
void libnm_glib_unregister_callback (libnm_glib_ctx *ctx, gint id); void libnm_glib_unregister_callback (libnm_glib_ctx *ctx, guint id);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
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