After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757882 - Add support for system-wide installed web apps
Add support for system-wide installed web apps
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Web Applications
git master
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-11-10 13:45 UTC by Carlos Garcia Campos
Modified: 2017-01-15 21:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file-helpers: Add ephy_default_dot_dir() (2.17 KB, patch)
2015-11-10 13:46 UTC, Carlos Garcia Campos
committed Details | Review
web-app: Use always the default dot dir instead of the one for current mode (3.30 KB, patch)
2015-11-10 13:46 UTC, Carlos Garcia Campos
committed Details | Review
file-helpers: Only write the migration version when creating the dot dir (1.35 KB, patch)
2015-11-10 13:46 UTC, Carlos Garcia Campos
committed Details | Review
web-app: Add support for system-wide installed web apps (8.54 KB, patch)
2015-11-10 13:47 UTC, Carlos Garcia Campos
committed Details | Review

Description Carlos Garcia Campos 2015-11-10 13:45:41 UTC
This will allow us to provide some pre-installed web apps like extensions.gnome.org, or distros to provide their own third-party web apps.
Comment 1 Carlos Garcia Campos 2015-11-10 13:46:15 UTC
Created attachment 315185 [details] [review]
file-helpers: Add ephy_default_dot_dir()
Comment 2 Carlos Garcia Campos 2015-11-10 13:46:36 UTC
Created attachment 315186 [details] [review]
web-app: Use always the default dot dir instead of the one for current mode
Comment 3 Carlos Garcia Campos 2015-11-10 13:46:57 UTC
Created attachment 315187 [details] [review]
file-helpers: Only write the migration version when creating the dot dir
Comment 4 Carlos Garcia Campos 2015-11-10 13:47:27 UTC
Created attachment 315188 [details] [review]
web-app: Add support for system-wide installed web apps
Comment 5 Carlos Garcia Campos 2015-11-10 13:54:19 UTC
This is the initial support, but there are still some details. System-wide apps don't appear in about:applications because I'm not sure what to do in some cases:

 - Should we show all installed web apps? or only the ones for which the user already has a profile dir (user run it at least once).

 - Should we allow to delete system-wide apps? In this case we remove the profile dir, of course, the desktop file can't be removed. Fortunately we use "delete" instead of "uninstall" in about:applications. 

Maybe now we can use uninstall for user created apps and delete for system-wide ones, since in the case os user web apps, we are actually unsintalling them (they no longer appear in the apps menus). This depends on the first question, though. If we only show the apps already run by the user, it make sense to allow the user to delete them, otherwise we should use delete data or move it to personal data dialog.
Comment 6 Michael Catanzaro 2015-11-16 22:56:27 UTC
Review of attachment 315186 [details] [review]:

Alternatively ephy_default_dot_dir() could return a const char * and you could free it in an exit handler, then it would be easier to use. But exit handlers aren't nice.
Comment 7 Michael Catanzaro 2015-11-16 23:41:12 UTC
Review of attachment 315188 [details] [review]:

Few things to fix before you push....

Typo in commit message: "shuld" -> "should"

::: lib/ephy-web-app-utils.c
@@ +381,3 @@
+  }
+
+  /* The address should be the last command line argument */

I would clarify the comment: "the last command line argument in the desktop file"

@@ +429,3 @@
+   * options, which inits GTK+ and sets this as a side effect.
+   */
+  gdk_set_program_class (app_name);

Pretty sure we don't need this anymore, since it always follows the call to g_set_prgname().

@@ +472,3 @@
+  wm_class = g_desktop_app_info_get_startup_wm_class (desktop_info);
+  if (wm_class)
+    gdk_set_program_class (wm_class);

Ditto.

::: lib/ephy-web-app-utils.h
@@ +45,3 @@
 char    *ephy_web_application_create (const char *address, const char *name, GdkPixbuf *icon);
 
+char    *ephy_web_application_ensure_for_app_info (GAppInfo *app_info);

Not thrilled that an "ensure" function returns a string, since it's not clear at all from the signature what it's returning. I would probably do this with a out parameter if I wrote this myself, even though it's clunkier to use. On the other hand, you're just following the existing style of ephy_web_application_create(), which has the same problem.

::: src/ephy-main.c
@@ +349,3 @@
+
+  if (application_mode && !profile_directory) {
+    const char* desktop_file_path = g_getenv("GIO_LAUNCHED_DESKTOP_FILE");

Bad copy/paste from WebKit or something? The * should nest to desktop_file_path rather than char, and there's a missing space after g_getenv.

@@ +355,3 @@
+
+      if (desktop_info)
+        profile_directory = ephy_web_application_ensure_for_app_info (desktop_info);

Need to add a cast here:

ephy-main.c:357:71: warning: passing argument 1 of ‘ephy_web_application_ensure_for_app_info’ from incompatible pointer type [-Wincompatible-pointer-types]
         profile_directory = ephy_web_application_ensure_for_app_info (desktop_info);
                                                                       ^
In file included from ephy-main.c:34:0:
../lib/ephy-web-app-utils.h:47:7: note: expected ‘GAppInfo * {aka struct _GAppInfo *}’ but argument is of type ‘GDesktopAppInfo * {aka struct _GDesktopAppInfo *}’
 char    *ephy_web_application_ensure_for_app_info (GAppInfo *app_info);
       ^
Comment 8 Carlos Garcia Campos 2015-11-17 14:30:10 UTC
(In reply to Michael Catanzaro from comment #7)
> Review of attachment 315188 [details] [review] [review]:
> 
> Few things to fix before you push....
> 
> Typo in commit message: "shuld" -> "should"

Oops.

> ::: lib/ephy-web-app-utils.c
> @@ +381,3 @@
> +  }
> +
> +  /* The address should be the last command line argument */
> 
> I would clarify the comment: "the last command line argument in the desktop
> file"

Sure.

> @@ +429,3 @@
> +   * options, which inits GTK+ and sets this as a side effect.
> +   */
> +  gdk_set_program_class (app_name);
> 
> Pretty sure we don't need this anymore, since it always follows the call to
> g_set_prgname().

I'm not so sure, because gdk has already been initialized at this point, so g_set_prgname() doesn't change anything.

> @@ +472,3 @@
> +  wm_class = g_desktop_app_info_get_startup_wm_class (desktop_info);
> +  if (wm_class)
> +    gdk_set_program_class (wm_class);
> 
> Ditto.

Ditto.

> ::: lib/ephy-web-app-utils.h
> @@ +45,3 @@
>  char    *ephy_web_application_create (const char *address, const char
> *name, GdkPixbuf *icon);
>  
> +char    *ephy_web_application_ensure_for_app_info (GAppInfo *app_info);
> 
> Not thrilled that an "ensure" function returns a string, since it's not
> clear at all from the signature what it's returning. I would probably do
> this with a out parameter if I wrote this myself, even though it's clunkier
> to use. On the other hand, you're just following the existing style of
> ephy_web_application_create(), which has the same problem.

Yes, I followed the style, we can change it on both cases if we really want it as a separate issue.

> ::: src/ephy-main.c
> @@ +349,3 @@
> +
> +  if (application_mode && !profile_directory) {
> +    const char* desktop_file_path = g_getenv("GIO_LAUNCHED_DESKTOP_FILE");
> 
> Bad copy/paste from WebKit or something? The * should nest to
> desktop_file_path rather than char, and there's a missing space after
> g_getenv.

Not copy paste but fast context switching, I guess.

> @@ +355,3 @@
> +
> +      if (desktop_info)
> +        profile_directory = ephy_web_application_ensure_for_app_info
> (desktop_info);
> 
> Need to add a cast here:
> 
> ephy-main.c:357:71: warning: passing argument 1 of
> ‘ephy_web_application_ensure_for_app_info’ from incompatible pointer type
> [-Wincompatible-pointer-types]
>          profile_directory = ephy_web_application_ensure_for_app_info
> (desktop_info);
>                                                                        ^
> In file included from ephy-main.c:34:0:
> ../lib/ephy-web-app-utils.h:47:7: note: expected ‘GAppInfo * {aka struct
> _GAppInfo *}’ but argument is of type ‘GDesktopAppInfo * {aka struct
> _GDesktopAppInfo *}’
>  char    *ephy_web_application_ensure_for_app_info (GAppInfo *app_info);
>        ^

Right. Thanks!
Comment 9 Carlos Garcia Campos 2015-11-17 14:38:53 UTC
Patches pushed, we still need to decide what to do with about:applications
Comment 10 Michael Catanzaro 2017-01-15 21:40:44 UTC
(In reply to Carlos Garcia Campos from comment #9)
> Patches pushed, we still need to decide what to do with about:applications

In another bug, it's too confusing to have bugs open for stuff fixed years ago.