示例#1
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;
}
示例#2
0
void
vinagre_bookmarks_entry_add_child (VinagreBookmarksEntry *entry, VinagreBookmarksEntry *child)
{
  g_return_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry));
  g_return_if_fail (entry->priv->node == VINAGRE_BOOKMARKS_ENTRY_NODE_FOLDER);
  g_return_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (child));

  entry->priv->children = g_slist_insert_sorted (entry->priv->children,
						 child,
						 (GCompareFunc)vinagre_bookmarks_entry_compare);
  child->priv->parent = entry;
}
示例#3
0
gboolean
vinagre_bookmarks_tree_select_entry (VinagreBookmarksTree *tree,
				     VinagreBookmarksEntry *entry)
{
  GtkTreeModel          *model;
  struct _find_entry     f;

  if (!entry)
    return FALSE;
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_TREE (tree), FALSE);
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), FALSE);

  model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree->priv->tree));
  f.entry = entry;
  f.found = FALSE;

  gtk_tree_model_foreach (model, find_entry, &f);
  if (f.found)
    {
      gtk_tree_view_expand_to_path (GTK_TREE_VIEW (tree->priv->tree), f.path);
      gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree->priv->tree), f.path, NULL, FALSE);
      gtk_tree_path_free (f.path);
      return TRUE;
    }
  else
    return FALSE;
}
示例#4
0
VinagreBookmarksEntry *
vinagre_bookmarks_entry_get_parent (VinagreBookmarksEntry *entry)
{
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), NULL);

  return entry->priv->parent;
}
示例#5
0
GSList *
vinagre_bookmarks_entry_get_children (VinagreBookmarksEntry *entry)
{
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), NULL);

  return entry->priv->children;
}
示例#6
0
const gchar *
vinagre_bookmarks_entry_get_name (VinagreBookmarksEntry *entry)
{
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), NULL);

  return entry->priv->name;
}
示例#7
0
VinagreConnection *
vinagre_bookmarks_entry_get_conn (VinagreBookmarksEntry *entry)
{
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), NULL);

  return entry->priv->conn;
}
示例#8
0
VinagreBookmarksEntryNode
vinagre_bookmarks_entry_get_node (VinagreBookmarksEntry *entry)
{
  g_return_val_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry), VINAGRE_BOOKMARKS_ENTRY_NODE_INVALID);

  return entry->priv->node;
}
示例#9
0
void
vinagre_bookmarks_entry_set_node (VinagreBookmarksEntry *entry, VinagreBookmarksEntryNode node)
{
  g_return_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry));

  if (entry->priv->node == node)
    return;

  entry->priv->node = node;

  switch (entry->priv->node)
    {
      case VINAGRE_BOOKMARKS_ENTRY_NODE_CONN:
	g_free (entry->priv->name);
	entry->priv->name = NULL;
	g_slist_foreach (entry->priv->children, (GFunc) g_object_unref, NULL);
	g_slist_free (entry->priv->children);
	entry->priv->children = NULL;
	break;

      case VINAGRE_BOOKMARKS_ENTRY_NODE_FOLDER:
	if (entry->priv->conn)
	  {
	    g_object_unref (entry->priv->conn);
	    entry->priv->conn = NULL;
	  }
	break;

      default:
	g_assert_not_reached ();
    }
}
示例#10
0
void
vinagre_bookmarks_entry_set_name (VinagreBookmarksEntry *entry, const gchar *name)
{
  g_return_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry));
  g_return_if_fail (entry->priv->node == VINAGRE_BOOKMARKS_ENTRY_NODE_FOLDER);
  g_return_if_fail (name != NULL);

  g_free (entry->priv->name);
  entry->priv->name = g_strdup (name);
}
示例#11
0
void
vinagre_bookmarks_entry_set_conn (VinagreBookmarksEntry *entry, VinagreConnection *conn)
{
  g_return_if_fail (VINAGRE_IS_BOOKMARKS_ENTRY (entry));
  g_return_if_fail (VINAGRE_IS_CONNECTION (conn));
  g_return_if_fail (entry->priv->node == VINAGRE_BOOKMARKS_ENTRY_NODE_CONN);

  if (entry->priv->conn != NULL)
    g_object_unref (entry->priv->conn);

  entry->priv->conn = g_object_ref (conn);
}