comparison src/layout_image.c @ 1397:a0bd58a6535f

In various Edit context menus, only display editors that match the file types in the selection.
author zas_
date Sun, 08 Mar 2009 13:23:25 +0000
parents 3c9abbc05792
children 7e180091e0b7
comparison
equal deleted inserted replaced
1396:58f0b4586c8c 1397:a0bd58a6535f
454 ret = (strcmp(lw->dir_fd->path, dirname) == 0); 454 ret = (strcmp(lw->dir_fd->path, dirname) == 0);
455 g_free(dirname); 455 g_free(dirname);
456 return ret; 456 return ret;
457 } 457 }
458 458
459 static void layout_image_popup_menu_destroy_cb(GtkWidget *widget, gpointer data)
460 {
461 LayoutWindow *lw = data;
462
463 filelist_free(lw->editmenu_fd_list);
464 lw->editmenu_fd_list = NULL;
465 }
466
467 static GList *layout_image_get_fd_list(LayoutWindow *lw)
468 {
469 GList *list = NULL;
470 FileData *fd = layout_image_get_fd(lw);
471
472 if (fd)
473 list = g_list_append(NULL, file_data_ref(fd));
474
475 return list;
476 }
477
459 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw) 478 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw)
460 { 479 {
461 GtkWidget *menu; 480 GtkWidget *menu;
462 GtkWidget *item; 481 GtkWidget *item;
463 GtkWidget *submenu; 482 GtkWidget *submenu;
466 485
467 path = layout_image_get_path(lw); 486 path = layout_image_get_path(lw);
468 fullscreen = layout_image_full_screen_active(lw); 487 fullscreen = layout_image_full_screen_active(lw);
469 488
470 menu = popup_menu_short_lived(); 489 menu = popup_menu_short_lived();
490 g_signal_connect(G_OBJECT(menu), "destroy",
491 G_CALLBACK(layout_image_popup_menu_destroy_cb), lw);
471 492
472 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(li_pop_menu_zoom_in_cb), lw); 493 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(li_pop_menu_zoom_in_cb), lw);
473 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(li_pop_menu_zoom_out_cb), lw); 494 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(li_pop_menu_zoom_out_cb), lw);
474 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(li_pop_menu_zoom_1_1_cb), lw); 495 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(li_pop_menu_zoom_1_1_cb), lw);
475 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(li_pop_menu_zoom_fit_cb), lw); 496 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(li_pop_menu_zoom_fit_cb), lw);
476 menu_item_add_divider(menu); 497 menu_item_add_divider(menu);
477 498
478 submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw); 499 lw->editmenu_fd_list = layout_image_get_fd_list(lw);
500 submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw, lw->editmenu_fd_list);
479 if (!path) gtk_widget_set_sensitive(item, FALSE); 501 if (!path) gtk_widget_set_sensitive(item, FALSE);
480 menu_item_add_divider(submenu); 502 menu_item_add_divider(submenu);
481 menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw); 503 menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw);
482 504
483 item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw); 505 item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw);