예제 #1
0
static bool
plugin_object_set_property (NPObject        *npobj,
			    NPIdentifier     name,
			    const NPVariant *value)
{
  PluginObject *obj;

  g_return_val_if_fail (plugin_object_has_property (npobj, name), FALSE);

  obj = (PluginObject*) npobj;
  if (obj->listener)
    funcs.releaseobject (obj->listener);

  obj->listener = NULL;
  if (NPVARIANT_IS_OBJECT (*value))
    {
      obj->listener = NPVARIANT_TO_OBJECT (*value);
      funcs.retainobject (obj->listener);
      return TRUE;
    }
  else if (NPVARIANT_IS_NULL (*value))
    return TRUE;

  return FALSE;
}
static bool
plugin_object_get_property (NPObject     *npobj,
                            NPIdentifier  name,
                            NPVariant    *result)
{
  PluginObject *obj;

  if (!plugin_object_has_property (npobj, name))
    return FALSE;

  obj = (PluginObject*) npobj;
  if (name == api_version_id)
    return plugin_get_api_version (obj, result);
  else if (name == shell_version_id)
    return plugin_get_shell_version (obj, result);
  else if (name == onextension_changed_id)
    {
      if (obj->listener)
        OBJECT_TO_NPVARIANT (obj->listener, *result);
      else
        NULL_TO_NPVARIANT (*result);
    }
  else if (name == onrestart_id)
    {
      if (obj->restart_listener)
        OBJECT_TO_NPVARIANT (obj->restart_listener, *result);
      else
        NULL_TO_NPVARIANT (*result);
    }

  return TRUE;
}
예제 #3
0
static bool
plugin_object_get_property (NPObject     *npobj,
			    NPIdentifier  name,
			    NPVariant    *result)
{
  PluginObject *obj;

  g_return_val_if_fail (plugin_object_has_property (npobj, name), FALSE);

  obj = (PluginObject*) npobj;
  if (obj->listener)
    OBJECT_TO_NPVARIANT (obj->listener, *result);
  else
    NULL_TO_NPVARIANT (*result);

  return TRUE;
}