Merge lp:~brandontschaefer/unity/lp.1328677-fix into lp:unity

Proposed by Brandon Schaefer
Status: Rejected
Rejected by: Brandon Schaefer
Proposed branch: lp:~brandontschaefer/unity/lp.1328677-fix
Merge into: lp:unity
Diff against target: 62 lines (+20/-2)
3 files modified
UnityCore/DesktopUtilities.cpp (+12/-0)
UnityCore/DesktopUtilities.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+7/-2)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1328677-fix
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+230539@code.launchpad.net

Commit message

Use CONFIG instead of CACHE to store the first_run.stamp

Description of the change

Use CONFIG instead of CACHE to store the first_run.stamp

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

Is there a way to add an "upgrade" option so that everyone isn't forced to see the Shortcuts screen again when they upgrade to this fix?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Ill just stick in a second check for the old location. After a while we can remove it I suppose. Not that big of a hit keeping that. (Also I should remove that printf).

3849. By Brandon Schaefer

* Make sure we still check ~/.cache other wise it'll cause the shortcut window to pop up on upgrades.
  * NOTE * This means, no first_run.stamp will be created if it exists in ~/.cache.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) wrote :

If it's in XDG_CACHE_HOME, would it be possible to remove it and recreate it in XDG_CACHE_HOME, and otherwise treat it as if it were founf in XDG_CACHE_HOME? That would fix the problem permanently.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Instead of checking if both config and cache dir, why not instead adding a migration script that moves the file in cache directory (if any) to the config one, and only using config?

review: Needs Information
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Better way (from Marcos comment) here:

https://code.launchpad.net/~brandontschaefer/unity/lp.1328677-fixv2

I also had extra commits to this branch, soo easier to just make a new branch.

Unmerged revisions

3849. By Brandon Schaefer

* Make sure we still check ~/.cache other wise it'll cause the shortcut window to pop up on upgrades.
  * NOTE * This means, no first_run.stamp will be created if it exists in ~/.cache.

3848. By Brandon Schaefer

* Go to use CONFIG instead of CACHE to store the first_run.stamp

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'UnityCore/DesktopUtilities.cpp'
--- UnityCore/DesktopUtilities.cpp 2014-04-16 22:17:11 +0000
+++ UnityCore/DesktopUtilities.cpp 2014-08-13 22:37:17 +0000
@@ -66,6 +66,18 @@
66 return "";66 return "";
67}67}
6868
69std::string DesktopUtilities::GetUserConfigDirectory()
70{
71 const char *config_dir = g_get_user_config_dir();
72 auto unity_config = glib::gchar_to_string(config_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S);
73
74 if (g_mkdir_with_parents(unity_config.c_str(), 0700) >= 0)
75 return unity_config;
76
77 LOG_ERROR(logger) << "Impossible to create unity config folder '"<< unity_config <<"' !";
78 return "";
79}
80
69std::string DesktopUtilities::GetUserRuntimeDirectory()81std::string DesktopUtilities::GetUserRuntimeDirectory()
70{82{
71 const char *runtime_dir = g_get_user_runtime_dir();83 const char *runtime_dir = g_get_user_runtime_dir();
7284
=== modified file 'UnityCore/DesktopUtilities.h'
--- UnityCore/DesktopUtilities.h 2014-04-16 22:17:11 +0000
+++ UnityCore/DesktopUtilities.h 2014-08-13 22:37:17 +0000
@@ -32,6 +32,7 @@
32 static std::string GetUserDataDirectory();32 static std::string GetUserDataDirectory();
33 static std::string GetUserCacheDirectory();33 static std::string GetUserCacheDirectory();
34 static std::string GetUserRuntimeDirectory();34 static std::string GetUserRuntimeDirectory();
35 static std::string GetUserConfigDirectory();
35 static std::vector<std::string> GetSystemDataDirectories();36 static std::vector<std::string> GetSystemDataDirectories();
36 static std::vector<std::string> GetDataDirectories();37 static std::vector<std::string> GetDataDirectories();
3738
3839
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2014-08-11 12:30:55 +0000
+++ plugins/unityshell/src/unityshell.cpp 2014-08-13 22:37:17 +0000
@@ -4041,8 +4041,13 @@
4041void UnityScreen::ShowFirstRunHints()4041void UnityScreen::ShowFirstRunHints()
4042{4042{
4043 sources_.AddTimeoutSeconds(1, [this] {4043 sources_.AddTimeoutSeconds(1, [this] {
4044 auto const& config_dir = DesktopUtilities::GetUserConfigDirectory();
4044 auto const& cache_dir = DesktopUtilities::GetUserCacheDirectory();4045 auto const& cache_dir = DesktopUtilities::GetUserCacheDirectory();
4045 if (!cache_dir.empty() && !g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS))4046
4047 bool is_not_in_config_dir = (!config_dir.empty() && !g_file_test((config_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS));
4048 bool is_not_in_cache_dir = (!cache_dir.empty() && !g_file_test( (cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS));
4049
4050 if (is_not_in_config_dir && is_not_in_cache_dir)
4046 {4051 {
4047 // We focus the panel, so the shortcut hint will be hidden at first user input4052 // We focus the panel, so the shortcut hint will be hidden at first user input
4048 auto const& panels = panel_controller_->panels();4053 auto const& panels = panel_controller_->panels();
@@ -4055,7 +4060,7 @@
4055 shortcut_controller_->Show();4060 shortcut_controller_->Show();
40564061
4057 glib::Error error;4062 glib::Error error;
4058 g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);4063 g_file_set_contents((config_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);
40594064
4060 if (error)4065 if (error)
4061 {4066 {