Commit 3b018578 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

do not select the folder after right-clicking on it

parent b09b61e6
......@@ -195,7 +195,7 @@ gth_browser_activate_action_catalog_new (GtkAction *action,
if (name == NULL)
return;
selected_parent = gth_folder_tree_get_selected_or_parent (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
selected_parent = gth_browser_get_folder_popup_file_data (browser);
if (selected_parent != NULL) {
GthFileSource *file_source;
GFileInfo *info;
......@@ -261,7 +261,7 @@ gth_browser_activate_action_catalog_new_library (GtkAction *action,
if (name == NULL)
return;
selected_parent = gth_folder_tree_get_selected_or_parent (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
selected_parent = gth_browser_get_folder_popup_file_data (browser);
if (selected_parent != NULL) {
GthFileSource *file_source;
GFileInfo *info;
......@@ -309,13 +309,11 @@ void
gth_browser_activate_action_catalog_remove (GtkAction *action,
GthBrowser *browser)
{
GthFolderTree *folder_tree;
GthFileData *file_data;
GFile *gio_file;
GError *error = NULL;
GthFileData *file_data;
GFile *gio_file;
GError *error = NULL;
folder_tree = GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser));
file_data = gth_folder_tree_get_selected (folder_tree);
file_data = gth_browser_get_folder_popup_file_data (browser);
gio_file = gth_main_get_gio_file (file_data->file);
if (g_file_delete (gio_file, NULL, &error)) {
GFile *parent;
......@@ -345,12 +343,10 @@ void
gth_browser_activate_action_catalog_rename (GtkAction *action,
GthBrowser *browser)
{
GthFolderTree *folder_tree;
GthFileData *file_data;
GthFileData *file_data;
folder_tree = GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser));
file_data = gth_folder_tree_get_selected (folder_tree);
gth_folder_tree_start_editing (folder_tree, file_data->file);
file_data = gth_browser_get_folder_popup_file_data (browser);
gth_folder_tree_start_editing (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)), file_data->file);
g_object_unref (file_data);
}
......@@ -360,11 +356,9 @@ void
gth_browser_activate_action_catalog_properties (GtkAction *action,
GthBrowser *browser)
{
GthFolderTree *folder_tree;
GthFileData *file_data;
GthFileData *file_data;
folder_tree = GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser));
file_data = gth_folder_tree_get_selected (folder_tree);
file_data = gth_browser_get_folder_popup_file_data (browser);
dlg_catalog_properties (browser, file_data);
g_object_unref (file_data);
......
......@@ -515,7 +515,7 @@ gth_browser_activate_action_folder_open_in_file_manager (GtkAction *action,
char *uri;
GError *error = NULL;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -539,13 +539,11 @@ gth_browser_activate_action_folder_create (GtkAction *action,
{
GthFileData *parent;
parent = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
if (parent == NULL)
return;
_gth_browser_create_new_folder (browser, parent->file);
g_object_unref (parent);
parent = gth_browser_get_folder_popup_file_data (browser);
if (parent != NULL) {
_gth_browser_create_new_folder (browser, parent->file);
g_object_unref (parent);
}
}
......@@ -555,7 +553,7 @@ gth_browser_activate_action_folder_rename (GtkAction *action,
{
GthFileData *file_data;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -572,7 +570,7 @@ gth_browser_activate_action_folder_cut (GtkAction *action,
GthFileData *file_data;
GList *file_list;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -590,7 +588,7 @@ gth_browser_activate_action_folder_copy (GtkAction *action,
GthFileData *file_data;
GList *file_list;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -608,7 +606,7 @@ gth_browser_activate_action_folder_paste (GtkAction *action,
GthFileData *file_data;
PasteData *paste_data;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -717,7 +715,7 @@ gth_browser_activate_action_folder_trash (GtkAction *action,
GthFileData *file_data;
GError *error = NULL;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -771,7 +769,7 @@ gth_browser_activate_action_folder_delete (GtkAction *action,
DeleteFolderData *delete_data;
GtkWidget *d;
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......
......@@ -693,7 +693,7 @@ clipboard_targets_received_cb (GtkClipboard *clipboard,
set_action_sensitive (data, "Edit_PasteInFolder", data->can_paste);
folder = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
folder = gth_browser_get_folder_popup_file_data (browser);
set_action_sensitive (data, "Folder_Paste", (folder != NULL) && data->can_paste && g_file_info_get_attribute_boolean (folder->info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE));
_g_object_unref (folder);
......@@ -745,7 +745,7 @@ fm__gth_browser_update_sensitivity_cb (GthBrowser *browser)
set_action_sensitive (data, "Edit_Delete", sensitive);
set_action_sensitive (data, "Edit_Duplicate", sensitive);
folder = gth_folder_tree_get_selected (GTH_FOLDER_TREE (gth_browser_get_folder_tree (browser)));
folder = gth_browser_get_folder_popup_file_data (browser);
set_action_sensitive (data, "Folder_Create", (folder != NULL) && g_file_info_get_attribute_boolean (folder->info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE));
set_action_sensitive (data, "Folder_Rename", (folder != NULL) && g_file_info_get_attribute_boolean (folder->info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME));
set_action_sensitive (data, "Folder_Delete", (folder != NULL) && g_file_info_get_attribute_boolean (folder->info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE));
......
......@@ -283,11 +283,9 @@ void
gth_browser_activate_action_folder_open (GtkAction *action,
GthBrowser *browser)
{
GtkWidget *folder_tree;
GthFileData *file_data;
folder_tree = gth_browser_get_folder_tree (browser);
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (folder_tree));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......@@ -301,12 +299,10 @@ void
gth_browser_activate_action_folder_open_in_new_window (GtkAction *action,
GthBrowser *browser)
{
GtkWidget *folder_tree;
GthFileData *file_data;
GtkWidget *new_browser;
folder_tree = gth_browser_get_folder_tree (browser);
file_data = gth_folder_tree_get_selected (GTH_FOLDER_TREE (folder_tree));
file_data = gth_browser_get_folder_popup_file_data (browser);
if (file_data == NULL)
return;
......
......@@ -152,6 +152,7 @@ struct _GthBrowserPrivateData {
char *list_attributes;
gboolean constructed;
guint selection_changed_event;
GthFileData *folder_popup_file_data;
/* fulscreen */
......@@ -2141,6 +2142,7 @@ gth_browser_finalize (GObject *object)
gth_icon_cache_free (browser->priv->menu_icon_cache);
g_hash_table_unref (browser->priv->named_dialogs);
g_free (browser->priv->list_attributes);
_g_object_unref (browser->priv->folder_popup_file_data);
g_free (browser->priv);
browser->priv = NULL;
}
......@@ -2316,6 +2318,9 @@ folder_tree_folder_popup_cb (GthFolderTree *folder_tree,
_gth_browser_set_action_sensitive (browser, "Folder_Open", sensitive);
_gth_browser_set_action_sensitive (browser, "Folder_OpenInNewWindow", sensitive);
_g_object_unref (browser->priv->folder_popup_file_data);
browser->priv->folder_popup_file_data = _g_object_ref (file_data);
if (file_data != NULL)
file_source = gth_main_get_file_source (file_data->file);
else
......@@ -2335,6 +2340,13 @@ folder_tree_folder_popup_cb (GthFolderTree *folder_tree,
}
GthFileData *
gth_browser_get_folder_popup_file_data (GthBrowser *browser)
{
return _g_object_ref (browser->priv->folder_popup_file_data);
}
static void
file_source_rename_ready_cb (GObject *object,
GError *error,
......@@ -2482,7 +2494,7 @@ file_attributes_ready_cb (GthFileSource *file_source,
}
GList *
static GList *
_g_file_list_find_file_or_ancestor (GList *l,
GFile *file)
{
......
......@@ -169,6 +169,7 @@ void gth_browser_fullscreen (GthBrowser *browser);
void gth_browser_unfullscreen (GthBrowser *browser);
void gth_browser_file_menu_popup (GthBrowser *browser,
GdkEventButton *event);
GthFileData * gth_browser_get_folder_popup_file_data (GthBrowser *browser);
/* protected methods */
......
......@@ -357,13 +357,6 @@ button_press_cb (GtkWidget *widget,
&cell_y))
{
if (event->button == 3) {
GtkTreeSelection *selection;
/* Update the selection. */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
gtk_tree_selection_unselect_all (selection);
g_signal_emit (folder_tree,
gth_folder_tree_signals[FOLDER_POPUP],
0,
......@@ -394,18 +387,6 @@ button_press_cb (GtkWidget *widget,
-1);
if (entry_type == ENTRY_TYPE_FILE) {
GtkTreeSelection *selection;
/* Update the selection. */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
if (! gtk_tree_selection_iter_is_selected (selection, &iter)) {
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_iter (selection, &iter);
}
/* Show the folder popup menu. */
g_signal_emit (folder_tree,
gth_folder_tree_signals[FOLDER_POPUP],
0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment