From 9bb3185b94bc1c4f52901bb2d93a59e103d66dd6 Mon Sep 17 00:00:00 2001
From: Brian Tarricone <brian@tarricone.org>
Date: Thu, 6 Nov 2008 11:20:12 +0000
Subject: [PATCH] 	* thunar/thunar-private.h, 	 
 thunar/thunar-{shortcuts-model,templates-action,window}.c: Fix 	 
 compilation with glib < 2.14.

(Old svn revision: 28630)
---
 ChangeLog                        |  6 ++++++
 thunar/thunar-private.h          |  2 ++
 thunar/thunar-shortcuts-model.c  |  4 ++++
 thunar/thunar-templates-action.c |  2 ++
 thunar/thunar-window.c           | 16 ++++++++++------
 5 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bfd764332..c4c786618 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-06	Brian Tarricone <bjt23@cornell.edu>
+
+	* thunar/thunar-private.h,
+	  thunar/thunar-{shortcuts-model,templates-action,window}.c: Fix
+	  compilation with glib < 2.14.
+
 2008-11-05	Olivier Fourdan <olivier@xfce.org>
 
 	* thunar/thunar-window.c: Remove portion including a C_() macro.
diff --git a/thunar/thunar-private.h b/thunar/thunar-private.h
index d752e228a..1e1097d7c 100644
--- a/thunar/thunar-private.h
+++ b/thunar/thunar-private.h
@@ -107,7 +107,9 @@ typedef GUserDirectory ThunarUserDirectory;
 #define THUNAR_USER_DIRECTORY_VIDEOS       G_USER_DIRECTORY_VIDEOS
 #define THUNAR_USER_N_DIRECTORIES          (8)
 
+#if GLIB_CHECK_VERSION(2, 14, 0)
 gchar *_thunar_get_xdg_user_dirs_locale (void);
+#endif
 extern const gchar *_thunar_user_directory_names[THUNAR_USER_N_DIRECTORIES+1];
 
 #else /* GLIB_CHECK_VERSION(2,14,0) */
diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 6ebd0019a..ebcda1a44 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -309,6 +309,7 @@ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
   /* append the system defined items ('Home', 'Trash', 'File System') */
   for (n = 0; n < G_N_ELEMENTS (system_path_list); ++n)
     {
+#if GLIB_CHECK_VERSION(2, 14, 0)
       /* we exclude the desktop if it points to home */
       if (n == desktop_index
           && exo_str_is_equal (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP),
@@ -317,6 +318,7 @@ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
           thunar_vfs_path_unref (system_path_list[n]);
           continue;
         }
+#endif
 
       /* determine the file for the path */
       file = thunar_file_get_for_path (system_path_list[n], NULL);
@@ -800,6 +802,7 @@ thunar_shortcuts_model_remove_shortcut (ThunarShortcutsModel *model,
     }
 }
 
+#if GLIB_CHECK_VERSION(2, 14, 0)
 /* Reads the current xdg user dirs locale from ~/.config/xdg-user-dirs.locale
  * Notice that the result shall be freed by using g_free (). */
 gchar *
@@ -828,6 +831,7 @@ _thunar_get_xdg_user_dirs_locale (void)
 
   return locale;
 }
+#endif
 
 static void
 thunar_shortcuts_model_load (ThunarShortcutsModel *model)
diff --git a/thunar/thunar-templates-action.c b/thunar/thunar-templates-action.c
index 77ef1df2c..6dfd9f03e 100644
--- a/thunar/thunar-templates-action.c
+++ b/thunar/thunar-templates-action.c
@@ -382,11 +382,13 @@ thunar_templates_action_menu_shown (GtkWidget             *menu,
 
   thunar_vfs_path_unref (home_path);
 
+#if GLIB_CHECK_VERSION(2, 14, 0)
   if (!exo_str_is_equal (g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES), xfce_get_homedir ()))
     {
       /* fill the menu with files/folders from the ~/Templates folder */
       thunar_templates_action_fill_menu (templates_action, templates_path, menu);
     }
+#endif
 
   /* check if any items were added to the menu */
   if (G_UNLIKELY (GTK_MENU_SHELL (menu)->children == NULL))
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 6d95e607e..89eda598d 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -608,11 +608,19 @@ static void
 thunar_window_setup_user_dir_menu_entries (ThunarWindow *window)
 {
   gint i;
+  static const gchar *callback_names[] = {
+    "open-desktop", "open-documents", "open-downloads", "open-music",
+    "open-pictures", "open-public", "open-templates", "open-videos"
+  };
 
 #if !GLIB_CHECK_VERSION(2, 14, 0)
 
-  for (i = 0; i < THUNAR_USER_N_DIRECTORIES; i++)
-    gtk_action_set_visible (GTK_ACTION (action), FALSE);
+  for (i = 0; i < G_N_ELEMENTS(callback_names); i++)
+    {
+      GtkAction *action = gtk_action_group_get_action (window->action_group,
+                                                       callback_names[i]);
+      gtk_action_set_visible (GTK_ACTION (action), FALSE);
+    }
 
 #else  /* GLIB_CHECK_VERSION(2, 14, 0) */
 
@@ -621,10 +629,6 @@ thunar_window_setup_user_dir_menu_entries (ThunarWindow *window)
   gchar *translation    = NULL;
   /* gchar *dir_name       = NULL;  */  // see below
   const gchar *home_dir = NULL;
-  static const gchar *callback_names[] = {
-    "open-desktop", "open-documents", "open-downloads", "open-music",
-    "open-pictures", "open-public", "open-templates", "open-videos"
-  };
 
   bindtextdomain (XDG_USER_DIRS_PACKAGE, PACKAGE_LOCALE_DIR);
 #ifdef HAVE_BIND_TEXTDOMAIN_CODESET
-- 
GitLab