Really initialize desktop widgets
This commit is contained in:
parent
dc82146aff
commit
3d2224a8d4
18
src/widget.c
18
src/widget.c
|
@ -47,9 +47,17 @@ DesktopWidget * desktop_widget_new(char const * name)
|
||||||
|
|
||||||
if((widget = object_new(sizeof(*widget))) == NULL)
|
if((widget = object_new(sizeof(*widget))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if((widget->plugin = plugin_new(LIBDIR, "Desktop", "widget", name))
|
widget->definition = NULL;
|
||||||
== NULL || (widget->definition = plugin_lookup(
|
widget->dplugin = NULL;
|
||||||
widget->plugin, "widget")) == NULL)
|
if((widget->plugin = plugin_new(LIBDIR, "Desktop", "widget",
|
||||||
|
name)) == NULL
|
||||||
|
|| (widget->definition = plugin_lookup(widget->plugin,
|
||||||
|
"widget")) == NULL
|
||||||
|
|| widget->definition->init == NULL
|
||||||
|
|| widget->definition->destroy == NULL
|
||||||
|
|| widget->definition->get_widget == NULL
|
||||||
|
|| (widget->dplugin = widget->definition->init(name))
|
||||||
|
== NULL)
|
||||||
{
|
{
|
||||||
desktop_widget_delete(widget);
|
desktop_widget_delete(widget);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -61,8 +69,8 @@ DesktopWidget * desktop_widget_new(char const * name)
|
||||||
/* desktop_widget_delete */
|
/* desktop_widget_delete */
|
||||||
void desktop_widget_delete(DesktopWidget * widget)
|
void desktop_widget_delete(DesktopWidget * widget)
|
||||||
{
|
{
|
||||||
if(widget->definition != NULL && widget->plugin != NULL)
|
if(widget->definition != NULL && widget->dplugin != NULL)
|
||||||
widget->definition->destroy(widget->plugin);
|
widget->definition->destroy(widget->dplugin);
|
||||||
if(widget->plugin != NULL)
|
if(widget->plugin != NULL)
|
||||||
plugin_delete(widget->plugin);
|
plugin_delete(widget->plugin);
|
||||||
object_delete(widget);
|
object_delete(widget);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user