]> Dogcows Code - chaz/openbox/commitdiff
Add skeleton for start of dot-desktop-file parser
authorDana Jansens <danakj@orodu.net>
Wed, 17 Feb 2010 03:08:03 +0000 (22:08 -0500)
committerDana Jansens <danakj@orodu.net>
Wed, 17 Feb 2010 03:10:07 +0000 (22:10 -0500)
Makefile.am
obt/ddfile.c [new file with mode: 0644]
obt/ddfile.h [new file with mode: 0644]

index d5e60b6d7c079d121a302ad2df4d216fede4c051..4c1f89d458d11be6d8bb29fd994e9ad4fb6f9e99 100644 (file)
@@ -130,6 +130,8 @@ obt_libobt_la_SOURCES = \
        obt/mainloop.c \
        obt/xml.h \
        obt/xml.c \
+       obt/ddfile.h \
+       obt/ddfile.c \
        obt/paths.h \
        obt/paths.c \
        obt/prop.h \
diff --git a/obt/ddfile.c b/obt/ddfile.c
new file mode 100644 (file)
index 0000000..c9ec32d
--- /dev/null
@@ -0,0 +1,49 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   obt/ddfile.c for the Openbox window manager
+   Copyright (c) 2009        Dana Jansens
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "obt/ddfile.h"
+#include <glib.h>
+
+struct _ObtDDFile {
+    ObtDDFileType type;
+    gchar *name; /*!< Specific name for the object (eg Firefox) */
+    gchar *generic; /*!< Generic name for the object (eg Web Browser) */
+    gchar *comment; /*!< Comment/description to display for the object */
+    gchar *icon; /*!< Name/path for an icon for the object */
+
+    union _ObtDDFileData {
+        struct {
+            gchar *exec; /*!< Executable to run for the app */
+            gchar *wdir; /*!< Working dir to run the app in */
+            gboolean term; /*!< Run the app in a terminal or not */
+            ObtDDFileAppOpen open;
+
+            /* XXX gchar**? or something better, a mime struct.. maybe
+               glib has something i can use. */
+            gchar **mime; /*!< Mime types the app can open */
+
+            ObtDDFileAppStartup startup;
+            gchar *startup_wmclass;
+        } app;
+        struct {
+            gchar *url;
+        } link;
+        struct {
+        } dir;
+    } d;
+};
diff --git a/obt/ddfile.h b/obt/ddfile.h
new file mode 100644 (file)
index 0000000..2fc2f10
--- /dev/null
@@ -0,0 +1,100 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+   obt/ddfile.h for the Openbox window manager
+   Copyright (c) 2009        Dana Jansens
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#ifndef __obt_ddfile_h
+#define __obt_ddfile_h
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+       OBT_DDFILE_TYPE_APPLICATION = 0,
+       OBT_DDFILE_TYPE_LINK        = 1,
+       OBT_DDFILE_TYPE_DIRECTORY   = 2
+} ObtDDFileType;
+
+typedef enum {
+       OBT_DDFILE_APP_STARTUP_NO_SUPPORT,
+       OBT_DDFILE_APP_STARTUP_PROTOCOL_SUPPORT,
+       OBT_DDFILE_APP_STARTUP_LEGACY_SUPPORT
+} ObtDDFileAppStartup;
+
+typedef enum {
+       /*! The app can be launched with a single local file */
+       OBT_DDFILE_APP_SINGLE_LOCAL = 1 << 0,
+       /*! The app can be launched with multiple local files */
+       OBT_DDFILE_APP_MULTI_LOCAL  = 1 << 1,
+       /*! The app can be launched with a single URL */
+       OBT_DDFILE_APP_SINGLE_URL   = 1 << 2,
+       /*! The app can be launched with multiple URLs */
+       OBT_DDFILE_APP_MULTI_URL    = 1 << 3
+} ObtDDFileAppOpen;
+
+typedef struct _ObtDDFile     ObtDDFile;
+
+ObtDDFile* obt_ddfile_new_from_file(const gchar *name);
+
+void obt_ddfile_ref(ObtDDFile *e);
+void obt_ddfile_unref(ObtDDFile *e);
+
+/*! Returns TRUE if the file exists but says it should be ignored, with
+    the Hidden flag.  No other functions can be used for the ObtDDFile
+    in this case. */
+gboolean obt_ddfile_deleted (ObtDDFile *e);
+
+/*! Returns the type of object refered to by the .desktop file. */
+ObtDDFileType obt_ddfile_type (ObtDDFile *e);
+
+/*! Returns TRUE if the .desktop file should be displayed to users, given the
+    current    environment.  If FALSE, the .desktop file should not be showed.
+       This also uses the TryExec option if it is present.
+    @env A semicolon-deliminated list of environemnts.  Can be one or more of:
+         GNOME, KDE, ROX, XFCE.  Other environments not listed here may also
+         be supported.  This can be null also if not listing any environment. */
+gboolean obt_ddfile_display(ObtDDFile *e, const gchar *env);
+
+const gchar* obt_ddfile_name           (ObtDDFile *e);
+const gchar* obt_ddfile_generic_name   (ObtDDFile *e);
+const gchar* obt_ddfile_comment        (ObtDDFile *e);
+/*! Returns the icon for the object referred to by the .desktop file.
+    Returns either an absolute path, or a string which can be used to find the
+    icon using the algorithm given by:
+    http://freedesktop.org/wiki/Specifications/icon-theme-spec?action=show&redirect=Standards/icon-theme-spec
+*/
+const gchar* obt_ddfile_icon           (ObtDDFile *e);
+
+const gchar *obt_ddfile_link_url(ObtDDFile *e);
+
+const gchar*  obt_ddfile_app_executable      (ObtDDFile *e);
+/*! Returns the path in which the application should be run */
+const gchar*  obt_ddfile_app_path            (ObtDDFile *e);
+gboolean      obt_ddfile_app_run_in_terminal (ObtDDFile *e);
+const gchar** obt_ddfile_app_mime_types      (ObtDDFile *e);
+/*! Returns a combination of values in the ObtDDFileAppOpen enum,
+    specifying if the application can be launched to open one or more files
+    and URLs. */
+ObtDDFileAppOpen obt_ddfile_app_open(ObtDDFile *e);
+
+ObtDDFileAppStartup obt_ddfile_app_startup_notify(ObtDDFile *e);
+const gchar* obt_ddfile_app_startup_wmclass(ObtDDFile *e);
+
+
+G_END_DECLS
+
+#endif
This page took 0.023604 seconds and 4 git commands to generate.