fix small bug

This commit is contained in:
Jonathan Blandford 2002-05-14 18:35:51 +00:00
parent b87cde513f
commit ac2ae66136

View file

@ -41,6 +41,7 @@ static GtkTargetEntry drop_types[] =
static gint n_drop_types = sizeof (drop_types) / sizeof (GtkTargetEntry);
static gboolean setting_model = FALSE;
static gboolean initial_scroll = TRUE;
static GladeXML *
create_dialog (void)
@ -141,13 +142,17 @@ read_themes (GladeXML *dialog)
if (strcmp (current_theme, info->name) == 0)
{
GtkTreeSelection *selection;
GtkTreePath *path;
selection = gtk_tree_view_get_selection (tree_view);
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (model, &iter);
row_ref = gtk_tree_row_reference_new (model, path);
gtk_tree_path_free (path);
if (initial_scroll)
{
GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter);
row_ref = gtk_tree_row_reference_new (model, path);
gtk_tree_path_free (path);
}
current_theme_found = TRUE;
}
@ -166,27 +171,34 @@ read_themes (GladeXML *dialog)
{
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
GtkTreeIter iter;
GtkTreePath *path;
gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
THEME_NAME_COLUMN, current_theme,
-1);
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (model, &iter);
row_ref = gtk_tree_row_reference_new (model, path);
gtk_tree_path_free (path);
if (initial_scroll)
{
GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter);
row_ref = gtk_tree_row_reference_new (model, path);
gtk_tree_path_free (path);
}
}
if (row_ref)
if (row_ref && initial_scroll)
{
GtkTreePath *path;
path = gtk_tree_row_reference_get_path (row_ref);
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, TRUE, 0.5, 0.0);
gtk_tree_path_free (path);
gtk_tree_row_reference_free (row_ref);
initial_scroll = FALSE;
}
setting_model = FALSE;