[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gcmd-dev] device buttons
From: |
Uwe Scholz |
Subject: |
Re: [gcmd-dev] device buttons |
Date: |
Sat, 13 Jun 2015 23:34:47 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi Michael,
Michael <address@hidden> schrieb am [Fr, 12.06.2015 23:27]:
> It would be nice to have the 'Home' button acting as a bookmark (i
> think that's the expected behavior anyway).
>
> Generally the device buttons do work only when you 'come from another
> device'. That first time, the device gets 'entered' (even if it is
> already mounted), but afterwards, the button (or device list entry)
> doesn't take effect anymore.
>
> It's hard to imagine what gcmd (or gnome) is doing here. I can not
> read C code so i can only estimate.
>
I remember that you already asked for that feature quite some time ago.
This evening I found some time to have a look at the source code and
fortunately it wasn't hard to find the line of code in question. Have a
look at my code change below:
diff --git a/src/gnome-cmd-file-selector.cc
b/src/gnome-cmd-file-selector.cc
index 3d4be23..81e5459 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -354,7 +354,7 @@ static void on_con_btn_clicked (GtkWidget *widget,
GdkEventButton *event, GnomeC
if (event->button==2 || event->state&GDK_CONTROL_MASK ||
fs->file_list()->locked)
fs->new_tab(gnome_cmd_con_get_default_dir (con));
- fs->set_connection(con);
+ fs->set_connection(con, gnome_cmd_con_get_default_dir (con));
}
This means, in function on_con_btn_clicked, the method set_connection()
is called, I just added the default directory of that connection as the
second argument. This code change switches all connection buttons to be
"home" buttons for their device. I tested this: Clicking on the "Home"
button while actually being somewhere below ~/ brought me back to ~/,
which should be exactly what you want.
Actually, set_connection() is used several times in the GCMD source
code:
grep "set_connection(" src/*.cc -r -n
src/gnome-cmd-file-list.cc:1423: fl->set_connection(get_home_con ());
src/gnome-cmd-file-selector.cc:328: fs->set_connection(con);
src/gnome-cmd-file-selector.cc:361: fs->set_connection(con,
gnome_cmd_con_get_default_dir (con));
src/gnome-cmd-file-selector.cc:1028: set_connection(get_home_con ());
src/gnome-cmd-file-selector.cc:1469:
list->set_connection(gnome_cmd_dir_get_connection (dir), dir);
src/gnome-cmd-main-win.cc:1014:
fs(ACTIVE)->set_connection(GNOME_CMD_CON (con));
src/gnome-cmd-main-win.cc:1125:
fs->file_list()->set_connection(other->get_connection(), dir);
src/gnome-cmd-user-actions.cc:1661: fl->set_connection(get_home_con ());
src/gnome-cmd-user-actions.cc:1852: get_fl
(ACTIVE)->set_connection((GnomeCmdCon *) con);
src/gnome-cmd-user-actions.cc:1876: active->set_connection(home);
src/gnome-cmd-user-actions.cc:1878: inactive->set_connection(home);
Before finally applying the code change from above, I want to find out
if it would be a good idea to add gnome_cmd_con_get_default_dir (...)
also to those other calls.
For example, there is also the "Device List", in which the same behavior
of the device buttons might be useful... I'll drop a message to that
list when I've pushed the commit to the GCMD master branch.
Best wishes,
Uwe