comparison src/layout_image.c @ 368:95fe470440ad

New Go to directory view feature that permits to find and display the directory corresponding to an image view. For example, when you open an image in new window from collection, right clicking on the newly displayed image will let you choose Go to directory view, which would open a new window, with image and directory list. If current directory is the one of the image, menu item is disabled.
author zas_
date Tue, 15 Apr 2008 06:56:25 +0000
parents de1c2cd06fce
children 959b6fcdaa17
comparison
equal deleted inserted replaced
367:3556cc825e59 368:95fe470440ad
707 LayoutWindow *lw = data; 707 LayoutWindow *lw = data;
708 708
709 layout_tools_hide_toggle(lw); 709 layout_tools_hide_toggle(lw);
710 } 710 }
711 711
712 static void li_set_layout_path_cb(GtkWidget *widget, gpointer data)
713 {
714 LayoutWindow *lw = data;
715 const gchar *path;
716
717 if (!layout_valid(&lw)) return;
718
719 path = layout_image_get_path(lw);
720 if (path) layout_set_path(lw, path);
721 }
722
723 static gint li_check_if_current_path(LayoutWindow *lw, const gchar *path)
724 {
725 gchar *dirname;
726 gint ret;
727
728 if (!path || !layout_valid(&lw) || !lw->path) return FALSE;
729
730 dirname = g_path_get_dirname(path);
731 ret = (strcmp(lw->path, dirname) == 0);
732 g_free(dirname);
733 return ret;
734 }
735
712 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw) 736 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw)
713 { 737 {
714 GtkWidget *menu; 738 GtkWidget *menu;
715 GtkWidget *item; 739 GtkWidget *item;
716 GtkWidget *submenu; 740 GtkWidget *submenu;
738 item = menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(li_pop_menu_info_cb), lw); 762 item = menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(li_pop_menu_info_cb), lw);
739 if (!path) gtk_widget_set_sensitive(item, FALSE); 763 if (!path) gtk_widget_set_sensitive(item, FALSE);
740 764
741 item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw); 765 item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw);
742 if (!path || fullscreen) gtk_widget_set_sensitive(item, FALSE); 766 if (!path || fullscreen) gtk_widget_set_sensitive(item, FALSE);
767
768 item = menu_item_add(menu, _("_Go to directory view"), G_CALLBACK(li_set_layout_path_cb), lw);
769 if (!path || li_check_if_current_path(lw, path)) gtk_widget_set_sensitive(item, FALSE);
743 770
744 menu_item_add_divider(menu); 771 menu_item_add_divider(menu);
745 772
746 item = menu_item_add_stock(menu, _("_Copy..."), GTK_STOCK_COPY, G_CALLBACK(li_pop_menu_copy_cb), lw); 773 item = menu_item_add_stock(menu, _("_Copy..."), GTK_STOCK_COPY, G_CALLBACK(li_pop_menu_copy_cb), lw);
747 if (!path) gtk_widget_set_sensitive(item, FALSE); 774 if (!path) gtk_widget_set_sensitive(item, FALSE);