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.
This commit is contained in:
Ryan Lortie 2013-07-27 15:08:58 -04:00
parent b0601e7558
commit c8e1dbb106

View File

@ -22,6 +22,8 @@
* Ryan Lortie <desrt@desrt.ca>
*/
/* Prelude {{{1 */
#include "config.h"
#include <errno.h>
@ -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)
{
@ -220,7 +237,7 @@ g_desktop_app_info_finalize (GObject *object)
}
static void
g_desktop_app_info_set_property(GObject *object,
g_desktop_app_info_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
@ -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,6 +300,16 @@ 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)
{
@ -297,7 +323,6 @@ binary_from_exec (const char *exec)
p++;
return g_strndup (start, p - start);
}
static gboolean
@ -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))
{
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;
@ -642,6 +662,8 @@ g_desktop_app_info_dup (GAppInfo *appinfo)
return G_APP_INFO (new_info);
}
/* GAppInfo interface implementation functions {{{2 */
static gboolean
g_desktop_app_info_equal (GAppInfo *appinfo1,
GAppInfo *appinfo2)
@ -877,6 +899,8 @@ g_desktop_app_info_get_show_in (GDesktopAppInfo *info,
return TRUE;
}
/* Launching... {{{2 */
static char *
expand_macro_single (char macro, char *uri)
{
@ -1716,6 +1740,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
@ -1760,6 +1786,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
@ -2209,6 +2237,7 @@ 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,
@ -2353,6 +2382,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
@ -2414,6 +2444,8 @@ g_app_info_create_from_commandline (const char *commandline,
return G_APP_INFO (info);
}
/* GAppInfo interface init */
static void
g_desktop_app_info_iface_init (GAppInfoIface *iface)
{
@ -2442,6 +2474,8 @@ 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,
GList *list)
@ -2788,6 +2822,7 @@ get_apps_from_dir (GHashTable *apps,
}
}
/* "Get all" API {{{2 */
/**
* g_app_info_get_all:
@ -2836,7 +2871,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;
@ -3558,7 +3593,7 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
return desktop_entries;
}
/* GDesktopAppInfoLookup interface: */
/* GDesktopAppInfoLookup interface {{{2 */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@ -3570,6 +3605,8 @@ 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
@ -3603,6 +3640,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
@ -3694,6 +3733,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
@ -3841,3 +3882,6 @@ g_desktop_app_info_launch_action (GDesktopAppInfo *info,
g_object_unref (session_bus);
}
}
/* Epilogue {{{1 */
/* vim:set foldmethod=marker: */