Merge lp:~paulliu/unity/add_superkey_configuration_dialog into lp:unity

Proposed by Ying-Chun Liu
Status: Superseded
Proposed branch: lp:~paulliu/unity/add_superkey_configuration_dialog
Merge into: lp:unity
Diff against target: 95 lines (+51/-1)
3 files modified
tools/Makefile.am (+1/-1)
tools/superkey_conf_dialog.py (+35/-0)
unity-private/panel/panel-home-button.vala (+15/-0)
To merge this branch: bzr merge lp:~paulliu/unity/add_superkey_configuration_dialog
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+37223@code.launchpad.net

This proposal has been superseded by a proposal from 2011-01-06.

Description of the change

Add a configuration dialog when super key is disabled by OEM.
The window will be shown each time when the dash button is pressed first time and the super key is disabled.

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Obviously this won't apply to Unity trunk anymore, but I don't mind if you want to merge it into the 0.2 series if it will lessen the distropatch burden for OEM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/Makefile.am'
2--- tools/Makefile.am 2010-09-09 16:05:44 +0000
3+++ tools/Makefile.am 2010-10-04 13:13:12 +0000
4@@ -1,3 +1,3 @@
5 EXTRA_DIST = makebootchart.py unity-xephyr.py
6
7-dist_libexec_SCRIPTS = migrate_favorites.py
8+dist_libexec_SCRIPTS = migrate_favorites.py superkey_conf_dialog.py
9
10=== added file 'tools/superkey_conf_dialog.py'
11--- tools/superkey_conf_dialog.py 1970-01-01 00:00:00 +0000
12+++ tools/superkey_conf_dialog.py 2010-10-04 13:13:12 +0000
13@@ -0,0 +1,35 @@
14+#!/usr/bin/python
15+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
16+# Copyright(C) 2010 Canonical
17+# Author: Ying-Chun Liu
18+#
19+# This program is free software: you can redistributeit and/or modify it
20+# under the terms of the GNU General Public License version 3, as published
21+# by the Free Software Foundation.
22+
23+import sys
24+import os
25+import gconf
26+import gtk
27+import gettext
28+
29+gettext.install('unity')
30+
31+if __name__ == '__main__':
32+
33+ gconfkey = '/desktop/unity/launcher/super_key_enable'
34+ dialog = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_NONE, message_format=None)
35+ dialog.set_resizable(True);
36+ dialog.set_default_size(420,-1);
37+ dialog.set_title(_('Microsoft Windows key Trademark Compliance'))
38+ dialog.set_markup(_('Wound you like to use the Super/Windows key to activate Ubuntu functions?'))
39+ dialog.add_button(_('No thanks'),gtk.RESPONSE_NO)
40+ dialog.add_button(_('Yes please'),gtk.RESPONSE_YES)
41+ dialog.set_default_response(gtk.RESPONSE_YES)
42+ response_id = dialog.run()
43+ gconf_client = gconf.client_get_default()
44+ gconf_client.add_dir("/desktop/unity/launcher",gconf.CLIENT_PRELOAD_NONE)
45+ if (response_id != gtk.RESPONSE_NO):
46+ gconf_client.set_bool(gconfkey,True)
47+ else:
48+ gconf_client.set_bool(gconfkey,False)
49
50=== modified file 'unity-private/panel/panel-home-button.vala'
51--- unity-private/panel/panel-home-button.vala 2010-09-24 12:40:30 +0000
52+++ unity-private/panel/panel-home-button.vala 2010-10-04 13:13:12 +0000
53@@ -28,6 +28,8 @@
54 private Clutter.Texture bfb_bg_normal;
55 private Clutter.Texture bfb_bg_prelight;
56 private Clutter.Texture bfb_bg_active;
57+ private bool super_key_enable_asked=false;
58+ private bool super_key_enable=false;
59
60 public HomeButton (Shell shell)
61 {
62@@ -97,6 +99,8 @@
63 set_background_for_state (Ctk.ActorState.STATE_NORMAL, bfb_bg_normal);
64 set_background_for_state (Ctk.ActorState.STATE_PRELIGHT, bfb_bg_prelight);
65 set_background_for_state (Ctk.ActorState.STATE_ACTIVE, bfb_bg_active);
66+ var gc = GConf.Client.get_default();
67+ super_key_enable = gc.get_bool("/desktop/unity/launcher/super_key_enable");
68 }
69
70 private override void allocate (Clutter.ActorBox box,
71@@ -205,6 +209,11 @@
72
73 private void on_clicked ()
74 {
75+ if (!super_key_enable && !super_key_enable_asked) {
76+ show_super_key_enable_dialog();
77+ super_key_enable_asked = true;
78+ return;
79+ }
80 shell.show_unity ();
81 MenuManager manager = MenuManager.get_default ();
82 manager.popdown_current_menu ();
83@@ -212,6 +221,12 @@
84 on_mode_changed (shell.get_mode ());
85 }
86
87+ private void* show_super_key_enable_dialog()
88+ {
89+ Process.spawn_command_line_async("/usr/lib/unity/superkey_conf_dialog.py");
90+ return null;
91+ }
92+
93 private bool on_motion_event (Clutter.Event event)
94 {
95 shell.about_to_show_places ();