Commit baec64d8 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

update the file selection before showing the context menu

parent 9cc61e57
......@@ -2700,9 +2700,19 @@ gth_file_list_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
GthBrowser *browser = user_data;
GthBrowser *browser = user_data;
if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3)) {
GtkWidget *file_view;
int pos;
file_view = gth_browser_get_file_list_view (browser);
pos = gth_file_view_get_at_position (GTH_FILE_VIEW (file_view), event->x, event->y);
if ((pos >= 0) && ! gth_file_selection_is_selected (GTH_FILE_SELECTION (file_view), pos)) {
gth_file_selection_unselect_all (GTH_FILE_SELECTION (file_view));
gth_file_selection_select (GTH_FILE_SELECTION (file_view), pos);
}
if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3)) {
gtk_menu_popup (GTK_MENU (browser->priv->file_list_popup),
NULL,
NULL,
......@@ -2710,10 +2720,10 @@ gth_file_list_button_press_cb (GtkWidget *widget,
NULL,
event->button,
event->time);
return TRUE;
}
return TRUE;
}
return FALSE;
return FALSE;
}
......
......@@ -870,7 +870,7 @@ gth_extension_manager_order_extensions (GthExtensionManager *manager,
GSList *scan;
GSList *ordered = NULL;
for (scan = extensions; scan;) {
for (scan = extensions; scan; /* void */) {
GSList *next = scan->next;
GSList *slink;
char *ext_name = scan->data;
......@@ -879,8 +879,10 @@ gth_extension_manager_order_extensions (GthExtensionManager *manager,
GList *scan_d;
ext_description = g_hash_table_lookup (manager->priv->extensions, ext_name);
if (ext_description == NULL)
if (ext_description == NULL) {
scan = scan->next;
continue;
}
dependencies = get_extension_optional_dependencies (manager, ext_description);
for (scan_d = dependencies; scan_d; scan_d = scan_d->next) {
......
......@@ -112,9 +112,17 @@ gth_icon_view_real_get_at_position (GthFileView *base,
int x,
int y)
{
GthIconView * self;
self = GTH_ICON_VIEW (base);
return -1;
GtkTreePath *path;
int pos;
path = gtk_icon_view_get_path_at_pos (GTK_ICON_VIEW (base), x, y);
if (path == NULL)
return -1;
pos = gtk_tree_path_get_indices (path)[0];
gtk_tree_path_free (path);
return pos;
}
......@@ -328,10 +336,16 @@ static gboolean
gth_icon_view_real_is_selected (GthFileSelection *base,
int pos)
{
GthIconView * self;
self = GTH_ICON_VIEW (base);
GtkTreePath *path;
gboolean result;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, pos);
result = gtk_icon_view_path_is_selected (GTK_ICON_VIEW (base), path);
gtk_tree_path_free (path);
return FALSE;
return result;
}
......
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