[Xfce4-commits] [xfce/exo] 01/01: Configure gio mime defaults with exo-helper (bug #14633)

noreply at xfce.org noreply at xfce.org
Sat May 25 21:56:54 CEST 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/exo.

commit 8bc59ad1c48df132e917337bd08211be58af5bb1
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat May 25 15:56:48 2019 -0400

    Configure gio mime defaults with exo-helper (bug #14633)
---
 exo-helper/exo-helper.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/exo-helper/exo-helper.c b/exo-helper/exo-helper.c
index cc89d42..b5da155 100644
--- a/exo-helper/exo-helper.c
+++ b/exo-helper/exo-helper.c
@@ -43,6 +43,8 @@
 #include <unistd.h>
 #endif
 
+#include <gio/gdesktopappinfo.h>
+
 #include <exo-helper/exo-helper.h>
 #include <exo-helper/exo-helper-utils.h>
 
@@ -789,6 +791,8 @@ exo_helper_database_set_default (ExoHelperDatabase *database,
       mimetypes = xfce_rc_read_list_entry (desktop_file, "X-XFCE-MimeType", ";");
       if (mimetypes != NULL)
         {
+          GDesktopAppInfo *info = g_desktop_app_info_new (filename);
+
           xfce_rc_set_group (rc, "Added Associations");
 
           for (i = 0; mimetypes[i] != NULL; i++)
@@ -797,8 +801,19 @@ exo_helper_database_set_default (ExoHelperDatabase *database,
                 entry = g_strconcat (filename, ";", NULL);
                 xfce_rc_write_entry (rc, mimetypes[i], entry);
                 g_free (entry);
+
+                if (info != NULL)
+                  {
+                    g_app_info_set_as_default_for_type (G_APP_INFO (info),
+                                                        mimetypes[i],
+                                                        NULL);
+                  }
               }
           g_strfreev (mimetypes);
+          if (info != NULL)
+            {
+              g_object_unref (info);
+            }
         }
 
       xfce_rc_close (desktop_file);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list