unix signal watch: make API match other sources

Change the unix signal watch API to match other sources in both
available functions, names of those functions and order of the
parameters to the _full function.

https://bugzilla.gnome.org/show_bug.cgi?id=657705
This commit is contained in:
Ryan Lortie
2011-08-30 09:45:52 -04:00
parent 1292ffc780
commit c0eb77bfc8
5 changed files with 45 additions and 25 deletions

View File

@@ -223,10 +223,10 @@ g_unix_signal_source_new (int signum)
}
/**
* g_unix_signal_add_watch_full:
* @signum: Signal number
* g_unix_signal_add_full:
* @priority: the priority of the signal source. Typically this will be in
* the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
* @signum: Signal number
* @handler: Callback
* @user_data: Data for @handler
* @notify: #GDestroyNotify for @handler
@@ -240,11 +240,11 @@ g_unix_signal_source_new (int signum)
* Since: 2.30
*/
guint
g_unix_signal_add_watch_full (int signum,
int priority,
GSourceFunc handler,
gpointer user_data,
GDestroyNotify notify)
g_unix_signal_add_full (int priority,
int signum,
GSourceFunc handler,
gpointer user_data,
GDestroyNotify notify)
{
guint id;
GSource *source;
@@ -260,3 +260,25 @@ g_unix_signal_add_watch_full (int signum,
return id;
}
/**
* g_unix_signal_add_full:
* @signum: Signal number
* @handler: Callback
* @user_data: Data for @handler
*
* A convenience function for g_unix_signal_source_new(), which
* attaches to the default #GMainContext. You can remove the watch
* using g_source_remove().
*
* Returns: An ID (greater than 0) for the event source
*
* Since: 2.30
*/
guint
g_unix_signal_add (int signum,
GSourceFunc handler,
gpointer user_data)
{
return g_unix_signal_add_full (G_PRIORITY_DEFAULT, signum, handler, user_data, NULL);
}