Skip to content
Snippets Groups Projects
Commit 160452b4 authored by Benedikt Meurer's avatar Benedikt Meurer
Browse files

2005-09-23 Benedikt Meurer <benny@xfce.org>

	* thunar/thunar-details-view.c(thunar_details_view_button_press_event),
	  thunar/thunar-icon-view.c(thunar_icon_view_button_press_event): Open
	  folders in new windows on double middle-click events.




(Old svn revision: 17789)
parent ac0d40c9
No related branches found
No related tags found
No related merge requests found
2005-09-23 Benedikt Meurer <benny@xfce.org>
* thunar/thunar-details-view.c(thunar_details_view_button_press_event),
thunar/thunar-icon-view.c(thunar_icon_view_button_press_event): Open
folders in new windows on double middle-click events.
2005-09-22 Benedikt Meurer <benny@xfce.org>
* configure.in.in: Fix typo.
......
......@@ -368,6 +368,9 @@ thunar_details_view_button_press_event (GtkTreeView *tree_view,
{
GtkTreeSelection *selection;
GtkTreePath *path;
GtkTreeIter iter;
ThunarFile *file;
GtkAction *action;
/* we unselect all selected items if the user clicks on an empty
* area of the treeview and no modifier key is active.
......@@ -406,6 +409,43 @@ thunar_details_view_button_press_event (GtkTreeView *tree_view,
return TRUE;
}
else if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) && event->button == 2)
{
/* determine the path to the item that was middle-clicked */
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL))
{
/* select only the path to the item on which the user clicked */
selection = gtk_tree_view_get_selection (tree_view);
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
/* if the event was a double-click, then we'll open the file or folder (folder's are opened in new windows) */
if (G_LIKELY (event->type == GDK_2BUTTON_PRESS))
{
/* determine the file for the path */
gtk_tree_model_get_iter (GTK_TREE_MODEL (THUNAR_STANDARD_VIEW (details_view)->model), &iter, path);
file = thunar_list_model_get_file (THUNAR_STANDARD_VIEW (details_view)->model, &iter);
if (G_LIKELY (file != NULL))
{
/* determine the action to perform depending on the type of the file */
action = gtk_action_group_get_action (THUNAR_STANDARD_VIEW (details_view)->action_group,
thunar_file_is_directory (file) ? "open-in-new-window" : "open");
/* emit the action */
if (G_LIKELY (action != NULL))
gtk_action_activate (action);
/* release the file reference */
g_object_unref (G_OBJECT (file));
}
}
/* cleanup */
gtk_tree_path_free (path);
}
return TRUE;
}
return FALSE;
}
......
......@@ -351,10 +351,13 @@ thunar_icon_view_button_press_event (ExoIconView *view,
ThunarIconView *icon_view)
{
GtkTreePath *path;
GtkTreeIter iter;
ThunarFile *file;
GtkAction *action;
/* open the context menu on right clicks */
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
{
/* open the context menu on right clicks */
if (exo_icon_view_get_item_at_pos (view, event->x, event->y, &path, NULL))
{
/* select the path on which the user clicked if not selected yet */
......@@ -383,6 +386,44 @@ thunar_icon_view_button_press_event (ExoIconView *view,
return TRUE;
}
else if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) && event->button == 2)
{
/* unselect all currently selected items */
exo_icon_view_unselect_all (view);
/* determine the path to the item that was middle-clicked */
if (exo_icon_view_get_item_at_pos (view, event->x, event->y, &path, NULL))
{
/* select only the path to the item on which the user clicked */
exo_icon_view_select_path (view, path);
/* if the event was a double-click, then we'll open the file or folder (folder's are opened in new windows) */
if (G_LIKELY (event->type == GDK_2BUTTON_PRESS))
{
/* determine the file for the path */
gtk_tree_model_get_iter (GTK_TREE_MODEL (THUNAR_STANDARD_VIEW (icon_view)->model), &iter, path);
file = thunar_list_model_get_file (THUNAR_STANDARD_VIEW (icon_view)->model, &iter);
if (G_LIKELY (file != NULL))
{
/* determine the action to perform depending on the type of the file */
action = gtk_action_group_get_action (THUNAR_STANDARD_VIEW (icon_view)->action_group,
thunar_file_is_directory (file) ? "open-in-new-window" : "open");
/* emit the action */
if (G_LIKELY (action != NULL))
gtk_action_activate (action);
/* release the file reference */
g_object_unref (G_OBJECT (file));
}
}
/* cleanup */
gtk_tree_path_free (path);
}
return TRUE;
}
return FALSE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment