[gnome-break-timer/dylanmccall/meson-build: 16/25] Remove unnecessary using statements
- From: Dylan McCall <dylanmccall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-break-timer/dylanmccall/meson-build: 16/25] Remove unnecessary using statements
- Date: Wed, 23 Jan 2019 04:04:20 +0000 (UTC)
commit 2a4734af168bb905efed20922a4f62149b1dd901
Author: Dylan McCall <dylan dylanmccall com>
Date: Wed Jan 9 23:31:10 2019 -0800
Remove unnecessary using statements
settings/BreakManager.vala | 3 ---
settings/BreakSettingsDialog.vala | 19 ++++++---------
settings/BreakType.vala | 15 +++++-------
settings/CircleCounter.vala | 3 ---
settings/MainWindow.vala | 9 +++----
settings/MicroBreakType.vala | 5 +---
settings/OverlayArrow.vala | 3 ---
settings/RestBreakType.vala | 5 +---
settings/SettingsApplication.vala | 17 ++++++-------
settings/TimeChooser.vala | 51 ++++++++++++++++++---------------------
settings/TimerBreakType.vala | 17 ++++++-------
11 files changed, 57 insertions(+), 90 deletions(-)
---
diff --git a/settings/BreakManager.vala b/settings/BreakManager.vala
index 3093883..a8ab8ac 100644
--- a/settings/BreakManager.vala
+++ b/settings/BreakManager.vala
@@ -18,9 +18,6 @@
// TODO: This intentionally resembles BreakManager from the helper
// application. Ideally, it should be common code in the future.
-using Gee;
-using GLib;
-
namespace BreakTimer.Settings {
public class BreakManager : Object {
diff --git a/settings/BreakSettingsDialog.vala b/settings/BreakSettingsDialog.vala
index ec8c51a..e11e7bd 100644
--- a/settings/BreakSettingsDialog.vala
+++ b/settings/BreakSettingsDialog.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public class BreakSettingsDialog : Gtk.Dialog {
@@ -25,23 +22,23 @@ public class BreakSettingsDialog : Gtk.Dialog {
private BreakConfigurationChooser configuration_chooser;
private Gtk.Grid breaks_grid;
-
+
private const int ABOUT_BUTTON_RESPONSE = 5;
-
+
public BreakSettingsDialog (BreakManager break_manager) {
Object (use_header_bar: 1);
this.break_manager = break_manager;
GLib.Settings settings = new GLib.Settings ("org.gnome.BreakTimer");
-
+
this.set_title ( _("Choose Your Break Schedule"));
this.set_resizable (false);
this.delete_event.connect (this.hide_on_delete);
-
+
this.add_button (_("_Close"), Gtk.ResponseType.CLOSE);
this.response.connect (this.response_cb);
-
+
Gtk.Container content_area = (Gtk.Container)this.get_content_area ();
Gtk.Grid content = new Gtk.Grid ();
@@ -71,7 +68,7 @@ public class BreakSettingsDialog : Gtk.Dialog {
this.breaks_grid = new FixedSizeGrid ();
content.add (this.breaks_grid);
this.breaks_grid.set_orientation (Gtk.Orientation.VERTICAL);
-
+
content.show_all ();
break_manager.break_added.connect (this.break_added_cb);
@@ -98,7 +95,7 @@ public class BreakSettingsDialog : Gtk.Dialog {
settings_panel.set_margin_bottom (10);
this.update_break_configuration ();
}
-
+
private void response_cb (int response_id) {
if (response_id == Gtk.ResponseType.CLOSE) {
this.hide ();
@@ -156,7 +153,7 @@ class BreakConfigurationChooser : Gtk.ComboBox {
Gtk.TreeIter iter;
this.list_store.append (out iter);
this.list_store.set (iter, 0, configuration, 1, configuration.label);
- configuration.iter = iter;
+ configuration.iter = iter;
}
private void send_selected_break () {
diff --git a/settings/BreakType.vala b/settings/BreakType.vala
index 894d6b4..0ae8979 100644
--- a/settings/BreakType.vala
+++ b/settings/BreakType.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public abstract class BreakType : Object {
@@ -29,7 +26,7 @@ public abstract class BreakType : Object {
public BreakSettingsPanel settings_panel;
public GLib.Settings settings;
-
+
public BreakType (string id, GLib.Settings settings) {
this.id = id;
this.settings = settings;
@@ -47,7 +44,7 @@ public abstract class BreakType : Object {
this.status = status;
this.status_changed (status);
}
-
+
protected abstract BreakInfoPanel get_info_panel ();
protected abstract BreakStatusPanel get_status_panel ();
protected abstract BreakSettingsPanel get_settings_panel ();
@@ -125,19 +122,19 @@ public abstract class BreakSettingsPanel : Gtk.Grid {
this.header = new Gtk.Grid ();
this.add (this.header);
this.header.set_column_spacing (12);
-
+
var title_grid = new Gtk.Grid ();
this.set_header (title_grid);
title_grid.set_orientation (Gtk.Orientation.VERTICAL);
title_grid.set_row_spacing (4);
-
+
var title_label = new Gtk.Label (title);
title_grid.add (title_label);
title_label.get_style_context ().add_class ("_settings-title");
title_label.set_halign (Gtk.Align.FILL);
title_label.set_hexpand (true);
title_label.set_justify (Gtk.Justification.CENTER);
-
+
// var description_label = new Gtk.Label ("<small>%s</small>".printf (description));
// title_grid.add (description_label);
// description_label.get_style_context ().add_class ("_settings-description");
@@ -164,7 +161,7 @@ public abstract class BreakSettingsPanel : Gtk.Grid {
content.set_halign (Gtk.Align.END);
content.set_valign (Gtk.Align.CENTER);
}
-
+
protected void set_details (Gtk.Widget content) {
this.details.add (content);
}
diff --git a/settings/CircleCounter.vala b/settings/CircleCounter.vala
index 6939eba..a89320b 100644
--- a/settings/CircleCounter.vala
+++ b/settings/CircleCounter.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
/**
diff --git a/settings/MainWindow.vala b/settings/MainWindow.vala
index 862ebfa..864f026 100644
--- a/settings/MainWindow.vala
+++ b/settings/MainWindow.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public class MainWindow : Gtk.ApplicationWindow {
@@ -50,7 +47,7 @@ public class MainWindow : Gtk.ApplicationWindow {
this.break_settings_dialog = new BreakSettingsDialog (break_manager);
this.break_settings_dialog.set_modal (true);
this.break_settings_dialog.set_transient_for (this);
-
+
Gtk.Grid content = new Gtk.Grid ();
this.add (content);
content.set_orientation (Gtk.Orientation.VERTICAL);
@@ -92,7 +89,7 @@ public class MainWindow : Gtk.ApplicationWindow {
this.header.show_all ();
content.show_all ();
-
+
break_manager.break_added.connect (this.break_added_cb);
break_manager.notify["foreground-break"].connect (this.update_visible_panel);
this.update_visible_panel ();
@@ -308,7 +305,7 @@ private class StatusPanel : Gtk.Stack {
this.breaks_list = this.build_breaks_list (break_manager);
this.add (this.breaks_list);
-
+
this.no_breaks_message = builder.get_object ("status_stopped") as Gtk.Widget;
this.add (this.no_breaks_message);
diff --git a/settings/MicroBreakType.vala b/settings/MicroBreakType.vala
index c8ec49c..23500e5 100644
--- a/settings/MicroBreakType.vala
+++ b/settings/MicroBreakType.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public class MicroBreakType : TimerBreakType {
@@ -36,7 +33,7 @@ public class MicroBreakType : TimerBreakType {
protected override BreakStatusPanel get_status_panel () {
return new MicroBreakStatusPanel (this);
}
-
+
protected override BreakSettingsPanel get_settings_panel () {
return new MicroBreakSettingsPanel (this);
}
diff --git a/settings/OverlayArrow.vala b/settings/OverlayArrow.vala
index 8bb59b8..bd7daa7 100644
--- a/settings/OverlayArrow.vala
+++ b/settings/OverlayArrow.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
/* FIXME: This widget is stealing clicks when it is used in an overlay */
diff --git a/settings/RestBreakType.vala b/settings/RestBreakType.vala
index d50e391..d931822 100644
--- a/settings/RestBreakType.vala
+++ b/settings/RestBreakType.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public class RestBreakType : TimerBreakType {
@@ -32,7 +29,7 @@ public class RestBreakType : TimerBreakType {
protected override BreakInfoPanel get_info_panel () {
return new RestBreakInfoPanel (this);
}
-
+
protected override BreakStatusPanel get_status_panel () {
return new RestBreakStatusPanel (this);
}
diff --git a/settings/SettingsApplication.vala b/settings/SettingsApplication.vala
index f1e877e..fa542eb 100644
--- a/settings/SettingsApplication.vala
+++ b/settings/SettingsApplication.vala
@@ -15,14 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public class SettingsApplication : Gtk.Application {
const string app_id = Config.SETTINGS_DESKTOP_ID;
-
+
private const string STYLE_DATA =
"""
._settings-title {
@@ -64,10 +61,10 @@ public class SettingsApplication : Gtk.Application {
public SettingsApplication () {
Object (application_id: app_id, flags: ApplicationFlags.FLAGS_NONE);
}
-
+
public override void activate () {
base.activate ();
-
+
if (this.break_manager.is_working ()) {
this.main_window.present ();
} else {
@@ -76,20 +73,20 @@ public class SettingsApplication : Gtk.Application {
this.delayed_start ();
}
}
-
+
public override void startup () {
base.startup ();
/* set up custom gtk style for application */
Gdk.Screen screen = Gdk.Screen.get_default ();
Gtk.CssProvider style_provider = new Gtk.CssProvider ();
-
+
try {
style_provider.load_from_data (STYLE_DATA, -1);
} catch (Error error) {
stderr.printf ("Error loading style data: %s\n", error.message);
}
-
+
Gtk.StyleContext.add_provider_for_screen (
screen,
style_provider,
@@ -107,7 +104,7 @@ public class SettingsApplication : Gtk.Application {
app_menu.append ( _("About"), "app.about");
app_menu.append ( _("Quit"), "app.quit");
this.set_app_menu (app_menu);
-
+
this.break_manager = new BreakManager (this);
this.main_window = new MainWindow (this, this.break_manager);
this.break_manager.load_breaks ();
diff --git a/settings/TimeChooser.vala b/settings/TimeChooser.vala
index 38ef82b..429db69 100644
--- a/settings/TimeChooser.vala
+++ b/settings/TimeChooser.vala
@@ -15,52 +15,49 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public class TimeChooser : Gtk.ComboBox {
private Gtk.ListStore list_store;
-
+
private Gtk.TreeIter? custom_item;
-
+
private const int OPTION_OTHER = -1;
-
+
public int time_seconds { get; set; }
-
+
public signal void time_selected (int time);
-
+
public TimeChooser (int[] options) {
Object ();
-
+
this.list_store = new Gtk.ListStore (3, typeof (string), typeof (string), typeof (int));
-
+
this.set_model (this.list_store);
this.set_id_column (1);
-
+
Gtk.CellRendererText cell = new Gtk.CellRendererText ();
this.pack_start (cell, true);
this.set_attributes (cell, "text", null);
-
+
foreach (int time in options) {
string label = NaturalTime.instance.get_label_for_seconds (time);
this.add_option (label, time);
}
this.custom_item = null;
-
+
this.changed.connect (this.on_changed);
-
+
this.notify["time-seconds"].connect ( (s, p) => {
this.set_time (this.time_seconds);
});
}
-
+
public bool set_time (int seconds) {
string id = seconds.to_string ();
-
+
bool option_exists = this.set_active_id (id);
-
+
if (!option_exists) {
if (seconds > 0) {
Gtk.TreeIter new_option = this.add_custom_option (seconds);
@@ -73,25 +70,25 @@ public class TimeChooser : Gtk.ComboBox {
return true;
}
}
-
+
public int get_time () {
return this.time_seconds;
}
-
+
private Gtk.TreeIter add_option (string label, int seconds) {
string id = seconds.to_string ();
-
+
Gtk.TreeIter iter;
this.list_store.append (out iter);
this.list_store.set (iter, 0, label, 1, id, 2, seconds, -1);
-
+
return iter;
}
-
+
private Gtk.TreeIter add_custom_option (int seconds) {
string label = NaturalTime.instance.get_label_for_seconds (seconds);
string id = seconds.to_string ();
-
+
if (this.custom_item == null) {
this.list_store.append (out this.custom_item);
this.list_store.set (this.custom_item, 0, label, 1, id, 2, seconds, -1);
@@ -101,15 +98,15 @@ public class TimeChooser : Gtk.ComboBox {
return this.custom_item;
}
}
-
+
private void on_changed () {
if (this.get_active () < 0) {
return;
}
-
+
Gtk.TreeIter iter;
this.get_active_iter (out iter);
-
+
int val;
this.list_store.get (iter, 2, out val);
if (val == OPTION_OTHER) {
@@ -119,7 +116,7 @@ public class TimeChooser : Gtk.ComboBox {
this.time_selected (val);
}
}
-
+
private void start_custom_input () {
GLib.warning("Custom time input is not implemented");
}
diff --git a/settings/TimerBreakType.vala b/settings/TimerBreakType.vala
index 58fddc5..0f75f36 100644
--- a/settings/TimerBreakType.vala
+++ b/settings/TimerBreakType.vala
@@ -15,9 +15,6 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-using Gtk;
-using GLib;
-
namespace BreakTimer.Settings {
public abstract class TimerBreakType : BreakType {
@@ -148,7 +145,7 @@ public abstract class TimerBreakStatusPanel : BreakStatusPanel {
if (status == null) return;
TimerBreakType timer_break = (TimerBreakType) this.break_type;
-
+
if (status.is_active) {
this.status_label.set_label (this.ongoing_text);
string time_text = NaturalTime.instance.get_countdown_for_seconds_with_start (
@@ -169,13 +166,13 @@ public abstract class TimerBreakStatusPanel : BreakStatusPanel {
public abstract class TimerBreakSettingsPanel : BreakSettingsPanel {
public TimerBreakSettingsPanel (TimerBreakType break_type, string title, string? description) {
base (break_type, title, description);
-
+
var details_grid = new Gtk.Grid ();
this.set_details (details_grid);
-
+
details_grid.set_column_spacing (8);
details_grid.set_row_spacing (8);
-
+
/* Label for the widget to choose how frequently a break occurs. (Choices such as "6 minutes" or "45
minutes") */
var interval_label = new Gtk.Label.with_mnemonic ( _("Every"));
interval_label.set_halign (Gtk.Align.END);
@@ -184,16 +181,16 @@ public abstract class TimerBreakSettingsPanel : BreakSettingsPanel {
var interval_chooser = new TimeChooser (break_type.interval_options);
details_grid.attach_next_to (interval_chooser, interval_label, Gtk.PositionType.RIGHT, 1, 1);
break_type.settings.bind ("interval-seconds", interval_chooser, "time-seconds",
SettingsBindFlags.DEFAULT);
-
+
/* Label for the widget to choose how long a break lasts when it occurs. (Choices such as "30
seconds" or "5 minutes") */
var duration_label = new Gtk.Label.with_mnemonic ( _("For"));
duration_label.set_halign (Gtk.Align.END);
details_grid.attach (duration_label, 0, 2, 1, 1);
-
+
var duration_chooser = new TimeChooser (break_type.duration_options);
details_grid.attach_next_to (duration_chooser, duration_label, Gtk.PositionType.RIGHT, 1, 1);
break_type.settings.bind ("duration-seconds", duration_chooser, "time-seconds",
SettingsBindFlags.DEFAULT);
-
+
details_grid.show_all ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]