Merge lp:~unity-team/unity/trusty-1328677 into lp:unity/7.2

Proposed by Stephen M. Webb
Status: Rejected
Rejected by: Stephen M. Webb
Proposed branch: lp:~unity-team/unity/trusty-1328677
Merge into: lp:unity/7.2
Diff against target: 122 lines (+60/-3)
6 files modified
UnityCore/DesktopUtilities.cpp (+14/-0)
UnityCore/DesktopUtilities.h (+1/-0)
debian/changelog (+6/-0)
debian/unity.migrations (+1/-0)
plugins/unityshell/src/unityshell.cpp (+3/-3)
tools/migration-scripts/03_unity_first_run_stamp_move (+35/-0)
To merge this branch: bzr merge lp:~unity-team/unity/trusty-1328677
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+244073@code.launchpad.net

Commit message

used 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 and created a migration script to move the new stamp to the new location (lp: #1328677).

This change is cherry-picked from trunk for SRUing into Ubuntu 14.04 LTS.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UnityCore/DesktopUtilities.cpp'
2--- UnityCore/DesktopUtilities.cpp 2014-04-16 22:17:11 +0000
3+++ UnityCore/DesktopUtilities.cpp 2014-12-09 00:11:13 +0000
4@@ -66,6 +66,20 @@
5 return "";
6 }
7
8+std::string DesktopUtilities::GetUserConfigDirectory()
9+{
10+ const char *config_dir = g_get_user_config_dir();
11+ auto unity_config = glib::gchar_to_string(config_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S);
12+
13+ printf("CONFIG %s\n", unity_config.c_str());
14+
15+ if (g_mkdir_with_parents(unity_config.c_str(), 0700) >= 0)
16+ return unity_config;
17+
18+ LOG_ERROR(logger) << "Impossible to create unity config folder '"<< unity_config <<"' !";
19+ return "";
20+}
21+
22 std::string DesktopUtilities::GetUserRuntimeDirectory()
23 {
24 const char *runtime_dir = g_get_user_runtime_dir();
25
26=== modified file 'UnityCore/DesktopUtilities.h'
27--- UnityCore/DesktopUtilities.h 2014-04-16 22:17:11 +0000
28+++ UnityCore/DesktopUtilities.h 2014-12-09 00:11:13 +0000
29@@ -32,6 +32,7 @@
30 static std::string GetUserDataDirectory();
31 static std::string GetUserCacheDirectory();
32 static std::string GetUserRuntimeDirectory();
33+ static std::string GetUserConfigDirectory();
34 static std::vector<std::string> GetSystemDataDirectories();
35 static std::vector<std::string> GetDataDirectories();
36
37
38=== modified file 'debian/changelog'
39--- debian/changelog 2014-08-26 13:49:00 +0000
40+++ debian/changelog 2014-12-09 00:11:13 +0000
41@@ -1,3 +1,9 @@
42+unity (7.2.3+14.04.20140826-0ubuntu2) UNRELEASED; urgency=medium
43+
44+ * Use CONFIG instead of CACHE to store the first_run.stamp (lp: #1328677)
45+
46+ -- Brandon Schaefer <brandon.schaefer@canonical.com> Mon, 08 Dec 2014 19:07:01 -0500
47+
48 unity (7.2.3+14.04.20140826-0ubuntu1) trusty; urgency=medium
49
50 [ Andrea Azzarone ]
51
52=== modified file 'debian/unity.migrations'
53--- debian/unity.migrations 2014-03-21 02:58:13 +0000
54+++ debian/unity.migrations 2014-12-09 00:11:13 +0000
55@@ -1,2 +1,3 @@
56 tools/migration-scripts/01_unity_change_dconf_path
57 tools/migration-scripts/02_unity_setup_text_scale_factor
58+tools/migration-scripts/03_unity_first_run_stamp_move
59
60=== modified file 'plugins/unityshell/src/unityshell.cpp'
61--- plugins/unityshell/src/unityshell.cpp 2014-08-06 14:19:10 +0000
62+++ plugins/unityshell/src/unityshell.cpp 2014-12-09 00:11:13 +0000
63@@ -4038,8 +4038,8 @@
64 void UnityScreen::ShowFirstRunHints()
65 {
66 sources_.AddTimeoutSeconds(1, [this] {
67- auto const& cache_dir = DesktopUtilities::GetUserCacheDirectory();
68- if (!cache_dir.empty() && !g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS))
69+ auto const& config_dir = DesktopUtilities::GetUserConfigDirectory();
70+ if (!config_dir.empty() && !g_file_test((config_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS))
71 {
72 // We focus the panel, so the shortcut hint will be hidden at first user input
73 auto const& panels = panel_controller_->panels();
74@@ -4052,7 +4052,7 @@
75 shortcut_controller_->Show();
76
77 glib::Error error;
78- g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);
79+ g_file_set_contents((config_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);
80
81 if (error)
82 {
83
84=== added file 'tools/migration-scripts/03_unity_first_run_stamp_move'
85--- tools/migration-scripts/03_unity_first_run_stamp_move 1970-01-01 00:00:00 +0000
86+++ tools/migration-scripts/03_unity_first_run_stamp_move 2014-12-09 00:11:13 +0000
87@@ -0,0 +1,35 @@
88+#!/usr/bin/python
89+# -*- coding: utf-8 -*-
90+# Copyright (C) 2014 Canonical
91+#
92+# Authors:
93+# Brandon Schaefer <brandon.schaefer@canonical.com>
94+#
95+# This program is free software; you can redistribute it and/or modify it under
96+# the terms of the GNU General Public License as published by the Free Software
97+# Foundation; version 3.
98+#
99+# This program is distributed in the hope that it will be useful, but WITHOUTa
100+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
101+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
102+# details.
103+#
104+# You should have received a copy of the GNU General Public License along with
105+# this program; if not, write to the Free Software Foundation, Inc.,
106+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
107+
108+from gi.repository import GLib
109+from os import path, rename, mkdir
110+
111+old_first_run_path = GLib.get_user_cache_dir() + "/unity/first_run.stamp"
112+new_first_run_path = GLib.get_user_config_dir() + "/unity"
113+
114+# If we have the old first_run.stamp file, we must move it to the new location
115+if path.isfile(old_first_run_path):
116+
117+ # make sure the new dir exists before attempting to move
118+ if not path.isdir(new_first_run_path):
119+ mkdir(new_first_run_path)
120+
121+ new_first_run_path += "/first_run.stamp"
122+ rename(old_first_run_path, new_first_run_path)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: