No longer requiring any value returned by the "destroy" callback in plug-ins

This commit is contained in:
Pierre Pronchery 2011-10-25 11:09:15 +00:00
parent 565aaca97d
commit 3b39d8b75c
12 changed files with 26 additions and 34 deletions

View File

@ -51,7 +51,7 @@ struct _PhonePlugin
char const * name;
char const * icon;
int (*init)(PhonePlugin * plugin);
int (*destroy)(PhonePlugin * plugin);
void (*destroy)(PhonePlugin * plugin);
int (*event)(PhonePlugin * plugin, PhoneEvent * event);
void (*settings)(PhonePlugin * plugin);
void * priv;

View File

@ -3685,8 +3685,8 @@ static int _phone_unload(Phone * phone, PhonePlugin * plugin)
fprintf(stderr, "DEBUG: %s() plugin %lu\n", __func__,
(unsigned long)i);
#endif
if(plugin->destroy != NULL && plugin->destroy(plugin) != 0)
phone_error(phone, error_get(), 0);
if(plugin->destroy != NULL)
plugin->destroy(plugin);
plugin_delete(phone->plugins[i].p);
memmove(&phone->plugins[i], &phone->plugins[i + 1],
sizeof(*phone->plugins)

View File

@ -36,7 +36,7 @@ typedef struct _Blacklist
/* prototypes */
static int _blacklist_init(PhonePlugin * plugin);
static int _blacklist_destroy(PhonePlugin * plugin);
static void _blacklist_destroy(PhonePlugin * plugin);
static int _blacklist_event(PhonePlugin * plugin, PhoneEvent * event);
static void _blacklist_settings(PhonePlugin * plugin);
@ -88,14 +88,13 @@ static void _init_foreach(char const * variable, char const * value,
/* blacklist_destroy */
static int _blacklist_destroy(PhonePlugin * plugin)
static void _blacklist_destroy(PhonePlugin * plugin)
{
Blacklist * blacklist = plugin->priv;
if(blacklist->window != NULL)
gtk_widget_destroy(blacklist->window);
object_delete(blacklist);
return 0;
}

View File

@ -87,7 +87,7 @@ static DebugPhoneEvents _debug_phone_events[] =
/* prototypes */
/* plug-in */
static int _debug_init(PhonePlugin * plugin);
static int _debug_destroy(PhonePlugin * plugin);
static void _debug_destroy(PhonePlugin * plugin);
static int _debug_event(PhonePlugin * plugin, PhoneEvent * event);
static void _debug_settings(PhonePlugin * plugin);
@ -213,13 +213,12 @@ static void _on_debug_queue_execute(gpointer data)
/* debug_destroy */
static int _debug_destroy(PhonePlugin * plugin)
static void _debug_destroy(PhonePlugin * plugin)
{
Debug * debug = plugin->priv;
gtk_widget_destroy(debug->window);
object_delete(debug);
return 0;
}

View File

@ -159,7 +159,7 @@ static struct
/* prototypes */
static int _engineering_init(PhonePlugin * plugin);
static int _engineering_destroy(PhonePlugin * plugin);
static void _engineering_destroy(PhonePlugin * plugin);
static double _engineering_get_frequency(unsigned int arfcn);
@ -326,7 +326,7 @@ static int _engineering_init(PhonePlugin * plugin)
/* engineering_destroy */
static int _engineering_destroy(PhonePlugin * plugin)
static void _engineering_destroy(PhonePlugin * plugin)
{
Engineering * engineering = plugin->priv;
@ -334,7 +334,6 @@ static int _engineering_destroy(PhonePlugin * plugin)
g_source_remove(engineering->source);
gtk_widget_destroy(engineering->window);
free(engineering);
return 0;
}

View File

@ -55,7 +55,7 @@ typedef struct _GPRS
/* prototypes */
/* plugins */
static int _gprs_init(PhonePlugin * plugin);
static int _gprs_destroy(PhonePlugin * plugin);
static void _gprs_destroy(PhonePlugin * plugin);
static int _gprs_event(PhonePlugin * plugin, PhoneEvent * event);
static void _gprs_settings(PhonePlugin * plugin);
@ -132,7 +132,7 @@ static int _gprs_init(PhonePlugin * plugin)
/* gprs_destroy */
static int _gprs_destroy(PhonePlugin * plugin)
static void _gprs_destroy(PhonePlugin * plugin)
{
GPRS * gprs = plugin->priv;
@ -144,7 +144,6 @@ static int _gprs_destroy(PhonePlugin * plugin)
if(gprs->window != NULL)
gtk_widget_destroy(gprs->window);
object_delete(gprs);
return 0;
}

View File

@ -70,7 +70,7 @@ typedef struct _Openmoko
/* prototypes */
/* plug-in */
static int _openmoko_init(PhonePlugin * plugin);
static int _openmoko_destroy(PhonePlugin * plugin);
static void _openmoko_destroy(PhonePlugin * plugin);
static int _openmoko_event(PhonePlugin * plugin, PhoneEvent * event);
static void _openmoko_deepsleep(PhonePlugin * plugin);
static void _openmoko_queue(PhonePlugin * plugin, char const * command);
@ -117,7 +117,7 @@ static int _openmoko_init(PhonePlugin * plugin)
/* openmoko_destroy */
static int _openmoko_destroy(PhonePlugin * plugin)
static void _openmoko_destroy(PhonePlugin * plugin)
{
Openmoko * openmoko = plugin->priv;
@ -125,7 +125,6 @@ static int _openmoko_destroy(PhonePlugin * plugin)
if(openmoko->window != NULL)
gtk_widget_destroy(openmoko->window);
object_delete(openmoko);
return 0;
}

View File

@ -54,7 +54,7 @@ typedef struct _OSS
/* prototypes */
static int _oss_init(PhonePlugin * plugin);
static int _oss_destroy(PhonePlugin * plugin);
static void _oss_destroy(PhonePlugin * plugin);
static int _oss_event(PhonePlugin * plugin, PhoneEvent * event);
static int _oss_open(PhonePlugin * plugin);
static void _oss_settings(PhonePlugin * plugin);
@ -93,7 +93,7 @@ static int _oss_init(PhonePlugin * plugin)
/* oss_destroy */
static int _oss_destroy(PhonePlugin * plugin)
static void _oss_destroy(PhonePlugin * plugin)
{
OSS * oss = plugin->priv;
@ -101,8 +101,7 @@ static int _oss_destroy(PhonePlugin * plugin)
close(oss->fd);
if(oss->window != NULL)
gtk_widget_destroy(oss->window);
free(oss);
return 0;
object_delete(oss);
}

View File

@ -82,7 +82,7 @@ typedef struct _Panel
/* prototypes */
static int _panel_init(PhonePlugin * plugin);
static int _panel_destroy(PhonePlugin * plugin);
static void _panel_destroy(PhonePlugin * plugin);
static int _panel_event(PhonePlugin * plugin, PhoneEvent * event);
static void _panel_settings(PhonePlugin * plugin);
@ -245,7 +245,7 @@ static gboolean _on_battery_timeout(gpointer data)
/* panel_destroy */
static int _panel_destroy(PhonePlugin * plugin)
static void _panel_destroy(PhonePlugin * plugin)
{
Panel * panel = plugin->priv;
@ -254,7 +254,7 @@ static int _panel_destroy(PhonePlugin * plugin)
if(panel->timeout != 0)
g_source_remove(panel->timeout);
gtk_widget_destroy(panel->hbox);
return 0;
object_delete(panel);
}

View File

@ -91,7 +91,7 @@ static ProfileDefinition _profiles_definitions[] =
/* prototypes */
static int _profiles_init(PhonePlugin * plugin);
static int _profiles_destroy(PhonePlugin * plugin);
static void _profiles_destroy(PhonePlugin * plugin);
static int _profiles_event(PhonePlugin * plugin, PhoneEvent * event);
static void _profiles_settings(PhonePlugin * plugin);
@ -189,7 +189,7 @@ static gboolean _init_idle(gpointer data)
/* profiles_destroy */
static int _profiles_destroy(PhonePlugin * plugin)
static void _profiles_destroy(PhonePlugin * plugin)
{
Profiles * profiles = plugin->priv;
@ -206,7 +206,6 @@ static int _profiles_destroy(PhonePlugin * plugin)
pa_context_unref(profiles->pac);
pa_threaded_mainloop_free(profiles->pam);
object_delete(profiles);
return 0;
}

View File

@ -44,7 +44,7 @@ typedef struct _SMSCrypt
static void _smscrypt_clear(PhonePlugin * plugin);
static gboolean _smscrypt_confirm(PhonePlugin * plugin, char const * message);
static int _smscrypt_init(PhonePlugin * plugin);
static int _smscrypt_destroy(PhonePlugin * plugin);
static void _smscrypt_destroy(PhonePlugin * plugin);
static int _smscrypt_event(PhonePlugin * plugin, PhoneEvent * event);
static int _smscrypt_secret(PhonePlugin * plugin, char const * number);
static void _smscrypt_settings(PhonePlugin * plugin);
@ -132,14 +132,13 @@ static void _init_foreach(char const * variable, char const * value,
/* smscrypt_destroy */
static int _smscrypt_destroy(PhonePlugin * plugin)
static void _smscrypt_destroy(PhonePlugin * plugin)
{
SMSCrypt * smscrypt = plugin->priv;
if(smscrypt->window != NULL)
gtk_widget_destroy(smscrypt->window);
free(smscrypt);
return 0;
}

View File

@ -38,7 +38,7 @@ typedef struct _Systray
/* prototypes */
/* plug-in */
static int _systray_init(PhonePlugin * plugin);
static int _systray_destroy(PhonePlugin * plugin);
static void _systray_destroy(PhonePlugin * plugin);
/* callbacks */
#if GTK_CHECK_VERSION(2, 10, 0)
@ -94,12 +94,12 @@ static int _systray_init(PhonePlugin * plugin)
/* systray_destroy */
static int _systray_destroy(PhonePlugin * plugin)
static void _systray_destroy(PhonePlugin * plugin)
{
Systray * systray = plugin->priv;
g_object_unref(systray->icon);
return 0;
object_delete(systray);
}