Commit 4c8586bb authored by Padraig O'Briain's avatar Padraig O'Briain Committed by Padraig O'Briain
Browse files

Use the signal "popup_menu" to handle Shift+F10 instead of doing it in

2003-05-16  Padraig O'Briain  <padraig.obriain@sun.com>

	* src/file-manager/fm-list-view.c:
	Use the signal "popup_menu" to handle Shift+F10 instead of doing
	it in "key_press_event" signal handler. This fixes bug #103348.
parent f975a851
2003-05-16 Padraig O'Briain <padraig.obriain@sun.com>
* src/file-manager/fm-list-view.c:
Use the signal "popup_menu" to handle Shift+F10 instead of doing
it in "key_press_event" signal handler. This fixes bug #103348.
2003-05-16 Padraig O'Briain <padraig.obriain@sun.com> 2003-05-16 Padraig O'Briain <padraig.obriain@sun.com>
   
* libnautilus-private/nautilus-program-chooser.c: * libnautilus-private/nautilus-program-chooser.c:
......
...@@ -362,6 +362,16 @@ motion_notify_callback (GtkWidget *widget, ...@@ -362,6 +362,16 @@ motion_notify_callback (GtkWidget *widget,
return TRUE; return TRUE;
} }
static void
do_popup_menu (GtkWidget *widget, FMListView *view, GdkEventButton *event)
{
if (tree_view_has_selection (GTK_TREE_VIEW (widget))) {
fm_directory_view_pop_up_selection_context_menu (FM_DIRECTORY_VIEW (view), event);
} else {
fm_directory_view_pop_up_background_context_menu (FM_DIRECTORY_VIEW (view), event);
}
}
static gboolean static gboolean
button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callback_data) button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callback_data)
{ {
...@@ -460,11 +470,7 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba ...@@ -460,11 +470,7 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
} }
if (event->button == 3) { if (event->button == 3) {
if (tree_view_has_selection (tree_view)) { do_popup_menu (widget, view, event);
fm_directory_view_pop_up_selection_context_menu (FM_DIRECTORY_VIEW (view), (GdkEventButton *) event);
} else {
fm_directory_view_pop_up_background_context_menu (FM_DIRECTORY_VIEW (view), (GdkEventButton *) event);
}
} }
gtk_tree_path_free (path); gtk_tree_path_free (path);
...@@ -498,6 +504,16 @@ button_release_callback (GtkWidget *widget, ...@@ -498,6 +504,16 @@ button_release_callback (GtkWidget *widget,
return FALSE; return FALSE;
} }
static gboolean
popup_menu_callback (GtkWidget *widget, gpointer callback_data)
{
FMListView *view;
view = FM_LIST_VIEW (callback_data);
do_popup_menu (widget, view, NULL);
}
static gboolean static gboolean
key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_data) key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_data)
{ {
...@@ -510,12 +526,6 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat ...@@ -510,12 +526,6 @@ key_press_callback (GtkWidget *widget, GdkEventKey *event, gpointer callback_dat
case GDK_F10: case GDK_F10:
if (event->state & GDK_CONTROL_MASK) { if (event->state & GDK_CONTROL_MASK) {
fm_directory_view_pop_up_background_context_menu (view, &button_event); fm_directory_view_pop_up_background_context_menu (view, &button_event);
} else if (event->state & GDK_SHIFT_MASK) {
if (tree_view_has_selection (GTK_TREE_VIEW (widget))) {
fm_directory_view_pop_up_selection_context_menu (view, &button_event);
} else {
fm_directory_view_pop_up_background_context_menu (view, &button_event);
}
} }
break; break;
case GDK_space: case GDK_space:
...@@ -693,6 +703,8 @@ create_and_set_up_tree_view (FMListView *view) ...@@ -693,6 +703,8 @@ create_and_set_up_tree_view (FMListView *view)
G_CALLBACK (button_release_callback), view, 0); G_CALLBACK (button_release_callback), view, 0);
g_signal_connect_object (view->details->tree_view, "key_press_event", g_signal_connect_object (view->details->tree_view, "key_press_event",
G_CALLBACK (key_press_callback), view, 0); G_CALLBACK (key_press_callback), view, 0);
g_signal_connect_object (view->details->tree_view, "popup_menu",
G_CALLBACK (popup_menu_callback), view, 0);
view->details->model = g_object_new (FM_TYPE_LIST_MODEL, NULL); view->details->model = g_object_new (FM_TYPE_LIST_MODEL, NULL);
gtk_tree_view_set_model (view->details->tree_view, GTK_TREE_MODEL (view->details->model)); gtk_tree_view_set_model (view->details->tree_view, GTK_TREE_MODEL (view->details->model));
......
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