[Xfce4-commits] <thunar:master> Show custom commands in the different models (bug #9169).
Nick Schermer
noreply at xfce.org
Sat Oct 20 19:16:01 CEST 2012
Updating branch refs/heads/master
to 8aa057167e3a078b3d35d2fbb171df9a54c71ccb (commit)
from 5649e02baaf9e03d55fff76db6eee4ec5ad00fba (commit)
commit 8aa057167e3a078b3d35d2fbb171df9a54c71ccb
Author: Nick Schermer <nick at xfce.org>
Date: Sat Oct 20 19:15:00 2012 +0200
Show custom commands in the different models (bug #9169).
thunar/thunar-chooser-button.c | 2 +-
thunar/thunar-chooser-model.c | 3 +--
thunar/thunar-file.c | 2 +-
thunar/thunar-gio-extensions.c | 33 +++++++++++++++++++++++++++++++++
thunar/thunar-gio-extensions.h | 2 ++
5 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/thunar/thunar-chooser-button.c b/thunar/thunar-chooser-button.c
index 71fcafe..f7ae355 100644
--- a/thunar/thunar-chooser-button.c
+++ b/thunar/thunar-chooser-button.c
@@ -454,7 +454,7 @@ thunar_chooser_button_file_changed (ThunarChooserButton *chooser_button,
for (lp = app_infos, i = 0; lp != NULL; lp = lp->next, ++i)
{
/* skip infos that have NoDisplay or OnlyShowIn set */
- if (g_app_info_should_show (lp->data))
+ if (thunar_g_app_info_should_show (lp->data))
{
/* insert the item into the store */
gtk_list_store_insert_with_values (chooser_button->store, &iter, i,
diff --git a/thunar/thunar-chooser-model.c b/thunar/thunar-chooser-model.c
index 2866e37..ef4721b 100644
--- a/thunar/thunar-chooser-model.c
+++ b/thunar/thunar-chooser-model.c
@@ -230,8 +230,7 @@ thunar_chooser_model_append (ThunarChooserModel *model,
/* insert the program items */
for (lp = app_infos; lp != NULL; lp = lp->next)
{
- /* skip infos that have NoDisplay or OnlyShowIn set */
- if (!g_app_info_should_show (lp->data))
+ if (!thunar_g_app_info_should_show (lp->data))
continue;
/* append the tree row with the program data */
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 710d0df..2cd5b10 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3676,7 +3676,7 @@ thunar_file_list_get_applications (GList *file_list)
/* grab a pointer on the next application */
next = ap->next;
- if (!g_app_info_should_show (ap->data))
+ if (!thunar_g_app_info_should_show (ap->data))
{
/* drop our reference on the application */
g_object_unref (G_OBJECT (ap->data));
diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index be4933e..f0b51a8 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -23,8 +23,10 @@
#endif
#include <gio/gio.h>
+
#ifdef HAVE_GIO_UNIX
#include <gio/gunixmounts.h>
+#include <gio/gdesktopappinfo.h>
#endif
#include <exo/exo.h>
@@ -467,3 +469,34 @@ thunar_g_app_info_launch (GAppInfo *info,
return result;
}
+
+
+gboolean
+thunar_g_app_info_should_show (GAppInfo *info)
+{
+#ifdef HAVE_GIO_UNIX
+ const gchar *filename;
+
+ _thunar_return_val_if_fail (G_IS_APP_INFO (info), FALSE);
+
+ /* check if NoDesktop is set or OnlyShowIn is set but
+ * does not contain XFCE */
+ if (g_app_info_should_show (info))
+ return TRUE;
+
+ if (G_IS_DESKTOP_APP_INFO (info))
+ {
+ /* show custom command from the user directory, this to not
+ * exclude custom commands */
+ filename = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info));
+ if (filename != NULL
+ && g_str_has_prefix (filename, g_get_user_data_dir ()))
+ return TRUE;
+ }
+
+ return FALSE;
+#else
+ /* we cannot exclude custom actions, so show everything */
+ return TRUE;
+#endif
+}
diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h
index c912948..4a879c5 100644
--- a/thunar/thunar-gio-extensions.h
+++ b/thunar/thunar-gio-extensions.h
@@ -75,6 +75,8 @@ gboolean thunar_g_app_info_launch (GAppInfo *info,
GAppLaunchContext *context,
GError **error);
+gboolean thunar_g_app_info_should_show (GAppInfo *info);
+
G_END_DECLS
#endif /* !__THUNAR_GIO_EXTENSIONS_H__ */
More information about the Xfce4-commits
mailing list