1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  *  Copyright © 2011 Igalia S.L.
4  *
5  *  This file is part of Epiphany.
6  *
7  *  Epiphany is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  Epiphany is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with Epiphany.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #pragma once
22 
23 #include <gio/gdesktopappinfo.h>
24 #include <glib.h>
25 #include <gtk/gtk.h>
26 
27 G_BEGIN_DECLS
28 
29 typedef struct {
30   char *id;
31   char *name;
32   char *icon_url;
33   char *url;
34   char *desktop_file;
35   char install_date[128];
36 } EphyWebApplication;
37 
38 typedef enum {
39   EPHY_WEB_APPLICATION_NONE,
40   EPHY_WEB_APPLICATION_MOBILE_CAPABLE,
41   EPHY_WEB_APPLICATION_SYSTEM,
42 } EphyWebApplicationOptions;
43 
44 #define EPHY_WEB_APP_ICON_NAME "app-icon.png"
45 
46 char               *ephy_web_application_get_app_id_from_name (const char *name);
47 
48 const char         *ephy_web_application_get_program_name_from_profile_directory (const char *profile_dir);
49 
50 char               *ephy_web_application_create (const char *id, const char *address, const char *name, GdkPixbuf *icon, EphyWebApplicationOptions options);
51 
52 char               *ephy_web_application_ensure_for_app_info (GAppInfo *app_info);
53 
54 gboolean            ephy_web_application_delete (const char *id);
55 
56 void                ephy_web_application_setup_from_profile_directory (const char *profile_directory);
57 
58 void                ephy_web_application_setup_from_desktop_file (GDesktopAppInfo *desktop_info);
59 
60 char               *ephy_web_application_get_profile_directory (const char *id);
61 
62 EphyWebApplication *ephy_web_application_for_profile_directory (const char *profile_dir);
63 
64 void                ephy_web_application_free (EphyWebApplication *app);
65 
66 gboolean            ephy_web_application_exists (const char *id);
67 
68 GList              *ephy_web_application_get_application_list (void);
69 
70 GList              *ephy_web_application_get_legacy_application_list (void);
71 
72 void                ephy_web_application_free_application_list (GList *list);
73 
74 void                ephy_web_application_initialize_settings (const char *profile_directory, EphyWebApplicationOptions options);
75 
76 gboolean            ephy_web_application_is_uri_allowed (const char *uri);
77 
78 gboolean            ephy_web_application_save (EphyWebApplication *app);
79 
80 gboolean            ephy_web_application_is_system (EphyWebApplication *app);
81 
82 G_END_DECLS
83