[nautilus/wip/gaction_reordered: 9/17] nautilus-view: Drop save search



commit f0b6f0ed02f007f6650f30e9820a1955e511cbc4
Author: Carlos Soriano <carlos sorian89 gmail com>
Date:   Mon Jan 5 14:02:19 2015 +0100

    nautilus-view: Drop save search

 src/nautilus-actions.h             |    2 -
 src/nautilus-directory-view-ui.xml |    2 -
 src/nautilus-view.c                |  175 ------------------------------------
 3 files changed, 0 insertions(+), 179 deletions(-)
---
diff --git a/src/nautilus-actions.h b/src/nautilus-actions.h
index 07db62d..71dd637 100644
--- a/src/nautilus-actions.h
+++ b/src/nautilus-actions.h
@@ -63,8 +63,6 @@
 #define NAUTILUS_ACTION_PROPERTIES_ACCEL "PropertiesAccel"
 #define NAUTILUS_ACTION_LOCATION_PROPERTIES "LocationProperties"
 #define NAUTILUS_ACTION_EMPTY_TRASH "Empty Trash"
-#define NAUTILUS_ACTION_SAVE_SEARCH "Save Search"
-#define NAUTILUS_ACTION_SAVE_SEARCH_AS "Save Search As"
 #define NAUTILUS_ACTION_CUT "Cut"
 #define NAUTILUS_ACTION_LOCATION_CUT "LocationCut"
 #define NAUTILUS_ACTION_COPY "Copy"
diff --git a/src/nautilus-directory-view-ui.xml b/src/nautilus-directory-view-ui.xml
index 4c4fade..d375b3a 100644
--- a/src/nautilus-directory-view-ui.xml
+++ b/src/nautilus-directory-view-ui.xml
@@ -19,8 +19,6 @@
   </placeholder>
   <placeholder name="Global File Items Placeholder">
     <menuitem name="Empty Trash" action="Empty Trash"/>
-    <menuitem name="Save Search" action="Save Search"/>
-    <menuitem name="Save Search As" action="Save Search As"/>
   </placeholder>
   <placeholder name="Edit Actions">
     <placeholder name="Undostack Actions">
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index cff1007..c5d1836 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -1398,147 +1398,6 @@ action_select_pattern_callback (GtkAction *action,
 }
 
 static void
-action_save_search_callback (GtkAction *action,
-                            gpointer callback_data)
-{                
-       NautilusSearchDirectory *search;
-       NautilusView    *directory_view;
-       
-        directory_view = NAUTILUS_VIEW (callback_data);
-
-       if (directory_view->details->model &&
-           NAUTILUS_IS_SEARCH_DIRECTORY (directory_view->details->model)) {
-               search = NAUTILUS_SEARCH_DIRECTORY (directory_view->details->model);
-               nautilus_search_directory_save_search (search);
-
-               /* Save search is disabled */
-               schedule_update_menus (directory_view);
-       }
-}
-
-static void
-query_name_entry_changed_cb  (GtkWidget *entry, GtkWidget *button)
-{
-       const char *text;
-       gboolean sensitive;
-       
-       text = gtk_entry_get_text (GTK_ENTRY (entry));
-
-       sensitive = (text != NULL) && (*text != 0);
-
-       gtk_widget_set_sensitive (button, sensitive);
-}
-
-
-static void
-action_save_search_as_callback (GtkAction *action,
-                               gpointer callback_data)
-{
-       NautilusView    *directory_view;
-       NautilusSearchDirectory *search;
-       GtkWidget *dialog, *grid, *label, *entry, *chooser, *save_button;
-       const char *entry_text;
-       char *filename, *filename_utf8, *dirname, *path, *uri;
-       GFile *location;
-       
-        directory_view = NAUTILUS_VIEW (callback_data);
-
-       if (directory_view->details->model &&
-           NAUTILUS_IS_SEARCH_DIRECTORY (directory_view->details->model)) {
-               search = NAUTILUS_SEARCH_DIRECTORY (directory_view->details->model);
-               
-               dialog = gtk_dialog_new_with_buttons (_("Save Search as"),
-                                                     nautilus_view_get_containing_window (directory_view),
-                                                     0,
-                                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                                     NULL);
-               save_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
-                                                    _("_Save"), GTK_RESPONSE_OK);
-               gtk_dialog_set_default_response (GTK_DIALOG (dialog),
-                                                GTK_RESPONSE_OK);
-               gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-               gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
-               gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-
-               grid = gtk_grid_new ();
-               g_object_set (grid,
-                             "orientation", GTK_ORIENTATION_VERTICAL,
-                             "border-width", 5,
-                             "row-spacing", 6,
-                             "column-spacing", 12,
-                             NULL);
-               gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid, TRUE, 
TRUE, 0);
-               gtk_widget_show (grid);
-               
-               label = gtk_label_new_with_mnemonic (_("Search _name:"));
-               gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-               gtk_container_add (GTK_CONTAINER (grid), label);
-               gtk_widget_show (label);
-
-               entry = gtk_entry_new ();
-               gtk_widget_set_hexpand (entry, TRUE);
-               gtk_grid_attach_next_to (GTK_GRID (grid), entry, label,
-                                        GTK_POS_RIGHT, 1, 1);
-               gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
-               gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
-               
-               gtk_widget_set_sensitive (save_button, FALSE);
-               g_signal_connect (entry, "changed",
-                                 G_CALLBACK (query_name_entry_changed_cb), save_button);
-               
-               gtk_widget_show (entry);
-               label = gtk_label_new_with_mnemonic (_("_Folder:"));
-               gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
-               gtk_container_add (GTK_CONTAINER (grid), label);
-               gtk_widget_show (label);
-
-               chooser = gtk_file_chooser_button_new (_("Select Folder to Save Search In"),
-                                                      GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
-               gtk_widget_set_hexpand (chooser, TRUE);
-               gtk_grid_attach_next_to (GTK_GRID (grid), chooser, label,
-                                        GTK_POS_RIGHT, 1, 1);
-               gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser);
-               gtk_widget_show (chooser);
-
-               gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), TRUE);
-
-               gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser),
-                                                    g_get_home_dir ());
-               
-               if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
-                       entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
-                       if (g_str_has_suffix (entry_text, NAUTILUS_SAVED_SEARCH_EXTENSION)) {
-                               filename_utf8 = g_strdup (entry_text);
-                       } else {
-                               filename_utf8 = g_strconcat (entry_text, NAUTILUS_SAVED_SEARCH_EXTENSION, 
NULL);
-                       }
-
-                       filename = g_filename_from_utf8 (filename_utf8, -1, NULL, NULL, NULL);
-                       g_free (filename_utf8);
-
-                       dirname = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
-                       
-                       path = g_build_filename (dirname, filename, NULL);
-                       g_free (filename);
-                       g_free (dirname);
-
-                       uri = g_filename_to_uri (path, NULL, NULL);
-                       g_free (path);
-                       
-                       nautilus_search_directory_save_to_file (search, uri);
-                       location = g_file_new_for_uri (uri);
-                       nautilus_file_changes_queue_file_added (location);
-                       g_object_unref (location);
-                       nautilus_file_changes_consume_changes (TRUE);
-                       g_free (uri);
-               }
-               
-               gtk_widget_destroy (dialog);
-       }
-}
-
-
-static void
 action_empty_trash_callback (GtkAction *action,
                             gpointer callback_data)
 {                
@@ -7069,14 +6928,6 @@ static const GtkActionEntry directory_view_entries[] = {
   /* label, accelerator */       N_("Open File and Close window"), "<alt><shift>Down",
   /* tooltip */                  NULL,
                                 G_CALLBACK (action_open_close_parent_callback) },
-  /* name, stock id */         { NAUTILUS_ACTION_SAVE_SEARCH, NULL,
-  /* label, accelerator */       N_("Sa_ve Search"), NULL,
-  /* tooltip */                  N_("Save the edited search"),
-                                G_CALLBACK (action_save_search_callback) },
-  /* name, stock id */         { NAUTILUS_ACTION_SAVE_SEARCH_AS, NULL,
-  /* label, accelerator */       N_("Sa_ve Search As…"), NULL,
-  /* tooltip */                  N_("Save the current search as a file"),
-                                G_CALLBACK (action_save_search_as_callback) },
 
   /* Location-specific actions */
   /* name, stock id */         { NAUTILUS_ACTION_LOCATION_OPEN_ALTERNATE, NULL,
@@ -8185,9 +8036,6 @@ real_update_menus (NautilusView *view)
        gboolean show_open_in_new_tab;
        gboolean can_open;
        gboolean show_app, show_run;
-       gboolean show_save_search;
-       gboolean save_search_sensitive;
-       gboolean show_save_search_as;
        GtkAction *action;
        GAppInfo *app;
        GIcon *app_icon;
@@ -8471,29 +8319,6 @@ real_update_menus (NautilusView *view)
        gtk_action_set_sensitive (action, !nautilus_trash_monitor_is_empty ());
        gtk_action_set_visible (action, should_show_empty_trash (view));
 
-       show_save_search = FALSE;
-       save_search_sensitive = FALSE;
-       show_save_search_as = FALSE;
-       if (selection_contains_search) {
-               NautilusSearchDirectory *search;
-
-               search = NAUTILUS_SEARCH_DIRECTORY (view->details->model);
-               if (nautilus_search_directory_is_saved_search (search)) {
-                       show_save_search = TRUE;
-                       save_search_sensitive = nautilus_search_directory_is_modified (search);
-               } else {
-                       show_save_search_as = TRUE;
-               }
-       } 
-       action = gtk_action_group_get_action (view->details->dir_action_group,
-                                             NAUTILUS_ACTION_SAVE_SEARCH);
-       gtk_action_set_visible (action, show_save_search);
-       gtk_action_set_sensitive (action, save_search_sensitive);
-       action = gtk_action_group_get_action (view->details->dir_action_group,
-                                             NAUTILUS_ACTION_SAVE_SEARCH_AS);
-       gtk_action_set_visible (action, show_save_search_as);
-
-
        action = gtk_action_group_get_action (view->details->dir_action_group,
                                              NAUTILUS_ACTION_SELECT_ALL);
        gtk_action_set_sensitive (action, !nautilus_view_is_empty (view));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]