Esempio n. 1
0
/* ViewFind {{{ */
static VALUE
ViewFind(VALUE value,
  int first)
{
  int flags = 0;
  VALUE parsed = Qnil;
  char buf[50] = { 0 };

  subSubtlextConnect(NULL); ///< Implicit open connection

  /* Check object type */
  switch(rb_type(parsed = subSubtlextParse(
      value, buf, sizeof(buf), &flags)))
    {
      case T_SYMBOL:
        if(CHAR2SYM("visible") == parsed)
          return subViewSingVisible(Qnil);
        else if(CHAR2SYM("all") == parsed)
          return subViewSingList(Qnil);
        else if(CHAR2SYM("current") == parsed)
          return subViewSingCurrent(Qnil);
        break;
      case T_OBJECT:
        if(rb_obj_is_instance_of(value, rb_const_get(mod, rb_intern("View"))))
          return parsed;
    }

  return subSubtlextFindObjects("_NET_DESKTOP_NAMES", "View",
    buf, flags, first);
} /* }}} */
Esempio n. 2
0
File: sublet.c Progetto: guns/subtle
VALUE
subSubletSingFind(VALUE self,
  VALUE value)
{
  int flags = 0;
  VALUE parsed = Qnil;
  char buf[50] = { 0 };

  subSubtlextConnect(NULL); ///< Implicit open connection

  /* Check object type */
  switch(rb_type(parsed = subSubtlextParse(
      value, buf, sizeof(buf), &flags)))
    {
      case T_SYMBOL:
        if(CHAR2SYM("all") == parsed)
          return subSubletSingAll(Qnil);
        break;
      case T_OBJECT:
        if(rb_obj_is_instance_of(value, rb_const_get(mod, rb_intern("Sublet"))))
          return parsed;
    }

  return subSubtlextFindObjects("SUBTLE_SUBLET_LIST", "Sublet", buf, flags);
} /* }}} */