Re: single click in "GQview - move" navigation WANTED
John Ellis <[email protected]> Thu, 02 Sep 2004 16:48:37 -0400
| Newsgroups | gmane.comp.gnome.apps.gqview.user |
|---|---|
| Message-ID | <[email protected]> |
nico wrote: > > Hi all, > > I love the main navigation of GQView when you can go through the folders > with a single click. > > Do somebody could teach me a hack inside the code to do the same for the > "GQview - move" navigation window? > I have been trying to find it but I am new to gtk+... I have included comments and a patch, but let me first suggest using the bookmarks within that window for frequently used folders. To create a bookmark right click a folder and select 'add bookmark' or select a folder and press Control-B, you can also drag a folder onto the bookmark area. Bookmarks can be edited, removed, and order changed from their right click menu. All the file selection dialog code is in ui_pathsel.c. The path is changed when the GtkTreeView for the folder list emits the "activate" signal, calling the dest_activate_cb() function. The simplest way to change the path on a single click is from within the dest_press_cb() function, which is called when the mouse button is pressed - that is what this patch does. To apply the attached patch, run this in the GQview source directory (gqview-x.x.x/src): patch ui_pathsel.c gqview-single-click-filesel.patch And recompile/install, in theory the patch should work for both the 1.4.x and 1.5.x releases. While the patch gets the job done, it lacks a nice visual feedback when clicking on a folder as there is in the main window Greetings, John -- John Ellis <[email protected]> http://gqview.sourceforge.net <GQview> | http://gqapplets.sourceforge.net http://gqmpeg.sourceforge.net <GQmpeg> | <panel applets>
gqview-single-click-filesel.patch
(text/plain, 989 B)
Index: ui_pathsel.c
===================================================================
RCS file: /devel/cvs/gqview/src/ui_pathsel.c,v
retrieving revision 1.12
diff -u -r1.12 ui_pathsel.c
--- ui_pathsel.c 9 Mar 2004 06:15:26 -0000 1.12
+++ ui_pathsel.c 2 Sep 2004 20:03:34 -0000
@@ -653,6 +653,25 @@
GtkTreeIter iter;
GtkTreeSelection *selection;
+ if (view == dd->d_view &&
+ event->button == 1 &&
+ gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(view), event->x, event->y,
+ &tpath, &column, &cell_x, &cell_y))
+ {
+ gchar *path;
+
+ model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
+ gtk_tree_model_get_iter(model, &iter, tpath);
+ gtk_tree_path_free(tpath);
+
+ gtk_tree_model_get(model, &iter, 1, &path, -1);
+
+ dest_change_dir(dd, path, (dd->f_view != NULL));
+ g_free(path);
+
+ return TRUE;
+ }
+
if (event->button != 3 ||
!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(view), event->x, event->y,
&tpath, &column, &cell_x, &cell_y))