Ejemplo n.º 1
0
static void
bookmarks_set_empty (gboolean empty)
{
    GtkTreeIter iter;

    if (empty)
    {
        gtk_tree_view_set_model (bookmark_list_widget,
                                 GTK_TREE_MODEL (bookmark_empty_list_store));
        gtk_widget_set_sensitive (GTK_WIDGET (bookmark_list_widget), FALSE);
    }
    else
    {
        gtk_tree_view_set_model (bookmark_list_widget,
                                 GTK_TREE_MODEL (bookmark_list_store));
        gtk_widget_set_sensitive (GTK_WIDGET (bookmark_list_widget), TRUE);

        if (caja_bookmark_list_length (bookmarks) > 0 &&
                !get_selection_exists ())
        {
            gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (bookmark_list_store),
                                           &iter, NULL, 0);
            gtk_tree_selection_select_iter (bookmark_selection, &iter);
        }
    }

    on_selection_changed (bookmark_selection, NULL);
}
static void
on_name_field_changed (GtkEditable *editable,
		       gpointer     user_data)
{
	GtkTreeIter   iter;
	g_return_if_fail(GTK_IS_TREE_VIEW(bookmark_list_widget));
	g_return_if_fail(GTK_IS_ENTRY(name_field));

	if (!get_selection_exists())
		return;

	/* Update text displayed in list instantly. Also remember that 
	 * user has changed text so we update real bookmark later. 
	 */
	gtk_tree_selection_get_selected (bookmark_selection,
					 NULL,
					 &iter);
	
	gtk_list_store_set (bookmark_list_store, 
			    &iter, BOOKMARK_LIST_COLUMN_NAME, 
			    gtk_entry_get_text (GTK_ENTRY (name_field)),
			    -1);
	text_changed = TRUE;
	name_text_changed = TRUE;
}
static NautilusBookmark *
get_selected_bookmark (void)
{
	g_return_val_if_fail(NAUTILUS_IS_BOOKMARK_LIST(bookmarks), NULL);

	if (!get_selection_exists())
		return NULL;

	if (nautilus_bookmark_list_length (bookmarks) < 1)
		return NULL;

	return nautilus_bookmark_list_item_at(bookmarks, get_selected_row ());
}
Ejemplo n.º 4
0
static CajaBookmark *
get_selected_bookmark (void)
{
    g_return_val_if_fail(CAJA_IS_BOOKMARK_LIST(bookmarks), NULL);

    if (!get_selection_exists())
        return NULL;

    if (caja_bookmark_list_length (bookmarks) < 1)
        return NULL;

    return caja_bookmark_list_item_at(bookmarks, get_selected_row ());
}
Ejemplo n.º 5
0
static NemoBookmark *
get_selected_bookmark (void)
{
	g_return_val_if_fail(NEMO_IS_BOOKMARK_LIST(bookmarks), NULL);

	if (!get_selection_exists())
		return NULL;

	if (nemo_bookmark_list_length (bookmarks) < 1)
		return NULL;

	return nemo_bookmark_list_item_at(bookmarks, get_selected_row ());
}
Ejemplo n.º 6
0
static NautilusBookmark *
get_selected_bookmark (NautilusBookmarksWindow *self)
{
	if (!get_selection_exists (self)) {
		return NULL;
	}

	if (nautilus_bookmark_list_length (self->priv->bookmarks) < 1) {
		return NULL;
	}

	return nautilus_bookmark_list_item_at (self->priv->bookmarks,
					       get_selected_row (self));
}
static guint
get_selected_row (void)
{
	GtkTreeIter       iter;
	GtkTreePath      *path;
	GtkTreeModel     *model;
	gint		 *indices, row;
	
	g_assert (get_selection_exists());
	
	model = GTK_TREE_MODEL (bookmark_list_store);
	gtk_tree_selection_get_selected (bookmark_selection,
					 &model,
					 &iter);
	
	path = gtk_tree_model_get_path (model, &iter);
	indices = gtk_tree_path_get_indices (path);
	row = indices[0];
	gtk_tree_path_free (path);
	return row;
}
Ejemplo n.º 8
0
static void
on_name_field_changed (GtkEditable *editable,
		       gpointer     user_data)
{
	NautilusBookmarksWindow *self = user_data;
	GtkTreeIter   iter;

	if (!get_selection_exists(self)) {
		return;
	}

	/* Update text displayed in list instantly. Also remember that 
	 * user has changed text so we update real bookmark later. 
	 */
	gtk_tree_selection_get_selected (self->priv->selection, NULL, &iter);
	gtk_list_store_set (self->priv->model,
			    &iter, BOOKMARK_LIST_COLUMN_NAME, 
			    gtk_entry_get_text (GTK_ENTRY (self->priv->name_field)),
			    -1);

	self->priv->text_changed = TRUE;
	self->priv->name_text_changed = TRUE;
}
Ejemplo n.º 9
0
static void
bookmarks_set_empty (NautilusBookmarksWindow *self,
		     gboolean empty)
{
	GtkTreeIter iter;

	if (empty) {
		setup_empty_list (self);
		gtk_widget_set_sensitive (GTK_WIDGET (self->priv->tree_view), FALSE);
	} else {
		gtk_tree_view_set_model (self->priv->tree_view, GTK_TREE_MODEL (self->priv->model));
		gtk_widget_set_sensitive (GTK_WIDGET (self->priv->tree_view), TRUE);

		if (nautilus_bookmark_list_length (self->priv->bookmarks) > 0 &&
		    !get_selection_exists (self)) {
			gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (self->priv->model),
						       &iter, NULL, 0);
			gtk_tree_selection_select_iter (self->priv->selection, &iter);
		}
	}

	on_selection_changed (self->priv->selection, self);
}