Web lists-archives.com

Re: Problem with 'gio/gwin32appinfo.c'




On 24.06.2015 13:02, Emmanuele Bassi wrote:
> Hi;
> 
> On 24 June 2015 at 10:46, John Emmas <johne53@xxxxxxxxxxxxx> wrote:
> 
>> So what needs to happen here?  Do the placeholder functions need to get put
>> back?  Or does somebody need to flag this up to the glibmm team so they can
>> accommodate the change at their end?  Thanks.
> 
> Since this is an ABI break, those function stubs should go back in.
> 
> Ideally, an implementation would follow; if not, we can think about
> deprecating those entry points and replacing them with other API that
> can be implemented on Windows as well.
> 
> Ciao,
>  Emmanuele.
> 

Try this, please.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
From c52cd8108dfb9c9dfab718cfd2f649161ce36523 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@xxxxxxxxx>
Date: Wed, 24 Jun 2015 10:07:40 +0000
Subject: [PATCH] W32: Add a g_app_info_get_all_for_type() implementation

Also add g_app_info_get_fallback_for_type() and
g_app_info_get_recommended_for_type() as proxies for
g_app_info_get_all_for_type(), until gcontenttype support is improved.
---
 gio/gwin32appinfo.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c
index a883b24..815af70 100644
--- a/gio/gwin32appinfo.c
+++ b/gio/gwin32appinfo.c
@@ -4590,3 +4590,80 @@ g_app_info_get_all (void)
 
   return infos;
 }
+
+GList *
+g_app_info_get_all_for_type (const char *content_type)
+{
+  GWin32AppInfoFileExtension *ext;
+  char *ext_down;
+  GWin32AppInfoHandler *handler;
+  GWin32AppInfoApplication *app;
+  GHashTableIter iter;
+  GList *result;
+
+  ext_down = g_utf8_casefold (content_type, -1);
+
+  if (!ext_down)
+    return NULL;
+
+  g_win32_appinfo_init ();
+  G_LOCK (gio_win32_appinfo);
+
+  /* Assuming that "content_type" is a file extension, not a MIME type */
+  ext = g_hash_table_lookup (extensions, ext_down);
+  g_free (ext_down);
+
+  result = NULL;
+
+  if (ext != NULL)
+    g_object_ref (ext);
+
+  G_UNLOCK (gio_win32_appinfo);
+
+  if (ext == NULL)
+    return NULL;
+
+  if (ext->chosen_handler != NULL &&
+      ext->chosen_handler->app != NULL)
+    result = g_list_prepend (result,
+                             g_win32_app_info_new_from_app (ext->chosen_handler->app,
+                                                            ext->chosen_handler));
+
+  g_hash_table_iter_init (&iter, ext->handlers);
+
+  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &handler))
+    {
+      if (handler->app &&
+          (ext->chosen_handler == NULL || ext->chosen_handler->app != app))
+          result = g_list_prepend (result,
+                                   g_win32_app_info_new_from_app (handler->app,
+                                                                  handler));
+    }
+
+  g_hash_table_iter_init (&iter, ext->other_apps);
+
+  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &app))
+    {
+      result = g_list_prepend (result, g_win32_app_info_new_from_app (app, NULL));
+    }
+
+  g_object_unref (ext);
+
+  result = g_list_reverse (result);
+
+  return result;
+}
+
+GList *
+g_app_info_get_fallback_for_type (const gchar *content_type)
+{
+  /* TODO: fix this once gcontenttype support is improved */
+  return g_app_info_get_all_for_type (content_type);
+}
+
+GList *
+g_app_info_get_recommended_for_type (const gchar *content_type)
+{
+  /* TODO: fix this once gcontenttype support is improved */
+  return g_app_info_get_all_for_type (content_type);
+}
-- 
2.4.0

Attachment: 0x922360B0.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list