[gthumb/ext] Fixed expand_all event in the folder tree view.
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] Fixed expand_all event in the folder tree view.
- Date: Fri, 25 Dec 2009 18:40:51 +0000 (UTC)
commit 6a64abdc1eb32d3f4fb5f3e3ce6f44440a01f5fb
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Dec 25 19:39:04 2009 +0100
Fixed expand_all event in the folder tree view.
gthumb/gth-browser.c | 50 +++++++++++++++----------
gthumb/gth-folder-tree.c | 89 ----------------------------------------------
gthumb/main.c | 6 ++--
3 files changed, 33 insertions(+), 112 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 7ba0d0a..d821708 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1226,7 +1226,7 @@ load_data_load_next_folder (LoadData *load_data)
}
while (TRUE);
- if (g_file_equal (folder_to_load, load_data->requested_folder->file))
+ if ((load_data->action != GTH_ACTION_LIST_CHILDREN) && g_file_equal (folder_to_load, load_data->requested_folder->file))
gth_file_source_read_metadata (load_data->file_source,
load_data->requested_folder,
GFILE_BASIC_ATTRIBUTES ",access::*,sort::*",
@@ -1307,17 +1307,16 @@ load_data_continue (LoadData *load_data,
load_data_done (load_data, NULL);
switch (load_data->action) {
- case GTH_ACTION_VIEW:
+ case GTH_ACTION_GO_TO:
case GTH_ACTION_GO_BACK:
case GTH_ACTION_GO_FORWARD:
- case GTH_ACTION_GO_TO:
+ case GTH_ACTION_GO_UP:
+ case GTH_ACTION_VIEW:
+ case GTH_ACTION_LIST_CHILDREN:
if (path != NULL) {
GList *entry_points;
GList *scan;
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (browser->priv->folder_tree), path, NULL, FALSE, .0, .0);
- gth_folder_tree_select_path (GTH_FOLDER_TREE (browser->priv->folder_tree), path);
-
/* expand the path if it's an entry point */
entry_points = gth_main_get_all_entry_points ();
@@ -1330,6 +1329,11 @@ load_data_continue (LoadData *load_data,
}
}
+ if (load_data->action != GTH_ACTION_LIST_CHILDREN) {
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (browser->priv->folder_tree), path, NULL, FALSE, 0.0, 0.0);
+ gth_folder_tree_select_path (GTH_FOLDER_TREE (browser->priv->folder_tree), path);
+ }
+
_g_object_list_unref (entry_points);
}
break;
@@ -1338,11 +1342,11 @@ load_data_continue (LoadData *load_data,
}
switch (load_data->action) {
- case GTH_ACTION_VIEW:
+ case GTH_ACTION_GO_TO:
case GTH_ACTION_GO_BACK:
case GTH_ACTION_GO_FORWARD:
- case GTH_ACTION_GO_INTO:
- case GTH_ACTION_GO_TO:
+ case GTH_ACTION_GO_UP:
+ case GTH_ACTION_VIEW:
filter = _gth_browser_get_file_filter (browser);
gth_file_list_set_filter (GTH_FILE_LIST (browser->priv->file_list), filter);
gth_file_list_set_files (GTH_FILE_LIST (browser->priv->file_list), files);
@@ -1406,22 +1410,25 @@ metadata_ready_cb (GList *files,
static void
-load_data_ready (LoadData *data,
+load_data_ready (LoadData *load_data,
GList *files,
GError *error)
{
if (error != NULL) {
- load_data_done (data, error);
- load_data_free (data);
+ load_data_done (load_data, error);
+ load_data_free (load_data);
}
- else if (g_file_equal ((GFile *) data->current->data, data->requested_folder->file))
+ else if ((load_data->action != GTH_ACTION_LIST_CHILDREN)
+ && g_file_equal ((GFile *) load_data->current->data, load_data->requested_folder->file))
+ {
_g_query_metadata_async (files,
- _gth_browser_get_list_attributes (data->browser, TRUE),
- data->cancellable,
+ _gth_browser_get_list_attributes (load_data->browser, TRUE),
+ load_data->cancellable,
metadata_ready_cb,
- data);
+ load_data);
+ }
else
- load_data_continue (data, files);
+ load_data_continue (load_data, files);
}
@@ -1519,12 +1526,13 @@ _gth_browser_load (GthBrowser *browser,
LoadData *load_data;
GFile *entry_point;
- _gth_browser_cancel (browser);
-
switch (action) {
+ case GTH_ACTION_GO_TO:
+ case GTH_ACTION_GO_INTO:
case GTH_ACTION_GO_BACK:
case GTH_ACTION_GO_FORWARD:
- case GTH_ACTION_GO_TO:
+ case GTH_ACTION_GO_UP:
+ case GTH_ACTION_VIEW:
if (browser->priv->location_source != NULL) {
gth_file_source_monitor_directory (browser->priv->location_source,
browser->priv->location->file,
@@ -2154,6 +2162,8 @@ folder_tree_list_children_cb (GthFolderTree *folder_tree,
GFile *file,
GthBrowser *browser)
{
+ g_print ("list children: %s\n", g_file_get_uri (file));
+
_gth_browser_load (browser, file, NULL, GTH_ACTION_LIST_CHILDREN, FALSE);
}
diff --git a/gthumb/gth-folder-tree.c b/gthumb/gth-folder-tree.c
index 410ce34..5cdd80d 100644
--- a/gthumb/gth-folder-tree.c
+++ b/gthumb/gth-folder-tree.c
@@ -79,7 +79,6 @@ struct _GthFolderTreePrivate
GthIconCache *icon_cache;
GtkCellRenderer *text_renderer;
GtkTreePath *hover_path;
- GtkTreePath *click_path;
};
@@ -310,12 +309,6 @@ row_expanded_cb (GtkTreeView *tree_view,
GthFileData *file_data;
gboolean loaded;
- if ((folder_tree->priv->click_path == NULL)
- || gtk_tree_path_compare (folder_tree->priv->click_path, expanded_path) != 0)
- {
- return FALSE;
- }
-
gtk_tree_model_get (GTK_TREE_MODEL (folder_tree->priv->tree_store),
expanded_iter,
COLUMN_TYPE, &entry_type,
@@ -326,9 +319,6 @@ row_expanded_cb (GtkTreeView *tree_view,
if ((entry_type == ENTRY_TYPE_FILE) && ! loaded)
g_signal_emit (folder_tree, gth_folder_tree_signals[LIST_CHILDREN], 0, file_data->file);
- gtk_tree_path_free (folder_tree->priv->click_path);
- folder_tree->priv->click_path = NULL;
-
_g_object_unref (file_data);
return FALSE;
@@ -353,11 +343,6 @@ button_press_cb (GtkWidget *widget,
gtk_widget_grab_focus (widget);
- if (folder_tree->priv->click_path != NULL) {
- gtk_tree_path_free (folder_tree->priv->click_path);
- folder_tree->priv->click_path = NULL;
- }
-
if ((event->state & GDK_SHIFT_MASK) || (event->state & GDK_CONTROL_MASK))
return retval;
@@ -466,8 +451,6 @@ button_press_cb (GtkWidget *widget,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
if ((cell_x > start_pos) && gtk_tree_selection_iter_is_selected (selection, &iter))
retval = TRUE;
-
- folder_tree->priv->click_path = gtk_tree_path_copy (path);
}
else if ((event->button == 1) && (event->type == GDK_2BUTTON_PRESS)) {
if (! gtk_tree_view_row_expanded (GTK_TREE_VIEW (folder_tree), path))
@@ -493,62 +476,6 @@ load_uri (GthFolderTree *folder_tree,
}
-static int
-button_release_cb (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- GthFolderTree *folder_tree = data;
- GtkTreeStore *tree_store = folder_tree->priv->tree_store;
- GtkTreePath *path;
- GtkTreeIter iter;
- GtkTreeSelection *selection;
-
- if ((event->state & GDK_SHIFT_MASK) || (event->state & GDK_CONTROL_MASK))
- return FALSE;
-
-return FALSE;
-
- if (event->button != 1)
- return FALSE;
-
- if (! gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (folder_tree),
- event->x, event->y,
- &path, NULL, NULL, NULL))
- {
- return FALSE;
- }
-
- if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_store),
- &iter,
- path))
- {
- gtk_tree_path_free (path);
- return FALSE;
- }
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
- if (gtk_tree_selection_iter_is_selected (selection, &iter)) {
- EntryType entry_type;
- GthFileData *file_data;
-
- gtk_tree_model_get (GTK_TREE_MODEL (tree_store),
- &iter,
- COLUMN_TYPE, &entry_type,
- COLUMN_FILE_DATA, &file_data,
- -1);
-
- load_uri (folder_tree, entry_type, file_data);
-
- _g_object_unref (file_data);
- }
-
- gtk_tree_path_free (path);
-
- return FALSE;
-}
-
-
static gboolean
selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
@@ -564,18 +491,6 @@ selection_changed_cb (GtkTreeSelection *selection,
selected_path = gtk_tree_model_get_path (GTK_TREE_MODEL (folder_tree->priv->tree_store), &iter);
- if ((folder_tree->priv->click_path == NULL)
- || gtk_tree_path_compare (folder_tree->priv->click_path, selected_path) != 0)
- {
- gtk_tree_path_free (selected_path);
- return FALSE;
- }
-
- /* FIXME
- gtk_tree_path_free (folder_tree->priv->click_path);
- folder_tree->priv->click_path = NULL;
- */
-
/*if (! gtk_tree_view_row_expanded (GTK_TREE_VIEW (folder_tree), selected_path))
gtk_tree_view_expand_row (GTK_TREE_VIEW (folder_tree), selected_path, FALSE);*/
@@ -883,10 +798,6 @@ gth_folder_tree_construct (GthFolderTree *folder_tree)
G_CALLBACK (button_press_cb),
folder_tree);
g_signal_connect (G_OBJECT (folder_tree),
- "button_release_event",
- G_CALLBACK (button_release_cb),
- folder_tree);
- g_signal_connect (G_OBJECT (folder_tree),
"row-activated",
G_CALLBACK (row_activated_cb),
folder_tree);
diff --git a/gthumb/main.c b/gthumb/main.c
index 78b4022..3ca7e18 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -369,13 +369,13 @@ main (int argc, char *argv[])
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- /* command line options */
-
#ifdef HAVE_CLUTTER
- if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
+ if (gtk_clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize GtkClutter");
#endif
+ /* command line options */
+
context = g_option_context_new (N_("- Image browser and viewer"));
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]