#include "gcontenttype.h"
#include "gfile.h"
#include "gfileicon.h"
+#include "gioerror.h"
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
}
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,
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;
}
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;
}
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);
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)
}
}
+/* 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,
/* 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;
}
{
/* 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);
}
}
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);
}
/**
}
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);
}
/**
"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 <andika@gmail.com>\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 <syafaatkukuh@gmail.com>\n"
"Language-Team: Indonesian <gnome@i15n.org>\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"
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"
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"
"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
"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"
"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
#: ../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."
"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
"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)"
#: ../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"
#: ../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"
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"
"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
#: ../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"
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
#: ../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
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