Conversation
eos-migrate-chrome-profile
Outdated
|
|
||
| def update_desktop_shortcut(path): | ||
| keyfile = GLib.KeyFile() | ||
| print("path: " + path) |
There was a problem hiding this comment.
Debug print left here unintentionally?
eos-migrate-chrome-profile
Outdated
| def update_desktop_shortcut(path): | ||
| keyfile = GLib.KeyFile() | ||
| print("path: " + path) | ||
| keyfile.load_from_file(path, GLib.KeyFileFlags.NONE) |
There was a problem hiding this comment.
https://docs.gtk.org/glib/flags.KeyFileFlags.html says, of both flags,
Use this flag if you plan to write the (possibly modified) contents of the key file back to a file
| keyfile.load_from_file(path, GLib.KeyFileFlags.NONE) | |
| keyfile.load_from_file(path, GLib.KeyFileFlags.KEEP_COMMENTS | GLib.KeyFileFlags.KEEP_TRANSLATIONS) |
There was a problem hiding this comment.
Thanks for the information! Updated in the new commit.
eos-migrate-chrome-profile
Outdated
|
|
||
| groups, _ = keyfile.get_groups() | ||
| for group in groups: | ||
| exec_cmd = keyfile.get_string(group, "Exec") |
There was a problem hiding this comment.
It's unlikely but you should handle the exception raised if the Exec key does not exist.
There was a problem hiding this comment.
Good point! Have not thought that the group may not have "Exec". Add the handler in the new commit.
| orig_data = textwrap.dedent( | ||
| """ | ||
| [Desktop Entry] | ||
| Exec=/usr/bin/eos-google-chrome --profile-directory=Default | ||
| """ | ||
| ).lstrip() | ||
| expected_data = textwrap.dedent( | ||
| """ | ||
| [Desktop Entry] | ||
| Exec=/usr/bin/flatpak run com.google.Chrome --profile-directory=Default | ||
| """ | ||
| ).lstrip() |
There was a problem hiding this comment.
| orig_data = textwrap.dedent( | |
| """ | |
| [Desktop Entry] | |
| Exec=/usr/bin/eos-google-chrome --profile-directory=Default | |
| """ | |
| ).lstrip() | |
| expected_data = textwrap.dedent( | |
| """ | |
| [Desktop Entry] | |
| Exec=/usr/bin/flatpak run com.google.Chrome --profile-directory=Default | |
| """ | |
| ).lstrip() | |
| orig_data = textwrap.dedent( | |
| """ | |
| # Comment | |
| [Desktop Entry] | |
| Name=Chrome | |
| Name[en_GB]=Chrome, milord | |
| Exec=/usr/bin/eos-google-chrome --profile-directory=Default | |
| """ | |
| ).lstrip() | |
| expected_data = textwrap.dedent( | |
| """ | |
| # Comment | |
| [Desktop Entry] | |
| Name=Chrome | |
| Name[en_GB]=Chrome, milord | |
| Exec=/usr/bin/flatpak run com.google.Chrome --profile-directory=Default | |
| """ | |
| ).lstrip() |
I believe this modified test would fail currently but would succeed with the changes I propose below.
There was a problem hiding this comment.
Also, added the multi language test in the new commit.
| self.assertEqual(expected_data, new_data) | ||
|
|
||
|
|
||
| class TestUpdateDesktopShortcuts(BaseTestCase): |
There was a problem hiding this comment.
Here is an actual file from my system:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=YouTube
Exec=/usr/bin/eos-google-chrome "--profile-directory=Profile 1" --app-id=agimnkijcaahngcdmfeangaknmldooml
Icon=chrome-agimnkijcaahngcdmfeangaknmldooml-Profile_1
StartupWMClass=crx_agimnkijcaahngcdmfeangaknmldooml
Actions=Explore;Subscriptions
[Desktop Action Explore]
Name=Explore
Exec=/usr/bin/eos-google-chrome "--profile-directory=Profile 1" --app-id=agimnkijcaahngcdmfeangaknmldooml "--app-launch-url-for-shortcuts-menu-item=https://www.youtube.com/feed/explore?feature=app_shortcuts"
[Desktop Action Subscriptions]
Name=Subscriptions
Exec=/usr/bin/eos-google-chrome "--profile-directory=Profile 1" --app-id=agimnkijcaahngcdmfeangaknmldooml "--app-launch-url-for-shortcuts-menu-item=https://www.youtube.com/feed/subscriptions?feature=app_shortcuts"I suggest you add this as a test case.
I think you should also test the case where there is a group that does not have an Exec= key.
There was a problem hiding this comment.
Sure! Added as the new commit.
Some desktop launchers execute eos-google-chrome which will run eos-apps Chrome as webapps. So, migrate them to use Flathub Chrome, too. https://phabricator.endlessm.com/T26944
a2eca7f to
5dba052
Compare
|
Thanks! And, cherry picked the commit to eos6.0 branch. |
Some desktop launchers execute eos-google-chrome which will run eos-apps Chrome as webapps. So, migrate them to use Flathub Chrome, too.
https://phabricator.endlessm.com/T26944