[glib/wip/gdesktopappinfo: 10/20] gdesktopappinfo: Large-scale whitespace fixup
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gdesktopappinfo: 10/20] gdesktopappinfo: Large-scale whitespace fixup
- Date: Wed, 25 Sep 2013 20:37:40 +0000 (UTC)
commit 8364e8a845d84bfd232e96b420ded8396a17809c
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Jul 27 15:08:58 2013 -0400
gdesktopappinfo: Large-scale whitespace fixup
Fix up a lot of whitespace issues in this file since we're about to do
some pretty serious rewriting here anyway...
Add some fold markers while we're at it.
gio/gdesktopappinfo.c | 1208 +++++++++++++++++++++++++------------------------
1 files changed, 626 insertions(+), 582 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 35077e2..c2a68ac 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -22,6 +22,8 @@
* Ryan Lortie <desrt desrt ca>
*/
+/* Prelude {{{1 */
+
#include "config.h"
#include <errno.h>
@@ -77,16 +79,16 @@ enum {
static void g_desktop_app_info_iface_init (GAppInfoIface *iface);
static GList * get_all_desktop_entries_for_mime_type (const char *base_mime_type,
- const char **except,
- gboolean include_fallback,
+ const char **except,
+ gboolean include_fallback,
char **explicit_default);
static void mime_info_cache_reload (const char *dir);
static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
- GError **error);
+ GError **error);
/**
* GDesktopAppInfo:
- *
+ *
* Information about an installed application from a desktop file.
*/
struct _GDesktopAppInfo
@@ -133,12 +135,13 @@ typedef enum {
} UpdateMimeFlags;
G_DEFINE_TYPE_WITH_CODE (GDesktopAppInfo, g_desktop_app_info, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO,
- g_desktop_app_info_iface_init))
+ G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO, g_desktop_app_info_iface_init))
G_LOCK_DEFINE_STATIC (g_desktop_env);
static gchar *g_desktop_env = NULL;
+/* DesktopFileDir implementation {{{1 */
+
typedef struct
{
gchar *path;
@@ -147,6 +150,16 @@ typedef struct
static DesktopFileDir *desktop_file_dirs;
static guint n_desktop_file_dirs;
+/* DesktopFileDir "API" {{{2 */
+
+/*< internal >
+ * desktop_file_dir_create:
+ * @array: the #GArray to add a new item to
+ * @data_dir: an XDG_DATA_DIR
+ *
+ * Creates a #DesktopFileDir for the corresponding @data_dir, adding it
+ * to @array.
+ */
static void
desktop_file_dir_create (GArray *array,
const gchar *data_dir)
@@ -158,6 +171,8 @@ desktop_file_dir_create (GArray *array,
g_array_append_val (array, dir);
}
+/* Global setup API {{{2 */
+
static void
desktop_file_dirs_refresh (void)
{
@@ -183,6 +198,8 @@ desktop_file_dirs_refresh (void)
}
}
+/* GDesktopAppInfo implementation {{{1 */
+/* GObject implementation {{{2 */
static void
g_desktop_app_info_finalize (GObject *object)
{
@@ -215,15 +232,15 @@ g_desktop_app_info_finalize (GObject *object)
g_strfreev (info->mime_types);
g_free (info->app_id);
g_strfreev (info->actions);
-
+
G_OBJECT_CLASS (g_desktop_app_info_parent_class)->finalize (object);
}
static void
-g_desktop_app_info_set_property(GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+g_desktop_app_info_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GDesktopAppInfo *self = G_DESKTOP_APP_INFO (object);
@@ -262,7 +279,7 @@ static void
g_desktop_app_info_class_init (GDesktopAppInfoClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
+
gobject_class->get_property = g_desktop_app_info_get_property;
gobject_class->set_property = g_desktop_app_info_set_property;
gobject_class->finalize = g_desktop_app_info_finalize;
@@ -274,8 +291,7 @@ g_desktop_app_info_class_init (GDesktopAppInfoClass *klass)
*/
g_object_class_install_property (gobject_class,
PROP_FILENAME,
- g_param_spec_string ("filename", "Filename", "",
- NULL,
+ g_param_spec_string ("filename", "Filename", "", NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
@@ -284,25 +300,34 @@ g_desktop_app_info_init (GDesktopAppInfo *local)
{
}
+/* Construction... {{{2 */
+
+/*< internal >
+ * binary_from_exec:
+ * @exec: an exec line
+ *
+ * Returns the first word in an exec line (ie: the binary name).
+ *
+ * If @exec is " progname --foo %F" then returns "progname".
+ */
static char *
binary_from_exec (const char *exec)
{
const char *p, *start;
-
+
p = exec;
while (*p == ' ')
p++;
start = p;
while (*p != ' ' && *p != 0)
p++;
-
+
return g_strndup (start, p - start);
-
}
static gboolean
-g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
- GKeyFile *key_file)
+g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
+ GKeyFile *key_file)
{
char *start_group;
char *type;
@@ -338,10 +363,10 @@ g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
char *t;
t = g_find_program_in_path (try_exec);
if (t == NULL)
- {
- g_free (try_exec);
- return FALSE;
- }
+ {
+ g_free (try_exec);
+ return FALSE;
+ }
g_free (t);
}
@@ -400,36 +425,36 @@ g_desktop_app_info_load_from_keyfile (GDesktopAppInfo *info,
/* Remove the special-case: no Actions= key just means 0 extra actions */
if (info->actions == NULL)
info->actions = g_new0 (gchar *, 0 + 1);
-
+
info->icon = NULL;
if (info->icon_name)
{
if (g_path_is_absolute (info->icon_name))
- {
- GFile *file;
-
- file = g_file_new_for_path (info->icon_name);
- info->icon = g_file_icon_new (file);
- g_object_unref (file);
- }
+ {
+ GFile *file;
+
+ file = g_file_new_for_path (info->icon_name);
+ info->icon = g_file_icon_new (file);
+ g_object_unref (file);
+ }
else
{
char *p;
- /* Work around a common mistake in desktop files */
+ /* Work around a common mistake in desktop files */
if ((p = strrchr (info->icon_name, '.')) != NULL &&
(strcmp (p, ".png") == 0 ||
strcmp (p, ".xpm") == 0 ||
- strcmp (p, ".svg") == 0))
+ strcmp (p, ".svg") == 0))
*p = 0;
- info->icon = g_themed_icon_new (info->icon_name);
+ info->icon = g_themed_icon_new (info->icon_name);
}
}
-
+
if (info->exec)
info->binary = binary_from_exec (info->exec);
-
+
if (info->path && info->path[0] == '\0')
{
g_free (info->path);
@@ -472,13 +497,8 @@ g_desktop_app_info_load_file (GDesktopAppInfo *self)
key_file = g_key_file_new ();
- if (g_key_file_load_from_file (key_file,
- self->filename,
- G_KEY_FILE_NONE,
- NULL))
- {
- retval = g_desktop_app_info_load_from_keyfile (self, key_file);
- }
+ if (g_key_file_load_from_file (key_file, self->filename, G_KEY_FILE_NONE, NULL))
+ retval = g_desktop_app_info_load_from_keyfile (self, key_file);
g_key_file_unref (key_file);
return retval;
@@ -512,7 +532,7 @@ g_desktop_app_info_new_from_keyfile (GKeyFile *key_file)
/**
* g_desktop_app_info_new_from_filename:
* @filename: the path of a desktop file, in the GLib filename encoding
- *
+ *
* Creates a new #GDesktopAppInfo.
*
* Returns: a new #GDesktopAppInfo or %NULL on error.
@@ -534,19 +554,19 @@ g_desktop_app_info_new_from_filename (const char *filename)
/**
* g_desktop_app_info_new:
* @desktop_id: the desktop file id
- *
- * Creates a new #GDesktopAppInfo based on a desktop file id.
*
- * A desktop file id is the basename of the desktop file, including the
- * .desktop extension. GIO is looking for a desktop file with this name
+ * Creates a new #GDesktopAppInfo based on a desktop file id.
+ *
+ * A desktop file id is the basename of the desktop file, including the
+ * .desktop extension. GIO is looking for a desktop file with this name
* in the <filename>applications</filename> subdirectories of the XDG data
- * directories (i.e. the directories specified in the
- * <envar>XDG_DATA_HOME</envar> and <envar>XDG_DATA_DIRS</envar> environment
+ * directories (i.e. the directories specified in the
+ * <envar>XDG_DATA_HOME</envar> and <envar>XDG_DATA_DIRS</envar> environment
* variables). GIO also supports the prefix-to-subdirectory mapping that is
- * described in the <ulink url="http://standards.freedesktop.org/menu-spec/latest/">Menu Spec</ulink>
+ * described in the <ulink url="http://standards.freedesktop.org/menu-spec/latest/">Menu Spec</ulink>
* (i.e. a desktop id of kde-foo.desktop will match
* <filename>/usr/share/applications/kde/foo.desktop</filename>).
- *
+ *
* Returns: a new #GDesktopAppInfo, or %NULL if no desktop file with that id
*/
GDesktopAppInfo *
@@ -601,7 +621,7 @@ g_desktop_app_info_new (const char *desktop_id)
g_object_unref (appinfo);
appinfo = NULL;
}
-
+
return appinfo;
}
@@ -610,7 +630,7 @@ g_desktop_app_info_dup (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
GDesktopAppInfo *new_info;
-
+
new_info = g_object_new (G_TYPE_DESKTOP_APP_INFO, NULL);
new_info->filename = g_strdup (info->filename);
@@ -638,13 +658,15 @@ g_desktop_app_info_dup (GAppInfo *appinfo)
new_info->hidden = info->hidden;
new_info->terminal = info->terminal;
new_info->startup_notify = info->startup_notify;
-
+
return G_APP_INFO (new_info);
}
+/* GAppInfo interface implementation functions {{{2 */
+
static gboolean
g_desktop_app_info_equal (GAppInfo *appinfo1,
- GAppInfo *appinfo2)
+ GAppInfo *appinfo2)
{
GDesktopAppInfo *info1 = G_DESKTOP_APP_INFO (appinfo1);
GDesktopAppInfo *info2 = G_DESKTOP_APP_INFO (appinfo2);
@@ -691,7 +713,7 @@ g_desktop_app_info_get_display_name (GAppInfo *appinfo)
* A desktop file is hidden if the Hidden key in it is
* set to True.
*
- * Returns: %TRUE if hidden, %FALSE otherwise.
+ * Returns: %TRUE if hidden, %FALSE otherwise.
**/
gboolean
g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info)
@@ -720,7 +742,7 @@ static const char *
g_desktop_app_info_get_description (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
-
+
return info->comment;
}
@@ -728,7 +750,7 @@ static const char *
g_desktop_app_info_get_executable (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
-
+
return info->binary;
}
@@ -736,7 +758,7 @@ static const char *
g_desktop_app_info_get_commandline (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
-
+
return info->exec;
}
@@ -850,33 +872,35 @@ g_desktop_app_info_get_show_in (GDesktopAppInfo *info,
if (info->only_show_in)
{
if (desktop_env == NULL)
- return FALSE;
+ return FALSE;
found = FALSE;
for (i = 0; info->only_show_in[i] != NULL; i++)
- {
- if (strcmp (info->only_show_in[i], desktop_env) == 0)
- {
- found = TRUE;
- break;
- }
- }
+ {
+ if (strcmp (info->only_show_in[i], desktop_env) == 0)
+ {
+ found = TRUE;
+ break;
+ }
+ }
if (!found)
- return FALSE;
+ return FALSE;
}
if (info->not_show_in && desktop_env)
{
for (i = 0; info->not_show_in[i] != NULL; i++)
- {
- if (strcmp (info->not_show_in[i], desktop_env) == 0)
- return FALSE;
- }
+ {
+ if (strcmp (info->not_show_in[i], desktop_env) == 0)
+ return FALSE;
+ }
}
return TRUE;
}
+/* Launching... {{{2 */
+
static char *
expand_macro_single (char macro, char *uri)
{
@@ -887,24 +911,24 @@ expand_macro_single (char macro, char *uri)
file = g_file_new_for_uri (uri);
path = g_file_get_path (file);
g_object_unref (file);
-
+
switch (macro)
{
case 'u':
- case 'U':
+ case 'U':
result = g_shell_quote (uri);
break;
case 'f':
case 'F':
if (path)
- result = g_shell_quote (path);
+ result = g_shell_quote (path);
break;
case 'd':
case 'D':
if (path)
{
name = g_path_get_dirname (path);
- result = g_shell_quote (name);
+ result = g_shell_quote (name);
g_free (name);
}
break;
@@ -913,21 +937,21 @@ expand_macro_single (char macro, char *uri)
if (path)
{
name = g_path_get_basename (path);
- result = g_shell_quote (name);
+ result = g_shell_quote (name);
g_free (name);
}
break;
}
g_free (path);
-
+
return result;
}
static void
-expand_macro (char macro,
- GString *exec,
- GDesktopAppInfo *info,
+expand_macro (char macro,
+ GString *exec,
+ GDesktopAppInfo *info,
GList **uri_list)
{
GList *uris = *uri_list;
@@ -948,18 +972,18 @@ expand_macro (char macro,
if (!info->no_fuse)
{
switch (macro)
- {
- case 'u':
- force_file_uri_macro = 'f';
- force_file_uri = TRUE;
- break;
- case 'U':
- force_file_uri_macro = 'F';
- force_file_uri = TRUE;
- break;
- default:
- break;
- }
+ {
+ case 'u':
+ force_file_uri_macro = 'f';
+ force_file_uri = TRUE;
+ break;
+ case 'U':
+ force_file_uri_macro = 'F';
+ force_file_uri = TRUE;
+ break;
+ default:
+ break;
+ }
}
switch (macro)
@@ -969,11 +993,11 @@ expand_macro (char macro,
case 'd':
case 'n':
if (uris)
- {
- uri = uris->data;
+ {
+ uri = uris->data;
if (!force_file_uri ||
- /* Pass URI if it contains an anchor */
- strchr (uri, '#') != NULL)
+ /* Pass URI if it contains an anchor */
+ strchr (uri, '#') != NULL)
{
expanded = expand_macro_single (macro, uri);
}
@@ -984,27 +1008,27 @@ expand_macro (char macro,
expanded = expand_macro_single (macro, uri);
}
- if (expanded)
- {
- g_string_append (exec, expanded);
- g_free (expanded);
- }
- uris = uris->next;
- }
+ if (expanded)
+ {
+ g_string_append (exec, expanded);
+ g_free (expanded);
+ }
+ uris = uris->next;
+ }
break;
- case 'U':
+ case 'U':
case 'F':
case 'D':
case 'N':
while (uris)
- {
- uri = uris->data;
-
+ {
+ uri = uris->data;
+
if (!force_file_uri ||
- /* Pass URI if it contains an anchor */
- strchr (uri, '#') != NULL)
+ /* Pass URI if it contains an anchor */
+ strchr (uri, '#') != NULL)
{
expanded = expand_macro_single (macro, uri);
}
@@ -1015,44 +1039,44 @@ expand_macro (char macro,
expanded = expand_macro_single (macro, uri);
}
- if (expanded)
- {
- g_string_append (exec, expanded);
- g_free (expanded);
- }
-
- uris = uris->next;
-
- if (uris != NULL && expanded)
- g_string_append_c (exec, ' ');
- }
+ if (expanded)
+ {
+ g_string_append (exec, expanded);
+ g_free (expanded);
+ }
+
+ uris = uris->next;
+
+ if (uris != NULL && expanded)
+ g_string_append_c (exec, ' ');
+ }
break;
case 'i':
if (info->icon_name)
- {
- g_string_append (exec, "--icon ");
+ {
+ g_string_append (exec, "--icon ");
expanded = g_shell_quote (info->icon_name);
- g_string_append (exec, expanded);
+ g_string_append (exec, expanded);
g_free (expanded);
- }
+ }
break;
case 'c':
- if (info->name)
+ if (info->name)
{
expanded = g_shell_quote (info->name);
- g_string_append (exec, expanded);
+ g_string_append (exec, expanded);
g_free (expanded);
}
break;
case 'k':
- if (info->filename)
+ if (info->filename)
{
expanded = g_shell_quote (info->filename);
- g_string_append (exec, expanded);
+ g_string_append (exec, expanded);
g_free (expanded);
}
break;
@@ -1064,17 +1088,17 @@ expand_macro (char macro,
g_string_append_c (exec, '%');
break;
}
-
+
*uri_list = uris;
}
static gboolean
expand_application_parameters (GDesktopAppInfo *info,
const gchar *exec_line,
- GList **uris,
- int *argc,
- char ***argv,
- GError **error)
+ GList **uris,
+ int *argc,
+ char ***argv,
+ GError **error)
{
GList *uri_list = *uris;
const char *p = exec_line;
@@ -1093,12 +1117,12 @@ expand_application_parameters (GDesktopAppInfo *info,
while (*p)
{
if (p[0] == '%' && p[1] != '\0')
- {
- expand_macro (p[1], expanded_exec, info, uris);
- p++;
- }
+ {
+ expand_macro (p[1], expanded_exec, info, uris);
+ p++;
+ }
else
- g_string_append_c (expanded_exec, *p);
+ g_string_append_c (expanded_exec, *p);
p++;
}
@@ -1118,7 +1142,7 @@ expand_application_parameters (GDesktopAppInfo *info,
static gboolean
prepend_terminal_to_vector (int *argc,
- char ***argv)
+ char ***argv)
{
#ifndef G_OS_WIN32
char **real_argv;
@@ -1128,24 +1152,24 @@ prepend_terminal_to_vector (int *argc,
int term_argc = 0;
char *check;
char **the_argv;
-
+
g_return_val_if_fail (argc != NULL, FALSE);
g_return_val_if_fail (argv != NULL, FALSE);
-
+
/* sanity */
if(*argv == NULL)
*argc = 0;
-
+
the_argv = *argv;
/* compute size if not given */
if (*argc < 0)
{
for (i = 0; the_argv[i] != NULL; i++)
- ;
+ ;
*argc = i;
}
-
+
term_argc = 2;
term_argv = g_new0 (char *, 3);
@@ -1160,39 +1184,39 @@ prepend_terminal_to_vector (int *argc,
else
{
if (check == NULL)
- check = g_find_program_in_path ("nxterm");
+ check = g_find_program_in_path ("nxterm");
if (check == NULL)
- check = g_find_program_in_path ("color-xterm");
+ check = g_find_program_in_path ("color-xterm");
if (check == NULL)
- check = g_find_program_in_path ("rxvt");
+ check = g_find_program_in_path ("rxvt");
if (check == NULL)
- check = g_find_program_in_path ("xterm");
+ check = g_find_program_in_path ("xterm");
if (check == NULL)
- check = g_find_program_in_path ("dtterm");
+ check = g_find_program_in_path ("dtterm");
if (check == NULL)
- {
- check = g_strdup ("xterm");
- g_warning ("couldn't find a terminal, falling back to xterm");
- }
+ {
+ check = g_strdup ("xterm");
+ g_warning ("couldn't find a terminal, falling back to xterm");
+ }
term_argv[0] = check;
term_argv[1] = g_strdup ("-e");
}
real_argc = term_argc + *argc;
real_argv = g_new (char *, real_argc + 1);
-
+
for (i = 0; i < term_argc; i++)
real_argv[i] = term_argv[i];
-
+
for (j = 0; j < *argc; j++, i++)
real_argv[i] = (char *)the_argv[j];
-
+
real_argv[i] = NULL;
-
+
g_free (*argv);
*argv = real_argv;
*argc = real_argc;
-
+
/* we use g_free here as we sucked all the inner strings
* out from it into real_argv */
g_free (term_argv);
@@ -1256,11 +1280,11 @@ child_setup (gpointer user_data)
static void
notify_desktop_launch (GDBusConnection *session_bus,
- GDesktopAppInfo *info,
- long pid,
- const char *display,
- const char *sn_id,
- GList *uris)
+ GDesktopAppInfo *info,
+ long pid,
+ const char *display,
+ const char *sn_id,
+ GList *uris)
{
GDBusMessage *msg;
GVariantBuilder uri_variant;
@@ -1279,22 +1303,22 @@ notify_desktop_launch (GDBusConnection *session_bus,
g_variant_builder_init (&extras_variant, G_VARIANT_TYPE ("a{sv}"));
if (sn_id != NULL && g_utf8_validate (sn_id, -1, NULL))
g_variant_builder_add (&extras_variant, "{sv}",
- "startup-id",
- g_variant_new ("s",
- sn_id));
+ "startup-id",
+ g_variant_new ("s",
+ sn_id));
gio_desktop_file = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
if (gio_desktop_file != NULL)
g_variant_builder_add (&extras_variant, "{sv}",
- "origin-desktop-file",
- g_variant_new_bytestring (gio_desktop_file));
+ "origin-desktop-file",
+ g_variant_new_bytestring (gio_desktop_file));
if (g_get_prgname () != NULL)
g_variant_builder_add (&extras_variant, "{sv}",
- "origin-prgname",
- g_variant_new_bytestring (g_get_prgname ()));
+ "origin-prgname",
+ g_variant_new_bytestring (g_get_prgname ()));
g_variant_builder_add (&extras_variant, "{sv}",
- "origin-pid",
- g_variant_new ("x",
- (gint64)getpid ()));
+ "origin-pid",
+ g_variant_new ("x",
+ (gint64)getpid ()));
if (info->filename)
desktop_file_id = info->filename;
@@ -1302,20 +1326,20 @@ notify_desktop_launch (GDBusConnection *session_bus,
desktop_file_id = info->desktop_id;
else
desktop_file_id = "";
-
+
msg = g_dbus_message_new_signal ("/org/gtk/gio/DesktopAppInfo",
- "org.gtk.gio.DesktopAppInfo",
- "Launched");
+ "org.gtk.gio.DesktopAppInfo",
+ "Launched");
g_dbus_message_set_body (msg, g_variant_new ("(@aysxasa{sv})",
- g_variant_new_bytestring (desktop_file_id),
- display ? display : "",
- (gint64)pid,
- &uri_variant,
- &extras_variant));
+ g_variant_new_bytestring (desktop_file_id),
+ display ? display : "",
+ (gint64)pid,
+ &uri_variant,
+ &extras_variant));
g_dbus_connection_send_message (session_bus,
- msg, 0,
- NULL,
- NULL);
+ msg, 0,
+ NULL,
+ NULL);
g_object_unref (msg);
}
@@ -1425,18 +1449,18 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
&pid,
error))
{
- if (sn_id)
- g_app_launch_context_launch_failed (launch_context, sn_id);
+ if (sn_id)
+ g_app_launch_context_launch_failed (launch_context, sn_id);
- g_free (display);
- g_free (sn_id);
- g_list_free (launched_uris);
+ g_free (display);
+ g_free (sn_id);
+ g_list_free (launched_uris);
- goto out;
- }
+ goto out;
+ }
if (pid_callback != NULL)
- pid_callback (info, pid, pid_callback_data);
+ pid_callback (info, pid, pid_callback_data);
if (launch_context != NULL)
{
@@ -1453,11 +1477,11 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
}
notify_desktop_launch (session_bus,
- info,
- pid,
- display,
- sn_id,
- launched_uris);
+ info,
+ pid,
+ display,
+ sn_id,
+ launched_uris);
g_free (display);
g_free (sn_id);
@@ -1603,9 +1627,9 @@ g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
static gboolean
g_desktop_app_info_launch_uris (GAppInfo *appinfo,
- GList *uris,
- GAppLaunchContext *launch_context,
- GError **error)
+ GList *uris,
+ GAppLaunchContext *launch_context,
+ GError **error)
{
return g_desktop_app_info_launch_uris_internal (appinfo, uris,
launch_context,
@@ -1618,8 +1642,8 @@ static gboolean
g_desktop_app_info_supports_uris (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
-
- return info->exec &&
+
+ return info->exec &&
((strstr (info->exec, "%u") != NULL) ||
(strstr (info->exec, "%U") != NULL));
}
@@ -1628,17 +1652,17 @@ static gboolean
g_desktop_app_info_supports_files (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
-
- return info->exec &&
+
+ return info->exec &&
((strstr (info->exec, "%f") != NULL) ||
(strstr (info->exec, "%F") != NULL));
}
static gboolean
g_desktop_app_info_launch (GAppInfo *appinfo,
- GList *files,
- GAppLaunchContext *launch_context,
- GError **error)
+ GList *files,
+ GAppLaunchContext *launch_context,
+ GError **error)
{
GList *uris;
char *uri;
@@ -1651,13 +1675,13 @@ g_desktop_app_info_launch (GAppInfo *appinfo,
uris = g_list_prepend (uris, uri);
files = files->next;
}
-
+
uris = g_list_reverse (uris);
-
+
res = g_desktop_app_info_launch_uris (appinfo, uris, launch_context, error);
-
+
g_list_free_full (uris, g_free);
-
+
return res;
}
@@ -1693,14 +1717,14 @@ g_desktop_app_info_launch (GAppInfo *appinfo,
*/
gboolean
g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
- GList *uris,
- GAppLaunchContext *launch_context,
- GSpawnFlags spawn_flags,
- GSpawnChildSetupFunc user_setup,
- gpointer user_setup_data,
- GDesktopAppLaunchCallback pid_callback,
- gpointer pid_callback_data,
- GError **error)
+ GList *uris,
+ GAppLaunchContext *launch_context,
+ GSpawnFlags spawn_flags,
+ GSpawnChildSetupFunc user_setup,
+ gpointer user_setup_data,
+ GDesktopAppLaunchCallback pid_callback,
+ gpointer pid_callback_data,
+ GError **error)
{
return g_desktop_app_info_launch_uris_internal ((GAppInfo*)appinfo,
uris,
@@ -1713,6 +1737,8 @@ g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
error);
}
+/* OnlyShowIn API support {{{2 */
+
/**
* g_desktop_app_info_set_desktop_env:
* @desktop_env: a string specifying what desktop this is
@@ -1757,6 +1783,8 @@ g_desktop_app_info_should_show (GAppInfo *appinfo)
return g_desktop_app_info_get_show_in (info, NULL);
}
+/* mime types/default apps support {{{2 */
+
typedef enum {
APP_DIR,
MIMETYPE_DIR
@@ -1796,10 +1824,10 @@ ensure_dir (DirType type,
}
static gboolean
-update_mimeapps_list (const char *desktop_id,
- const char *content_type,
+update_mimeapps_list (const char *desktop_id,
+ const char *content_type,
UpdateMimeFlags flags,
- GError **error)
+ GError **error)
{
char *dirname, *filename, *string;
GKeyFile *key_file;
@@ -1884,14 +1912,14 @@ update_mimeapps_list (const char *desktop_id,
g_strfreev (content_types);
content_types = g_key_file_get_keys (key_file, ADDED_ASSOCIATIONS_GROUP, NULL, NULL);
}
-
+
for (k = 0; content_types && content_types[k]; k++)
- {
+ {
/* Add to the right place in the list */
-
+
length = 0;
old_list = g_key_file_get_string_list (key_file, ADDED_ASSOCIATIONS_GROUP,
- content_types[k], &length, NULL);
+ content_types[k], &length, NULL);
list = g_new (char *, 1 + length + 1);
@@ -1910,21 +1938,21 @@ update_mimeapps_list (const char *desktop_id,
if (old_list)
{
for (j = 0; old_list[j] != NULL; j++)
- {
- if (g_strcmp0 (old_list[j], desktop_id) != 0)
+ {
+ if (g_strcmp0 (old_list[j], desktop_id) != 0)
{
/* rewrite other entries if they're different from the new one */
list[i++] = g_strdup (old_list[j]);
}
- else if (flags & UPDATE_MIME_SET_NON_DEFAULT)
- {
+ else if (flags & UPDATE_MIME_SET_NON_DEFAULT)
+ {
/* we encountered an old entry which is equal to the one we're adding as non-default,
* don't change its position in the list.
*/
- flags ^= UPDATE_MIME_SET_NON_DEFAULT;
- list[i++] = g_strdup (old_list[j]);
- }
- }
+ flags ^= UPDATE_MIME_SET_NON_DEFAULT;
+ list[i++] = g_strdup (old_list[j]);
+ }
+ }
}
/* add it at the end of the list */
@@ -1932,14 +1960,14 @@ update_mimeapps_list (const char *desktop_id,
list[i++] = g_strdup (desktop_id);
list[i] = NULL;
-
+
g_strfreev (old_list);
if (list[0] == NULL || desktop_id == NULL)
g_key_file_remove_key (key_file,
- ADDED_ASSOCIATIONS_GROUP,
- content_types[k],
- NULL);
+ ADDED_ASSOCIATIONS_GROUP,
+ content_types[k],
+ NULL);
else
g_key_file_set_string_list (key_file,
ADDED_ASSOCIATIONS_GROUP,
@@ -1948,7 +1976,7 @@ update_mimeapps_list (const char *desktop_id,
g_strfreev (list);
}
-
+
if (content_type)
{
/* reuse the list from above */
@@ -1959,13 +1987,13 @@ update_mimeapps_list (const char *desktop_id,
content_types = g_key_file_get_keys (key_file, REMOVED_ASSOCIATIONS_GROUP, NULL, NULL);
}
- for (k = 0; content_types && content_types[k]; k++)
+ for (k = 0; content_types && content_types[k]; k++)
{
/* Remove from removed associations group (unless remove) */
-
+
length = 0;
old_list = g_key_file_get_string_list (key_file, REMOVED_ASSOCIATIONS_GROUP,
- content_types[k], &length, NULL);
+ content_types[k], &length, NULL);
list = g_new (char *, 1 + length + 1);
@@ -1975,25 +2003,25 @@ update_mimeapps_list (const char *desktop_id,
if (old_list)
{
for (j = 0; old_list[j] != NULL; j++)
- {
- if (g_strcmp0 (old_list[j], desktop_id) != 0)
- list[i++] = g_strdup (old_list[j]);
- }
+ {
+ if (g_strcmp0 (old_list[j], desktop_id) != 0)
+ list[i++] = g_strdup (old_list[j]);
+ }
}
list[i] = NULL;
-
+
g_strfreev (old_list);
if (list[0] == NULL || desktop_id == NULL)
g_key_file_remove_key (key_file,
- REMOVED_ASSOCIATIONS_GROUP,
- content_types[k],
- NULL);
+ REMOVED_ASSOCIATIONS_GROUP,
+ content_types[k],
+ NULL);
else
g_key_file_set_string_list (key_file,
- REMOVED_ASSOCIATIONS_GROUP,
- content_types[k],
- (const char * const *)list, i);
+ REMOVED_ASSOCIATIONS_GROUP,
+ content_types[k],
+ (const char * const *)list, i);
g_strfreev (list);
}
@@ -2039,8 +2067,8 @@ g_desktop_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
static gboolean
g_desktop_app_info_set_as_default_for_type (GAppInfo *appinfo,
- const char *content_type,
- GError **error)
+ const char *content_type,
+ GError **error)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
@@ -2061,8 +2089,8 @@ g_desktop_app_info_set_as_default_for_type (GAppInfo *appinfo,
static void
update_program_done (GPid pid,
- gint status,
- gpointer data)
+ gint status,
+ gpointer data)
{
/* Did the application exit correctly */
if (g_spawn_check_exit_status (status, NULL))
@@ -2073,67 +2101,67 @@ update_program_done (GPid pid,
static void
run_update_command (char *command,
- char *subdir)
-{
- char *argv[3] = {
- NULL,
- NULL,
- NULL,
- };
- GPid pid = 0;
- GError *error = NULL;
-
- argv[0] = command;
- argv[1] = g_build_filename (g_get_user_data_dir (), subdir, NULL);
-
- if (g_spawn_async ("/", argv,
- NULL, /* envp */
- G_SPAWN_SEARCH_PATH |
- G_SPAWN_STDOUT_TO_DEV_NULL |
- G_SPAWN_STDERR_TO_DEV_NULL |
- G_SPAWN_DO_NOT_REAP_CHILD,
- NULL, NULL, /* No setup function */
- &pid,
- &error))
- g_child_watch_add (pid, update_program_done, NULL);
- else
- {
- /* If we get an error at this point, it's quite likely the user doesn't
- * have an installed copy of either 'update-mime-database' or
- * 'update-desktop-database'. I don't think we want to popup an error
- * dialog at this point, so we just do a g_warning to give the user a
- * chance of debugging it.
- */
- g_warning ("%s", error->message);
- }
-
- g_free (argv[1]);
+ char *subdir)
+{
+ char *argv[3] = {
+ NULL,
+ NULL,
+ NULL,
+ };
+ GPid pid = 0;
+ GError *error = NULL;
+
+ argv[0] = command;
+ argv[1] = g_build_filename (g_get_user_data_dir (), subdir, NULL);
+
+ if (g_spawn_async ("/", argv,
+ NULL, /* envp */
+ G_SPAWN_SEARCH_PATH |
+ G_SPAWN_STDOUT_TO_DEV_NULL |
+ G_SPAWN_STDERR_TO_DEV_NULL |
+ G_SPAWN_DO_NOT_REAP_CHILD,
+ NULL, NULL, /* No setup function */
+ &pid,
+ &error))
+ g_child_watch_add (pid, update_program_done, NULL);
+ else
+ {
+ /* If we get an error at this point, it's quite likely the user doesn't
+ * have an installed copy of either 'update-mime-database' or
+ * 'update-desktop-database'. I don't think we want to popup an error
+ * dialog at this point, so we just do a g_warning to give the user a
+ * chance of debugging it.
+ */
+ g_warning ("%s", error->message);
+ }
+
+ g_free (argv[1]);
}
static gboolean
g_desktop_app_info_set_as_default_for_extension (GAppInfo *appinfo,
- const char *extension,
- GError **error)
+ const char *extension,
+ GError **error)
{
char *filename, *basename, *mimetype;
char *dirname;
gboolean res;
if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (appinfo), error))
- return FALSE;
-
+ return FALSE;
+
dirname = ensure_dir (MIMETYPE_DIR, error);
if (!dirname)
return FALSE;
-
+
basename = g_strdup_printf ("user-extension-%s.xml", extension);
filename = g_build_filename (dirname, basename, NULL);
g_free (basename);
g_free (dirname);
mimetype = g_strdup_printf ("application/x-extension-%s", extension);
-
- if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
{
char *contents;
@@ -2152,26 +2180,26 @@ g_desktop_app_info_set_as_default_for_extension (GAppInfo *appinfo,
run_update_command ("update-mime-database", "mime");
}
g_free (filename);
-
+
res = g_desktop_app_info_set_as_default_for_type (appinfo,
- mimetype,
- error);
+ mimetype,
+ error);
g_free (mimetype);
-
+
return res;
}
static gboolean
g_desktop_app_info_add_supports_type (GAppInfo *appinfo,
- const char *content_type,
- GError **error)
+ const char *content_type,
+ GError **error)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (info), error))
- return FALSE;
-
+ return FALSE;
+
return update_mimeapps_list (info->desktop_id, content_type,
UPDATE_MIME_SET_NON_DEFAULT,
error);
@@ -2185,14 +2213,14 @@ g_desktop_app_info_can_remove_supports_type (GAppInfo *appinfo)
static gboolean
g_desktop_app_info_remove_supports_type (GAppInfo *appinfo,
- const char *content_type,
- GError **error)
+ const char *content_type,
+ GError **error)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
if (!g_desktop_app_info_ensure_saved (G_DESKTOP_APP_INFO (info), error))
return FALSE;
-
+
return update_mimeapps_list (info->desktop_id, content_type,
UPDATE_MIME_REMOVE,
error);
@@ -2206,10 +2234,11 @@ g_desktop_app_info_get_supported_types (GAppInfo *appinfo)
return (const char**) info->mime_types;
}
+/* Saving and deleting {{{2 */
static gboolean
g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
- GError **error)
+ GError **error)
{
GKeyFile *key_file;
char *dirname;
@@ -2218,7 +2247,7 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
gsize data_size;
int fd;
gboolean res;
-
+
if (info->filename != NULL)
return TRUE;
@@ -2226,46 +2255,46 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
* g_app_info_create_from_commandline. All other
* object should have a filename
*/
-
+
dirname = ensure_dir (APP_DIR, error);
if (!dirname)
return FALSE;
-
+
key_file = g_key_file_new ();
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- "Encoding", "UTF-8");
+ "Encoding", "UTF-8");
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_VERSION, "1.0");
+ G_KEY_FILE_DESKTOP_KEY_VERSION, "1.0");
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_TYPE,
+ G_KEY_FILE_DESKTOP_KEY_TYPE,
G_KEY_FILE_DESKTOP_TYPE_APPLICATION);
- if (info->terminal)
+ if (info->terminal)
g_key_file_set_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_TERMINAL, TRUE);
+ G_KEY_FILE_DESKTOP_KEY_TERMINAL, TRUE);
if (info->nodisplay)
g_key_file_set_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, TRUE);
+ G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, TRUE);
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_EXEC, info->exec);
+ G_KEY_FILE_DESKTOP_KEY_EXEC, info->exec);
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_NAME, info->name);
+ G_KEY_FILE_DESKTOP_KEY_NAME, info->name);
if (info->generic_name != NULL)
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- GENERIC_NAME_KEY, info->generic_name);
+ GENERIC_NAME_KEY, info->generic_name);
if (info->fullname != NULL)
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- FULL_NAME_KEY, info->fullname);
+ FULL_NAME_KEY, info->fullname);
g_key_file_set_string (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_COMMENT, info->comment);
-
+ G_KEY_FILE_DESKTOP_KEY_COMMENT, info->comment);
+
g_key_file_set_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, TRUE);
+ G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, TRUE);
data = g_key_file_to_data (key_file, &data_size, NULL);
g_key_file_free (key_file);
@@ -2274,7 +2303,7 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
filename = g_build_filename (dirname, desktop_id, NULL);
g_free (desktop_id);
g_free (dirname);
-
+
fd = g_mkstemp (filename);
if (fd == -1)
{
@@ -2282,7 +2311,7 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
display_name = g_filename_display_name (filename);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Can't create user desktop file %s"), display_name);
+ _("Can't create user desktop file %s"), display_name);
g_free (display_name);
g_free (filename);
g_free (data);
@@ -2293,7 +2322,7 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
/* FIXME - actually handle error */
(void) g_close (fd, NULL);
-
+
res = g_file_set_contents (filename, data, data_size, error);
g_free (data);
if (!res)
@@ -2305,9 +2334,9 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
info->filename = filename;
info->desktop_id = desktop_id;
-
+
run_update_command ("update-desktop-database", "applications");
-
+
return TRUE;
}
@@ -2329,9 +2358,9 @@ static gboolean
g_desktop_app_info_delete (GAppInfo *appinfo)
{
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (appinfo);
-
+
if (info->filename)
- {
+ {
if (g_remove (info->filename) == 0)
{
update_mimeapps_list (info->desktop_id, NULL,
@@ -2350,6 +2379,7 @@ g_desktop_app_info_delete (GAppInfo *appinfo)
return FALSE;
}
+/* Create for commandline {{{2 */
/**
* g_app_info_create_from_commandline:
* @commandline: the commandline to use
@@ -2369,9 +2399,9 @@ g_desktop_app_info_delete (GAppInfo *appinfo)
**/
GAppInfo *
g_app_info_create_from_commandline (const char *commandline,
- const char *application_name,
- GAppInfoCreateFlags flags,
- GError **error)
+ const char *application_name,
+ GAppInfoCreateFlags flags,
+ GError **error)
{
char **split;
char *basename;
@@ -2383,7 +2413,7 @@ g_app_info_create_from_commandline (const char *commandline,
info->filename = NULL;
info->desktop_id = NULL;
-
+
info->terminal = (flags & G_APP_INFO_CREATE_NEEDS_TERMINAL) != 0;
info->startup_notify = (flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION) != 0;
info->hidden = FALSE;
@@ -2393,7 +2423,7 @@ g_app_info_create_from_commandline (const char *commandline,
info->exec = g_strconcat (commandline, " %f", NULL);
info->nodisplay = TRUE;
info->binary = binary_from_exec (info->exec);
-
+
if (application_name)
info->name = g_strdup (application_name);
else
@@ -2404,13 +2434,15 @@ g_app_info_create_from_commandline (const char *commandline,
g_strfreev (split);
info->name = basename;
if (info->name == NULL)
- info->name = g_strdup ("custom");
+ info->name = g_strdup ("custom");
}
info->comment = g_strdup_printf (_("Custom definition for %s"), info->name);
-
+
return G_APP_INFO (info);
}
+/* GAppInfo interface init */
+
static void
g_desktop_app_info_iface_init (GAppInfoIface *iface)
{
@@ -2439,14 +2471,16 @@ g_desktop_app_info_iface_init (GAppInfoIface *iface)
iface->get_supported_types = g_desktop_app_info_get_supported_types;
}
+/* Recommended applications {{{2 */
+
static gboolean
-app_info_in_list (GAppInfo *info,
+app_info_in_list (GAppInfo *info,
GList *list)
{
while (list != NULL)
{
if (g_app_info_equal (info, list->data))
- return TRUE;
+ return TRUE;
list = list->next;
}
return FALSE;
@@ -2455,7 +2489,7 @@ app_info_in_list (GAppInfo *info,
/**
* g_app_info_get_recommended_for_type:
* @content_type: the content type to find a #GAppInfo for
- *
+ *
* Gets a list of recommended #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type exactly,
* and not by MIME type subclassing.
@@ -2486,12 +2520,12 @@ g_app_info_get_recommended_for_type (const gchar *content_type)
info = g_desktop_app_info_new (desktop_entry);
if (info)
- {
- if (app_info_in_list (G_APP_INFO (info), infos))
- g_object_unref (info);
- else
- infos = g_list_prepend (infos, info);
- }
+ {
+ if (app_info_in_list (G_APP_INFO (info), infos))
+ g_object_unref (info);
+ else
+ infos = g_list_prepend (infos, info);
+ }
g_free (desktop_entry);
}
@@ -2503,7 +2537,7 @@ g_app_info_get_recommended_for_type (const gchar *content_type)
/**
* g_app_info_get_fallback_for_type:
* @content_type: the content type to find a #GAppInfo for
- *
+ *
* Gets a list of fallback #GAppInfos for a given content type, i.e.
* those applications which claim to support the given content type
* by MIME type subclassing and not directly.
@@ -2532,13 +2566,13 @@ g_app_info_get_fallback_for_type (const gchar *content_type)
info = g_desktop_app_info_new (desktop_entry);
if (info)
- {
- if (app_info_in_list (G_APP_INFO (info), infos) ||
- app_info_in_list (G_APP_INFO (info), recommended_infos))
- g_object_unref (info);
- else
- infos = g_list_prepend (infos, info);
- }
+ {
+ if (app_info_in_list (G_APP_INFO (info), infos) ||
+ app_info_in_list (G_APP_INFO (info), recommended_infos))
+ g_object_unref (info);
+ else
+ infos = g_list_prepend (infos, info);
+ }
g_free (desktop_entry);
}
@@ -2569,7 +2603,7 @@ g_app_info_get_all_for_type (const char *content_type)
GDesktopAppInfo *info;
g_return_val_if_fail (content_type != NULL, NULL);
-
+
desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE, &user_default);
infos = NULL;
@@ -2590,17 +2624,17 @@ g_app_info_get_all_for_type (const char *content_type)
info = g_desktop_app_info_new (desktop_entry);
if (info)
- {
- if (app_info_in_list (G_APP_INFO (info), infos))
- g_object_unref (info);
- else
- infos = g_list_prepend (infos, info);
- }
+ {
+ if (app_info_in_list (G_APP_INFO (info), infos))
+ g_object_unref (info);
+ else
+ infos = g_list_prepend (infos, info);
+ }
g_free (desktop_entry);
}
g_list_free (desktop_entries);
-
+
return g_list_reverse (infos);
}
@@ -2637,14 +2671,14 @@ g_app_info_reset_type_associations (const char *content_type)
*/
GAppInfo *
g_app_info_get_default_for_type (const char *content_type,
- gboolean must_support_uris)
+ gboolean must_support_uris)
{
GList *desktop_entries, *l;
char *user_default = NULL;
GAppInfo *info;
g_return_val_if_fail (content_type != NULL, NULL);
-
+
desktop_entries = get_all_desktop_entries_for_mime_type (content_type, NULL, TRUE, &user_default);
info = NULL;
@@ -2655,11 +2689,11 @@ g_app_info_get_default_for_type (const char *content_type,
if (info)
{
- if (must_support_uris && !g_app_info_supports_uris (info))
- {
- g_object_unref (info);
- info = NULL;
- }
+ if (must_support_uris && !g_app_info_supports_uris (info))
+ {
+ g_object_unref (info);
+ info = NULL;
+ }
}
}
@@ -2680,17 +2714,17 @@ g_app_info_get_default_for_type (const char *content_type,
info = (GAppInfo *)g_desktop_app_info_new (desktop_entry);
if (info)
- {
- if (must_support_uris && !g_app_info_supports_uris (info))
- {
- g_object_unref (info);
- info = NULL;
- }
- else
- break;
- }
+ {
+ if (must_support_uris && !g_app_info_supports_uris (info))
+ {
+ g_object_unref (info);
+ info = NULL;
+ }
+ else
+ break;
+ }
}
-
+
g_list_free_full (desktop_entries, g_free);
return info;
@@ -2785,20 +2819,21 @@ get_apps_from_dir (GHashTable *apps,
}
}
+/* "Get all" API {{{2 */
/**
* g_app_info_get_all:
*
- * Gets a list of all of the applications currently registered
+ * Gets a list of all of the applications currently registered
* on this system.
- *
- * For desktop files, this includes applications that have
- * <literal>NoDisplay=true</literal> set or are excluded from
+ *
+ * For desktop files, this includes applications that have
+ * <literal>NoDisplay=true</literal> set or are excluded from
* display by means of <literal>OnlyShowIn</literal> or
* <literal>NotShowIn</literal>. See g_app_info_should_show().
* The returned list does not include applications which have
- * the <literal>Hidden</literal> key set.
- *
+ * the <literal>Hidden</literal> key set.
+ *
* Returns: (element-type GAppInfo) (transfer full): a newly allocated #GList of references to
#GAppInfo<!---->s.
**/
GList *
@@ -2833,7 +2868,7 @@ g_app_info_get_all (void)
return g_list_reverse (infos);
}
-/* Cacheing of mimeinfo.cache and defaults.list files */
+/* Caching of mimeinfo.cache and defaults.list files {{{2 */
typedef struct {
char *path;
@@ -2856,14 +2891,14 @@ static MimeInfoCache *mime_info_cache = NULL;
G_LOCK_DEFINE_STATIC (mime_info_cache);
static void mime_info_cache_dir_add_desktop_entries (MimeInfoCacheDir *dir,
- const char *mime_type,
- char **new_desktop_file_ids);
+ const char *mime_type,
+ char **new_desktop_file_ids);
static MimeInfoCache * mime_info_cache_new (void);
static void
-destroy_info_cache_value (gpointer key,
- GList *value,
+destroy_info_cache_value (gpointer key,
+ GList *value,
gpointer data)
{
g_list_free_full (value, g_free);
@@ -2878,14 +2913,14 @@ destroy_info_cache_map (GHashTable *info_cache_map)
static gboolean
mime_info_cache_dir_out_of_date (MimeInfoCacheDir *dir,
- const char *cache_file,
- time_t *timestamp)
+ const char *cache_file,
+ time_t *timestamp)
{
struct stat buf;
char *filename;
-
+
filename = g_build_filename (dir->path, cache_file, NULL);
-
+
if (g_stat (filename, &buf) < 0)
{
g_free (filename);
@@ -2893,9 +2928,9 @@ mime_info_cache_dir_out_of_date (MimeInfoCacheDir *dir,
}
g_free (filename);
- if (buf.st_mtime != *timestamp)
+ if (buf.st_mtime != *timestamp)
return TRUE;
-
+
return FALSE;
}
@@ -2908,78 +2943,78 @@ mime_info_cache_dir_init (MimeInfoCacheDir *dir)
gchar *filename, **mime_types;
int i;
struct stat buf;
-
+
load_error = NULL;
mime_types = NULL;
-
+
if (dir->mime_info_cache_map != NULL &&
!mime_info_cache_dir_out_of_date (dir, "mimeinfo.cache",
- &dir->mime_info_cache_timestamp))
+ &dir->mime_info_cache_timestamp))
return;
-
+
if (dir->mime_info_cache_map != NULL)
destroy_info_cache_map (dir->mime_info_cache_map);
-
+
dir->mime_info_cache_map = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- NULL);
-
+ (GDestroyNotify) g_free,
+ NULL);
+
key_file = g_key_file_new ();
-
+
filename = g_build_filename (dir->path, "mimeinfo.cache", NULL);
-
+
if (g_stat (filename, &buf) < 0)
goto error;
-
+
dir->mime_info_cache_timestamp = buf.st_mtime;
-
+
g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &load_error);
-
+
g_free (filename);
filename = NULL;
-
+
if (load_error != NULL)
goto error;
-
+
mime_types = g_key_file_get_keys (key_file, MIME_CACHE_GROUP,
- NULL, &load_error);
-
+ NULL, &load_error);
+
if (load_error != NULL)
goto error;
-
+
for (i = 0; mime_types[i] != NULL; i++)
{
gchar **desktop_file_ids;
char *unaliased_type;
desktop_file_ids = g_key_file_get_string_list (key_file,
- MIME_CACHE_GROUP,
- mime_types[i],
- NULL,
- NULL);
-
+ MIME_CACHE_GROUP,
+ mime_types[i],
+ NULL,
+ NULL);
+
if (desktop_file_ids == NULL)
- continue;
+ continue;
unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
mime_info_cache_dir_add_desktop_entries (dir,
- unaliased_type,
- desktop_file_ids);
+ unaliased_type,
+ desktop_file_ids);
g_free (unaliased_type);
-
+
g_strfreev (desktop_file_ids);
}
-
+
g_strfreev (mime_types);
g_key_file_free (key_file);
-
+
return;
error:
g_free (filename);
g_key_file_free (key_file);
-
+
if (mime_types != NULL)
g_strfreev (mime_types);
-
+
if (load_error)
g_error_free (load_error);
}
@@ -3000,17 +3035,17 @@ mime_info_cache_dir_init_defaults_list (MimeInfoCacheDir *dir)
if (dir->defaults_list_map != NULL &&
!mime_info_cache_dir_out_of_date (dir, "defaults.list",
- &dir->defaults_list_timestamp))
+ &dir->defaults_list_timestamp))
return;
-
+
if (dir->defaults_list_map != NULL)
g_hash_table_destroy (dir->defaults_list_map);
dir->defaults_list_map = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, (GDestroyNotify)g_strfreev);
-
+ g_free, (GDestroyNotify)g_strfreev);
+
key_file = g_key_file_new ();
-
+
filename = g_build_filename (dir->path, "defaults.list", NULL);
if (g_stat (filename, &buf) < 0)
goto error;
@@ -3025,38 +3060,38 @@ mime_info_cache_dir_init_defaults_list (MimeInfoCacheDir *dir)
goto error;
mime_types = g_key_file_get_keys (key_file, DEFAULT_APPLICATIONS_GROUP,
- NULL, NULL);
+ NULL, NULL);
if (mime_types != NULL)
{
for (i = 0; mime_types[i] != NULL; i++)
- {
- desktop_file_ids = g_key_file_get_string_list (key_file,
- DEFAULT_APPLICATIONS_GROUP,
- mime_types[i],
- NULL,
- NULL);
- if (desktop_file_ids == NULL)
- continue;
-
- unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
- g_hash_table_replace (dir->defaults_list_map,
- unaliased_type,
- desktop_file_ids);
- }
-
+ {
+ desktop_file_ids = g_key_file_get_string_list (key_file,
+ DEFAULT_APPLICATIONS_GROUP,
+ mime_types[i],
+ NULL,
+ NULL);
+ if (desktop_file_ids == NULL)
+ continue;
+
+ unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
+ g_hash_table_replace (dir->defaults_list_map,
+ unaliased_type,
+ desktop_file_ids);
+ }
+
g_strfreev (mime_types);
}
g_key_file_free (key_file);
return;
-
+
error:
g_free (filename);
g_key_file_free (key_file);
-
+
if (mime_types != NULL)
g_strfreev (mime_types);
-
+
if (load_error)
g_error_free (load_error);
}
@@ -3078,18 +3113,18 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
if (dir->mimeapps_list_added_map != NULL &&
!mime_info_cache_dir_out_of_date (dir, "mimeapps.list",
- &dir->mimeapps_list_timestamp))
+ &dir->mimeapps_list_timestamp))
return;
-
+
if (dir->mimeapps_list_added_map != NULL)
g_hash_table_destroy (dir->mimeapps_list_added_map);
dir->mimeapps_list_added_map = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, (GDestroyNotify)g_strfreev);
-
+ g_free, (GDestroyNotify)g_strfreev);
+
if (dir->mimeapps_list_removed_map != NULL)
g_hash_table_destroy (dir->mimeapps_list_removed_map);
dir->mimeapps_list_removed_map = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, (GDestroyNotify)g_strfreev);
+ g_free, (GDestroyNotify)g_strfreev);
if (dir->mimeapps_list_defaults_map != NULL)
g_hash_table_destroy (dir->mimeapps_list_defaults_map);
@@ -3097,7 +3132,7 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
g_free, g_free);
key_file = g_key_file_new ();
-
+
filename = g_build_filename (dir->path, "mimeapps.list", NULL);
if (g_stat (filename, &buf) < 0)
goto error;
@@ -3112,48 +3147,48 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
goto error;
mime_types = g_key_file_get_keys (key_file, ADDED_ASSOCIATIONS_GROUP,
- NULL, NULL);
+ NULL, NULL);
if (mime_types != NULL)
{
for (i = 0; mime_types[i] != NULL; i++)
- {
- desktop_file_ids = g_key_file_get_string_list (key_file,
- ADDED_ASSOCIATIONS_GROUP,
- mime_types[i],
- NULL,
- NULL);
- if (desktop_file_ids == NULL)
- continue;
-
- unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
- g_hash_table_replace (dir->mimeapps_list_added_map,
- unaliased_type,
- desktop_file_ids);
- }
-
+ {
+ desktop_file_ids = g_key_file_get_string_list (key_file,
+ ADDED_ASSOCIATIONS_GROUP,
+ mime_types[i],
+ NULL,
+ NULL);
+ if (desktop_file_ids == NULL)
+ continue;
+
+ unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
+ g_hash_table_replace (dir->mimeapps_list_added_map,
+ unaliased_type,
+ desktop_file_ids);
+ }
+
g_strfreev (mime_types);
}
mime_types = g_key_file_get_keys (key_file, REMOVED_ASSOCIATIONS_GROUP,
- NULL, NULL);
+ NULL, NULL);
if (mime_types != NULL)
{
for (i = 0; mime_types[i] != NULL; i++)
- {
- desktop_file_ids = g_key_file_get_string_list (key_file,
- REMOVED_ASSOCIATIONS_GROUP,
- mime_types[i],
- NULL,
- NULL);
- if (desktop_file_ids == NULL)
- continue;
-
- unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
- g_hash_table_replace (dir->mimeapps_list_removed_map,
- unaliased_type,
- desktop_file_ids);
- }
-
+ {
+ desktop_file_ids = g_key_file_get_string_list (key_file,
+ REMOVED_ASSOCIATIONS_GROUP,
+ mime_types[i],
+ NULL,
+ NULL);
+ if (desktop_file_ids == NULL)
+ continue;
+
+ unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
+ g_hash_table_replace (dir->mimeapps_list_removed_map,
+ unaliased_type,
+ desktop_file_ids);
+ }
+
g_strfreev (mime_types);
}
@@ -3181,14 +3216,14 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
g_key_file_free (key_file);
return;
-
+
error:
g_free (filename);
g_key_file_free (key_file);
-
+
if (mime_types != NULL)
g_strfreev (mime_types);
-
+
if (load_error)
g_error_free (load_error);
}
@@ -3200,7 +3235,7 @@ mime_info_cache_dir_new (const char *path)
dir = g_new0 (MimeInfoCacheDir, 1);
dir->path = g_strdup (path);
-
+
return dir;
}
@@ -3209,26 +3244,26 @@ mime_info_cache_dir_free (MimeInfoCacheDir *dir)
{
if (dir == NULL)
return;
-
+
if (dir->mime_info_cache_map != NULL)
{
destroy_info_cache_map (dir->mime_info_cache_map);
dir->mime_info_cache_map = NULL;
-
+
}
-
+
if (dir->defaults_list_map != NULL)
{
g_hash_table_destroy (dir->defaults_list_map);
dir->defaults_list_map = NULL;
}
-
+
if (dir->mimeapps_list_added_map != NULL)
{
g_hash_table_destroy (dir->mimeapps_list_added_map);
dir->mimeapps_list_added_map = NULL;
}
-
+
if (dir->mimeapps_list_removed_map != NULL)
{
g_hash_table_destroy (dir->mimeapps_list_removed_map);
@@ -3246,22 +3281,22 @@ mime_info_cache_dir_free (MimeInfoCacheDir *dir)
static void
mime_info_cache_dir_add_desktop_entries (MimeInfoCacheDir *dir,
- const char *mime_type,
- char **new_desktop_file_ids)
+ const char *mime_type,
+ char **new_desktop_file_ids)
{
GList *desktop_file_ids;
int i;
-
+
desktop_file_ids = g_hash_table_lookup (dir->mime_info_cache_map,
- mime_type);
-
+ mime_type);
+
for (i = 0; new_desktop_file_ids[i] != NULL; i++)
{
if (!g_list_find_custom (desktop_file_ids, new_desktop_file_ids[i], (GCompareFunc) strcmp))
- desktop_file_ids = g_list_append (desktop_file_ids,
- g_strdup (new_desktop_file_ids[i]));
+ desktop_file_ids = g_list_append (desktop_file_ids,
+ g_strdup (new_desktop_file_ids[i]));
}
-
+
g_hash_table_insert (dir->mime_info_cache_map, g_strdup (mime_type), desktop_file_ids);
}
@@ -3277,17 +3312,17 @@ mime_info_cache_init_dir_lists (void)
for (i = 0; i < n_desktop_file_dirs; i++)
{
MimeInfoCacheDir *dir;
-
+
dir = mime_info_cache_dir_new (desktop_file_dirs[i].path);
-
+
if (dir != NULL)
- {
- mime_info_cache_dir_init (dir);
- mime_info_cache_dir_init_defaults_list (dir);
- mime_info_cache_dir_init_mimeapps_list (dir);
-
- mime_info_cache->dirs = g_list_append (mime_info_cache->dirs, dir);
- }
+ {
+ mime_info_cache_dir_init (dir);
+ mime_info_cache_dir_init_defaults_list (dir);
+ mime_info_cache_dir_init_mimeapps_list (dir);
+
+ mime_info_cache->dirs = g_list_append (mime_info_cache->dirs, dir);
+ }
}
}
@@ -3295,9 +3330,9 @@ static void
mime_info_cache_update_dir_lists (void)
{
GList *tmp;
-
+
tmp = mime_info_cache->dirs;
-
+
while (tmp != NULL)
{
MimeInfoCacheDir *dir = (MimeInfoCacheDir *) tmp->data;
@@ -3306,7 +3341,7 @@ mime_info_cache_update_dir_lists (void)
mime_info_cache_dir_init (dir);
mime_info_cache_dir_init_defaults_list (dir);
mime_info_cache_dir_init_mimeapps_list (dir);
-
+
tmp = tmp->next;
}
}
@@ -3320,13 +3355,13 @@ mime_info_cache_init (void)
else
{
time_t now;
-
+
time (&now);
if (now >= mime_info_cache->last_stat_time + 10)
- {
- mime_info_cache_update_dir_lists ();
- mime_info_cache->last_stat_time = now;
- }
+ {
+ mime_info_cache_update_dir_lists ();
+ mime_info_cache->last_stat_time = now;
+ }
}
G_UNLOCK (mime_info_cache);
@@ -3355,7 +3390,7 @@ mime_info_cache_free (MimeInfoCache *cache)
/**
* mime_info_cache_reload:
* @dir: directory path which needs reloading.
- *
+ *
* Reload the mime information for the @dir.
*/
static void
@@ -3374,15 +3409,15 @@ mime_info_cache_reload (const char *dir)
}
static GList *
-append_desktop_entry (GList *list,
+append_desktop_entry (GList *list,
const char *desktop_entry,
- GList *removed_entries)
+ GList *removed_entries)
{
/* Add if not already in list, and valid */
if (!g_list_find_custom (list, desktop_entry, (GCompareFunc) strcmp) &&
!g_list_find_custom (removed_entries, desktop_entry, (GCompareFunc) strcmp))
list = g_list_prepend (list, g_strdup (desktop_entry));
-
+
return list;
}
@@ -3396,15 +3431,15 @@ append_desktop_entry (GList *list,
* non-default ones, and handlers for inherited mimetypes are listed
* after the base ones.
*
- * Optionally doesn't list the desktop ids given in the @except
+ * Optionally doesn't list the desktop ids given in the @except
*
* Return value: a #GList containing the desktop ids which claim
* to handle @mime_type.
*/
static GList *
get_all_desktop_entries_for_mime_type (const char *base_mime_type,
- const char **except,
- gboolean include_fallback,
+ const char **except,
+ gboolean include_fallback,
char **explicit_default)
{
GList *desktop_entries, *removed_entries, *list, *dir_list, *tmp;
@@ -3419,7 +3454,7 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
int i, j, k;
GPtrArray *array;
char **anc;
-
+
mime_info_cache_init ();
if (include_fallback)
@@ -3428,23 +3463,23 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
mime_types = _g_unix_content_type_get_parents (base_mime_type);
array = g_ptr_array_new ();
for (i = 0; mime_types[i]; i++)
- g_ptr_array_add (array, mime_types[i]);
+ g_ptr_array_add (array, mime_types[i]);
g_free (mime_types);
for (i = 0; i < array->len; i++)
- {
- anc = _g_unix_content_type_get_parents (g_ptr_array_index (array, i));
- for (j = 0; anc[j]; j++)
- {
- for (k = 0; k < array->len; k++)
- {
- if (strcmp (anc[j], g_ptr_array_index (array, k)) == 0)
- break;
- }
- if (k == array->len) /* not found */
- g_ptr_array_add (array, g_strdup (anc[j]));
- }
- g_strfreev (anc);
- }
+ {
+ anc = _g_unix_content_type_get_parents (g_ptr_array_index (array, i));
+ for (j = 0; anc[j]; j++)
+ {
+ for (k = 0; k < array->len; k++)
+ {
+ if (strcmp (anc[j], g_ptr_array_index (array, k)) == 0)
+ break;
+ }
+ if (k == array->len) /* not found */
+ g_ptr_array_add (array, g_strdup (anc[j]));
+ }
+ g_strfreev (anc);
+ }
g_ptr_array_add (array, NULL);
mime_types = (char **)g_ptr_array_free (array, FALSE);
}
@@ -3456,13 +3491,13 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
}
G_LOCK (mime_info_cache);
-
+
removed_entries = NULL;
desktop_entries = NULL;
for (i = 0; except != NULL && except[i] != NULL; i++)
removed_entries = g_list_prepend (removed_entries, g_strdup (except[i]));
-
+
for (i = 0; mime_types[i] != NULL; i++)
{
mime_type = mime_types[i];
@@ -3474,10 +3509,10 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
/* Go through all apps listed in user and system dirs */
for (dir_list = mime_info_cache->dirs;
- dir_list != NULL;
- dir_list = dir_list->next)
- {
- dir = dir_list->data;
+ dir_list != NULL;
+ dir_list = dir_list->next)
+ {
+ dir = dir_list->data;
/* Pick the explicit default application if we got no result earlier
* (ie, for more specific mime types)
@@ -3494,40 +3529,40 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
}
}
- /* Then added associations from mimeapps.list */
- default_entries = g_hash_table_lookup (dir->mimeapps_list_added_map, mime_type);
- for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
+ /* Then added associations from mimeapps.list */
+ default_entries = g_hash_table_lookup (dir->mimeapps_list_added_map, mime_type);
+ for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
- /* Then removed associations from mimeapps.list */
- removed_associations = g_hash_table_lookup (dir->mimeapps_list_removed_map, mime_type);
- for (j = 0; removed_associations != NULL && removed_associations[j] != NULL; j++)
- removed_entries = append_desktop_entry (removed_entries, removed_associations[j], NULL);
+ /* Then removed associations from mimeapps.list */
+ removed_associations = g_hash_table_lookup (dir->mimeapps_list_removed_map, mime_type);
+ for (j = 0; removed_associations != NULL && removed_associations[j] != NULL; j++)
+ removed_entries = append_desktop_entry (removed_entries, removed_associations[j], NULL);
- /* Then system defaults (or old per-user config) (using removed associations from this dir or
earlier) */
- default_entries = g_hash_table_lookup (dir->defaults_list_map, mime_type);
- for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
+ /* Then system defaults (or old per-user config) (using removed associations from this dir or
earlier) */
+ default_entries = g_hash_table_lookup (dir->defaults_list_map, mime_type);
+ for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
{
if (default_entry == NULL && old_default_entry == NULL && !already_found_handler)
old_default_entry = g_strdup (default_entries[j]);
desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
}
- }
+ }
/* Go through all entries that support the mimetype */
for (dir_list = mime_info_cache->dirs;
- dir_list != NULL;
- dir_list = dir_list->next)
+ dir_list != NULL;
+ dir_list = dir_list->next)
{
- dir = dir_list->data;
-
- list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type);
- for (tmp = list; tmp != NULL; tmp = tmp->next)
- desktop_entries = append_desktop_entry (desktop_entries, tmp->data, removed_entries);
+ dir = dir_list->data;
+
+ list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type);
+ for (tmp = list; tmp != NULL; tmp = tmp->next)
+ desktop_entries = append_desktop_entry (desktop_entries, tmp->data, removed_entries);
}
}
-
+
G_UNLOCK (mime_info_cache);
g_strfreev (mime_types);
@@ -3551,11 +3586,11 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
g_list_free_full (removed_entries, g_free);
desktop_entries = g_list_reverse (desktop_entries);
-
+
return desktop_entries;
}
-/* GDesktopAppInfoLookup interface: */
+/* GDesktopAppInfoLookup interface {{{2 */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@@ -3567,12 +3602,14 @@ g_desktop_app_info_lookup_default_init (GDesktopAppInfoLookupInterface *iface)
{
}
+/* "Get for mime type" APIs {{{2 */
+
/**
* g_desktop_app_info_lookup_get_default_for_uri_scheme:
* @lookup: a #GDesktopAppInfoLookup
* @uri_scheme: a string containing a URI scheme.
*
- * Gets the default application for launching applications
+ * Gets the default application for launching applications
* using this URI scheme for a particular GDesktopAppInfoLookup
* implementation.
*
@@ -3580,14 +3617,14 @@ g_desktop_app_info_lookup_default_init (GDesktopAppInfoLookupInterface *iface)
* to implement g_app_info_get_default_for_uri_scheme() backends
* in a GIO module. There is no reason for applications to use it
* directly. Applications should use g_app_info_get_default_for_uri_scheme().
- *
+ *
* Returns: (transfer full): #GAppInfo for given @uri_scheme or %NULL on error.
*
* Deprecated: The #GDesktopAppInfoLookup interface is deprecated and unused by gio.
*/
GAppInfo *
g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
- const char *uri_scheme)
+ const char *uri_scheme)
{
GDesktopAppInfoLookupIface *iface;
@@ -3600,6 +3637,8 @@ g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *loo
G_GNUC_END_IGNORE_DEPRECATIONS
+/* Misc getter APIs {{{2 */
+
/**
* g_desktop_app_info_get_startup_wm_class:
* @info: a #GDesktopAppInfo that supports startup notify
@@ -3691,6 +3730,8 @@ g_desktop_app_info_has_key (GDesktopAppInfo *info,
G_KEY_FILE_DESKTOP_GROUP, key, NULL);
}
+/* Desktop actions support {{{2 */
+
/**
* g_desktop_app_info_list_actions:
* @info: a #GDesktopAppInfo
@@ -3838,3 +3879,6 @@ g_desktop_app_info_launch_action (GDesktopAppInfo *info,
g_object_unref (session_bus);
}
}
+/* Epilogue {{{1 */
+
+/* vim:set foldmethod=marker: */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]