Merge lp:~jmiguelbenitez/pantheon-files/fix-1082680 into lp:~elementary-apps/pantheon-files/trunk

Proposed by José M. Benítez
Status: Merged
Approved by: Cody Garver
Approved revision: 1405
Merged at revision: 1449
Proposed branch: lp:~jmiguelbenitez/pantheon-files/fix-1082680
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 112 lines (+20/-15)
1 file modified
src/fm-columns-view.c (+20/-15)
To merge this branch: bzr merge lp:~jmiguelbenitez/pantheon-files/fix-1082680
Reviewer Review Type Date Requested Status
Jeremy Wootten Approve
Review via email: mp+202213@code.launchpad.net

Commit message

Files in columns view now open with single click properly to fix bug #1082680

Description of the change

Fix for bug #1082680 (open file with one click doesn't work in column view).

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

Right clicking still opens things in Columns mode. Maybe that bug was not intended to be attached to this branch?

Revision history for this message
José M. Benítez (jmiguelbenitez) wrote :

You are absolutely right, my man!

My mistake. I already removed the link between bug and branch O:)

Thanks!

2014/1/19 Cody Garver <email address hidden>

> Right clicking still opens things in Columns mode. Maybe that bug was not
> intended to be attached to this branch?
> --
>
> https://code.launchpad.net/~jmiguelbenitez/pantheon-files/fix-1082680/+merge/202213
> You are the owner of lp:~jmiguelbenitez/pantheon-files/fix-1082680.
>

1403. By José M. Benítez

Open regular files in column view with a click only if the setting is on

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

If you select two files using Ctrl-LeftButton and then deselect one of them using Ctrl-LeftButton then the remaining selected file is opened. This does not occur in icon view and list view and is not a desirable behaviour.

There is potential that if the fix to bug 1028637 is merged (which automatically selects files that are dropped or pasted into a view) then dropping or pasting a single file into a column view would cause that file to be opened, though I haven't checked this yet.

The file should only open when the file alone becomes selected from an unselected state only by virtue of a single mouse click when the single-click option is set.

review: Needs Fixing
Revision history for this message
José M. Benítez (jmiguelbenitez) wrote :

I don't want to make any excuses here, but that faulty behaviour is not introduced by the new code: I'm seeing now it was already there for directories. I understand though that it's much more annoying (and wrong, of course) when selecting files.

Anyway, the point I'm trying to make here is whether I should file another bug and solve it before this one. I did it already with a similar side effect (bug #1270566). Well, I mean I filed a bug, but I did not solve it O:)

Regarding the fix to bug #1028637, it doesn't seem it's going to have an affect here, but I've to look at it more closely.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

I am not an authority on this but if the new branch exposes new bug or
magnifies an existing bug that:

1) involves significant changes to parts of the code that is not already
being changed by the new branch and
2) is a bug in its own right - i.e. would be worth fixing whether or not
the new branch is accepted

then I would say that it is best to create another branch that fixes that
bug (or file a bug and wait for some else to fix it!) and make the merging
of the first branch depend on the prior merging of the branch that fixes
that bug.

Having said that, I just created a branch enabling smooth scrolling that
exposed a deficiency in related code that had no effect whatsoever unless
smooth-scrolling was enabled but seriously degraded the performance of
zooming when it was. As it was comparatively easily fixed and was closely
related to smooth scroll event handling, I fixed it in the same branch.
I'll just have to see if anyone objects ...

When in doubt, create a new branch.

On Sun, Feb 23, 2014 at 11:19 AM, José M. Benítez
<email address hidden>wrote:

> I don't want to make any excuses here, but that faulty behaviour is not
> introduced by the new code: I'm seeing now it was already there for
> directories. I understand though that it's much more annoying (and wrong,
> of course) when selecting files.
>
> Anyway, the point I'm trying to make here is whether I should file another
> bug and solve it before this one. I did it already with a similar side
> effect (bug #1270566). Well, I mean I filed a bug, but I did not solve it
> O:)
>
> Regarding the fix to bug #1028637, it doesn't seem it's going to have an
> affect here, but I've to look at it more closely.
>
> --
>
> https://code.launchpad.net/~jmiguelbenitez/pantheon-files/fix-1082680/+merge/202213
> You are reviewing the proposed merge of
> lp:~jmiguelbenitez/pantheon-files/fix-1082680 into lp:pantheon-files.
>

Revision history for this message
José M. Benítez (jmiguelbenitez) wrote :

Thanks once more, Jeremy.

I'll see whether it's easy to solve it all in this branch. If the thing goes out of hand, I'll create another one.

1404. By José M. Benítez

Fixed bug by which the last selected file after deselecting all others was mistakenly open.

Revision history for this message
José M. Benítez (jmiguelbenitez) wrote :

I think now it's ok, isn't it?

There's still something going on with Ctrl-selecting one element in a brand new slot, but IMHO it has nothing to do with this bug.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Sorry I have not had a chance to pursue this for a while - I have been
distracted by trying to construct a build environment for the latest trunk
version of pantheon-files - without success so far! The switch to gee-0.8
caused the problem. As you have not merged that revision I should be able
to build your branch still.

On Tue, Feb 25, 2014 at 12:07 AM, José M. Benítez
<email address hidden>wrote:

> I think now it's ok, isn't it?
>
> There's still something going on with Ctrl-selecting one element in a
> brand new slot, but IMHO it has nothing to do with this bug.
>
> --
>
> https://code.launchpad.net/~jmiguelbenitez/pantheon-files/fix-1082680/+merge/202213
> You are reviewing the proposed merge of
> lp:~jmiguelbenitez/pantheon-files/fix-1082680 into lp:pantheon-files.
>

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

I now have a working Isis build environment but in the process lost my Luna
build environment. So I merged the current trunk with your branch and
tested that (there were no conflicts). You will have to merge changes from
trunk at some point anyway. However, be aware that when you do this you
may have to update your build environment.

Your latest revision opens the file with a fast right-click (so the context
menu opens after the button release). This can be fixed (for example -
there may be better ways) by changing the button_release callback code to:

    if (view->details->pressed_button == event->button &&
view->details->pressed_button != -1)
    {
        /* don't do anything if any modifier key is active */
        if ((event->state & gtk_accelerator_get_default_mod_mask ()) == 0
         && view->details->pressed_button != 3)
        {
            view->details->updates_frozen = FALSE;
            selection = gtk_tree_view_get_selection (tree_view);
            list_selection_changed_callback (selection, view);
        }
        /* reset the pressed_button state */
        view->details->pressed_button = -1;
    }

Apart from that it seems to work OK.

On Tue, Feb 25, 2014 at 12:07 AM, José M. Benítez
<email address hidden>wrote:

> I think now it's ok, isn't it?
>
> There's still something going on with Ctrl-selecting one element in a
> brand new slot, but IMHO it has nothing to do with this bug.
>
> --
>
> https://code.launchpad.net/~jmiguelbenitez/pantheon-files/fix-1082680/+merge/202213
> You are reviewing the proposed merge of
> lp:~jmiguelbenitez/pantheon-files/fix-1082680 into lp:pantheon-files.
>

1405. By José M. Benítez

Modified code so that right clicks do not open files in column view mode.

Revision history for this message
José M. Benítez (jmiguelbenitez) wrote :

Thanks, Jerermy, and sorry for the late reply.

I think the right-click thing is solved now (I haven't used your suggestion because of an item selection issue). Anyway, GtkTreeView has got an "activate-on-single-click" signal since 3.8 which IMHO would make all this much cleaner, but I'm not sure if all other devs are on Isis already.

Regarding that, you're right, I should update my build environment. It's just that I'm waiting for my new laptop to do it.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

That's fixed it, good work!

I now approve.

review: Approve
Revision history for this message
Cody Garver (codygarver) wrote :

Use the Gtk 3.8 signal, it's safe to use up to Gtk 3.10 at this point. And probably 3.12 soon.

Revision history for this message
José M. Benítez (jmiguelbenitez) wrote :

Ok, great. However, if you both agree, I'd merge this branch as it is and leave the new code using the signal for another branch (I will file the request myself).

It's just that I find the column view behaviour a bit inconsistent, as it accepts single-clicks no matter the setting. So I would like to make all that clear before I get the things wrong.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/fm-columns-view.c'
2--- src/fm-columns-view.c 2014-02-17 00:56:55 +0000
3+++ src/fm-columns-view.c 2014-03-16 10:02:05 +0000
4@@ -95,12 +95,6 @@
5 }
6
7 static void
8-show_selected_files (GOFFile *file)
9-{
10- g_message ("selected: %s\n", g_file_info_get_name (file->info));
11-}
12-
13-static void
14 list_selection_changed_callback (GtkTreeSelection *selection, FMColumnsView *view)
15 {
16 GOFFile *file;
17@@ -109,7 +103,6 @@
18 if (view->details->selection != NULL)
19 gof_file_list_free (view->details->selection);
20 view->details->selection = get_selection (view);
21- //show_selected_files (file);
22
23 if (FM_DIRECTORY_VIEW (view)->updates_frozen)
24 return;
25@@ -123,7 +116,7 @@
26
27 if (view->details->selection == NULL)
28 return;
29- /* dont show preview or load directory if we got more than 1 element selected */
30+ /* don't show preview or load directory if we got more than 1 element selected */
31 if (view->details->selection->next)
32 return;
33 if (view->details->updates_frozen)
34@@ -134,7 +127,12 @@
35 fm_directory_view_column_add_location (FM_DIRECTORY_VIEW (view), file->location);
36 /* give back the focus to the active slot */
37 gtk_widget_grab_focus (GTK_WIDGET (view));
38- }
39+ } else if (view->details->pressed_button == 1 && g_settings_get_boolean (settings, "single-click"))
40+ /* Open a file provided that it's been selected with the mouse (left
41+ * clicks if single-click mode is activated): we don't want files to be
42+ * open when changing selection with the keyboard.
43+ */
44+ fm_directory_view_activate_selected_items (FM_DIRECTORY_VIEW (view), MARLIN_WINDOW_OPEN_FLAG_DEFAULT);
45 }
46
47 static void
48@@ -347,6 +345,7 @@
49 return FALSE;
50
51 view->details->pressed_button = -1;
52+
53 /* we unselect all selected items if the user clicks on an empty
54 * area of the treeview and no modifier key is active.
55 */
56@@ -357,7 +356,7 @@
57 gtk_tree_selection_unselect_all (selection);
58 }
59
60- selection = gtk_tree_view_get_selection (tree_view);
61+ /* left clicks */
62 if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
63 /* save last pressed button */
64 if (view->details->pressed_button < 0) {
65@@ -366,6 +365,7 @@
66 }
67 }
68
69+ selection = gtk_tree_view_get_selection (tree_view);
70 /* open the context menu on right clicks */
71 if (event->type == GDK_BUTTON_PRESS && event->button == 3)
72 {
73@@ -373,6 +373,7 @@
74 view->details->pressed_button = event->button;
75 view->details->updates_frozen = TRUE;
76 }
77+
78 if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
79 {
80 /* select the path on which the user clicked if not selected yet */
81@@ -400,7 +401,8 @@
82
83 return TRUE;
84 }
85- else if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) && event->button == 2)
86+
87+ if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) && event->button == 2)
88 {
89 /* determine the path to the item that was middle-clicked */
90 if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
91@@ -458,15 +460,18 @@
92 g_message ("%s", G_STRFUNC);
93 if (view->details->pressed_button == event->button && view->details->pressed_button != -1)
94 {
95- view->details->updates_frozen = FALSE;
96- selection = gtk_tree_view_get_selection (tree_view);
97- list_selection_changed_callback (selection, view);
98+ /* don't do anything if any modifier key is active */
99+ if ((event->state & gtk_accelerator_get_default_mod_mask ()) == 0)
100+ {
101+ view->details->updates_frozen = FALSE;
102+ selection = gtk_tree_view_get_selection (tree_view);
103+ list_selection_changed_callback (selection, view);
104+ }
105
106 /* reset the pressed_button state */
107 view->details->pressed_button = -1;
108 }
109
110-
111 return TRUE;
112 }
113

Subscribers

People subscribed via source and target branches

to all changes: