Example #1
0
File: main.c Project: Tilka/ncdc
static void open_autoconnect() {
  char **hubs = db_vars_hubs();
  char **hub;
  // TODO: make sure the tabs are opened in the same order as they were in the last run?
  for(hub=hubs; *hub; hub++)
    if(var_get_bool(db_vars_hubid(*hub), VAR_autoconnect))
      ui_tab_open(uit_hub_create(*hub+1, TRUE), FALSE, NULL);
  listen_refresh();
  g_strfreev(hubs);
}
Example #2
0
File: vars.c Project: srijan/ncdc
static char *p_hubname(const char *val, GError **err) {
  if(val[0] == '#')
    val++;
  char *g = g_strdup_printf("#%s", val);
  if(!is_valid_hubname(g+1)) {
    g_set_error_literal(err, 1, 0, "Illegal characters or too long.");
    g_free(g);
    return NULL;
  } else if(db_vars_hubid(g)) {
    g_set_error_literal(err, 1, 0, "Name already used.");
    g_free(g);
    return NULL;
  }
  return g;
}