Advertisement
Guest User

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

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