Advertisement
Guest User

remove-recent-n-search-from-dialogs-GTK3.patch

a guest
Oct 20th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 50.98 KB | None | 0 0
  1. # remove-recent-n-search-from-dialogs-GTK3.patch
  2. --- gtk/gtkfilechooserdefault.c.orig    2012-07-15 17:48:47.000000000 +0200
  3. +++ gtk/gtkfilechooserdefault.c 2012-10-03 09:39:08.292064518 +0200
  4. @@ -167,9 +167,6 @@
  5.    QUICK_BOOKMARK,
  6.    LOCATION_TOGGLE_POPUP,
  7.    SHOW_HIDDEN,
  8. -  SEARCH_SHORTCUT,
  9. -  RECENT_SHORTCUT,
  10. -
  11.    LAST_SIGNAL
  12.  };
  13.  
  14. @@ -191,8 +188,6 @@
  15.    SHORTCUT_TYPE_FILE,
  16.    SHORTCUT_TYPE_VOLUME,
  17.    SHORTCUT_TYPE_SEPARATOR,
  18. -  SHORTCUT_TYPE_SEARCH,
  19. -  SHORTCUT_TYPE_RECENT
  20.  } ShortcutType;
  21.  
  22.  #define MODEL_ATTRIBUTES "standard::name,standard::type,standard::display-name," \
  23. @@ -234,9 +229,6 @@
  24.  
  25.  /* Interesting places in the shortcuts bar */
  26.  typedef enum {
  27. -  SHORTCUTS_SEARCH,
  28. -  SHORTCUTS_RECENT,
  29. -  SHORTCUTS_RECENT_SEPARATOR,
  30.    SHORTCUTS_HOME,
  31.    SHORTCUTS_DESKTOP,
  32.    SHORTCUTS_VOLUMES,
  33. @@ -331,8 +323,6 @@
  34.  static gboolean       gtk_file_chooser_default_should_respond         (GtkFileChooserEmbed *chooser_embed);
  35.  static void           gtk_file_chooser_default_initial_focus          (GtkFileChooserEmbed *chooser_embed);
  36.  
  37. -static void add_selection_to_recent_list (GtkFileChooserDefault *impl);
  38. -
  39.  static void location_popup_handler  (GtkFileChooserDefault *impl,
  40.                      const gchar           *path);
  41.  static void location_popup_on_paste_handler (GtkFileChooserDefault *impl);
  42. @@ -344,8 +334,6 @@
  43.  static void quick_bookmark_handler  (GtkFileChooserDefault *impl,
  44.                      gint                   bookmark_index);
  45.  static void show_hidden_handler     (GtkFileChooserDefault *impl);
  46. -static void search_shortcut_handler (GtkFileChooserDefault *impl);
  47. -static void recent_shortcut_handler (GtkFileChooserDefault *impl);
  48.  static void update_appearance       (GtkFileChooserDefault *impl);
  49.  
  50.  static void set_current_filter   (GtkFileChooserDefault *impl,
  51. @@ -409,25 +397,10 @@
  52.  static void location_switch_to_path_bar (GtkFileChooserDefault *impl);
  53.  
  54.  static void stop_loading_and_clear_list_model (GtkFileChooserDefault *impl,
  55. -                                               gboolean remove_from_treeview);
  56. +                                                gboolean remove_from_treeview);
  57.  
  58. -static void     search_setup_widgets         (GtkFileChooserDefault *impl);
  59. -static void     search_stop_searching        (GtkFileChooserDefault *impl,
  60. -                                              gboolean               remove_query);
  61. -static void     search_clear_model           (GtkFileChooserDefault *impl,
  62. -                         gboolean               remove_from_treeview);
  63. -static gboolean search_should_respond        (GtkFileChooserDefault *impl);
  64. -static GSList  *search_get_selected_files    (GtkFileChooserDefault *impl);
  65. -static void     search_entry_activate_cb     (GtkEntry              *entry,
  66. -                         gpointer               data);
  67.  static void     settings_load                (GtkFileChooserDefault *impl);
  68.  
  69. -static void     recent_start_loading         (GtkFileChooserDefault *impl);
  70. -static void     recent_stop_loading          (GtkFileChooserDefault *impl);
  71. -static void     recent_clear_model           (GtkFileChooserDefault *impl,
  72. -                                              gboolean               remove_from_treeview);
  73. -static gboolean recent_should_respond        (GtkFileChooserDefault *impl);
  74. -static GSList * recent_get_selected_files    (GtkFileChooserDefault *impl);
  75.  static void     set_file_system_backend      (GtkFileChooserDefault *impl);
  76.  static void     unset_file_system_backend    (GtkFileChooserDefault *impl);
  77.  
  78. @@ -593,24 +566,6 @@
  79.                                  _gtk_marshal_VOID__VOID,
  80.                                  G_TYPE_NONE, 0);
  81.  
  82. -  signals[SEARCH_SHORTCUT] =
  83. -    g_signal_new_class_handler (I_("search-shortcut"),
  84. -                                G_OBJECT_CLASS_TYPE (class),
  85. -                                G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
  86. -                                G_CALLBACK (search_shortcut_handler),
  87. -                                NULL, NULL,
  88. -                                _gtk_marshal_VOID__VOID,
  89. -                                G_TYPE_NONE, 0);
  90. -
  91. -  signals[RECENT_SHORTCUT] =
  92. -    g_signal_new_class_handler (I_("recent-shortcut"),
  93. -                                G_OBJECT_CLASS_TYPE (class),
  94. -                                G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
  95. -                                G_CALLBACK (recent_shortcut_handler),
  96. -                                NULL, NULL,
  97. -                                _gtk_marshal_VOID__VOID,
  98. -                                G_TYPE_NONE, 0);
  99. -
  100.    binding_set = gtk_binding_set_by_class (class);
  101.  
  102.    gtk_binding_entry_add_signal (binding_set,
  103. @@ -674,15 +629,7 @@
  104.                 GDK_KEY_h, GDK_CONTROL_MASK,
  105.                                  "show-hidden",
  106.                                  0);
  107. -  gtk_binding_entry_add_signal (binding_set,
  108. -                                GDK_KEY_s, GDK_MOD1_MASK,
  109. -                                "search-shortcut",
  110. -                                0);
  111. -  gtk_binding_entry_add_signal (binding_set,
  112. -                                GDK_KEY_r, GDK_MOD1_MASK,
  113. -                                "recent-shortcut",
  114. -                                0);
  115. -
  116. +  
  117.    for (i = 0; i < 10; i++)
  118.      gtk_binding_entry_add_signal (binding_set,
  119.                   quick_bookmark_keyvals[i], GDK_MOD1_MASK,
  120. @@ -742,7 +689,6 @@
  121.    impl->operation_mode = OPERATION_MODE_BROWSE;
  122.    impl->sort_column = MODEL_COL_NAME;
  123.    impl->sort_order = GTK_SORT_ASCENDING;
  124. -  impl->recent_manager = gtk_recent_manager_get_default ();
  125.    impl->create_folders = TRUE;
  126.  
  127.    gtk_orientable_set_orientation (GTK_ORIENTABLE (impl),
  128. @@ -872,8 +818,6 @@
  129.  
  130.    /* Free all the Models we have */
  131.    stop_loading_and_clear_list_model (impl, FALSE);
  132. -  search_clear_model (impl, FALSE);
  133. -  recent_clear_model (impl, FALSE);
  134.  
  135.    /* stopping the load above should have cleared this */
  136.    g_assert (impl->load_timeout_id == 0);
  137. @@ -1155,36 +1099,6 @@
  138.    update_preview_widget_visibility (impl);
  139.  }
  140.  
  141. -/* Renders a "Search" icon at an appropriate size for a tree view */
  142. -static GdkPixbuf *
  143. -render_search_icon (GtkFileChooserDefault *impl)
  144. -{
  145. -  return gtk_widget_render_icon_pixbuf (GTK_WIDGET (impl), GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
  146. -}
  147. -
  148. -static GdkPixbuf *
  149. -render_recent_icon (GtkFileChooserDefault *impl)
  150. -{
  151. -  GtkIconTheme *theme;
  152. -  GdkPixbuf *retval;
  153. -
  154. -  if (gtk_widget_has_screen (GTK_WIDGET (impl)))
  155. -    theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
  156. -  else
  157. -    theme = gtk_icon_theme_get_default ();
  158. -
  159. -  retval = gtk_icon_theme_load_icon (theme, "document-open-recent",
  160. -                                     impl->icon_size, 0,
  161. -                                     NULL);
  162. -
  163. -  /* fallback */
  164. -  if (!retval)
  165. -    retval = gtk_widget_render_icon_pixbuf (GTK_WIDGET (impl), GTK_STOCK_FILE, GTK_ICON_SIZE_MENU);
  166. -
  167. -  return retval;
  168. -}
  169. -
  170. -
  171.  /* Re-reads all the icons for the shortcuts, used when the theme changes */
  172.  struct ReloadIconsData
  173.  {
  174. @@ -1315,14 +1229,6 @@
  175.                              impl->icon_size, 0, NULL);
  176.             }
  177.              }
  178. -     else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
  179. -       {
  180. -         pixbuf = render_search_icon (impl);
  181. -            }
  182. -     else if (shortcut_type == SHORTCUT_TYPE_RECENT)
  183. -            {
  184. -              pixbuf = render_recent_icon (impl);
  185. -            }
  186.  
  187.            gtk_list_store_set (impl->shortcuts_model, &iter,
  188.                       SHORTCUTS_COL_PIXBUF, pixbuf,
  189. @@ -1721,52 +1627,6 @@
  190.    profile_end ("end", NULL);
  191.  }
  192.  
  193. -static void
  194. -shortcuts_append_search (GtkFileChooserDefault *impl)
  195. -{
  196. -  GdkPixbuf *pixbuf;
  197. -  GtkTreeIter iter;
  198. -
  199. -  pixbuf = render_search_icon (impl);
  200. -
  201. -  gtk_list_store_append (impl->shortcuts_model, &iter);
  202. -  gtk_list_store_set (impl->shortcuts_model, &iter,
  203. -             SHORTCUTS_COL_PIXBUF, pixbuf,
  204. -             SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
  205. -             SHORTCUTS_COL_NAME, _("Search"),
  206. -             SHORTCUTS_COL_DATA, NULL,
  207. -             SHORTCUTS_COL_TYPE, SHORTCUT_TYPE_SEARCH,
  208. -             SHORTCUTS_COL_REMOVABLE, FALSE,
  209. -             -1);
  210. -
  211. -  if (pixbuf)
  212. -    g_object_unref (pixbuf);
  213. -
  214. -  impl->has_search = TRUE;
  215. -}
  216. -
  217. -static void
  218. -shortcuts_append_recent (GtkFileChooserDefault *impl)
  219. -{
  220. -  GdkPixbuf *pixbuf;
  221. -  GtkTreeIter iter;
  222. -
  223. -  pixbuf = render_recent_icon (impl);
  224. -
  225. -  gtk_list_store_append (impl->shortcuts_model, &iter);
  226. -  gtk_list_store_set (impl->shortcuts_model, &iter,
  227. -                      SHORTCUTS_COL_PIXBUF, pixbuf,
  228. -                      SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
  229. -                      SHORTCUTS_COL_NAME, _("Recently Used"),
  230. -                      SHORTCUTS_COL_DATA, NULL,
  231. -                      SHORTCUTS_COL_TYPE, SHORTCUT_TYPE_RECENT,
  232. -                      SHORTCUTS_COL_REMOVABLE, FALSE,
  233. -                      -1);
  234. -  
  235. -  if (pixbuf)
  236. -    g_object_unref (pixbuf);
  237. -}
  238. -
  239.  /* Appends an item for the user's home directory to the shortcuts model */
  240.  static void
  241.  shortcuts_append_home (GtkFileChooserDefault *impl)
  242. @@ -1871,21 +1731,6 @@
  243.    int n;
  244.  
  245.    n = 0;
  246. -  
  247. -  if (where == SHORTCUTS_SEARCH)
  248. -    goto out;
  249. -
  250. -  n += impl->has_search ? 1 : 0;
  251. -
  252. -  if (where == SHORTCUTS_RECENT)
  253. -    goto out;
  254. -
  255. -  n += 1; /* we always have the recently-used item */
  256. -
  257. -  if (where == SHORTCUTS_RECENT_SEPARATOR)
  258. -    goto out;
  259. -
  260. -  n += 1; /* we always have the separator after the recently-used item */
  261.  
  262.    if (where == SHORTCUTS_HOME)
  263.      goto out;
  264. @@ -2009,8 +1854,7 @@
  265.  {
  266.    GtkTreeIter iter;
  267.  
  268. -  g_assert (where == SHORTCUTS_RECENT_SEPARATOR ||
  269. -            where == SHORTCUTS_BOOKMARKS_SEPARATOR ||
  270. +  g_assert (where == SHORTCUTS_BOOKMARKS_SEPARATOR ||
  271.         where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
  272.  
  273.    gtk_list_store_insert (impl->shortcuts_model, &iter,
  274. @@ -2172,14 +2016,6 @@
  275.                           G_TYPE_BOOLEAN,   /* removable */
  276.                           G_TYPE_BOOLEAN,   /* pixbuf cell visibility */
  277.                           G_TYPE_POINTER);  /* GCancellable */
  278. -
  279. -  shortcuts_append_search (impl);
  280. -
  281. -  if (impl->recent_manager)
  282. -    {
  283. -      shortcuts_append_recent (impl);
  284. -      shortcuts_insert_separator (impl, SHORTCUTS_RECENT_SEPARATOR);
  285. -    }
  286.    
  287.    if (impl->file_system)
  288.      {
  289. @@ -3226,14 +3062,6 @@
  290.  
  291.       return TRUE;
  292.     }
  293. -      else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
  294. -   {
  295. -     return FALSE;
  296. -   }
  297. -      else if (shortcut_type == SHORTCUT_TYPE_RECENT)
  298. -   {
  299. -     return FALSE;
  300. -   }
  301.      }
  302.  
  303.    return FALSE;
  304. @@ -3291,8 +3119,6 @@
  305.  
  306.    if (impl->location_entry)
  307.      entry = impl->location_entry;
  308. -  else if (impl->search_entry)
  309. -    entry = impl->search_entry;
  310.    else
  311.      entry = NULL;
  312.  
  313. @@ -3803,95 +3629,11 @@
  314.    bookmarks_add_selected_folder (impl);
  315.  }
  316.  
  317. -/* callback used to set data to clipboard */
  318. -static void
  319. -copy_file_get_cb  (GtkClipboard     *clipboard,
  320. -                   GtkSelectionData *selection_data,
  321. -                   guint             info,
  322. -                   gpointer          data)
  323. -{
  324. -  GSList *selected_files = data;
  325. -
  326. -  if (selected_files)
  327. -    {
  328. -      gint num_files = g_slist_length (selected_files);
  329. -      gchar **uris;
  330. -      gint i;
  331. -      GSList *l;
  332. -
  333. -      uris = g_new (gchar *, num_files + 1);
  334. -      uris[num_files] = NULL; /* null terminator */
  335. -
  336. -      i = 0;
  337. -
  338. -      for (l = selected_files; l; l = l->next)
  339. -        {
  340. -          GFile *file = (GFile *) l->data;
  341. -
  342. -     if (info == SELECTION_URI)
  343. -       uris[i] = g_file_get_uri (file);
  344. -     else /* if (info == SELECTION_TEXT) - let this be the fallback */
  345. -       uris[i] = g_file_get_parse_name (file);
  346. -
  347. -          i++;
  348. -        }
  349. -
  350. -      if (info == SELECTION_URI)
  351. -   gtk_selection_data_set_uris (selection_data, uris);
  352. -      else /* if (info == SELECTION_TEXT) - let this be the fallback */
  353. -   {
  354. -     char *str = g_strjoinv (" ", uris);
  355. -     gtk_selection_data_set_text (selection_data, str, -1);
  356. -     g_free (str);
  357. -   }
  358. -
  359. -      g_strfreev (uris);
  360. -    }
  361. -}
  362. -
  363. -/* callback used to clear the clipboard data */
  364. -static void
  365. -copy_file_clear_cb (GtkClipboard *clipboard,
  366. -                    gpointer      data)
  367. -{
  368. -  GSList *selected_files = data;
  369. -
  370. -  g_slist_foreach (selected_files, (GFunc) g_object_unref, NULL);
  371. -  g_slist_free (selected_files);
  372. -}
  373. -
  374.  /* Callback used when the "Copy file's location" menu item is activated */
  375.  static void
  376.  copy_file_location_cb (GtkMenuItem           *item,
  377.                         GtkFileChooserDefault *impl)
  378.  {
  379. -  GSList *selected_files = NULL;
  380. -
  381. -  selected_files = search_get_selected_files (impl);
  382. -
  383. -  if (selected_files)
  384. -    {
  385. -      GtkClipboard *clipboard;
  386. -      GtkTargetList *target_list;
  387. -      GtkTargetEntry *targets;
  388. -      int n_targets;
  389. -
  390. -      clipboard = gtk_widget_get_clipboard (GTK_WIDGET (impl), GDK_SELECTION_CLIPBOARD);
  391. -
  392. -      target_list = gtk_target_list_new (NULL, 0);
  393. -      gtk_target_list_add_text_targets (target_list, SELECTION_TEXT);
  394. -      gtk_target_list_add_uri_targets (target_list, SELECTION_URI);
  395. -
  396. -      targets = gtk_target_table_new_from_list (target_list, &n_targets);
  397. -      gtk_target_list_unref (target_list);
  398. -
  399. -      gtk_clipboard_set_with_data (clipboard, targets, n_targets,
  400. -                  copy_file_get_cb,
  401. -                                   copy_file_clear_cb,
  402. -                  selected_files);
  403. -
  404. -      gtk_target_table_free (targets, n_targets);
  405. -    }
  406.  }
  407.  
  408.  /* Callback used when the "Visit this file" menu item is activated */
  409. @@ -3899,20 +3641,6 @@
  410.  visit_file_cb (GtkMenuItem *item,
  411.            GtkFileChooserDefault *impl)
  412.  {
  413. -  GSList *files;
  414. -
  415. -  files = search_get_selected_files (impl);
  416. -
  417. -  /* Sigh, just use the first one */
  418. -  if (files)
  419. -    {
  420. -      GFile *file = files->data;
  421. -
  422. -      gtk_file_chooser_default_select_file (GTK_FILE_CHOOSER (impl), file, NULL); /* NULL-GError */
  423. -    }
  424. -
  425. -  g_slist_foreach (files, (GFunc) g_object_unref, NULL);
  426. -  g_slist_free (files);
  427.  }
  428.  
  429.  /* callback used when the "Show Hidden Files" menu item is toggled */
  430. @@ -4652,14 +4380,6 @@
  431.  static void
  432.  location_switch_to_filename_entry (GtkFileChooserDefault *impl)
  433.  {
  434. -  /* when in search or recent files mode, we are not showing the
  435. -   * location_entry_box container, so there's no point in switching
  436. -   * to it.
  437. -   */
  438. -  if (impl->operation_mode == OPERATION_MODE_SEARCH ||
  439. -      impl->operation_mode == OPERATION_MODE_RECENT)
  440. -    return;
  441. -
  442.    /* Box */
  443.  
  444.    gtk_widget_show (impl->location_entry_box);
  445. @@ -4752,13 +4472,6 @@
  446.  static void
  447.  location_toggle_popup_handler (GtkFileChooserDefault *impl)
  448.  {
  449. -  /* when in search or recent files mode, we are not showing the
  450. -   * location_entry_box container, so there's no point in switching
  451. -   * to it.
  452. -   */
  453. -  if (impl->operation_mode == OPERATION_MODE_SEARCH ||
  454. -      impl->operation_mode == OPERATION_MODE_RECENT)
  455. -    return;
  456.  
  457.    /* If the file entry is not visible, show it.
  458.     * If it is visible, turn it off only if it is focused.  Otherwise, switch to the entry.
  459. @@ -4832,8 +4545,6 @@
  460.    PATH_BAR_SELECT_A_FOLDER,
  461.    PATH_BAR_ERROR_NO_FILENAME,
  462.    PATH_BAR_ERROR_NO_FOLDER,
  463. -  PATH_BAR_RECENTLY_USED,
  464. -  PATH_BAR_SEARCH
  465.  } PathBarMode;
  466.  
  467.  /* Creates the info bar for informational messages or warnings, with its icon and label */
  468. @@ -4898,19 +4609,6 @@
  469.      g_free (str);
  470.  }
  471.  
  472. -/* Creates the icon and label used to show that the file chooser is in Search or Recently-used mode */
  473. -static void
  474. -special_mode_widgets_create (GtkFileChooserDefault *impl)
  475. -{
  476. -  impl->browse_special_mode_icon = gtk_image_new ();
  477. -  gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_special_mode_icon);
  478. -  gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_special_mode_icon, FALSE, FALSE, 0);
  479. -
  480. -  impl->browse_special_mode_label = gtk_label_new (NULL);
  481. -  gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_special_mode_label);
  482. -  gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_special_mode_label, FALSE, FALSE, 0);
  483. -}
  484. -
  485.  /* Creates the path bar's container and eveyrthing that goes in it: location button, pathbar, info bar, and Create Folder button */
  486.  static void
  487.  path_bar_widgets_create (GtkFileChooserDefault *impl)
  488. @@ -4941,9 +4639,6 @@
  489.    gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_select_a_folder_info_bar);
  490.    gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_select_a_folder_info_bar, TRUE, TRUE, 0);
  491.  
  492. -  /* Widgets for special modes (recently-used in Open mode, Search mode) */
  493. -  special_mode_widgets_create (impl);
  494. -
  495.    /* Create Folder */
  496.    impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder"));
  497.    g_signal_connect (impl->browse_new_folder_button, "clicked",
  498. @@ -4965,8 +4660,6 @@
  499.    gboolean info_bar_visible        = FALSE;
  500.    gboolean create_folder_visible        = FALSE;
  501.  
  502. -  char *tmp;
  503. -
  504.    switch (mode)
  505.      {
  506.      case PATH_BAR_FOLDER_PATH:
  507. @@ -4980,26 +4673,6 @@
  508.        info_bar_visible = TRUE;
  509.        break;
  510.  
  511. -    case PATH_BAR_RECENTLY_USED:
  512. -      gtk_image_set_from_icon_name (GTK_IMAGE (impl->browse_special_mode_icon), "document-open-recent", GTK_ICON_SIZE_BUTTON);
  513. -
  514. -      tmp = g_strdup_printf ("<b>%s</b>", _("Recently Used"));
  515. -      gtk_label_set_markup (GTK_LABEL (impl->browse_special_mode_label), tmp);
  516. -      g_free (tmp);
  517. -
  518. -      special_mode_widgets_visible = TRUE;
  519. -      break;
  520. -
  521. -    case PATH_BAR_SEARCH:
  522. -      gtk_image_set_from_stock (GTK_IMAGE (impl->browse_special_mode_icon), GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
  523. -
  524. -      tmp = g_strdup_printf ("<b>%s</b>", _("Search:"));
  525. -      gtk_label_set_markup (GTK_LABEL (impl->browse_special_mode_label), tmp);
  526. -      g_free (tmp);
  527. -
  528. -      special_mode_widgets_visible = TRUE;
  529. -      break;
  530. -
  531.      default:
  532.        g_assert_not_reached ();
  533.      }
  534. @@ -5013,7 +4686,7 @@
  535.      {
  536.        if (impl->create_folders
  537.       && impl->action != GTK_FILE_CHOOSER_ACTION_OPEN
  538. -     && impl->operation_mode != OPERATION_MODE_RECENT)
  539. +     )
  540.     create_folder_visible = TRUE;
  541.      }
  542.  
  543. @@ -5277,19 +4950,6 @@
  544.    g_object_unref (impl->browse_path_bar_hbox);
  545.  }
  546.  
  547. -/* Takes the folder stored in a row in the recent_model, and puts it in the pathbar */
  548. -static void
  549. -put_recent_folder_in_pathbar (GtkFileChooserDefault *impl, GtkTreeIter *iter)
  550. -{
  551. -  GFile *file;
  552. -
  553. -  gtk_tree_model_get (GTK_TREE_MODEL (impl->recent_model), iter,
  554. -             MODEL_COL_FILE, &file,
  555. -             -1);
  556. -  _gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), file, FALSE);
  557. -  g_object_unref (file);
  558. -}
  559. -
  560.  /* Sets the pathbar in the appropriate mode according to the current operation mode and action.  This is the central function for
  561.   * dealing with the pathbar's widgets; as long as impl->action and impl->operation_mode are set correctly, then calling this
  562.   * function will update all the pathbar's widgets.
  563. @@ -5305,35 +4965,6 @@
  564.        mode = PATH_BAR_FOLDER_PATH;
  565.        break;
  566.  
  567. -    case OPERATION_MODE_RECENT:
  568. -      if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
  569. -   {
  570. -     GtkTreeSelection *selection;
  571. -     gboolean have_selected;
  572. -     GtkTreeIter iter;
  573. -
  574. -     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
  575. -
  576. -     /* Save mode means single-selection mode, so the following is valid */
  577. -     have_selected = gtk_tree_selection_get_selected (selection, NULL, &iter);
  578. -
  579. -     if (have_selected)
  580. -       {
  581. -         mode = PATH_BAR_FOLDER_PATH;
  582. -         put_recent_folder_in_pathbar (impl, &iter);
  583. -       }
  584. -     else
  585. -       mode = PATH_BAR_SELECT_A_FOLDER;
  586. -   }
  587. -      else
  588. -   mode = PATH_BAR_RECENTLY_USED;
  589. -
  590. -      break;
  591. -
  592. -    case OPERATION_MODE_SEARCH:
  593. -      mode = PATH_BAR_SEARCH;
  594. -      break;
  595. -
  596.      default:
  597.        g_assert_not_reached ();
  598.        return;
  599. @@ -5342,18 +4973,6 @@
  600.    path_bar_set_mode (impl, mode);
  601.  }
  602.  
  603. -static void
  604. -operation_mode_discard_search_widgets (GtkFileChooserDefault *impl)
  605. -{
  606. -  if (impl->search_hbox)
  607. -    {
  608. -      gtk_widget_destroy (impl->search_hbox);
  609. -
  610. -      impl->search_hbox = NULL;
  611. -      impl->search_entry = NULL;
  612. -    }
  613. -}
  614. -
  615.  /* Stops running operations like populating the browse model, searches, and the recent-files model */
  616.  static void
  617.  operation_mode_stop (GtkFileChooserDefault *impl, OperationMode mode)
  618. @@ -5364,18 +4983,6 @@
  619.        stop_loading_and_clear_list_model (impl, TRUE);
  620.        break;
  621.  
  622. -    case OPERATION_MODE_SEARCH:
  623. -      search_stop_searching (impl, FALSE);
  624. -      search_clear_model (impl, TRUE);
  625. -
  626. -      operation_mode_discard_search_widgets (impl);
  627. -      break;
  628. -
  629. -    case OPERATION_MODE_RECENT:
  630. -      recent_stop_loading (impl);
  631. -      recent_clear_model (impl, TRUE);
  632. -      break;
  633. -
  634.      default:
  635.        g_assert_not_reached ();
  636.      }
  637. @@ -5397,32 +5004,6 @@
  638.      }
  639.  }
  640.  
  641. -static void
  642. -operation_mode_set_search (GtkFileChooserDefault *impl)
  643. -{
  644. -  g_assert (impl->search_hbox == NULL);
  645. -  g_assert (impl->search_entry == NULL);
  646. -  g_assert (impl->search_model == NULL);
  647. -
  648. -  search_setup_widgets (impl);
  649. -}
  650. -
  651. -static void
  652. -operation_mode_set_recent (GtkFileChooserDefault *impl)
  653. -{
  654. -  path_bar_update (impl);
  655. -
  656. -  /* Hide the location widgets temporarily */
  657. -  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
  658. -      impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
  659. -    {
  660. -      gtk_widget_hide (impl->location_button);
  661. -      gtk_widget_hide (impl->location_entry_box);
  662. -    }
  663. -
  664. -  recent_start_loading (impl);
  665. -}
  666. -
  667.  /* Sometimes we need to frob the selection in the shortcuts list manually */
  668.  static void
  669.  shortcuts_select_item_without_activating (GtkFileChooserDefault *impl, int pos)
  670. @@ -5457,16 +5038,6 @@
  671.        shortcut_to_select = SHORTCUTS_CURRENT_FOLDER;
  672.        break;
  673.  
  674. -    case OPERATION_MODE_SEARCH:
  675. -      operation_mode_set_search (impl);
  676. -      shortcut_to_select = SHORTCUTS_SEARCH;
  677. -      break;
  678. -
  679. -    case OPERATION_MODE_RECENT:
  680. -      operation_mode_set_recent (impl);
  681. -      shortcut_to_select = SHORTCUTS_RECENT;
  682. -      break;
  683. -
  684.      default:
  685.        g_assert_not_reached ();
  686.        return;
  687. @@ -5774,9 +5345,6 @@
  688.        g_cancellable_cancel (impl->shortcuts_activate_iter_cancellable);
  689.        impl->shortcuts_activate_iter_cancellable = NULL;
  690.      }
  691. -
  692. -  search_stop_searching (impl, TRUE);
  693. -  recent_stop_loading (impl);
  694.  }
  695.  
  696.  /* Removes the settings signal handler.  It's safe to call multiple times */
  697. @@ -6165,7 +5733,7 @@
  698.        switch (impl->reload_state)
  699.          {
  700.          case RELOAD_EMPTY:
  701. -     recent_shortcut_handler (impl);
  702. +           /* Removed call to recent-related function */
  703.            break;
  704.          
  705.          case RELOAD_HAS_FOLDER:
  706. @@ -7012,11 +6580,6 @@
  707.    GtkTreeSelection *selection;
  708.    struct update_chooser_entry_selected_foreach_closure closure;
  709.  
  710. -  /* no need to update the file chooser's entry if there's no entry */
  711. -  if (impl->operation_mode == OPERATION_MODE_SEARCH ||
  712. -      !impl->location_entry)
  713. -    return;
  714. -
  715.    if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
  716.          || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
  717.          || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
  718. @@ -7032,9 +6595,6 @@
  719.  
  720.    if (closure.num_selected == 0)
  721.      {
  722. -      if (impl->operation_mode == OPERATION_MODE_RECENT)
  723. -   _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), NULL);
  724. -      else
  725.     goto maybe_clear_entry;
  726.      }
  727.    else if (closure.num_selected == 1)
  728. @@ -7076,20 +6636,6 @@
  729.  
  730.            return;
  731.          }
  732. -      else if (impl->operation_mode == OPERATION_MODE_RECENT
  733. -          && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
  734. -   {
  735. -     GFile *folder;
  736. -
  737. -     /* Set the base folder on the name entry, so it will do completion relative to the correct recent-folder */
  738. -
  739. -     gtk_tree_model_get (GTK_TREE_MODEL (impl->recent_model), &closure.first_selected_iter,
  740. -                 MODEL_COL_FILE, &folder,
  741. -                 -1);
  742. -     _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), folder);
  743. -     g_object_unref (folder);
  744. -     return;
  745. -   }
  746.      }
  747.    else
  748.      {
  749. @@ -7415,10 +6961,6 @@
  750.  gtk_file_chooser_default_get_current_folder (GtkFileChooser *chooser)
  751.  {
  752.    GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
  753. -
  754. -  if (impl->operation_mode == OPERATION_MODE_SEARCH ||
  755. -      impl->operation_mode == OPERATION_MODE_RECENT)
  756. -    return NULL;
  757.  
  758.    if (impl->reload_state == RELOAD_EMPTY)
  759.      {
  760. @@ -7463,9 +7005,7 @@
  761.    if (!parent_file)
  762.      return gtk_file_chooser_set_current_folder_file (chooser, file, error);
  763.  
  764. -  if (impl->operation_mode == OPERATION_MODE_SEARCH ||
  765. -      impl->operation_mode == OPERATION_MODE_RECENT ||
  766. -      impl->load_state == LOAD_EMPTY)
  767. +  if (impl->load_state == LOAD_EMPTY)
  768.      {
  769.        same_path = FALSE;
  770.      }
  771. @@ -7554,16 +7094,6 @@
  772.  {
  773.    GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
  774.  
  775. -  if (impl->operation_mode == OPERATION_MODE_SEARCH ||
  776. -      impl->operation_mode == OPERATION_MODE_RECENT)
  777. -    {
  778. -      GtkTreeSelection *selection;
  779. -      
  780. -      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
  781. -      gtk_tree_selection_select_all (selection);
  782. -      return;
  783. -    }
  784. -
  785.    if (impl->select_multiple)
  786.      gtk_tree_model_foreach (GTK_TREE_MODEL (impl->browse_files_model),
  787.                 maybe_select, impl);
  788. @@ -7707,20 +7237,6 @@
  789.    info.result = NULL;
  790.    info.file_from_entry = NULL;
  791.  
  792. -  if (impl->operation_mode == OPERATION_MODE_SEARCH)
  793. -    return search_get_selected_files (impl);
  794. -
  795. -  if (impl->operation_mode == OPERATION_MODE_RECENT)
  796. -    {
  797. -      if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
  798. -   {
  799. -     file_list_seen = TRUE;
  800. -     goto file_entry;
  801. -   }
  802. -      else
  803. -   return recent_get_selected_files (impl);
  804. -    }
  805. -
  806.    toplevel = get_toplevel (GTK_WIDGET (impl));
  807.    if (toplevel)
  808.      current_focus = gtk_window_get_focus (toplevel);
  809. @@ -8370,16 +7886,6 @@
  810.    gchar *file_part;
  811.  };
  812.  
  813. -/* Every time we request a response explicitly, we need to save the selection to the recently-used list,
  814. - * as requesting a response means, "the dialog is confirmed".
  815. - */
  816. -static void
  817. -request_response_and_add_to_recent_list (GtkFileChooserDefault *impl)
  818. -{
  819. -  g_signal_emit_by_name (impl, "response-requested");
  820. -  add_selection_to_recent_list (impl);
  821. -}
  822. -
  823.  static void
  824.  confirmation_confirm_get_info_cb (GCancellable *cancellable,
  825.                   GFileInfo    *info,
  826. @@ -8405,8 +7911,8 @@
  827.      should_respond = confirm_dialog_should_accept_filename (data->impl, data->file_part, g_file_info_get_display_name (info));
  828.  
  829.    set_busy_cursor (data->impl, FALSE);
  830.    if (should_respond)
  831. -    request_response_and_add_to_recent_list (data->impl);
  832. +    g_signal_emit_by_name (data->impl, "response-requested");
  833.  
  834.  out:
  835.    g_object_unref (data->impl);
  836. @@ -8506,28 +8010,15 @@
  837.      {
  838.        if (data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
  839.     {
  840. -     request_response_and_add_to_recent_list (data->impl); /* even if the file doesn't exist, apps can make good use of that (e.g. Emacs) */
  841. +     g_signal_emit_by_name (data->impl, "response-requested");
  842.     }
  843.        else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
  844.          {
  845.            if (data->file_exists_and_is_not_folder)
  846.         {
  847. -         gboolean retval;
  848. -         char *file_part;
  849. -
  850. -              /* Dup the string because the string may be modified
  851. -               * depending on what clients do in the confirm-overwrite
  852. -               * signal and this corrupts the pointer
  853. -               */
  854. -              file_part = g_strdup (_gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (data->impl->location_entry)));
  855. -         retval = should_respond_after_confirm_overwrite (data->impl, file_part, data->parent_file);
  856. -              g_free (file_part);
  857. -
  858. -         if (retval)
  859. -       request_response_and_add_to_recent_list (data->impl);
  860. +       g_signal_emit_by_name (data->impl, "response-requested");
  861.         }
  862.       else
  863. -       request_response_and_add_to_recent_list (data->impl);
  864. +       g_signal_emit_by_name (data->impl, "response-requested");
  865.     }
  866.        else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
  867.            || data->impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
  868. @@ -8542,9 +8032,9 @@
  869.       g_file_make_directory (data->file, NULL, &mkdir_error);
  870.       set_busy_cursor (data->impl, FALSE);
  871.  
  872.       if (!mkdir_error)
  873. -       request_response_and_add_to_recent_list (data->impl);
  874. +       g_signal_emit_by_name (data->impl, "response-requested");
  875.       else
  876.         error_creating_folder_dialog (data->impl, data->file, mkdir_error);
  877.          }
  878.        else
  879. @@ -8609,9 +8097,9 @@
  880.     change_folder_and_display_error (data->impl, data->file, TRUE);
  881.        else
  882.     {
  883.       if (file_exists)
  884. -       request_response_and_add_to_recent_list (data->impl); /* user typed an existing filename; we are done */
  885. +       g_signal_emit_by_name (data->impl, "response-requested");
  886.       else
  887.         needs_parent_check = TRUE; /* file doesn't exist; see if its parent exists */
  888.     }
  889.      }
  890. @@ -8638,12 +8124,9 @@
  891.          }
  892.        else
  893.     {
  894.       if (is_folder)
  895. -       {
  896. -         /* User typed a folder; we are done */
  897. -         request_response_and_add_to_recent_list (data->impl);
  898. -       }
  899. +       g_signal_emit_by_name (data->impl, "response-requested");
  900.       else
  901.         error_selecting_folder_over_existing_file_dialog (data->impl, data->file);
  902.     }
  903.      }
  904. @@ -8718,32 +8199,6 @@
  905.                   impl);
  906.  }
  907.  
  908. -/* Implementation for GtkFileChooserEmbed::should_respond() */
  909. -static void
  910. -add_selection_to_recent_list (GtkFileChooserDefault *impl)
  911. -{
  912. -  GSList *files;
  913. -  GSList *l;
  914. -
  915. -  files = gtk_file_chooser_default_get_files (GTK_FILE_CHOOSER (impl));
  916. -
  917. -  for (l = files; l; l = l->next)
  918. -    {
  919. -      GFile *file = l->data;
  920. -      char *uri;
  921. -
  922. -      uri = g_file_get_uri (file);
  923. -      if (uri)
  924. -   {
  925. -     gtk_recent_manager_add_item (impl->recent_manager, uri);
  926. -     g_free (uri);
  927. -   }
  928. -    }
  929. -
  930. -  g_slist_foreach (files, (GFunc) g_object_unref, NULL);
  931. -  g_slist_free (files);
  932. -}
  933. -
  934.  static gboolean
  935.  gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
  936.  {
  937. @@ -8792,22 +8247,6 @@
  938.  
  939.        g_assert (impl->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->action <= GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
  940.  
  941. -      if (impl->operation_mode == OPERATION_MODE_SEARCH)
  942. -   {
  943. -     retval = search_should_respond (impl);
  944. -     goto out;
  945. -   }
  946. -
  947. -      if (impl->operation_mode == OPERATION_MODE_RECENT)
  948. -   {
  949. -     if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
  950. -       goto save_entry;
  951. -     else
  952. -       {
  953. -         retval = recent_should_respond (impl);
  954. -         goto out;
  955. -       }
  956. -   }
  957.  
  958.        selection_check (impl, &num_selected, &all_files, &all_folders);
  959.  
  960. @@ -8884,20 +8323,6 @@
  961.  
  962.        if (!is_well_formed)
  963.     {
  964. -     if (!is_empty
  965. -         && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
  966. -         && impl->operation_mode == OPERATION_MODE_RECENT)
  967. -       {
  968. -         path_bar_set_mode (impl, PATH_BAR_ERROR_NO_FOLDER);
  969. -#if 0
  970. -         /* We'll #ifdef this out, as the fucking treeview selects its first row,
  971. -          * thus changing our assumption that no selection is present - setting
  972. -          * a selection causes the error message from path_bar_set_mode() to go away,
  973. -          * but we want the user to see that message!
  974. -          */
  975. -         gtk_widget_grab_focus (impl->browse_files_tree_view);
  976. -#endif
  977. -       }
  978.       /* FIXME: else show an "invalid filename" error as the pathbar mode? */
  979.  
  980.       return FALSE;
  981. @@ -8978,11 +8403,6 @@
  982.         */
  983.        goto file_list;
  984.      }
  985. -  else if (impl->operation_mode == OPERATION_MODE_SEARCH && impl->toplevel_last_focus_widget == impl->search_entry)
  986. -    {
  987. -      search_entry_activate_cb (GTK_ENTRY (impl->search_entry), impl);
  988. -      return FALSE;
  989. -    }
  990.    else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
  991.      {
  992.        /* The focus is on a dialog's action area button, *and* the widget that
  993. @@ -9000,9 +8420,6 @@
  994.  
  995.   out:
  996.  
  997. -  if (retval)
  998. -    add_selection_to_recent_list (impl);
  999. -
  1000.    return retval;
  1001.  }
  1002.  
  1003. @@ -9018,8 +8435,7 @@
  1004.    if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
  1005.        impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
  1006.      {
  1007. -      if (impl->location_mode == LOCATION_MODE_PATH_BAR
  1008. -     || impl->operation_mode == OPERATION_MODE_RECENT)
  1009. +      if (impl->location_mode == LOCATION_MODE_PATH_BAR)
  1010.     widget = impl->browse_files_tree_view;
  1011.        else
  1012.     widget = impl->location_entry;
  1013. @@ -9037,273 +8453,6 @@
  1014.    gtk_widget_grab_focus (widget);
  1015.  }
  1016.  
  1017. -/* Callback used from gtk_tree_selection_selected_foreach(); gets the selected GFiles */
  1018. -static void
  1019. -search_selected_foreach_get_file_cb (GtkTreeModel *model,
  1020. -                    GtkTreePath  *path,
  1021. -                    GtkTreeIter  *iter,
  1022. -                    gpointer      data)
  1023. -{
  1024. -  GSList **list;
  1025. -  GFile *file;
  1026. -
  1027. -  list = data;
  1028. -
  1029. -  gtk_tree_model_get (model, iter, MODEL_COL_FILE, &file, -1);
  1030. -  *list = g_slist_prepend (*list, file); /* The file already has a new ref courtesy of gtk_tree_model_get(); this will be unreffed by the caller */
  1031. -}
  1032. -
  1033. -/* Constructs a list of the selected paths in search mode */
  1034. -static GSList *
  1035. -search_get_selected_files (GtkFileChooserDefault *impl)
  1036. -{
  1037. -  GSList *result;
  1038. -  GtkTreeSelection *selection;
  1039. -
  1040. -  result = NULL;
  1041. -
  1042. -  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
  1043. -  gtk_tree_selection_selected_foreach (selection, search_selected_foreach_get_file_cb, &result);
  1044. -  result = g_slist_reverse (result);
  1045. -
  1046. -  return result;
  1047. -}
  1048. -
  1049. -/* Called from ::should_respond().  We return whether there are selected files
  1050. - * in the search list.
  1051. - */
  1052. -static gboolean
  1053. -search_should_respond (GtkFileChooserDefault *impl)
  1054. -{
  1055. -  GtkTreeSelection *selection;
  1056. -
  1057. -  g_assert (impl->operation_mode == OPERATION_MODE_SEARCH);
  1058. -
  1059. -  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
  1060. -  return (gtk_tree_selection_count_selected_rows (selection) != 0);
  1061. -}
  1062. -
  1063. -/* Adds one hit from the search engine to the search_model */
  1064. -static void
  1065. -search_add_hit (GtkFileChooserDefault *impl,
  1066. -       gchar                 *uri)
  1067. -{
  1068. -  GFile *file;
  1069. -
  1070. -  file = g_file_new_for_uri (uri);
  1071. -  if (!file)
  1072. -    return;
  1073. -
  1074. -  if (!g_file_is_native (file))
  1075. -    {
  1076. -      g_object_unref (file);
  1077. -      return;
  1078. -    }
  1079. -
  1080. -  _gtk_file_system_model_add_and_query_file (impl->search_model,
  1081. -                                             file,
  1082. -                                             MODEL_ATTRIBUTES);
  1083. -
  1084. -  g_object_unref (file);
  1085. -}
  1086. -
  1087. -/* Callback used from GtkSearchEngine when we get new hits */
  1088. -static void
  1089. -search_engine_hits_added_cb (GtkSearchEngine *engine,
  1090. -                GList           *hits,
  1091. -                gpointer         data)
  1092. -{
  1093. -  GtkFileChooserDefault *impl;
  1094. -  GList *l;
  1095. -  
  1096. -  impl = GTK_FILE_CHOOSER_DEFAULT (data);
  1097. -
  1098. -  for (l = hits; l; l = l->next)
  1099. -    search_add_hit (impl, (gchar*)l->data);
  1100. -}
  1101. -
  1102. -/* Callback used from GtkSearchEngine when the query is done running */
  1103. -static void
  1104. -search_engine_finished_cb (GtkSearchEngine *engine,
  1105. -              gpointer         data)
  1106. -{
  1107. -  GtkFileChooserDefault *impl;
  1108. -  
  1109. -  impl = GTK_FILE_CHOOSER_DEFAULT (data);
  1110. -  
  1111. -#if 0
  1112. -  /* EB: setting the model here will avoid loads of row events,
  1113. -   * but it'll make the search look like blocked.
  1114. -   */
  1115. -  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
  1116. -                           GTK_TREE_MODEL (impl->search_model));
  1117. -  file_list_set_sort_column_ids (impl);
  1118. -#endif
  1119. -
  1120. -  /* FMQ: if search was empty, say that we got no hits */
  1121. -  set_busy_cursor (impl, FALSE);
  1122. -}
  1123. -
  1124. -/* Displays a generic error when we cannot create a GtkSearchEngine.  
  1125. - * It would be better if _gtk_search_engine_new() gave us a GError
  1126. - * with a better message, but it doesn't do that right now.
  1127. - */
  1128. -static void
  1129. -search_error_could_not_create_client (GtkFileChooserDefault *impl)
  1130. -{
  1131. -  error_message (impl,
  1132. -        _("Could not start the search process"),
  1133. -        _("The program was not able to create a connection to the indexer "
  1134. -          "daemon.  Please make sure it is running."));
  1135. -}
  1136. -
  1137. -static void
  1138. -search_engine_error_cb (GtkSearchEngine *engine,
  1139. -           const gchar     *message,
  1140. -           gpointer         data)
  1141. -{
  1142. -  GtkFileChooserDefault *impl;
  1143. -  
  1144. -  impl = GTK_FILE_CHOOSER_DEFAULT (data);
  1145. -
  1146. -  search_stop_searching (impl, TRUE);
  1147. -  error_message (impl, _("Could not send the search request"), message);
  1148. -
  1149. -  set_busy_cursor (impl, FALSE);
  1150. -}
  1151. -
  1152. -/* Frees the data in the search_model */
  1153. -static void
  1154. -search_clear_model (GtkFileChooserDefault *impl,
  1155. -           gboolean               remove_from_treeview)
  1156. -{
  1157. -  if (!impl->search_model)
  1158. -    return;
  1159. -
  1160. -  g_object_unref (impl->search_model);
  1161. -  impl->search_model = NULL;
  1162. -  
  1163. -  if (remove_from_treeview)
  1164. -    gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
  1165. -}
  1166. -
  1167. -/* Stops any ongoing searches; does not touch the search_model */
  1168. -static void
  1169. -search_stop_searching (GtkFileChooserDefault *impl,
  1170. -                       gboolean               remove_query)
  1171. -{
  1172. -  if (remove_query && impl->search_query)
  1173. -    {
  1174. -      g_object_unref (impl->search_query);
  1175. -      impl->search_query = NULL;
  1176. -    }
  1177. -  
  1178. -  if (impl->search_engine)
  1179. -    {
  1180. -      _gtk_search_engine_stop (impl->search_engine);
  1181. -      
  1182. -      g_object_unref (impl->search_engine);
  1183. -      impl->search_engine = NULL;
  1184. -    }
  1185. -}
  1186. -
  1187. -/* Creates the search_model and puts it in the tree view */
  1188. -static void
  1189. -search_setup_model (GtkFileChooserDefault *impl)
  1190. -{
  1191. -  g_assert (impl->search_model == NULL);
  1192. -
  1193. -  impl->search_model = _gtk_file_system_model_new (file_system_model_set,
  1194. -                                                   impl,
  1195. -                          MODEL_COLUMN_TYPES);
  1196. -
  1197. -  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
  1198. -                  MODEL_COL_NAME,
  1199. -                  name_sort_func,
  1200. -                  impl, NULL);
  1201. -  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
  1202. -                  MODEL_COL_MTIME,
  1203. -                  mtime_sort_func,
  1204. -                  impl, NULL);
  1205. -  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
  1206. -                  MODEL_COL_SIZE,
  1207. -                  size_sort_func,
  1208. -                  impl, NULL);
  1209. -  set_sort_column (impl);
  1210. -
  1211. -  /* EB: setting the model here will make the hits list update feel
  1212. -   * more "alive" than setting the model at the end of the search
  1213. -   * run
  1214. -   */
  1215. -  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
  1216. -                           GTK_TREE_MODEL (impl->search_model));
  1217. -  file_list_set_sort_column_ids (impl);
  1218. -}
  1219. -
  1220. -/* Creates a new query with the specified text and launches it */
  1221. -static void
  1222. -search_start_query (GtkFileChooserDefault *impl,
  1223. -           const gchar           *query_text)
  1224. -{
  1225. -  search_stop_searching (impl, FALSE);
  1226. -  search_clear_model (impl, TRUE);
  1227. -  search_setup_model (impl);
  1228. -  set_busy_cursor (impl, TRUE);
  1229. -
  1230. -  if (impl->search_engine == NULL)
  1231. -    impl->search_engine = _gtk_search_engine_new ();
  1232. -
  1233. -  if (!impl->search_engine)
  1234. -    {
  1235. -      set_busy_cursor (impl, FALSE);
  1236. -      search_error_could_not_create_client (impl); /* lame; we don't get an error code or anything */
  1237. -      return;
  1238. -    }
  1239. -
  1240. -  if (!impl->search_query)
  1241. -    {
  1242. -      impl->search_query = _gtk_query_new ();
  1243. -      _gtk_query_set_text (impl->search_query, query_text);
  1244. -    }
  1245. -  
  1246. -  _gtk_search_engine_set_query (impl->search_engine, impl->search_query);
  1247. -
  1248. -  g_signal_connect (impl->search_engine, "hits-added",
  1249. -           G_CALLBACK (search_engine_hits_added_cb), impl);
  1250. -  g_signal_connect (impl->search_engine, "finished",
  1251. -           G_CALLBACK (search_engine_finished_cb), impl);
  1252. -  g_signal_connect (impl->search_engine, "error",
  1253. -           G_CALLBACK (search_engine_error_cb), impl);
  1254. -
  1255. -  _gtk_search_engine_start (impl->search_engine);
  1256. -}
  1257. -
  1258. -/* Callback used when the user presses Enter while typing on the search
  1259. - * entry; starts the query
  1260. - */
  1261. -static void
  1262. -search_entry_activate_cb (GtkEntry *entry,
  1263. -             gpointer data)
  1264. -{
  1265. -  GtkFileChooserDefault *impl;
  1266. -  const char *text;
  1267. -
  1268. -  impl = GTK_FILE_CHOOSER_DEFAULT (data);
  1269. -
  1270. -  text = gtk_entry_get_text (GTK_ENTRY (impl->search_entry));
  1271. -  if (strlen (text) == 0)
  1272. -    return;
  1273. -
  1274. -  /* reset any existing query object */
  1275. -  if (impl->search_query)
  1276. -    {
  1277. -      g_object_unref (impl->search_query);
  1278. -      impl->search_query = NULL;
  1279. -    }
  1280. -
  1281. -  search_start_query (impl, text);
  1282. -}
  1283. -
  1284.  static gboolean
  1285.  focus_entry_idle_cb (GtkFileChooserDefault *impl)
  1286.  {
  1287. @@ -9320,131 +8469,6 @@
  1288.    return FALSE;
  1289.  }
  1290.  
  1291. -static void
  1292. -focus_search_entry_in_idle (GtkFileChooserDefault *impl)
  1293. -{
  1294. -  /* bgo#634558 - When the user clicks on the Search entry in the shortcuts
  1295. -   * pane, we get a selection-changed signal and we set up the search widgets.
  1296. -   * However, gtk_tree_view_button_press() focuses the treeview *after* making
  1297. -   * the change to the selection.  So, we need to re-focus the search entry
  1298. -   * after the treeview has finished doing its work; we'll do that in an idle
  1299. -   * handler.
  1300. -   */
  1301. -
  1302. -  if (!impl->focus_entry_idle)
  1303. -    impl->focus_entry_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (focus_entry_idle_cb));
  1304. -}
  1305. -
  1306. -/* Hides the path bar and creates the search entry */
  1307. -static void
  1308. -search_setup_widgets (GtkFileChooserDefault *impl)
  1309. -{
  1310. -  impl->search_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
  1311. -
  1312. -  path_bar_update (impl);
  1313. -
  1314. -  impl->search_entry = gtk_entry_new ();
  1315. -  g_signal_connect (impl->search_entry, "activate",
  1316. -           G_CALLBACK (search_entry_activate_cb),
  1317. -           impl);
  1318. -  gtk_box_pack_start (GTK_BOX (impl->search_hbox), impl->search_entry, TRUE, TRUE, 0);
  1319. -
  1320. -  /* if there already is a query, restart it */
  1321. -  if (impl->search_query)
  1322. -    {
  1323. -      gchar *query = _gtk_query_get_text (impl->search_query);
  1324. -
  1325. -      if (query)
  1326. -        {
  1327. -          gtk_entry_set_text (GTK_ENTRY (impl->search_entry), query);
  1328. -          search_start_query (impl, query);
  1329. -
  1330. -          g_free (query);
  1331. -        }
  1332. -      else
  1333. -        {
  1334. -          g_object_unref (impl->search_query);
  1335. -          impl->search_query = NULL;
  1336. -        }
  1337. -    }
  1338. -
  1339. -  /* Box for search widgets */
  1340. -  gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->search_hbox, TRUE, TRUE, 0);
  1341. -  gtk_widget_show_all (impl->search_hbox);
  1342. -  gtk_size_group_add_widget (GTK_SIZE_GROUP (impl->browse_path_bar_size_group), impl->search_hbox);
  1343. -
  1344. -  /* Hide the location widgets temporarily */
  1345. -
  1346. -  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
  1347. -      impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
  1348. -    {
  1349. -      gtk_widget_hide (impl->location_button);
  1350. -      gtk_widget_hide (impl->location_entry_box);
  1351. -    }
  1352. -
  1353. -  focus_search_entry_in_idle (impl);
  1354. -
  1355. -  /* FMQ: hide the filter combo? */
  1356. -}
  1357. -
  1358. -/*
  1359. - * Recent files support
  1360. - */
  1361. -
  1362. -/* Frees the data in the recent_model */
  1363. -static void
  1364. -recent_clear_model (GtkFileChooserDefault *impl,
  1365. -                    gboolean               remove_from_treeview)
  1366. -{
  1367. -  if (!impl->recent_model)
  1368. -    return;
  1369. -
  1370. -  if (remove_from_treeview)
  1371. -    gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
  1372. -
  1373. -  g_object_unref (impl->recent_model);
  1374. -  impl->recent_model = NULL;
  1375. -}
  1376. -
  1377. -/* Stops any ongoing loading of the recent files list; does
  1378. - * not touch the recent_model
  1379. - */
  1380. -static void
  1381. -recent_stop_loading (GtkFileChooserDefault *impl)
  1382. -{
  1383. -  if (impl->load_recent_id)
  1384. -    {
  1385. -      g_source_remove (impl->load_recent_id);
  1386. -      impl->load_recent_id = 0;
  1387. -    }
  1388. -}
  1389. -
  1390. -static void
  1391. -recent_setup_model (GtkFileChooserDefault *impl)
  1392. -{
  1393. -  g_assert (impl->recent_model == NULL);
  1394. -
  1395. -  impl->recent_model = _gtk_file_system_model_new (file_system_model_set,
  1396. -                                                   impl,
  1397. -                          MODEL_COLUMN_TYPES);
  1398. -
  1399. -  _gtk_file_system_model_set_filter (impl->recent_model,
  1400. -                                     impl->current_filter);
  1401. -  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
  1402. -                  MODEL_COL_NAME,
  1403. -                  name_sort_func,
  1404. -                  impl, NULL);
  1405. -  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
  1406. -                                   MODEL_COL_SIZE,
  1407. -                                   size_sort_func,
  1408. -                                   impl, NULL);
  1409. -  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
  1410. -                                   MODEL_COL_MTIME,
  1411. -                                   mtime_sort_func,
  1412. -                                   impl, NULL);
  1413. -  set_sort_column (impl);
  1414. -}
  1415. -
  1416.  typedef struct
  1417.  {
  1418.    GtkFileChooserDefault *impl;
  1419. @@ -9452,183 +8476,6 @@
  1420.  } RecentLoadData;
  1421.  
  1422.  static void
  1423. -recent_idle_cleanup (gpointer data)
  1424. -{
  1425. -  RecentLoadData *load_data = data;
  1426. -  GtkFileChooserDefault *impl = load_data->impl;
  1427. -
  1428. -  gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
  1429. -                           GTK_TREE_MODEL (impl->recent_model));
  1430. -  file_list_set_sort_column_ids (impl);
  1431. -  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->recent_model), MODEL_COL_MTIME, GTK_SORT_DESCENDING);
  1432. -
  1433. -  set_busy_cursor (impl, FALSE);
  1434. -  
  1435. -  impl->load_recent_id = 0;
  1436. -  
  1437. -  g_free (load_data);
  1438. -}
  1439. -
  1440. -static gint
  1441. -get_recent_files_limit (GtkWidget *widget)
  1442. -{
  1443. -  GtkSettings *settings;
  1444. -  gint limit;
  1445. -
  1446. -  if (gtk_widget_has_screen (widget))
  1447. -    settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget));
  1448. -  else
  1449. -    settings = gtk_settings_get_default ();
  1450. -
  1451. -  g_object_get (G_OBJECT (settings), "gtk-recent-files-limit", &limit, NULL);
  1452. -
  1453. -  return limit;
  1454. -}
  1455. -
  1456. -/* Populates the file system model with the GtkRecentInfo* items in the provided list; frees the items */
  1457. -static void
  1458. -populate_model_with_recent_items (GtkFileChooserDefault *impl, GList *items)
  1459. -{
  1460. -  gint limit;
  1461. -  GList *l;
  1462. -  int n;
  1463. -
  1464. -  limit = get_recent_files_limit (GTK_WIDGET (impl));
  1465. -
  1466. -  n = 0;
  1467. -
  1468. -  for (l = items; l; l = l->next)
  1469. -    {
  1470. -      GtkRecentInfo *info = l->data;
  1471. -      GFile *file;
  1472. -
  1473. -      file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
  1474. -      _gtk_file_system_model_add_and_query_file (impl->recent_model,
  1475. -                                                 file,
  1476. -                                                 MODEL_ATTRIBUTES);
  1477. -      g_object_unref (file);
  1478. -
  1479. -      n++;
  1480. -      if (limit != -1 && n >= limit)
  1481. -   break;
  1482. -    }
  1483. -}
  1484. -
  1485. -static void
  1486. -populate_model_with_folders (GtkFileChooserDefault *impl, GList *items)
  1487. -{
  1488. -  GList *folders;
  1489. -  GList *l;
  1490. -
  1491. -  folders = _gtk_file_chooser_extract_recent_folders (items);
  1492. -
  1493. -  for (l = folders; l; l = l->next)
  1494. -    {
  1495. -      GFile *folder = l->data;
  1496. -
  1497. -      _gtk_file_system_model_add_and_query_file (impl->recent_model,
  1498. -                                                 folder,
  1499. -                                                 MODEL_ATTRIBUTES);
  1500. -    }
  1501. -
  1502. -  g_list_foreach (folders, (GFunc) g_object_unref, NULL);
  1503. -  g_list_free (folders);
  1504. -}
  1505. -
  1506. -static gboolean
  1507. -recent_idle_load (gpointer data)
  1508. -{
  1509. -  RecentLoadData *load_data = data;
  1510. -  GtkFileChooserDefault *impl = load_data->impl;
  1511. -
  1512. -  if (!impl->recent_manager)
  1513. -    return FALSE;
  1514. -
  1515. -  load_data->items = gtk_recent_manager_get_items (impl->recent_manager);
  1516. -  if (!load_data->items)
  1517. -    return FALSE;
  1518. -
  1519. -  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
  1520. -    populate_model_with_recent_items (impl, load_data->items);
  1521. -  else
  1522. -    populate_model_with_folders (impl, load_data->items);
  1523. -
  1524. -  g_list_foreach (load_data->items, (GFunc) gtk_recent_info_unref, NULL);
  1525. -  g_list_free (load_data->items);
  1526. -  load_data->items = NULL;
  1527. -
  1528. -  return FALSE;
  1529. -}
  1530. -
  1531. -static void
  1532. -recent_start_loading (GtkFileChooserDefault *impl)
  1533. -{
  1534. -  RecentLoadData *load_data;
  1535. -
  1536. -  recent_stop_loading (impl);
  1537. -  recent_clear_model (impl, TRUE);
  1538. -  recent_setup_model (impl);
  1539. -  set_busy_cursor (impl, TRUE);
  1540. -
  1541. -  g_assert (impl->load_recent_id == 0);
  1542. -
  1543. -  load_data = g_new (RecentLoadData, 1);
  1544. -  load_data->impl = impl;
  1545. -  load_data->items = NULL;
  1546. -
  1547. -  /* begin lazy loading the recent files into the model */
  1548. -  impl->load_recent_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
  1549. -                                                    recent_idle_load,
  1550. -                                                    load_data,
  1551. -                                                    recent_idle_cleanup);
  1552. -}
  1553. -
  1554. -static void
  1555. -recent_selected_foreach_get_file_cb (GtkTreeModel *model,
  1556. -                    GtkTreePath  *path,
  1557. -                    GtkTreeIter  *iter,
  1558. -                    gpointer      data)
  1559. -{
  1560. -  GSList **list;
  1561. -  GFile *file;
  1562. -
  1563. -  list = data;
  1564. -
  1565. -  gtk_tree_model_get (model, iter, MODEL_COL_FILE, &file, -1);
  1566. -  *list = g_slist_prepend (*list, file);
  1567. -}
  1568. -
  1569. -/* Constructs a list of the selected paths in recent files mode */
  1570. -static GSList *
  1571. -recent_get_selected_files (GtkFileChooserDefault *impl)
  1572. -{
  1573. -  GSList *result;
  1574. -  GtkTreeSelection *selection;
  1575. -
  1576. -  result = NULL;
  1577. -
  1578. -  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
  1579. -  gtk_tree_selection_selected_foreach (selection, recent_selected_foreach_get_file_cb, &result);
  1580. -  result = g_slist_reverse (result);
  1581. -
  1582. -  return result;
  1583. -}
  1584. -
  1585. -/* Called from ::should_respond().  We return whether there are selected
  1586. - * files in the recent files list.
  1587. - */
  1588. -static gboolean
  1589. -recent_should_respond (GtkFileChooserDefault *impl)
  1590. -{
  1591. -  GtkTreeSelection *selection;
  1592. -
  1593. -  g_assert (impl->operation_mode == OPERATION_MODE_RECENT);
  1594. -
  1595. -  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
  1596. -  return (gtk_tree_selection_count_selected_rows (selection) != 0);
  1597. -}
  1598. -
  1599. -static void
  1600.  set_current_filter (GtkFileChooserDefault *impl,
  1601.             GtkFileFilter         *filter)
  1602.  {
  1603. @@ -9657,12 +8504,6 @@
  1604.        if (impl->browse_files_model)
  1605.     install_list_model_filter (impl);
  1606.  
  1607. -      if (impl->search_model)
  1608. -        _gtk_file_system_model_set_filter (impl->search_model, filter);
  1609. -
  1610. -      if (impl->recent_model)
  1611. -        _gtk_file_system_model_set_filter (impl->recent_model, filter);
  1612. -
  1613.        g_object_notify (G_OBJECT (impl), "filter");
  1614.      }
  1615.  }
  1616. @@ -9975,14 +8816,6 @@
  1617.                        shortcuts_activate_get_info_cb, data);
  1618.     }
  1619.      }
  1620. -  else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
  1621. -    {
  1622. -      operation_mode_set (impl, OPERATION_MODE_SEARCH);
  1623. -    }
  1624. -  else if (shortcut_type == SHORTCUT_TYPE_RECENT)
  1625. -    {
  1626. -      operation_mode_set (impl, OPERATION_MODE_RECENT);
  1627. -    }
  1628.  }
  1629.  
  1630.  /* Handler for GtkWidget::key-press-event on the shortcuts list */
  1631. @@ -10323,29 +9156,6 @@
  1632.      switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_DESKTOP));
  1633.  }
  1634.  
  1635. -/* Handler for the "search-shortcut" keybinding signal */
  1636. -static void
  1637. -search_shortcut_handler (GtkFileChooserDefault *impl)
  1638. -{
  1639. -  if (impl->has_search)
  1640. -    {
  1641. -      switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_SEARCH));
  1642. -
  1643. -      /* we want the entry widget to grab the focus the first
  1644. -       * time, not the browse_files_tree_view widget.
  1645. -       */
  1646. -      if (impl->search_entry)
  1647. -        gtk_widget_grab_focus (impl->search_entry);
  1648. -    }
  1649. -}
  1650. -
  1651. -/* Handler for the "recent-shortcut" keybinding signal */
  1652. -static void
  1653. -recent_shortcut_handler (GtkFileChooserDefault *impl)
  1654. -{
  1655. -  switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_RECENT));
  1656. -}
  1657. -
  1658.  static void
  1659.  quick_bookmark_handler (GtkFileChooserDefault *impl,
  1660.             gint bookmark_index)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement