Ejemplo n.º 1
0
static void
vinagre_bookmarks_fill_tree (GSList *entries, GtkTreeStore *store, GtkTreeIter *parent, GdkPixbuf *pixbuf)
{
  GSList                *l;
  GtkTreeIter            iter;
  VinagreBookmarksEntry *entry;

  for (l = entries; l; l = l->next)
    {
      entry = VINAGRE_BOOKMARKS_ENTRY (l->data);
      if (vinagre_bookmarks_entry_get_node (entry) != VINAGRE_BOOKMARKS_ENTRY_NODE_FOLDER)
	continue;

      gtk_tree_store_append (store, &iter, parent);
      gtk_tree_store_set (store, &iter,
                          IMAGE_COL, pixbuf,
                          NAME_COL, vinagre_bookmarks_entry_get_name (entry),
                          ENTRY_COL, entry,
		          -1);
      vinagre_bookmarks_fill_tree (vinagre_bookmarks_entry_get_children (entry),
				   store,
				   &iter,
				   pixbuf);
    }
}
Ejemplo n.º 2
0
gboolean
vinagre_bookmarks_entry_remove_child (VinagreBookmarksEntry *entry,
				      VinagreBookmarksEntry *child)
{
  GSList *l;

  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), FALSE);
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (child), FALSE);

  if (g_slist_index (entry->priv->children, child) > -1)
    {
      entry->priv->children = g_slist_remove (entry->priv->children, child);
      return TRUE;
    }

  for (l = entry->priv->children; l; l = l->next)
    {
      VinagreBookmarksEntry *e = (VinagreBookmarksEntry *) l->data;

      if (vinagre_bookmarks_entry_get_node (e) != VINAGRE_BOOKMARKS_ENTRY_NODE_FOLDER)
	continue;

      if (vinagre_bookmarks_entry_remove_child (e, child))
	return TRUE;
    }

  return FALSE;
}