Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions core/Backends/PlacementWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ public class Maya.PlacementWidget : GLib.Object {

namespace Maya.DefaultPlacementWidgets {
public Gee.LinkedList<Maya.PlacementWidget> get_user (int row, bool needed = true, string entry_text = "", string? ph_text = null) {
var user_label = new PlacementWidget () {
column = 0,
row = row,
ref_name = "user_label",
widget = new Gtk.Label (_("User:")) {
xalign = 1.0f
}
};

var user_entry = new PlacementWidget () {
column = 1,
row = row,
Expand All @@ -41,6 +32,16 @@ namespace Maya.DefaultPlacementWidgets {
}
};

var user_label = new PlacementWidget () {
column = 0,
row = row,
ref_name = "user_label",
widget = new Gtk.Label (_("User")) {
mnemonic_widget = user_entry.widget,
xalign = 1.0f
}
};

var collection = new Gee.LinkedList<Maya.PlacementWidget> ();
collection.add (user_label);
collection.add (user_entry);
Expand All @@ -49,15 +50,6 @@ namespace Maya.DefaultPlacementWidgets {
}

public Gee.LinkedList<Maya.PlacementWidget> get_email (int row, bool needed = true, string entry_text = "", string? ph_text = null) {
var user_label = new PlacementWidget () {
column = 0,
row = row,
ref_name = "email_label",
widget = new Gtk.Label (_("Email:")) {
xalign = 1.0f
}
};

var user_entry = new PlacementWidget () {
column = 1,
row = row,
Expand All @@ -69,6 +61,16 @@ namespace Maya.DefaultPlacementWidgets {
}
};

var user_label = new PlacementWidget () {
column = 0,
row = row,
ref_name = "email_label",
widget = new Gtk.Label (_("Email")) {
mnemonic_widget = user_entry.widget,
xalign = 1.0f
}
};

var collection = new Gee.LinkedList<Maya.PlacementWidget> ();
collection.add (user_label);
collection.add (user_entry);
Expand Down
28 changes: 13 additions & 15 deletions plugins/CalDAV/CalDAVBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ public class Maya.CalDavBackend : GLib.Object, Maya.Backend {
keep_copy = source_offline.stay_synchronized;
}

collection.add (Maya.DefaultPlacementWidgets.get_keep_copy (0, keep_copy));

var url_label = new PlacementWidget () {
column = 0,
row = 1,
ref_name = "url_label"
};

url_label.widget = new Gtk.Label (_("URL:")) {
hexpand = true,
xalign = 1.0f
};

collection.add (url_label);

var url_entry = new PlacementWidget () {
column = 1,
row = 1,
Expand All @@ -62,6 +47,19 @@ public class Maya.CalDavBackend : GLib.Object, Maya.Backend {
}
};

var url_label = new PlacementWidget () {
column = 0,
row = 1,
ref_name = "url_label",
widget = new Gtk.Label (_("URL")) {
hexpand = true,
mnemonic_widget = url_entry.widget,
xalign = 1.0f
}
};

collection.add (Maya.DefaultPlacementWidgets.get_keep_copy (0, keep_copy));
collection.add (url_label);
collection.add (url_entry);
if (to_edit != null) {
E.SourceWebdav webdav = (E.SourceWebdav)to_edit.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
Expand Down
24 changes: 12 additions & 12 deletions plugins/Web/WebBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@ public class Maya.WebBackend : GLib.Object, Maya.Backend {
keep_copy = source_offline.stay_synchronized;
}

collection.add (Maya.DefaultPlacementWidgets.get_keep_copy (0, keep_copy));
var url_entry = new PlacementWidget ();
url_entry.widget = new Gtk.Entry () {
placeholder_text = "https://example.com"
};
url_entry.row = 1;
url_entry.column = 1;
url_entry.ref_name = "url_entry";
url_entry.needed = true;

var url_label = new PlacementWidget ();
url_label.widget = new Gtk.Label (_("URL:")) {
url_label.widget = new Gtk.Label (_("URL")) {
hexpand = true,
vexpand = true,
mnemonic_widget = url_entry.widget,
xalign = 1.0f
};
url_label.row = 1;
url_label.column = 0;
url_label.ref_name = "url_label";
collection.add (url_label);

var url_entry = new PlacementWidget ();
url_entry.widget = new Gtk.Entry () {
placeholder_text = "https://example.com"
};
url_entry.row = 1;
url_entry.column = 1;
url_entry.ref_name = "url_entry";
url_entry.needed = true;
collection.add (Maya.DefaultPlacementWidgets.get_keep_copy (0, keep_copy));
collection.add (url_label);
collection.add (url_entry);
if (to_edit != null) {
E.SourceWebdav webdav = (E.SourceWebdav)to_edit.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
Expand Down
167 changes: 91 additions & 76 deletions src/SourceDialog/SourceDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ public class Maya.View.SourceDialog : Granite.Dialog {
create_button.clicked.connect (save);
cancel_button.clicked.connect (() => go_back ());

var name_label = new Gtk.Label (_("Name:"));
name_label.xalign = 1;
name_entry = new Gtk.Entry () {
placeholder_text = _("Calendar Name")
};
name_entry.changed.connect (check_can_validate);

name_entry = new Gtk.Entry ();
name_entry.placeholder_text = _("Calendar Name");
name_entry.changed.connect (() => {check_can_validate ();});
var name_label = new Gtk.Label (_("Name")) {
mnemonic_widget = name_entry,
xalign = 1
};

list_store = new Gtk.ListStore (2, typeof (string), typeof (Backend));

Expand All @@ -85,8 +88,10 @@ public class Maya.View.SourceDialog : Granite.Dialog {
add_backend_widgets ();
});

var type_label = new Gtk.Label (_("Type:"));
type_label.xalign = 1.0f;
var type_label = new Gtk.Label (_("Type")) {
mnemonic_widget = type_combobox,
xalign = 1.0f
};

Gtk.TreeIter iter;
var backends_manager = BackendsManager.get_default ();
Expand All @@ -102,85 +107,95 @@ public class Maya.View.SourceDialog : Granite.Dialog {

type_combobox.set_active (0);

var color_label = new Gtk.Label (_("Color:"));
color_label.xalign = 1;

color_button_blue = new Gtk.RadioButton (null);

var color_button_blue_context = color_button_blue.get_style_context ();
color_button_blue_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_blue_context.add_class ("blue");

color_button_mint = new Gtk.RadioButton.from_widget (color_button_blue);

var color_button_mint_context = color_button_mint.get_style_context ();
color_button_mint_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_mint_context.add_class ("mint");

color_button_green = new Gtk.RadioButton.from_widget (color_button_blue);

var color_button_green_context = color_button_green.get_style_context ();
color_button_green_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_green_context.add_class ("green");

color_button_yellow = new Gtk.RadioButton.from_widget (color_button_blue);

var color_button_yellow_context = color_button_yellow.get_style_context ();
color_button_yellow_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_yellow_context.add_class ("yellow");

color_button_orange = new Gtk.RadioButton.from_widget (color_button_blue);

var color_button_orange_context = color_button_orange.get_style_context ();
color_button_orange_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_orange_context.add_class ("orange");

color_button_red = new Gtk.RadioButton.from_widget (color_button_blue);

var color_button_red_context = color_button_red.get_style_context ();
color_button_red_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_red_context.add_class ("red");
color_button_blue = new Gtk.RadioButton (null) {
tooltip_text = _("Blueberry")
};
color_button_blue.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_blue.get_style_context ().add_class ("blue");

color_button_pink = new Gtk.RadioButton.from_widget (color_button_blue);
color_button_mint = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Mint")
};
color_button_mint.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_mint.get_style_context ().add_class ("mint");

var color_button_pink_context = color_button_pink.get_style_context ();
color_button_pink_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_pink_context.add_class ("pink");
color_button_green = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Lime")
};
color_button_green.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_green.get_style_context ().add_class ("green");

color_button_purple = new Gtk.RadioButton.from_widget (color_button_blue);
color_button_yellow = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Banana")
};
color_button_yellow.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_yellow.get_style_context ().add_class ("yellow");

var color_button_purple_context = color_button_purple.get_style_context ();
color_button_purple_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_purple_context.add_class ("purple");
color_button_orange = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Orange")
};
color_button_orange.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_orange.get_style_context ().add_class ("orange");

color_button_brown = new Gtk.RadioButton.from_widget (color_button_blue);
color_button_red = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Strawberry")
};
color_button_red.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_red.get_style_context ().add_class ("red");

var color_button_brown_context = color_button_brown.get_style_context ();
color_button_brown_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_brown_context.add_class ("brown");
color_button_pink = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Bubblegum")
};
color_button_pink.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_pink.get_style_context ().add_class ("pink");

color_button_slate = new Gtk.RadioButton.from_widget (color_button_blue);
color_button_purple = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Grape")
};
color_button_purple.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_purple.get_style_context ().add_class ("purple");

var color_button_slate_context = color_button_slate.get_style_context ();
color_button_slate_context.add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_slate_context.add_class ("slate");
color_button_brown = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Cocoa")
};
color_button_brown.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_brown.get_style_context ().add_class ("brown");

color_button_none = new Gtk.RadioButton.from_widget (color_button_blue);
color_button_slate = new Gtk.RadioButton (null) {
group = color_button_blue,
tooltip_text = _("Slate")
};
color_button_slate.get_style_context ().add_class (Granite.STYLE_CLASS_COLOR_BUTTON);
color_button_slate.get_style_context ().add_class ("slate");

var color_grid = new Gtk.Grid () {
column_spacing = 3
color_button_none = new Gtk.RadioButton (null) {
group = color_button_blue
};

color_grid.add (color_button_blue);
color_grid.add (color_button_mint);
color_grid.add (color_button_green);
color_grid.add (color_button_yellow);
color_grid.add (color_button_orange);
color_grid.add (color_button_red);
color_grid.add (color_button_pink);
color_grid.add (color_button_purple);
color_grid.add (color_button_brown);
color_grid.add (color_button_slate);
var color_box = new Gtk.Box (HORIZONTAL, 6);
color_box.add (color_button_blue);
color_box.add (color_button_mint);
color_box.add (color_button_green);
color_box.add (color_button_yellow);
color_box.add (color_button_orange);
color_box.add (color_button_red);
color_box.add (color_button_pink);
color_box.add (color_button_purple);
color_box.add (color_button_brown);
color_box.add (color_button_slate);

var color_label = new Gtk.Label (_("Color")) {
mnemonic_widget = color_box,
xalign = 1
};

is_default_check = new Gtk.CheckButton.with_label (_("Mark as default calendar"));

Expand Down Expand Up @@ -230,15 +245,15 @@ public class Maya.View.SourceDialog : Granite.Dialog {
margin_start = 12,
margin_bottom = 24,
column_spacing = 12,
row_spacing = 6,
row_spacing = 12,
vexpand = true
};
main_grid.attach (type_label, 0, 0);
main_grid.attach (type_combobox, 1, 0);
main_grid.attach (name_label, 0, 1);
main_grid.attach (name_entry, 1, 1);
main_grid.attach (color_label, 0, 2);
main_grid.attach (color_grid, 1, 2);
main_grid.attach (color_box, 1, 2);
main_grid.attach (is_default_check, 1, 3);
main_grid.show_all ();

Expand Down