Esempio n. 1
0
/* *****************************************************************************
 * load and initialize and external module
 */
gboolean nav_init (const gchar *mod_path, const gchar *mod_name)
{
    gchar *t_path;

    nav_close ();

    t_path = g_module_build_path (mod_path, mod_name);
    nav_module = g_module_open (t_path, G_MODULE_BIND_LAZY);
    if (!nav_module)
    {
        g_print (_("WARNING: %s\n"), g_module_error ());
        return FALSE;
    }
    if (!g_module_symbol (nav_module, "calculate_route", (gpointer *)&calculate_route))
    {
        g_print (_("ERROR: %s\n"), g_module_error ());
        nav_close ();
        return FALSE;
    }
    if (calculate_route == NULL)
    {
        g_print (_("ERROR: Missing symbol \"calculate_route\" in navigation module '%s'\n"),
                 g_module_name (nav_module));
        nav_close ();
        return FALSE;
    }

    g_print (_("Navigation module '%s' successfully loaded.\n"), g_module_name (nav_module));

    return TRUE;
}
Esempio n. 2
0
static void
nav_insert_page(navigator_t *nav, nav_page_t *np, prop_t *origin)
{
  nav_page_t *np2;

  if(prop_set_parent(np->np_prop_root, nav->nav_prop_pages)) {
    /* nav->nav_prop_pages is a zombie, this is an error */
    abort();
  }

  if(np->np_inhistory == 0) {
    if(nav->nav_page_current != NULL) {
      
      /* Destroy any previous "future" histories,
       * this happens if we back a few times and then jumps away
       * in another "direction"
       */
      
      while((np2 = TAILQ_NEXT(nav->nav_page_current, np_history_link)) != NULL)
	nav_close(np2, 1);
    }

    TAILQ_INSERT_TAIL(&nav->nav_history, np, np_history_link);
    np->np_inhistory = 1;
  }
  nav_select(nav, np, origin);
}
Esempio n. 3
0
static void
nav_close_all(navigator_t *nav, int with_prop)
{
  nav_page_t *np;

  while((np = TAILQ_LAST(&nav->nav_pages, nav_page_queue)) != NULL)
    nav_close(np, with_prop);
}
Esempio n. 4
0
static void
nav_back(navigator_t *nav)
{
  nav_page_t *prev, *np = nav->nav_page_current;

  if(np != NULL &&
     (prev = TAILQ_PREV(np, nav_page_queue, np_history_link)) != NULL) {

    nav_select(nav, prev, NULL);

    if(np->np_direct_close)
      nav_close(np, 1);
  }
}
Esempio n. 5
0
static void
nav_page_close_set(void *opaque, int value)
{
  nav_page_t *np = opaque, *np2;
  navigator_t *nav = np->np_nav;
  if(!value)
    return;

  if(nav->nav_page_current == np) {
    np2 = TAILQ_PREV(np, nav_page_queue, np_history_link);
    nav_select(nav, np2, NULL);
  }

  nav_close(np, 1);
}