Namespace

Class Index [+]

Quicksearch

Notify

Constants

VERSION

Public Class Methods

init(name) click to toggle source

name = application name (required)

Initialize libnotify. This must be called before any other functions. Throw an expection If name is empty or nil

Returns TRUE if the library initialized properly, FALSE otherwise

static VALUE
_wrap_notify_init(VALUE self, VALUE app_name)
{
  gboolean init;
  char *name = NIL_P(app_name) ? NULL : StringValuePtr(app_name);

  if(name == NULL || *name == '\0')
    rb_raise(rb_eRuntimeError,
             "You MUST call this method with a valid string that will be used as Application name");
  else
    init = notify_init(name);

  if(init == TRUE)
    return Qtrue;

  return Qfalse;
}
init? click to toggle source

Returns TRUE if libnotify is inizialized, FALSE otherwise

static VALUE
_wrap_notify_is_initted(VALUE self)
{
  if(notify_is_initted())
    return Qtrue;

  return Qfalse;
}
name click to toggle source

Returns the application name passed to Notify.init

static VALUE
_wrap_notify_get_app_name(VALUE self)
{
  const gchar *name = notify_get_app_name();

  return rb_str_new2(name);
}
name= new_name click to toggle source

if new_name is a valid string, change the application name to new_name otherwise nothing will be changed

** ONLY WHEN COMPILED AGAINST LIBNOTIFY >= 0.7.2 **

static VALUE
_wrap_notify_set_app_name(VALUE self, VALUE app_name)
{
  char *name = NIL_P(app_name) ? NULL : StringValuePtr(app_name);

  if(name != NULL || *name != '\0')
    notify_set_app_name(name);

  return Qnil;
}
server_caps click to toggle source

Queries the server for its capabilities and returns them in an Array

static VALUE
_wrap_notify_get_server_caps(VALUE self)
{
  GList *caps = NULL;
  VALUE rb_caps;

  caps = notify_get_server_caps();
  rb_caps = rb_ary_new();

  do
  {
      rb_ary_push(rb_caps, rb_str_new2(caps->data));
      caps = caps->next;
  } while(caps != NULL);

  g_list_foreach(caps, (GFunc)g_free, NULL);
  g_list_free(caps);

  return rb_caps;
}
server_info click to toggle source

Queries the server for its information (name, vendor, server version, notification version)

Returns FALSE if there were errors, an Hash otherwise

example:

     h = Notify.server_info
     p h[:name]                #print the product name of the server
     p h[:vendor]              #print the vendor
     p h[:version]             #print the server version
     p h[:spec_version]        #print the specification version supported
static VALUE
_wrap_notify_get_server_info(VALUE self)
{
  gchar *serv_name = NULL,
           *vendor = NULL,
           *serv_version = NULL,
           *spec_vers = NULL;
  VALUE rb_info;

  if(!notify_get_server_info(&serv_name, &vendor, &serv_version, &spec_vers))
    return Qfalse;
  else
  {
    rb_info = rb_hash_new();
    rb_hash_aset(rb_info, ID2SYM(rb_intern("name")), rb_str_new2(serv_name));
    rb_hash_aset(rb_info, ID2SYM(rb_intern("vendor")), rb_str_new2(vendor));
    rb_hash_aset(rb_info, ID2SYM(rb_intern("version")), rb_str_new2(serv_version));
    rb_hash_aset(rb_info, ID2SYM(rb_intern("spec_version")), rb_str_new2(spec_vers));

    g_free(serv_name);
    g_free(vendor);
    g_free(serv_version);
    g_free(spec_vers);
   }

  return rb_info;
}
uninit click to toggle source

Deinitialize libnotify, you must to call this before quit the program

static VALUE
_wrap_notify_uninit(VALUE self)
{
  notify_uninit();

  return Qnil;
}

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.