[gnome-shell] clock: Use settings from gsettings-desktop-schemas



commit 24f1e87813cf516b8151cc6112cee03dacbe9d44
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Dec 2 17:28:06 2010 +0100

    clock: Use settings from gsettings-desktop-schemas
    
    A key for 12hr/24hr clock format has been added to gsettings-desktop-schemas,
    so use that instead of the one from the shell clock schema.
    
    As the setting can be controlled from the Date and Time panel of
    gnome-control-center now, drop the temporary preference dialog
    as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=633200

 .gitignore                                       |    3 -
 data/Makefile.am                                 |    6 +-
 data/clock-preferences.ui                        |  188 ----------------------
 data/gnome-shell-clock-preferences.desktop.in.in |   15 --
 data/org.gnome.shell.gschema.xml.in              |   37 +----
 js/Makefile.am                                   |    1 -
 js/prefs/clockPreferences.js                     |   97 -----------
 js/ui/panel.js                                   |   65 +++------
 po/POTFILES.in                                   |    2 -
 src/Makefile.am                                  |   11 +--
 src/gnome-shell-clock-preferences.in             |   24 ---
 11 files changed, 23 insertions(+), 426 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index c3669d4..e043cb8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,8 +18,6 @@ config
 configure
 data/gnome-shell.desktop
 data/gnome-shell.desktop.in
-data/gnome-shell-clock-preferences.desktop
-data/gnome-shell-clock-preferences.desktop.in
 data/gschemas.compiled
 data/org.gnome.shell.gschema.xml
 data/org.gnome.shell.gschema.valid
@@ -46,7 +44,6 @@ src/Makefile
 src/Makefile.in
 src/gnomeshell-taskpanel
 src/gnome-shell
-src/gnome-shell-clock-preferences
 src/run-js-test
 src/test-recorder
 src/test-recorder.ogg
diff --git a/data/Makefile.am b/data/Makefile.am
index d8cb906..ece423d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,5 @@
 desktopdir=$(datadir)/applications
-desktop_DATA = gnome-shell.desktop gnome-shell-clock-preferences.desktop
+desktop_DATA = gnome-shell.desktop
 
 # We substitute in bindir so it works as an autostart
 # file when built in a non-system prefix
@@ -12,8 +12,6 @@ desktop_DATA = gnome-shell.desktop gnome-shell-clock-preferences.desktop
 %.desktop:%.desktop.in
 	$(AM_V_GEN) sed s/^_// < $< > $@ || rm $@
 
-dist_pkgdata_DATA = clock-preferences.ui
-
 imagesdir = $(pkgdatadir)/images
 dist_images_DATA =				\
 	close-black.svg				\
@@ -88,7 +86,6 @@ install-data-local:
 
 EXTRA_DIST =						\
 	gnome-shell.desktop.in.in			\
-	gnome-shell-clock-preferences.desktop.in.in	\
 	$(menu_DATA)					\
 	$(gconfschema_DATA)				\
 	$(shaders_DATA)					\
@@ -97,7 +94,6 @@ EXTRA_DIST =						\
 
 CLEANFILES =						\
 	gnome-shell.desktop.in				\
-	gnome-shell-clock-preferences.desktop.in	\
 	$(desktop_DATA)					\
 	$(gsettings_SCHEMAS)				\
 	gschemas.compiled
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index 031930a..8434268 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -59,51 +59,18 @@
 
   <schema id="org.gnome.shell.clock" path="/apps/gnome-shell/clock/"
           gettext-domain="@GETTEXT_PACKAGE@">
-    <key name="format" type="s">
-      <default l10n="messages" context="hour_format">
-      <!-- TRANSLATORS: This is the default hour format, choose ONLY '12-hour' or '24-hour'. -->
-        "12-hour"
-      </default>
-      <_summary>Hour format</_summary>
-      <_description>
-        This key specifies the hour format used by the panel clock.
-        Possible values are "12-hour", "24-hour", "unix" and "custom". If set
-        to "unix", the clock will display time in seconds since Epoch,
-        i.e. 1970-01-01. If set to "custom", the clock will display time
-        according to the format specified in the custom_format key. Note that
-        if set to either "unix" or "custom", the show_date and show_seconds
-        keys are ignored.
-      </_description>
-      <choices>
-        <choice value="12-hour"/>
-        <choice value="24-hour"/>
-        <choice value="unix"/>
-        <choice value="custom"/>
-      </choices>
-    </key>
-    <key name="custom-format" type="s">
-      <default>''</default>
-      <_summary>Custom format of the clock</_summary>
-      <_description>
-        This key specifies the format used by the panel clock when the format
-        key is set to "custom". You can use conversion specifiers understood
-        by strftime() to obtain a specific format. See the strftime() manual
-        for more information.
-      </_description>
-    </key>
     <key name="show-seconds" type="b">
       <default>false</default>
       <_summary>Show time with seconds</_summary>
       <_description>
-        If true and format is either "12-hour" or "24-hour", display seconds in time.
+        If true, display seconds in time.
       </_description>
     </key>
     <key name="show-date" type="b">
       <default>false</default>
       <_summary>Show date in clock</_summary>
       <_description>
-        If true and format is either "12-hour" or "24-hour",
-        display date in the clock, in addition to time.
+        If true, display date in the clock, in addition to time.
       </_description>
     </key>
   </schema>
diff --git a/js/Makefile.am b/js/Makefile.am
index 462f81b..555be7b 100644
--- a/js/Makefile.am
+++ b/js/Makefile.am
@@ -11,7 +11,6 @@ nobase_dist_js_DATA = 	\
 	misc/telepathy.js	\
 	misc/utils.js		\
 	perf/core.js		\
-	prefs/clockPreferences.js \
 	ui/altTab.js		\
 	ui/appDisplay.js	\
 	ui/appFavorites.js	\
diff --git a/js/ui/panel.js b/js/ui/panel.js
index e797a36..eb994d1 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -40,8 +40,10 @@ const STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION = {
 if (Config.HAVE_BLUETOOTH)
     STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['bluetooth'] = imports.ui.status.bluetooth.Indicator;
 
-const CLOCK_FORMAT_KEY        = 'format';
-const CLOCK_CUSTOM_FORMAT_KEY = 'custom-format';
+// in org.gnome.desktop.interface
+const CLOCK_FORMAT_KEY        = 'clock-format';
+
+// in org.gnome.shell.clock
 const CLOCK_SHOW_DATE_KEY     = 'show-date';
 const CLOCK_SHOW_SECONDS_KEY  = 'show-seconds';
 
@@ -492,36 +494,32 @@ function ClockButton() {
 }
 
 ClockButton.prototype = {
-    __proto__: PanelMenu.Button.prototype,
-
     _init: function() {
-        PanelMenu.Button.prototype._init.call(this, St.Align.START);
-        this.menu.addAction(_("Preferences"), Lang.bind(this, this._onPrefs));
+        this.actor = new St.Bin({ style_class: 'panel-button',
+                                  reactive: true,
+                                  can_focus: true,
+                                  x_fill: true,
+                                  y_fill: false,
+                                  track_hover: true });
+        this.actor._delegate = this;
+        this.actor.connect('button-press-event',
+                           Lang.bind(this, this._toggleCalendar));
 
         this._clock = new St.Label();
         this.actor.set_child(this._clock);
 
         this._calendarPopup = null;
 
+        this._desktopSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
         this._clockSettings = new Gio.Settings({ schema: 'org.gnome.shell.clock' });
+
+        this._desktopSettings.connect('changed', Lang.bind(this, this._updateClock));
         this._clockSettings.connect('changed', Lang.bind(this, this._updateClock));
 
         // Start the clock
         this._updateClock();
     },
 
-    _onButtonPress: function(actor, event) {
-        let button = event.get_button();
-        let menuShowing = this.menu.isOpen;
-        let calendarShowing = this._calendarPopup && this._calendarPopup.isOpen;
-
-        if (menuShowing || (button == 3 && !calendarShowing))
-            this.menu.toggle();
-        else
-            this._toggleCalendar();
-        return true;
-    },
-
     closeCalendar: function() {
         if (!this._calendarPopup || !this._calendarPopup.isOpen)
             return;
@@ -537,24 +535,12 @@ ClockButton.prototype = {
         this.actor.add_style_pseudo_class('pressed');
     },
 
-    _onPrefs: function() {
-        let args = ['gnome-shell-clock-preferences'];
-        let p = new Shell.Process({ args: args });
-
-        p.run();
-    },
-
     _toggleCalendar: function() {
         if (this._calendarPopup == null) {
             this._calendarPopup = new CalendarPopup();
             this._calendarPopup.actor.hide();
         }
 
-        if (this.menu.isOpen && !this._calendarPopup.isOpen) {
-            this.menu.close();
-            return;
-        }
-
         if (!this._calendarPopup.isOpen)
             this.openCalendar();
         else
@@ -562,23 +548,13 @@ ClockButton.prototype = {
     },
 
     _updateClock: function() {
-        let format = this._clockSettings.get_string(CLOCK_FORMAT_KEY);
+        let format = this._desktopSettings.get_string(CLOCK_FORMAT_KEY);
         let showDate = this._clockSettings.get_boolean(CLOCK_SHOW_DATE_KEY);
         let showSeconds = this._clockSettings.get_boolean(CLOCK_SHOW_SECONDS_KEY);
 
         let clockFormat;
         switch (format) {
-            case 'unix':
-                // force updates every second
-                showSeconds = true;
-                clockFormat = '%s';
-                break;
-            case 'custom':
-                // force updates every second
-                showSeconds = true;
-                clockFormat = this._clockSettings.get_string(CLOCK_CUSTOM_FORMAT_KEY);
-                break;
-            case '24-hour':
+            case '24h':
                 if (showDate)
 	            /* Translators: This is the time format with date used
                        in 24-hour mode. */
@@ -590,7 +566,7 @@ ClockButton.prototype = {
                     clockFormat = showSeconds ? _("%a %R:%S")
                                               : _("%a %R");
                 break;
-            case '12-hour':
+            case '12h':
             default:
                 if (showDate)
 	            /* Translators: This is a time format with date used
@@ -803,9 +779,6 @@ Panel.prototype = {
         this._clockButton = new ClockButton();
         this._centerBox.add(this._clockButton.actor, { y_fill: true });
 
-        let clockMenuManager = new PopupMenu.PopupMenuManager(this);
-        clockMenuManager.addMenu(this._clockButton.menu);
-
         /* right */
 
         // System status applets live in statusBox, while legacy tray icons
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b0e2831..5ac0ba7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,6 @@
 data/gnome-shell.desktop.in.in
-data/gnome-shell-clock-preferences.desktop.in.in
 data/org.gnome.shell.gschema.xml.in
 data/org.gnome.accessibility.magnifier.gschema.xml.in
-[type: gettext/glade]data/clock-preferences.ui
 js/ui/appDisplay.js
 js/ui/appFavorites.js
 js/ui/dash.js
diff --git a/src/Makefile.am b/src/Makefile.am
index e79a486..fa9804b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,7 +8,7 @@ noinst_PROGRAMS =
 
 .AUTOPARALLEL:
 
-bin_SCRIPTS = gnome-shell gnome-shell-clock-preferences
+bin_SCRIPTS = gnome-shell
 
 gnome-shell: gnome-shell.in
 	$(AM_V_GEN) sed -e "s|@MUTTER_BIN_DIR[ ]|$(MUTTER_BIN_DIR)|" \
@@ -23,15 +23,6 @@ gnome-shell: gnome-shell.in
 CLEANFILES += gnome-shell
 EXTRA_DIST += gnome-shell.in
 
-gnome-shell-clock-preferences: gnome-shell-clock-preferences.in
-	$(AM_V_GEN) sed -e "s|@datadir[ ]|$(datadir)|" \
-	    -e "s|@pkgdatadir[ ]|$(pkgdatadir)|" \
-	    -e "s|@localedir[ ]|$(datadir)/locale|" \
-	    -e "s|@GJS_CONSOLE[ ]|$(GJS_CONSOLE)|" \
-	    $< > $@ && chmod a+x $@
-CLEANFILES += gnome-shell-clock-preferences
-EXTRA_DIST += gnome-shell-clock-preferences.in
-
 include Makefile-gdmuser.am
 include Makefile-st.am
 include Makefile-tray.am



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]