Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 2nd, 2010  |  syntax: Diff  |  size: 12.32 KB  |  hits: 153  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff -ru Thunar-1.0.2.orig/thunar/thunar-application.c Thunar-1.0.2/thunar/thunar-application.c
  2. --- Thunar-1.0.2.orig/thunar/thunar-application.c       2010-06-01 15:36:41.000000000 -0400
  3. +++ Thunar-1.0.2/thunar/thunar-application.c    2010-06-02 16:07:06.000000000 -0400
  4. @@ -1328,13 +1328,20 @@
  5.    gchar          *message;
  6.    guint           n_path_list = 0;
  7.    gint            response;
  8. +  gboolean        isTrashEnabled;
  9.  
  10.    _thunar_return_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent));
  11.    _thunar_return_if_fail (THUNAR_IS_APPLICATION (application));
  12. -
  13. +
  14.    /* check if we should permanently delete the files (user holds shift) */
  15.    permanently = (gtk_get_current_event_state (&state) && (state & GDK_SHIFT_MASK) != 0);
  16.  
  17. +  g_object_get (G_OBJECT (application->preferences), "misc-enable-trash", &isTrashEnabled, NULL);
  18. +  if (!isTrashEnabled)
  19. +    {
  20. +      permanently = TRUE;
  21. +    }  
  22. +  
  23.    /* determine the paths for the files */
  24.    for (lp = g_list_last (file_list); lp != NULL; lp = lp->prev, ++n_path_list)
  25.      {
  26. @@ -1354,8 +1361,8 @@
  27.    if (G_UNLIKELY (permanently))
  28.      {
  29.        /* parse the parent pointer */
  30. -      screen = thunar_util_parse_parent (parent, &window);
  31. -
  32. +      screen = thunar_util_parse_parent (parent, &window);    
  33. +      
  34.        /* generate the question to confirm the delete operation */
  35.        if (G_LIKELY (n_path_list == 1))
  36.          {
  37. diff -ru Thunar-1.0.2.orig/thunar/thunar-file.c Thunar-1.0.2/thunar/thunar-file.c
  38. --- Thunar-1.0.2.orig/thunar/thunar-file.c      2010-06-01 15:36:41.000000000 -0400
  39. +++ Thunar-1.0.2/thunar/thunar-file.c   2010-06-02 16:59:05.000000000 -0400
  40. @@ -49,6 +49,7 @@
  41.  #include <thunar/thunar-file.h>
  42.  #include <thunar/thunar-file-monitor.h>
  43.  #include <thunar/thunar-gobject-extensions.h>
  44. +#include <thunar/thunar-preferences.h>
  45.  #include <thunar/thunar-private.h>
  46.  #include <thunar/thunar-util.h>
  47.  
  48. @@ -571,7 +572,41 @@
  49.    g_object_unref (G_OBJECT (monitor));
  50.  }
  51.  
  52. +/**
  53. + * thunar_file_get_display_name:
  54. + * @file : a #ThunarFile instance.
  55. + *
  56. + * Returns the @file name in the UTF-8 encoding, which is
  57. + * suitable for displaying the file name in the GUI.
  58. + *
  59. + * Return value: the @file name suitable for display.
  60. + **/
  61.  
  62. +const gchar*
  63. +thunar_file_get_display_name (const ThunarFile *file)
  64. +{
  65. +  gchar    *absolute_path;
  66. +  gboolean  desktop_nolie;
  67. +  
  68. +  g_object_get(G_OBJECT (thunar_preferences_get ()), "misc-desktop-nolie", &desktop_nolie, NULL);
  69. +  
  70. +  if (desktop_nolie)
  71. +    {
  72. +      absolute_path = thunar_vfs_path_dup_string (THUNAR_FILE(file)->info->path);
  73. +      if (strcmp(g_path_get_basename(g_path_get_dirname(absolute_path)), "Desktop") == 0)
  74. +        {
  75. +         return THUNAR_FILE (file)->info->display_name;
  76. +       }
  77. +      else
  78. +        {
  79. +         return g_filename_display_name(g_path_get_basename(absolute_path));
  80. +       }
  81. +    }
  82. +  else
  83. +    {
  84. +      return THUNAR_FILE (file)->info->display_name;
  85. +    }
  86. +}
  87.  
  88.  /**
  89.   * thunar_file_get_for_info:
  90. diff -ru Thunar-1.0.2.orig/thunar/thunar-file.h Thunar-1.0.2/thunar/thunar-file.h
  91. --- Thunar-1.0.2.orig/thunar/thunar-file.h      2010-06-01 15:36:41.000000000 -0400
  92. +++ Thunar-1.0.2/thunar/thunar-file.h   2010-06-02 16:46:54.000000000 -0400
  93. @@ -494,17 +494,6 @@
  94.                                          && !exo_str_is_equal (thunar_vfs_path_get_name (thunar_file_get_path ((file))), ".directory"))
  95.  
  96.  /**
  97. - * thunar_file_get_display_name:
  98. - * @file : a #ThunarFile instance.
  99. - *
  100. - * Returns the @file name in the UTF-8 encoding, which is
  101. - * suitable for displaying the file name in the GUI.
  102. - *
  103. - * Return value: the @file name suitable for display.
  104. - **/
  105. -#define thunar_file_get_display_name(file) (THUNAR_FILE ((file))->info->display_name)
  106. -
  107. -/**
  108.   * thunar_file_read_link:
  109.   * @file  : a #ThunarFile instance.
  110.   * @error : return location for errors or %NULL.
  111. diff -ru Thunar-1.0.2.orig/thunar/thunar-preferences-dialog.c Thunar-1.0.2/thunar/thunar-preferences-dialog.c
  112. --- Thunar-1.0.2.orig/thunar/thunar-preferences-dialog.c        2010-06-01 15:36:41.000000000 -0400
  113. +++ Thunar-1.0.2/thunar/thunar-preferences-dialog.c     2010-06-02 16:14:23.000000000 -0400
  114. @@ -373,7 +373,7 @@
  115.    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
  116.    gtk_widget_show (label);
  117.  
  118. -  table = gtk_table_new (2, 2, FALSE);
  119. +  table = gtk_table_new (4, 2, FALSE);
  120.    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  121.    gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  122.    gtk_container_set_border_width (GTK_CONTAINER (table), 12);
  123. @@ -418,7 +418,7 @@
  124.    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
  125.    gtk_widget_show (label);
  126.  
  127. -  table = gtk_table_new (2, 2, FALSE);
  128. +  table = gtk_table_new (4, 2, FALSE);
  129.    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  130.    gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  131.    gtk_container_set_border_width (GTK_CONTAINER (table), 12);
  132. @@ -573,7 +573,7 @@
  133.    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
  134.    gtk_widget_show (label);
  135.  
  136. -  table = gtk_table_new (2, 2, FALSE);
  137. +  table = gtk_table_new (4, 2, FALSE);
  138.    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  139.    gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  140.    gtk_container_set_border_width (GTK_CONTAINER (table), 12);
  141. @@ -591,6 +591,7 @@
  142.    gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Ask everytime"));
  143.    gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder Only"));
  144.    gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder and Contents"));
  145. +  
  146.  #if !GTK_CHECK_VERSION(2,9,0)
  147.    g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
  148.  #endif
  149. @@ -599,6 +600,18 @@
  150.    thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo);
  151.    gtk_widget_show (combo);
  152.  
  153. +  button = gtk_check_button_new_with_mnemonic (_("Move items to Trash when on _delete."));
  154. +  exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-enable-trash", G_OBJECT (button), "active");
  155. +  thunar_gtk_widget_set_tooltip (button, _( "By default, items are sent to the Trash on delete. By disabling this option, items will be removed on delete and will be lost forever. (DANGEROUS)" ) );
  156. +  gtk_table_attach (GTK_TABLE (table), button, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
  157. +  gtk_widget_show (button);
  158. +  
  159. +  button = gtk_check_button_new_with_mnemonic (_("Only _lie about names of desktop files on the Desktop."));
  160. +  exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-desktop-nolie", G_OBJECT (button), "active");
  161. +  thunar_gtk_widget_set_tooltip (button, _( "If this is checked, files ending in .desktop will have their true names displayed in regular folders." ) );
  162. +  gtk_table_attach (GTK_TABLE (table), button, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
  163. +  gtk_widget_show (button);
  164. +
  165.    frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
  166.    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
  167.    gtk_widget_show (frame);
  168. @@ -608,7 +621,7 @@
  169.    gtk_frame_set_label_widget (GTK_FRAME (frame), label);
  170.    gtk_widget_show (label);
  171.  
  172. -  table = gtk_table_new (2, 2, FALSE);
  173. +  table = gtk_table_new (3, 2, FALSE);
  174.    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  175.    gtk_table_set_col_spacings (GTK_TABLE (table), 12);
  176.    gtk_container_set_border_width (GTK_CONTAINER (table), 12);
  177. diff -ru Thunar-1.0.2.orig/thunar/thunar-preferences.c Thunar-1.0.2/thunar/thunar-preferences.c
  178. --- Thunar-1.0.2.orig/thunar/thunar-preferences.c       2010-06-01 15:36:41.000000000 -0400
  179. +++ Thunar-1.0.2/thunar/thunar-preferences.c    2010-06-02 16:15:42.000000000 -0400
  180. @@ -71,6 +71,8 @@
  181.    PROP_MISC_VOLUME_MANAGEMENT,
  182.    PROP_MISC_CASE_SENSITIVE,
  183.    PROP_MISC_DATE_STYLE,
  184. +  PROP_MISC_DESKTOP_NOLIE,
  185. +  PROP_MISC_ENABLE_TRASH,
  186.    PROP_MISC_FOLDERS_FIRST,
  187.    PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES,
  188.    PROP_MISC_RECURSIVE_PERMISSIONS,
  189. @@ -664,6 +666,32 @@
  190.                                                        THUNAR_TYPE_ICON_SIZE,
  191.                                                        THUNAR_ICON_SIZE_SMALLEST,
  192.                                                        EXO_PARAM_READWRITE));
  193. +                                                    
  194. +  /**
  195. +   * ThunarPreferences:misc-desktop-nolie:
  196. +   *
  197. +   * If nolie is turned on, .desktop files have their true names displayed in most places
  198. +   **/
  199. +  g_object_class_install_property (gobject_class,
  200. +                                   PROP_MISC_DESKTOP_NOLIE,
  201. +                                   g_param_spec_boolean ("misc-desktop-nolie",
  202. +                                                        "misc-desktop-nolie",
  203. +                                                        "misc-desktop-nolie",
  204. +                                                        TRUE,
  205. +                                                        EXO_PARAM_READWRITE));
  206. +  
  207. +  /**
  208. +   * ThunarPreferences:misc-enable-trash:
  209. +   *
  210. +   * If trash is disabled, files will be deleted permanently
  211. +   **/
  212. +  g_object_class_install_property (gobject_class,
  213. +                                   PROP_MISC_ENABLE_TRASH,
  214. +                                   g_param_spec_boolean ("misc-enable-trash",
  215. +                                                        "misc-enable-trash",
  216. +                                                        "misc-enable-trash",
  217. +                                                        TRUE,
  218. +                                                        EXO_PARAM_READWRITE));
  219.  }
  220.  
  221.  
  222. diff -ru Thunar-1.0.2.orig/thunar/thunar-shortcuts-model.c Thunar-1.0.2/thunar/thunar-shortcuts-model.c
  223. --- Thunar-1.0.2.orig/thunar/thunar-shortcuts-model.c   2010-06-01 15:36:41.000000000 -0400
  224. +++ Thunar-1.0.2/thunar/thunar-shortcuts-model.c        2010-06-02 16:07:06.000000000 -0400
  225. @@ -34,6 +34,7 @@
  226.  #include <locale.h>
  227.  #endif
  228.  
  229. +#include <thunar/thunar-preferences.h>
  230.  #include <thunar/thunar-file.h>
  231.  #include <thunar/thunar-shortcuts-model.h>
  232.  #include <thunar/thunar-private.h>
  233. @@ -63,7 +64,6 @@
  234.  } ThunarShortcutType;
  235.  
  236.  
  237. -
  238.  static void               thunar_shortcuts_model_class_init         (ThunarShortcutsModelClass *klass);
  239.  static void               thunar_shortcuts_model_tree_model_init    (GtkTreeModelIface         *iface);
  240.  static void               thunar_shortcuts_model_drag_source_init   (GtkTreeDragSourceIface    *iface);
  241. @@ -278,6 +278,8 @@
  242.    guint            n;
  243.    gchar           *desktop_path = NULL;
  244.    guint            desktop_index;
  245. +  gboolean        isTrashEnabled;
  246. +
  247.  
  248.  #ifndef NDEBUG
  249.    model->stamp = g_random_int ();
  250. @@ -292,6 +294,8 @@
  251.    system_path_list[0] = thunar_vfs_path_get_for_home ();
  252.    system_path_list[1] = thunar_vfs_path_get_for_trash ();
  253.  
  254. +  g_object_get (G_OBJECT (thunar_preferences_get ()), "misc-enable-trash", &isTrashEnabled, NULL);
  255. +
  256.  #if GLIB_CHECK_VERSION(2,14,0)
  257.    desktop_path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
  258.  #else /* GLIB_CHECK_VERSION(2,14,0) */
  259. @@ -322,6 +326,12 @@
  260.          {
  261.            thunar_vfs_path_unref (system_path_list[n]);
  262.            continue;
  263. +        }
  264. +      /* we exclude the trash */
  265. +      if (n == 1 && !isTrashEnabled)
  266. +        {
  267. +          thunar_vfs_path_unref (system_path_list[n]);
  268. +          continue;
  269.          }
  270.  #endif
  271.  
  272. diff -ru Thunar-1.0.2.orig/thunar-vfs/thunar-vfs-io-local.c Thunar-1.0.2/thunar-vfs/thunar-vfs-io-local.c
  273. --- Thunar-1.0.2.orig/thunar-vfs/thunar-vfs-io-local.c  2010-06-01 15:36:40.000000000 -0400
  274. +++ Thunar-1.0.2/thunar-vfs/thunar-vfs-io-local.c       2010-06-02 16:39:55.000000000 -0400
  275. @@ -972,6 +972,7 @@
  276.    gchar             *dir_name;
  277.    gchar             *dst_name;
  278.    gchar             *dst_path;
  279. +  gboolean          desktop_lie = TRUE;
  280.  
  281.    _thunar_vfs_return_val_if_fail (*name != '\0' && strchr (name, G_DIR_SEPARATOR) == NULL, FALSE);
  282.    _thunar_vfs_return_val_if_fail (_thunar_vfs_path_is_local (info->path), FALSE);
  283. @@ -981,9 +982,18 @@
  284.    /* determine the source path */
  285.    if (thunar_vfs_path_to_string (info->path, src_path, sizeof (src_path), error) < 0)
  286.      return FALSE;
  287. -
  288. +  
  289. +  /* if ".desktop" appears in the new name it is very likely that the user has name lying turned off */
  290. +  if (strcmp(g_path_get_basename(g_path_get_dirname(src_path)), "Desktop"))
  291. +    {
  292. +      if (g_strrstr(name, ".desktop"))
  293. +        {
  294. +         desktop_lie = FALSE;
  295. +       }
  296. +    }
  297. +  
  298.    /* check if we have a .desktop (and NOT a .directory) file here */
  299. -  if (G_UNLIKELY (info->mime_info == _thunar_vfs_mime_application_x_desktop && strcmp (thunar_vfs_path_get_name (info->path), ".directory") != 0))
  300. +  if (G_UNLIKELY ((desktop_lie) && (info->mime_info == _thunar_vfs_mime_application_x_desktop) && (strcmp (thunar_vfs_path_get_name (info->path), ".directory") != 0)))
  301.      {
  302.        /* try to update the name in the .desktop file */
  303.        if (!_thunar_vfs_desktop_file_set_value (src_path, "Name", name, error))