From 5072ea7e4733f2bc1aec47fe4dbdb62e0db7d1a3 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Mon, 3 Dec 2012 19:18:51 +0100 Subject: [PATCH] Calendar: remove dead code this._weekdateHeader is never assigned, so _setWeekdateHeaderWidth is useless. Everything else falls from that. Spotted by mathematical.coffee@gmail.com, our human coverity :) https://bugzilla.gnome.org/show_bug.cgi?id=687250 --- js/ui/calendar.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 3a3e73c66..0cab1d650 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -11,7 +11,6 @@ const Mainloop = imports.mainloop; const Shell = imports.gi.Shell; const MSECS_IN_DAY = 24 * 60 * 60 * 1000; -const WEEKDATE_HEADER_WIDTH_DIGITS = 3; const SHOW_WEEKDATE_KEY = 'show-weekdate'; // in org.gnome.desktop.interface @@ -95,15 +94,6 @@ function _getCalendarWeekForDate(date) { return weekNumber; } -function _getDigitWidth(actor){ - let context = actor.get_pango_context(); - let themeNode = actor.get_theme_node(); - let font = themeNode.get_font(); - let metrics = context.get_metrics(font, context.get_language()); - let width = metrics.get_approximate_digit_width(); - return width; -} - function _getCalendarDayAbbreviation(dayNumber) { let abbreviations = [ /* Translators: Calendar grid abbreviation for Sunday. @@ -345,8 +335,6 @@ const Calendar = new Lang.Class({ _init: function() { this._weekStart = Shell.util_get_week_start(); - this._weekdate = NaN; - this._digitWidth = NaN; this._settings = new Gio.Settings({ schema: 'org.gnome.shell.calendar' }); this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange)); @@ -419,8 +407,6 @@ const Calendar = new Lang.Class({ this.actor.add(this._topBox, { row: 0, col: 0, col_span: offsetCols + 7 }); - this.actor.connect('style-changed', Lang.bind(this, this._onStyleChange)); - let back = new St.Button({ style_class: 'calendar-change-month-back' }); this._topBox.add(back); back.connect('clicked', Lang.bind(this, this._onPrevMonthButtonClicked)); @@ -457,18 +443,6 @@ const Calendar = new Lang.Class({ this._firstDayIndex = this.actor.get_n_children(); }, - _onStyleChange: function(actor, event) { - // width of a digit in pango units - this._digitWidth = _getDigitWidth(this.actor) / Pango.SCALE; - this._setWeekdateHeaderWidth(); - }, - - _setWeekdateHeaderWidth: function() { - if (this.digitWidth != NaN && this._useWeekdate && this._weekdateHeader) { - this._weekdateHeader.set_width (this._digitWidth * WEEKDATE_HEADER_WIDTH_DIGITS); - } - }, - _onScroll : function(actor, event) { switch (event.get_scroll_direction()) { case Clutter.ScrollDirection.UP: