Trim trailing white spaces on empty lines.
[geeqie.git] / src / menu.c
index f6390ec..7d493a8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Geeqie
  * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
  *
  * Author: John Ellis
  *
@@ -54,9 +54,9 @@ static GtkWidget *add_menu_item(GtkWidget *menu, gchar *label, GtkAccelGroup *ac
 
 gpointer submenu_item_get_data(GtkWidget *menu)
 {
-       if (!menu->parent || !GTK_IS_MENU(menu->parent)) return NULL;
+       if (!gtk_widget_get_parent(menu) || !GTK_IS_MENU(gtk_widget_get_parent(menu))) return NULL;
 
-       return g_object_get_data(G_OBJECT(menu->parent), "submenu_data");
+       return g_object_get_data(G_OBJECT(gtk_widget_get_parent(menu)), "submenu_data");
 }
 
 /*
@@ -80,7 +80,7 @@ static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list)
                work = work->next;
                gboolean active = TRUE;
 
-               if (fd_list && EDITOR_ERRORS(editor_command_parse(editor, fd_list, NULL)))
+               if (fd_list && EDITOR_ERRORS(editor_command_parse(editor, fd_list, FALSE, NULL)))
                        active = FALSE;
 
                if (active)
@@ -96,7 +96,7 @@ static void add_edit_items(GtkWidget *menu, GCallback func, GList *fd_list)
                        g_signal_connect(G_OBJECT(item), "destroy", G_CALLBACK(edit_item_destroy_cb), key);
                        }
                }
-       
+
        g_list_free(editors_list);
 }
 
@@ -135,6 +135,9 @@ gchar *sort_type_get_text(SortType method)
                case SORT_TIME:
                        return _("Sort by date");
                        break;
+               case SORT_EXIFTIME:
+                       return _("Sort by Exif-date");
+                       break;
                case SORT_NONE:
                        return _("Unsorted");
                        break;
@@ -153,7 +156,7 @@ gchar *sort_type_get_text(SortType method)
        return "";
 }
 
-static GtkWidget *submenu_add_sort_item(GtkWidget *menu, GtkWidget *parent,
+static GtkWidget *submenu_add_sort_item(GtkWidget *menu,
                                        GCallback func, SortType type,
                                        gboolean show_current, SortType show_type)
 {
@@ -161,8 +164,8 @@ static GtkWidget *submenu_add_sort_item(GtkWidget *menu, GtkWidget *parent,
 
        if (show_current)
                {
-               item = menu_item_add_radio(menu, parent,
-                                          sort_type_get_text(type), (type == show_type),
+               item = menu_item_add_radio(menu,
+                                          sort_type_get_text(type), GINT_TO_POINTER((gint)type), (type == show_type),
                                           func, GINT_TO_POINTER((gint)type));
                }
        else
@@ -179,19 +182,19 @@ GtkWidget *submenu_add_sort(GtkWidget *menu, GCallback func, gpointer data,
                            gboolean show_current, SortType type)
 {
        GtkWidget *submenu;
-       GtkWidget *parent;
 
        submenu = gtk_menu_new();
        g_object_set_data(G_OBJECT(submenu), "submenu_data", data);
 
-       parent = submenu_add_sort_item(submenu, NULL, func, SORT_NAME, show_current, type);
+       submenu_add_sort_item(submenu, func, SORT_NAME, show_current, type);
 #ifdef HAVE_STRVERSCMP
-       submenu_add_sort_item(submenu, parent, func, SORT_NUMBER, show_current, type);
+       submenu_add_sort_item(submenu, func, SORT_NUMBER, show_current, type);
 #endif
-       submenu_add_sort_item(submenu, parent, func, SORT_TIME, show_current, type);
-       submenu_add_sort_item(submenu, parent, func, SORT_SIZE, show_current, type);
-       if (include_path) submenu_add_sort_item(submenu, parent, func, SORT_PATH, show_current, type);
-       if (include_none) submenu_add_sort_item(submenu, parent, func, SORT_NONE, show_current, type);
+       submenu_add_sort_item(submenu, func, SORT_TIME, show_current, type);
+       submenu_add_sort_item(submenu, func, SORT_EXIFTIME, show_current, type);
+       submenu_add_sort_item(submenu, func, SORT_SIZE, show_current, type);
+       if (include_path) submenu_add_sort_item(submenu, func, SORT_PATH, show_current, type);
+       if (include_none) submenu_add_sort_item(submenu, func, SORT_NONE, show_current, type);
 
        if (menu)
                {