From 7e1f2567a6ffac85e7c1cbb4a8954af4a5d0844e Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 19 May 2017 09:26:29 +0900 Subject: [PATCH] Imported Upstream version 2.52.2 Change-Id: I71ac7d11a2d40ffe74a13b1d190dbe652cba140a Signed-off-by: DongHun Kwak --- NEWS | 14 ++++++++ configure.ac | 4 +-- gio/gnetworkmonitorportal.c | 2 +- gio/gosxappinfo.c | 81 +++++++++++++++++++++++++++++++-------------- gio/gosxcontenttype.c | 17 ++++++++++ gio/tests/Makefile.am | 6 +++- glib/gfileutils.c | 8 +++-- glib/gmain.c | 38 ++++++++++++++++----- po/id.po | 77 +++++++++++++++++++++++++++--------------- 9 files changed, 181 insertions(+), 66 deletions(-) diff --git a/NEWS b/NEWS index e2f733e..e0a5835 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,17 @@ +Overview of changes in GLib 2.52.2 +================================== + +* Bug fixes: + 734946 Implement GContentType on OSX + 761102 Increase performance for main loop + 780300 gio/gosxappinfo.c uses deprecated LSFindApplicationForInfo + 780309 gio/tests/appinfo build fails: gdesktopappinfo.c skipped on OS X + 781298 gfileutils.c:330:3: error: ISO C90 forbids mixed declarations and code + +* Translation updates: + Indonesian + + Overview of changes in GLib 2.52.1 ================================== diff --git a/configure.ac b/configure.ac index 8b25d03..cfaea6c 100644 --- a/configure.ac +++ b/configure.ac @@ -31,8 +31,8 @@ m4_define(glib_configure_ac) m4_define([glib_major_version], [2]) m4_define([glib_minor_version], [52]) -m4_define([glib_micro_version], [1]) -m4_define([glib_interface_age], [1]) +m4_define([glib_micro_version], [2]) +m4_define([glib_interface_age], [2]) m4_define([glib_binary_age], [m4_eval(100 * glib_minor_version + glib_micro_version)]) m4_define([glib_version], diff --git a/gio/gnetworkmonitorportal.c b/gio/gnetworkmonitorportal.c index 7f1e7c1..ea9fb5b 100644 --- a/gio/gnetworkmonitorportal.c +++ b/gio/gnetworkmonitorportal.c @@ -53,7 +53,7 @@ G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorPortal, g_network_monitor_portal, G_TYPE g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME, g_define_type_id, "portal", - 30)) + 40)) static void g_network_monitor_portal_init (GNetworkMonitorPortal *nm) diff --git a/gio/gosxappinfo.c b/gio/gosxappinfo.c index d62dfc0..ce70817 100644 --- a/gio/gosxappinfo.c +++ b/gio/gosxappinfo.c @@ -24,6 +24,7 @@ #include "gcontenttype.h" #include "gfile.h" #include "gfileicon.h" +#include "gioerror.h" #import #import @@ -295,13 +296,27 @@ free_urlspec (LSLaunchURLSpec *urlspec) } static NSBundle * +get_bundle_for_url (CFURLRef app_url) +{ + NSBundle *bundle = [NSBundle bundleWithURL: (NSURL*)app_url]; + + if (!bundle) + { + g_debug ("Bundle not found for url."); + return NULL; + } + + return bundle; +} + +static NSBundle * get_bundle_for_id (CFStringRef bundle_id) { CFURLRef app_url; NSBundle *bundle; -#ifdef AVAILABLE_MAC_OS_VERSION_10_10_OR_LATER - CSArrayRef urls = LSCopyApplicationURLsForBundleIdentifier (bundle_id, NULL); +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER + CFArrayRef urls = LSCopyApplicationURLsForBundleIdentifier (bundle_id, NULL); if (urls) { /* TODO: if there's multiple, we should perhaps prefer one thats in $HOME, @@ -324,15 +339,8 @@ get_bundle_for_id (CFStringRef bundle_id) return NULL; } - bundle = [NSBundle bundleWithURL: (NSURL*)app_url]; + bundle = get_bundle_for_url (app_url); CFRelease (app_url); - - if (!bundle) - { - g_debug ("Bundle not found for url."); - return NULL; - } - return bundle; } @@ -445,7 +453,7 @@ g_osx_app_info_launch_internal (GAppInfo *appinfo, if ((ret = LSOpenFromURLSpec (urlspec, NULL))) { /* TODO: Better error codes */ - g_set_error (error, G_IO_ERR, G_IO_ERROR_FAILED, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Opening application failed with code %d", ret); success = FALSE; } @@ -593,24 +601,25 @@ g_osx_app_info_get_all_for_scheme (const char *cscheme) GList * g_app_info_get_all_for_type (const char *content_type) { - gchar *type_cstr; + gchar *mime_type; CFArrayRef bundle_list; CFStringRef type; NSBundle *bundle; GList *info_list = NULL; gint i; - if (g_str_has_prefix (content_type, "x-scheme-handler/")) + mime_type = g_content_type_get_mime_type (content_type); + if (g_str_has_prefix (mime_type, "x-scheme-handler/")) { - gchar *scheme = strchr (content_type, '/') + 1; + gchar *scheme = strchr (mime_type, '/') + 1; + GList *ret = g_osx_app_info_get_all_for_scheme (scheme); - return g_osx_app_info_get_all_for_scheme (scheme); + g_free (mime_type); + return ret; } + g_free (mime_type); - type_cstr = g_content_type_from_mime_type (content_type); - type = create_cfstring_from_cstr (type_cstr); - g_free (type_cstr); - + type = create_cfstring_from_cstr (content_type); bundle_list = LSCopyAllRoleHandlersForContentType (type, kLSRolesAll); CFRelease (type); @@ -650,24 +659,46 @@ GAppInfo * g_app_info_get_default_for_type (const char *content_type, gboolean must_support_uris) { - gchar *type_cstr; - CFStringRef type, bundle_id; + gchar *mime_type; + CFStringRef type; NSBundle *bundle; +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER + CFURLRef bundle_id; +#else + CFStringRef bundle_id; +#endif + + mime_type = g_content_type_get_mime_type (content_type); + if (g_str_has_prefix (mime_type, "x-scheme-handler/")) + { + gchar *scheme = strchr (mime_type, '/') + 1; + GAppInfo *ret = g_app_info_get_default_for_uri_scheme (scheme); + + g_free (mime_type); + return ret; + } + g_free (mime_type); - type_cstr = g_content_type_from_mime_type (content_type); - type = create_cfstring_from_cstr (type_cstr); - g_free (type_cstr); + type = create_cfstring_from_cstr (content_type); +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER + bundle_id = LSCopyDefaultApplicationURLForContentType (type, kLSRolesAll, NULL); +#else bundle_id = LSCopyDefaultRoleHandlerForContentType (type, kLSRolesAll); +#endif CFRelease (type); if (!bundle_id) { - g_warning ("No default handler found for mimetype '%s'.", content_type); + g_warning ("No default handler found for content type '%s'.", content_type); return NULL; } +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER + bundle = get_bundle_for_url (bundle_id); +#else bundle = get_bundle_for_id (bundle_id); +#endif CFRelease (bundle_id); if (!bundle) diff --git a/gio/gosxcontenttype.c b/gio/gosxcontenttype.c index 3c223d6..8c15ec7 100644 --- a/gio/gosxcontenttype.c +++ b/gio/gosxcontenttype.c @@ -133,6 +133,23 @@ g_content_type_is_a (const gchar *ctype, } gboolean +g_content_type_is_mime_type (const gchar *type, + const gchar *mime_type) +{ + gchar *content_type; + gboolean ret; + + g_return_val_if_fail (type != NULL, FALSE); + g_return_val_if_fail (mime_type != NULL, FALSE); + + content_type = g_content_type_from_mime_type (mime_type); + ret = g_content_type_is_a (type, content_type); + g_free (content_type); + + return ret; +} + +gboolean g_content_type_is_unknown (const gchar *type) { g_return_val_if_fail (type != NULL, FALSE); diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am index 59f2468..8ba7626 100644 --- a/gio/tests/Makefile.am +++ b/gio/tests/Makefile.am @@ -398,7 +398,6 @@ gdbus_sessionbus_sources = gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h g test_programs += \ actions \ - dbus-appinfo \ defaultvalue \ gapplication \ gdbus-auth \ @@ -425,6 +424,11 @@ test_programs += \ if OS_UNIX test_programs += gdbus-unix-addresses + +if !OS_COCOA +test_programs += dbus-appinfo +endif + endif gdbus_proxy_threads_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS) diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 6789c53..ea3806e 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -317,6 +317,11 @@ gboolean g_file_test (const gchar *filename, GFileTest test) { +#ifdef G_OS_WIN32 + int attributes; + wchar_t *wfilename; +#endif + g_return_val_if_fail (filename != NULL, FALSE); #ifdef G_OS_WIN32 @@ -327,8 +332,7 @@ g_file_test (const gchar *filename, # ifndef FILE_ATTRIBUTE_DEVICE # define FILE_ATTRIBUTE_DEVICE 64 # endif - int attributes; - wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); + wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL); if (wfilename == NULL) return FALSE; diff --git a/glib/gmain.c b/glib/gmain.c index a503431..ab2908e 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -1118,6 +1118,29 @@ source_remove_from_context (GSource *source, } } +/* See https://bugzilla.gnome.org/show_bug.cgi?id=761102 for + * the introduction of this. + * + * The main optimization is to avoid waking up the main + * context if a change is made by the current owner. + */ +static void +conditional_wakeup (GMainContext *context) +{ + /* We want to signal wakeups in two cases: + * 1 When the context is owned by another thread + * 2 When the context owner is NULL (two subcases) + * 2a Possible if the context has never been acquired + * 2b Or if the context has no current owner + * + * At least case 2a) is necessary to ensure backwards compatibility with + * qemu's use of GMainContext. + * https://bugzilla.gnome.org/show_bug.cgi?id=761102#c14 + */ + if (context->owner != G_THREAD_SELF) + g_wakeup_signal (context->wakeup); +} + static guint g_source_attach_unlocked (GSource *source, GMainContext *context, @@ -1164,8 +1187,8 @@ g_source_attach_unlocked (GSource *source, /* If another thread has acquired the context, wake it up since it * might be in poll() right now. */ - if (do_wakeup && context->owner && context->owner != G_THREAD_SELF) - g_wakeup_signal (context->wakeup); + if (do_wakeup) + conditional_wakeup (context); return source->source_id; } @@ -1842,8 +1865,7 @@ g_source_set_ready_time (GSource *source, { /* Quite likely that we need to change the timeout on the poll */ if (!SOURCE_BLOCKED (source)) - if (context->owner && context->owner != G_THREAD_SELF) - g_wakeup_signal (context->wakeup); + conditional_wakeup (context); UNLOCK_CONTEXT (context); } } @@ -4361,8 +4383,7 @@ g_main_context_add_poll_unlocked (GMainContext *context, context->poll_changed = TRUE; /* Now wake up the main loop if it is waiting in the poll() */ - if (context->owner && context->owner != G_THREAD_SELF) - g_wakeup_signal (context->wakeup); + conditional_wakeup (context); } /** @@ -4420,10 +4441,9 @@ g_main_context_remove_poll_unlocked (GMainContext *context, } context->poll_changed = TRUE; - + /* Now wake up the main loop if it is waiting in the poll() */ - if (context->owner && context->owner != G_THREAD_SELF) - g_wakeup_signal (context->wakeup); + conditional_wakeup (context); } /** diff --git a/po/id.po b/po/id.po index 845fcf0..a97b8db 100644 --- a/po/id.po +++ b/po/id.po @@ -10,16 +10,16 @@ msgstr "" "Project-Id-Version: glib master\n" "Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=glib&keywords=I18N+L10N&component=general\n" -"POT-Creation-Date: 2017-03-15 19:24+0000\n" -"PO-Revision-Date: 2017-03-19 22:07+0700\n" -"Last-Translator: Andika Triwidada \n" +"POT-Creation-Date: 2017-03-25 05:03+0000\n" +"PO-Revision-Date: 2017-04-15 23:02+0700\n" +"Last-Translator: Kukuh Syafaat \n" "Language-Team: Indonesian \n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 1.8.12\n" +"X-Generator: Poedit 1.8.11\n" #: ../gio/gapplication.c:493 msgid "GApplication options" @@ -1320,7 +1320,6 @@ msgid "Containing mount does not exist" msgstr "Kait yang memuat tak ada" #: ../gio/gfile.c:2515 ../gio/glocalfile.c:2375 -#, fuzzy msgid "Can’t copy over directory" msgstr "Tak bisa menyalin direktori atas direktori" @@ -1643,15 +1642,14 @@ msgid "Concatenate files and print to standard output." msgstr "Sambung berkas berurutan dan cetak ke keluaran standar." #: ../gio/gio-tool-cat.c:131 -#, fuzzy msgid "" "gio cat works just like the traditional cat utility, but using GIO\n" "locations instead of local files: for example, you can use something\n" "like smb://server/resource/file.txt as location." msgstr "" -"gvfs-cat bekerja seperti utilitas cat tradisional, tapi memakai lokasi gvfs\n" +"gio cat bekerja seperti utilitas cat tradisional, tapi memakai lokasi GIO\n" "sebagai ganti berkas lokal: sebagai contoh Anda dapat memakai\n" -" smb://server/sumberdaya/berkas.txt sebagai lokasi yang akan disambung." +" smb://server/sumberdaya/berkas.txt sebagai lokasi." #: ../gio/gio-tool-cat.c:151 msgid "No files given" @@ -1708,6 +1706,9 @@ msgid "" "locations instead of local files: for example, you can use something\n" "like smb://server/resource/file.txt as location." msgstr "" +"gio copy mirip dengan utilitas cp tradisional, tapi memakai lokasi GIO\n" +"sebagai ganti berkas lokal: sebagai contoh Anda dapat memakai\n" +"smb://server/sumberdaya/berkas.txt sebagai lokasi." #: ../gio/gio-tool-copy.c:143 #, c-format @@ -1808,6 +1809,12 @@ msgid "" "be specified with their GIO name, e.g. standard::icon, or just by\n" "namespace, e.g. unix, or by “*”, which matches all attributes" msgstr "" +"gio info mirip dengan utilitas ls tradisional, tapi memakai lokasi GIO\n" +"sebagai ganti berkas lokal: sebagai contoh Anda dapat memakai\n" +"smb://server/sumberdaya/berkas.txt sebagai lokasi. Atribut berkas dapat\n" +"ditentukan dengan nama GIO mereka, misalnya standar::ikon, atau hanya " +"dengan\n" +"namespace, misalnya unix, atau dengan \"*\", yang cocok dengan semua atribut" #: ../gio/gio-tool-info.c:307 ../gio/gio-tool-mkdir.c:74 msgid "No locations given" @@ -1836,6 +1843,10 @@ msgid "" "like smb://server/resource/file.txt as location. File attributes can\n" "be specified with their GIO name, e.g. standard::icon" msgstr "" +"gio list mirip dengan utilitas ls tradisional, tapi memakai lokasi GIO\n" +"sebagai ganti berkas lokal: sebagai contoh Anda dapat memakai\n" +"smb://server/sumberdaya/berkas.txt sebagai lokasi. Atribut berkas dapat\n" +"ditentukan dengan nama GIO mereka, misalnya standar::ikon" #. Translators: commandline placeholder #: ../gio/gio-tool-mime.c:71 @@ -1844,7 +1855,7 @@ msgstr "MIMETYPE" #: ../gio/gio-tool-mime.c:71 msgid "HANDLER" -msgstr "HANDLER" +msgstr "PENANGAN" #: ../gio/gio-tool-mime.c:76 msgid "Get or set the handler for a mimetype." @@ -1856,10 +1867,13 @@ msgid "" "for the mimetype. If a handler is given, it is set as the default\n" "handler for the mimetype." msgstr "" +"Jika tidak ada penangan yang diberikan, daftar aplikasi terdaftar dan\n" +"direkomendasikan untuk mimetype. Jika penangan diberikan, ini disetel\n" +"sebagai penangan bawaan untuk mimetype." #: ../gio/gio-tool-mime.c:98 msgid "Must specify a single mimetype, and maybe a handler" -msgstr "" +msgstr "Harus menentukan mimetype tunggal, dan mungkin penangan" #: ../gio/gio-tool-mime.c:113 #, c-format @@ -1915,6 +1929,9 @@ msgid "" "locations instead of local files: for example, you can use something\n" "like smb://server/resource/mydir as location." msgstr "" +"gio mkdir mirip dengan utilitas mkdir tradisional, tapi memakai lokasi GIO\n" +"sebagai ganti berkas lokal: sebagai contoh Anda dapat memakai\n" +"smb://server/sumberdaya/direktorisaya sebagai lokasi." #: ../gio/gio-tool-monitor.c:37 msgid "Monitor a directory (default: depends on type)" @@ -1927,6 +1944,8 @@ msgstr "Memantau suatu direktori (baku: bergantung kepada tipe)" #: ../gio/gio-tool-monitor.c:41 msgid "Monitor a file directly (notices changes made via hardlinks)" msgstr "" +"Pantau berkas secara langsung (pemberitahuan perubahan yang dilakukan " +"melalui hardlinks)" #: ../gio/gio-tool-monitor.c:43 msgid "Monitors a file directly, but doesn’t report changes" @@ -1936,6 +1955,8 @@ msgstr "" #: ../gio/gio-tool-monitor.c:45 msgid "Report moves and renames as simple deleted/created events" msgstr "" +"Laporkan pergerakan dan mengganti nama menjadi acara yang dihapus/dibuat " +"sederhana" #: ../gio/gio-tool-monitor.c:47 msgid "Watch for mount events" @@ -2040,7 +2061,6 @@ msgid "Mount or unmount the locations." msgstr "Kait atau lepas kait lokasi." #: ../gio/gio-tool-move.c:42 -#, fuzzy msgid "Don’t use copy and delete fallback" msgstr "Jangan gunakan fallback salin dan hapus" @@ -2054,6 +2074,9 @@ msgid "" "locations instead of local files: for example, you can use something\n" "like smb://server/resource/file.txt as location" msgstr "" +"gio move mirip dengan utilitas mv tradisional, tapi memakai lokasi GIO\n" +"sebagai ganti berkas lokal: sebagai contoh Anda dapat memakai\n" +"smb://server/sumberdaya/berkas.txt sebagai lokasi." #: ../gio/gio-tool-move.c:139 #, c-format @@ -2303,7 +2326,7 @@ msgstr "nama berkas kebergantungan yang akan dibuat" #: ../gio/glib-compile-resources.c:672 msgid "Include phony targets in the generated dependency file" -msgstr "" +msgstr "Sertakan target palsu pada berkas dependensi yang dihasilkan" #: ../gio/glib-compile-resources.c:673 msgid "Don’t automatically create and register resource" @@ -3921,9 +3944,9 @@ msgid "No valid bookmark file found in data dirs" msgstr "Tak ditemukan penanda buku yang valid di direktori data" #: ../glib/gbookmarkfile.c:1957 -#, fuzzy, c-format +#, c-format msgid "A bookmark for URI “%s” already exists" -msgstr "Pengguna dengan nama '%s' telah ada." +msgstr "Penanda taut untuk URI “%s” telah ada." #: ../glib/gbookmarkfile.c:2003 ../glib/gbookmarkfile.c:2161 #: ../glib/gbookmarkfile.c:2246 ../glib/gbookmarkfile.c:2326 @@ -3934,30 +3957,32 @@ msgstr "Pengguna dengan nama '%s' telah ada." #: ../glib/gbookmarkfile.c:3176 ../glib/gbookmarkfile.c:3344 #: ../glib/gbookmarkfile.c:3433 ../glib/gbookmarkfile.c:3522 #: ../glib/gbookmarkfile.c:3638 -#, fuzzy, c-format +#, c-format msgid "No bookmark found for URI “%s”" -msgstr "Tak ditemukan penanda buku yang valid di direktori data" +msgstr "Tak ditemukan penanda taut untuk URI “%s”" #: ../glib/gbookmarkfile.c:2335 -#, fuzzy, c-format +#, c-format msgid "No MIME type defined in the bookmark for URI “%s”" -msgstr "Tipe MIME tak didefinisikan pada penanda buku bagi URI '%s'" +msgstr "" +"Tidak ada jenis MIME yang didefinisikan pada penanda taut untuk URI \"%s\"" #: ../glib/gbookmarkfile.c:2420 -#, fuzzy, c-format +#, c-format msgid "No private flag has been defined in bookmark for URI “%s”" -msgstr "Flag privat tak didefinisikan di penanda buku bagi URI '%s'" +msgstr "" +"Tidak ada flag privat yang ditetapkan dalam penanda taut untuk URI \"%s\"" #: ../glib/gbookmarkfile.c:2799 -#, fuzzy, c-format +#, c-format msgid "No groups set in bookmark for URI “%s”" -msgstr "Gagal menata grup ke %ld: %s\n" +msgstr "Tidak ada grup yang ditetapkan dalam penanda taut untuk URI \"%s\"" #: ../glib/gbookmarkfile.c:3197 ../glib/gbookmarkfile.c:3354 -#, fuzzy, c-format +#, c-format msgid "No application with name “%s” registered a bookmark for “%s”" msgstr "" -"Tak ditemukan aplikasi terdaftar dengan nama '%s' bagi butir dengan URI '%s'" +"Tak ditemukan aplikasi terdaftar dengan nama \"%s\" bagi penanda taut \"%s\"" #: ../glib/gbookmarkfile.c:3377 #, c-format @@ -3970,9 +3995,9 @@ msgid "Partial character sequence at end of input" msgstr "Rangkaian karakter sebagian pada akhir input" #: ../glib/gconvert.c:742 -#, fuzzy, c-format +#, c-format msgid "Cannot convert fallback “%s” to codeset “%s”" -msgstr "Tidak bisa mengonversi '%s' ke suatu NSURL yang valid." +msgstr "Tidak dapat mengonversi fallback \"%s\" menjadi codeset \"%s\"" #: ../glib/gconvert.c:1566 #, c-format -- 2.7.4