diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc32b73c5..385583829 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libchamplain-0.12-dev libchamplain-gtk-0.12-dev libclutter-1.0-dev libecal2.0-dev libedataserver1.2-dev libedataserverui1.2-dev libfolks-dev libgee-0.8-dev libgeoclue-2-dev libgeocode-glib-dev libglib2.0-dev libgranite-dev libgtk-3-dev libhandy-1-dev libical-dev libportal-dev libportal-gtk3-dev meson valac + apt install -y libadwaita-1-dev libecal2.0-dev libedataserver1.2-dev libedataserverui4-dev libfolks-dev libgee-0.8-dev libgeoclue-2-dev libgeocode-glib-dev libglib2.0-dev libgranite-7-dev libgtk-4-dev libical-dev libportal-dev libportal-gtk4-dev libshumate-dev meson valac - name: Build and Test env: DESTDIR: out diff --git a/README.md b/README.md index 4885658ee..332ba14d0 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,7 @@ You'll need the following dependencies: -* libchamplain-0.12-dev -* libchamplain-gtk-0.12-dev -* libclutter-1.0-dev +* libadwaita-1-dev * libecal1.2-dev * libedataserverui1.2-dev >=3.46 * libfolks-dev @@ -17,10 +15,10 @@ You'll need the following dependencies: * libgeocode-glib-dev * libgeoclue-2-dev * libglib2.0-dev -* libgranite-dev >= 6.2.0 -* libgtk-3-dev +* libgranite-7-dev >= 7.7.0 +* libgtk-4-dev >= 4.12 * libical-dev -* libhandy-1-dev >= 0.90.0 +* libshumate-dev * meson * valac diff --git a/core/GesturesUtils.vala b/core/GesturesUtils.vala index 5097bb938..48adba0b9 100644 --- a/core/GesturesUtils.vala +++ b/core/GesturesUtils.vala @@ -23,7 +23,7 @@ namespace Maya.GesturesUtils { static bool has_scrolled = false; const uint INTERVAL = 500; - public void on_scroll (Gtk.EventControllerScroll scroll_controller, double delta_x, double delta_y) { + public bool on_scroll (Gtk.EventControllerScroll scroll_controller, double delta_x, double delta_y) { double choice = delta_x; if (((int)delta_x).abs () < ((int)delta_y).abs ()) { choice = delta_y; @@ -33,27 +33,29 @@ namespace Maya.GesturesUtils { if (choice == 1 || choice == -1) { Calendar.EventStore.get_default ().change_month ((int) choice); scroll_controller.reset (); - return; + return true; } if (has_scrolled == true) { scroll_controller.reset (); - return; + return true; } if (choice > 0.3) { reset_timer.begin (); Calendar.EventStore.get_default ().change_month (1); scroll_controller.reset (); - return; + return true; } if (choice < -0.3) { reset_timer.begin (); Calendar.EventStore.get_default ().change_month (-1); scroll_controller.reset (); - return; + return true; } + + return false; } public async void reset_timer () { diff --git a/data/io.elementary.calendar.gschema.xml b/data/io.elementary.calendar.gschema.xml index f531321a0..6cd6074c0 100644 --- a/data/io.elementary.calendar.gschema.xml +++ b/data/io.elementary.calendar.gschema.xml @@ -12,10 +12,15 @@ Whether the window was maximized on last run Whether the window was maximized on last run - - (1024, 750) - Most recent window size - Most recent window size (width, height) + + 750 + Most recent window height + Most recent window height + + + 1024 + Most recent window width + Most recent window width true diff --git a/data/meson.build b/data/meson.build index 515473194..f9e09f927 100644 --- a/data/meson.build +++ b/data/meson.build @@ -50,7 +50,7 @@ i18n.merge_file( i18n.merge_file( input: 'calendar.metainfo.xml.in', output: meson.project_name() + '.metainfo.xml', - po_dir: meson.source_root() / 'po' / 'extra', + po_dir: meson.project_source_root() / 'po' / 'extra', type: 'xml', install: true, install_dir: get_option('datadir') / 'metainfo', diff --git a/meson.build b/meson.build index 044af293b..2fc8faeb8 100644 --- a/meson.build +++ b/meson.build @@ -22,30 +22,21 @@ gnome = import('gnome') i18n = import('i18n') pkgconfig = import('pkgconfig') +adw_dep = dependency('libadwaita-1', version: '>=1.0.0') glib_dep = dependency('glib-2.0') gee_dep = dependency('gee-0.8') -granite_dep = dependency('granite', version: '>=6.2.0') -gtk_dep = dependency('gtk+-3.0', version: '>=3.22') -handy_dep = dependency('libhandy-1', version: '>=0.90.0') -libedataserver_dep = dependency('libedataserver-1.2', version: '>=3.8.0') -libedataserverui_dep = dependency('libedataserverui-1.2', version: '>=3.46') +granite_dep = dependency('granite-7', version: '>=7.7.0') +gtk_dep = dependency('gtk4', version: '>=4.12') +libedataserver_dep = dependency('libedataserver-1.2', version: '>=3.45.1') +libedataserverui_dep = dependency('libedataserverui4-1.0', version: '>= 3.46.4') geocode_glib_dep = dependency('geocode-glib-2.0') gmodule_dep = dependency('gmodule-2.0') -champlain_dep = dependency('champlain-0.12', fallback: ['libchamplain', 'libchamplain_dep'], default_options: ['default_library=static', 'introspection=false', 'vapi=false']) -champlain_gtk_dep = dependency('champlain-gtk-0.12', fallback: ['libchamplain', 'libchamplain_gtk_dep'], default_options: ['default_library=static', 'introspection=false', 'vapi=false']) -# We need to force the inclusion of the Vapi in case of fallback -if (champlain_dep.type_name() == 'internal') - vapi_dir = meson.current_source_dir() / 'vapi' - champlain_dep = [champlain_dep, meson.get_compiler('vala').find_library('champlain-0.12', dirs: vapi_dir)] - champlain_gtk_dep = [champlain_gtk_dep, meson.get_compiler('vala').find_library('champlain-gtk-0.12', dirs: vapi_dir)] -endif -clutter_dep = dependency('clutter-1.0') -clutter_gtk_dep = dependency('clutter-gtk-1.0') folks_dep = dependency('folks') gclue_dep = dependency('libgeoclue-2.0') libecal_dep = dependency('libecal-2.0') libical_dep = dependency('libical-glib') -libportal_dep = [ dependency('libportal'), dependency('libportal-gtk3') ] +libportal_dep = [ dependency('libportal'), dependency('libportal-gtk4') ] +shumate_dep = dependency('shumate-1.0') add_project_arguments('-DLIBICAL_GLIB_UNSTABLE_API=1', language: 'c') diff --git a/src/AgendaView.vala b/src/AgendaView.vala index b0fbeec5a..f760aeb37 100644 --- a/src/AgendaView.vala +++ b/src/AgendaView.vala @@ -10,7 +10,7 @@ public class Maya.View.AgendaView : Gtk.Box { public signal void event_removed (ECal.Component event); - public Hdy.HeaderBar header_bar { get; private set; } + public Adw.HeaderBar header_bar { get; private set; } private Gtk.Label day_label; private Gtk.Label weekday_label; @@ -21,33 +21,35 @@ public class Maya.View.AgendaView : Gtk.Box { construct { var application_instance = ((Gtk.Application) GLib.Application.get_default ()); - var button_add = new Gtk.Button.from_icon_name ("appointment-new", Gtk.IconSize.LARGE_TOOLBAR) { + var button_add = new Gtk.Button.from_icon_name ("appointment-new") { action_name = Maya.MainWindow.ACTION_PREFIX + Maya.MainWindow.ACTION_NEW_EVENT }; button_add.tooltip_markup = Granite.markup_accel_tooltip ( application_instance.get_accels_for_action (button_add.action_name), _("Create a new event") ); + button_add.add_css_class (Granite.STYLE_CLASS_LARGE_ICONS); weekday_label = new Gtk.Label ("") { margin_start = 6, xalign = 0 }; - weekday_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + weekday_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); - header_bar = new Hdy.HeaderBar () { - show_close_button = true + header_bar = new Adw.HeaderBar () { + show_start_title_buttons = false, + show_title = false }; header_bar.pack_start (weekday_label); header_bar.pack_end (button_add); - header_bar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + header_bar.add_css_class (Granite.STYLE_CLASS_FLAT); day_label = new Gtk.Label ("") { margin_start = 12, margin_end = 12, xalign = 0 }; - day_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + day_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); var placeholder_label = new Gtk.Label (_("Your upcoming events will be displayed here when you select a date with events.")) { wrap = true, @@ -56,8 +58,7 @@ public class Maya.View.AgendaView : Gtk.Box { margin_end = 12, justify = CENTER }; - placeholder_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - placeholder_label.show_all (); + placeholder_label.add_css_class (Granite.CssClass.DIM); selected_date_events_list = new Gtk.ListBox () { activate_on_single_click = false, @@ -103,20 +104,20 @@ public class Maya.View.AgendaView : Gtk.Box { }); var box = new Gtk.Box (VERTICAL, 0); - box.add (day_label); - box.add (selected_date_events_list); - box.add (upcoming_events_list); + box.append (day_label); + box.append (selected_date_events_list); + box.append (upcoming_events_list); - var scrolled_window = new Gtk.ScrolledWindow (null, null) { + var scrolled_window = new Gtk.ScrolledWindow () { hscrollbar_policy = NEVER, child = box, vexpand = true }; orientation = VERTICAL; - add (header_bar); - add (scrolled_window); - get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); + append (header_bar); + append (scrolled_window); + add_css_class (Granite.STYLE_CLASS_VIEW); // Listen to changes for events var calmodel = Calendar.EventStore.get_default (); @@ -129,7 +130,6 @@ public class Maya.View.AgendaView : Gtk.Box { time_manager.on_update_today.connect (on_today_changed); set_selected_date (Maya.Application.get_selected_datetime ()); - show_all (); selected_date_events_list.row_activated.connect (activate_eventrow); upcoming_events_list.row_activated.connect (activate_eventrow); @@ -303,13 +303,11 @@ public class Maya.View.AgendaView : Gtk.Box { foreach (var event in events) { var row = new AgendaEventRow (source, event, false); row.removed.connect ((event) => (event_removed (event))); - row.show_all (); - selected_date_events_list.add (row); + selected_date_events_list.append (row); var row2 = new AgendaEventRow (source, event, true); row2.removed.connect ((event) => (event_removed (event))); - row2.show_all (); - upcoming_events_list.add (row2); + upcoming_events_list.append (row2); } } @@ -372,13 +370,8 @@ public class Maya.View.AgendaView : Gtk.Box { * Calendar model parameters have been updated. */ private void on_model_parameters_changed () { - foreach (unowned var row in selected_date_events_list.get_children ()) { - row.destroy (); - } - - foreach (unowned var row in upcoming_events_list.get_children ()) { - row.destroy (); - } + selected_date_events_list.remove_all (); + upcoming_events_list.remove_all (); } private void on_today_changed () { diff --git a/src/Application.vala b/src/Application.vala index 32ec2afff..6c1ceefa4 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -65,25 +65,8 @@ namespace Maya { protected override void startup () { base.startup (); - Hdy.init (); - - var style_provider = new Gtk.CssProvider (); - style_provider.load_from_resource ("/io/elementary/calendar/Application.css"); - - Gtk.StyleContext.add_provider_for_screen ( - Gdk.Screen.get_default (), - style_provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION - ); - - var granite_settings = Granite.Settings.get_default (); - var gtk_settings = Gtk.Settings.get_default (); - - gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK; - - granite_settings.notify["prefers-color-scheme"].connect (() => { - gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK; - }); + Granite.init (); + Adw.init (); var quit_action = new SimpleAction ("quit", null); quit_action.activate.connect (quit); @@ -161,16 +144,22 @@ namespace Maya { * Initializes the graphical window and its components */ void init_gui () { - var rect = Gtk.Allocation (); - saved_state.get ("window-size", "(ii)", out rect.width, out rect.height); - window = new MainWindow (this); window.title = _(Build.APP_NAME); - window.set_allocation (rect); + + /* + * This is very finicky. Bind size after present else set_titlebar gives us bad sizes + * Set maximize after height/width else window is min size on unmaximize + * Bind maximize as SET else get get bad sizes + */ + saved_state.bind ("window-height", window, "default-height", SettingsBindFlags.DEFAULT); + saved_state.bind ("window-width", window, "default-width", SettingsBindFlags.DEFAULT); if (saved_state.get_boolean ("window-maximized")) { window.maximize (); } + + saved_state.bind ("window-maximized", window, "maximized", SettingsBindFlags.SET); } public async bool ask_for_background () { @@ -211,7 +200,6 @@ namespace Maya { } public static int main (string[] args) { - GtkClutter.init (ref args); var app = new Application (); int res = app.run (args); diff --git a/src/EventEdition/EventDialog.vala b/src/EventEdition/EventDialog.vala index 85e578d05..f08f3856e 100644 --- a/src/EventEdition/EventDialog.vala +++ b/src/EventEdition/EventDialog.vala @@ -114,20 +114,22 @@ public class EventDialog : Granite.Dialog { stack.add_titled (reminder_panel, "reminderpanel", _("Reminders")); ///Translators: The name of the repeat panel tab stack.add_titled (repeat_panel, "repeatpanel", C_("Section Header", "Repeat")); //vala-lint=space-before-paren - stack.child_set_property (info_panel, "icon-name", "office-calendar-symbolic"); - stack.child_set_property (location_panel, "icon-name", "mark-location-symbolic"); - stack.child_set_property (guests_panel, "icon-name", "system-users-symbolic"); - stack.child_set_property (reminder_panel, "icon-name", "alarm-symbolic"); - stack.child_set_property (repeat_panel, "icon-name", "media-playlist-repeat-symbolic"); + + stack.get_page (info_panel).set_property ("icon-name", "office-calendar-symbolic"); + stack.get_page (location_panel).set_property ("icon-name", "mark-location-symbolic"); + stack.get_page (guests_panel).set_property ("icon-name", "system-users-symbolic"); + stack.get_page (reminder_panel).set_property ("icon-name", "alarm-symbolic"); + stack.get_page (repeat_panel).set_property ("icon-name", "media-playlist-repeat-symbolic"); var stack_switcher = new Gtk.StackSwitcher () { - homogeneous = true, margin_end = 12, margin_start = 12, stack = stack }; + ((Gtk.BoxLayout) stack_switcher.layout_manager).homogeneous = true; var buttonbox = new Gtk.Box (HORIZONTAL, 6) { + halign = END, baseline_position = CENTER, margin_end = 12, margin_start = 12 @@ -138,14 +140,14 @@ public class EventDialog : Granite.Dialog { halign = START, hexpand = true }; - delete_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + delete_button.add_css_class (Granite.CssClass.DESTRUCTIVE); delete_button.clicked.connect (remove_event); - buttonbox.add (delete_button); + buttonbox.append (delete_button); } var create_button = new Gtk.Button (); - create_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + create_button.add_css_class (Granite.CssClass.SUGGESTED); create_button.clicked.connect (save_dialog); if (date_time != null) { @@ -158,20 +160,19 @@ public class EventDialog : Granite.Dialog { var cancel_button = new Gtk.Button.with_label (_("Cancel")); cancel_button.clicked.connect (() => {this.destroy ();}); - buttonbox.add (cancel_button); - buttonbox.add (create_button); + buttonbox.append (cancel_button); + buttonbox.append (create_button); var button_sizegroup = new Gtk.SizeGroup (HORIZONTAL); button_sizegroup.add_widget (cancel_button); button_sizegroup.add_widget (create_button); - var box = new Gtk.Box (VERTICAL, 24); - box.add (stack_switcher); - box.add (stack); - box.add (buttonbox); - box.show_all (); + var box = new Granite.Box (VERTICAL, DOUBLE); + box.append (stack_switcher); + box.append (stack); + box.append (buttonbox); - get_content_area ().add (box); + get_content_area ().append (box); info_panel.valid_event.connect ((is_valid) => { create_button.sensitive = is_valid; diff --git a/src/EventEdition/GuestGrid.vala b/src/EventEdition/GuestGrid.vala index d5794fa24..54715d883 100644 --- a/src/EventEdition/GuestGrid.vala +++ b/src/EventEdition/GuestGrid.vala @@ -14,7 +14,7 @@ public class Maya.View.EventEdition.GuestGrid : Gtk.Grid { private Gtk.Label mail_label; private Gtk.Label name_label; - private Hdy.Avatar avatar; + private Adw.Avatar avatar; public GuestGrid (ICal.Property attendee) { Object (attendee: attendee.clone ()); @@ -24,7 +24,7 @@ public class Maya.View.EventEdition.GuestGrid : Gtk.Grid { var status_label = new Gtk.Label ("") { justify = RIGHT }; - status_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + status_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); var mail = attendee.get_attendee ().replace ("mailto:", ""); @@ -39,12 +39,12 @@ public class Maya.View.EventEdition.GuestGrid : Gtk.Grid { xalign = 0 }; - var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic", BUTTON) { - relief = NONE, + var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") { + has_frame = false, valign = CENTER }; - avatar = new Hdy.Avatar (ICON_SIZE, name_label.label, true); + avatar = new Adw.Avatar (ICON_SIZE, name_label.label, true); column_spacing = 12; margin_top = 6; @@ -64,15 +64,15 @@ public class Maya.View.EventEdition.GuestGrid : Gtk.Grid { switch (parameter.get_partstat ()) { case ICal.ParameterPartstat.ACCEPTED: status_label.label = _("Accepted"); - status_label.get_style_context ().add_class ("success"); + status_label.add_css_class (Granite.CssClass.SUCCESS); break; case ICal.ParameterPartstat.DECLINED: status_label.label = _("Declined"); - status_label.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR); + status_label.add_css_class (Granite.CssClass.ERROR); break; case ICal.ParameterPartstat.TENTATIVE: status_label.label = _("Maybe"); - status_label.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR); + status_label.add_css_class (Granite.CssClass.WARNING); break; default: break; @@ -117,7 +117,17 @@ public class Maya.View.EventEdition.GuestGrid : Gtk.Grid { avatar.text = individual.display_name; if (individual.avatar != null) { - avatar.set_loadable_icon (individual.avatar); + try { + individual.avatar.load (ICON_SIZE, null); + var avatar_image = new Gtk.Image.from_file (individual.avatar.to_string ()) { + width_request = avatar.size, + height_request = avatar.size + }; + + avatar.set_custom_image (new Gtk.WidgetPaintable (avatar_image)); + } catch (Error e) { + critical (e.message); + } } if (individual.full_name != null && individual.full_name != "") { diff --git a/src/EventEdition/GuestsPanel.vala b/src/EventEdition/GuestsPanel.vala index 88fb1d960..e9b810a42 100644 --- a/src/EventEdition/GuestsPanel.vala +++ b/src/EventEdition/GuestsPanel.vala @@ -37,9 +37,8 @@ public class Maya.View.EventEdition.GuestsPanel : Gtk.Box { load_contacts.begin (); var no_guests_label = new Gtk.Label (_("No Invitees")); - no_guests_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); - no_guests_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - no_guests_label.show (); + no_guests_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); + no_guests_label.add_css_class (Granite.CssClass.DIM); guest_list = new Gtk.ListBox () { hexpand = true, @@ -52,7 +51,7 @@ public class Maya.View.EventEdition.GuestsPanel : Gtk.Box { mnemonic_widget = guest_list }; - var guest_scrolledwindow = new Gtk.ScrolledWindow (null, null) { + var guest_scrolledwindow = new Gtk.ScrolledWindow () { child = guest_list }; @@ -80,7 +79,7 @@ public class Maya.View.EventEdition.GuestsPanel : Gtk.Box { return false; }); - guest_entry = new Gtk.SearchEntry () { + guest_entry = new Gtk.Entry () { hexpand = true, placeholder_text = _("Invite") }; @@ -96,9 +95,9 @@ public class Maya.View.EventEdition.GuestsPanel : Gtk.Box { margin_end = 12; spacing = 6; orientation = VERTICAL; - add (guest_label); - add (guest_entry); - add (frame); + append (guest_label); + append (guest_entry); + append (frame); var property = component.get_first_property (ATTENDEE_PROPERTY); for (int i = 0; i < component.count_properties (ATTENDEE_PROPERTY); i++) { @@ -108,8 +107,6 @@ public class Maya.View.EventEdition.GuestsPanel : Gtk.Box { property = component.get_next_property (ATTENDEE_PROPERTY); } - - show_all (); } /** @@ -167,9 +164,8 @@ public class Maya.View.EventEdition.GuestsPanel : Gtk.Box { var row = new Gtk.ListBoxRow () { child = guest_element }; - row.show_all (); - guest_list.add (row); + guest_list.append (row); attendees.add (guest_element.attendee); diff --git a/src/EventEdition/InfoPanel.vala b/src/EventEdition/InfoPanel.vala index 447d27d1e..c67d48326 100644 --- a/src/EventEdition/InfoPanel.vala +++ b/src/EventEdition/InfoPanel.vala @@ -21,11 +21,11 @@ public class Maya.View.EventEdition.InfoPanel : Gtk.Grid { private Gtk.Entry title_entry; private Granite.HyperTextView comment_textview; - private Granite.Widgets.DatePicker from_date_picker; - private Granite.Widgets.DatePicker to_date_picker; + private Granite.DatePicker from_date_picker; + private Granite.DatePicker to_date_picker; private Gtk.Switch allday_switch; - private Granite.Widgets.TimePicker from_time_picker; - private Granite.Widgets.TimePicker to_time_picker; + private Granite.TimePicker from_time_picker; + private Granite.TimePicker to_time_picker; private Gtk.Label timezone_label; private Widgets.CalendarChooser calchooser; @@ -149,8 +149,9 @@ public class Maya.View.EventEdition.InfoPanel : Gtk.Grid { margin_bottom = 6 }; - var popover = new Gtk.Popover (null) { + var popover = new Gtk.Popover () { child = calchooser, + has_arrow = false, width_request = 310 }; @@ -160,8 +161,8 @@ public class Maya.View.EventEdition.InfoPanel : Gtk.Grid { }; var button_box = new Gtk.Box (HORIZONTAL, 6); - button_box.add (current_calendar_grid); - button_box.add (new Gtk.Image.from_icon_name ("pan-down-symbolic", Gtk.IconSize.MENU)); + button_box.append (current_calendar_grid); + button_box.append (new Gtk.Image.from_icon_name ("pan-down-symbolic")); var calendar_button = new Gtk.MenuButton () { child = button_box, @@ -190,7 +191,7 @@ public class Maya.View.EventEdition.InfoPanel : Gtk.Grid { mnemonic_widget = comment_textview }; - var scrolled = new Gtk.ScrolledWindow (null, null) { + var scrolled = new Gtk.ScrolledWindow () { child = comment_textview, height_request = 100, hexpand = true, @@ -373,15 +374,15 @@ public class Maya.View.EventEdition.InfoPanel : Gtk.Grid { timezone_label.label = timezone.get_display_name (); } - Granite.Widgets.DatePicker make_date_picker () { + Granite.DatePicker make_date_picker () { var format = Granite.DateTime.get_default_date_format (false, true, true); - var date_picker = new Granite.Widgets.DatePicker.with_format (format); + var date_picker = new Granite.DatePicker.with_format (format); date_picker.width_request = 200; return date_picker; } - Granite.Widgets.TimePicker make_time_picker () { - var time_picker = new Granite.Widgets.TimePicker (); + Granite.TimePicker make_time_picker () { + var time_picker = new Granite.TimePicker (); time_picker.width_request = 120; return time_picker; } diff --git a/src/EventEdition/LocationPanel.vala b/src/EventEdition/LocationPanel.vala index 00187d535..152721af7 100644 --- a/src/EventEdition/LocationPanel.vala +++ b/src/EventEdition/LocationPanel.vala @@ -8,10 +8,10 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { private EventDialog parent_dialog; - private Gtk.SearchEntry location_entry; + private Gtk.Entry location_entry; private Gtk.ListStore location_store; - private GtkChamplain.Embed champlain_embed; - private Maya.Marker point; + private Shumate.SimpleMap simple_map; + private Shumate.Marker point; // Only set the geo property if map_selected is true, this is a smart behavior! private bool map_selected = false; private GLib.Cancellable search_cancellable; @@ -47,7 +47,7 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { location_completion.set_text_column (1); location_completion.match_selected.connect ((model, iter) => suggestion_selected (model, iter)); - location_entry = new Gtk.SearchEntry () { + location_entry = new Gtk.Entry () { completion = location_completion, hexpand = true, placeholder_text = _("John Smith OR Example St.") @@ -60,37 +60,47 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { mnemonic_widget = location_entry }; - champlain_embed = new GtkChamplain.Embed (); + var registry = new Shumate.MapSourceRegistry.with_defaults (); - point = new Maya.Marker (); - point.drag_finish.connect (() => { - map_selected = true; - find_location.begin (point.latitude, point.longitude); - }); + simple_map = new Shumate.SimpleMap () { + map_source = registry.get_by_id (Shumate.MAP_SOURCE_OSM_MAPNIK), + vexpand = true + }; + + point = new Shumate.Marker () { + child = new Gtk.Image.from_icon_name ("location-marker") { + icon_size = LARGE + } + }; + // point.drag_finish.connect (() => { + // map_selected = true; + // find_location.begin (point.latitude, point.longitude); + // }); - var marker_layer = new Champlain.MarkerLayer.full (SINGLE); + var marker_layer = new Shumate.MarkerLayer.full (simple_map.viewport, SINGLE); marker_layer.add_marker (point); - var view = champlain_embed.champlain_view; + var view = simple_map.viewport; view.zoom_level = 10; - view.goto_animation_duration = 500; - view.add_layer (marker_layer); - view.center_on (point.latitude, point.longitude); + var map = simple_map.map; + map.go_to_duration = 500; + map.add_layer (marker_layer); + map.center_on (point.latitude, point.longitude); load_contact.begin (); var frame = new Gtk.Frame (null) { - child = champlain_embed + child = simple_map }; margin_start = 12; margin_end = 12; orientation = VERTICAL; spacing = 6; - add (location_label); - add (location_entry); - add (frame); + append (location_label); + append (location_entry); + append (frame); // Load the location if (parent_dialog.ecal != null) { @@ -108,8 +118,8 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { if (geo != null) { var latitude = geo.get_lat (); var longitude = geo.get_lon (); - if (latitude >= Champlain.MIN_LATITUDE && longitude >= Champlain.MIN_LONGITUDE && - latitude <= Champlain.MAX_LATITUDE && longitude <= Champlain.MAX_LONGITUDE) { + if (latitude >= Shumate.MIN_LATITUDE && longitude >= Shumate.MIN_LONGITUDE && + latitude <= Shumate.MAX_LATITUDE && longitude <= Shumate.MAX_LONGITUDE) { need_relocation = false; point.latitude = latitude; point.longitude = longitude; @@ -169,8 +179,10 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { } private async void compute_location (string loc) { - if (search_cancellable != null) + if (search_cancellable != null) { search_cancellable.cancel (); + } + search_cancellable = new GLib.Cancellable (); var forward = new Geocode.Forward.for_string (loc); try { @@ -180,16 +192,19 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { point.latitude = place.location.latitude; point.longitude = place.location.longitude; Idle.add (() => { - if (search_cancellable.is_cancelled () == false) - champlain_embed.champlain_view.go_to (point.latitude, point.longitude); + if (search_cancellable.is_cancelled () == false) { + simple_map.map.go_to (point.latitude, point.longitude); + } + return false; }); } - if (loc == location_entry.text) + if (loc == location_entry.text) { map_selected = true; + } - location_entry.has_focus = true; + location_entry.grab_focus (); } catch (Error error) { debug (error.message); } @@ -236,8 +251,10 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { point.latitude = simple.location.latitude; point.longitude = simple.location.longitude; Idle.add (() => { - if (search_cancellable.is_cancelled () == false) - champlain_embed.champlain_view.go_to (point.latitude, point.longitude); + if (search_cancellable.is_cancelled () == false) { + simple_map.map.go_to (point.latitude, point.longitude); + } + return false; }); @@ -299,24 +316,3 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box { return true; } } - -public class Maya.Marker : Champlain.Marker { - public Marker () { - try { - weak Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default (); - var pixbuf = icon_theme.load_icon ("location-marker", 32, Gtk.IconLookupFlags.GENERIC_FALLBACK); - Clutter.Image image = new Clutter.Image (); - image.set_data (pixbuf.get_pixels (), - pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, - pixbuf.width, - pixbuf.height, - pixbuf.rowstride); - content = image; - set_size (pixbuf.width, pixbuf.height); - translation_x = -pixbuf.width / 2; - translation_y = -pixbuf.height; - } catch (Error e) { - critical (e.message); - } - } -} diff --git a/src/EventEdition/ReminderPanel.vala b/src/EventEdition/ReminderPanel.vala index 0b831fa04..3f1713f54 100644 --- a/src/EventEdition/ReminderPanel.vala +++ b/src/EventEdition/ReminderPanel.vala @@ -15,10 +15,8 @@ public class Maya.View.EventEdition.ReminderPanel : Gtk.Box { this.parent_dialog = parent_dialog; var no_reminder_label = new Gtk.Label (_("No Reminders")); - no_reminder_label.show (); - - no_reminder_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); - no_reminder_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + no_reminder_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); + no_reminder_label.add_css_class (Granite.CssClass.DIM); reminders = new Gee.ArrayList (); reminders_to_remove = new Gee.ArrayList (); @@ -34,28 +32,28 @@ public class Maya.View.EventEdition.ReminderPanel : Gtk.Box { mnemonic_widget = reminder_list }; - var scrolled = new Gtk.ScrolledWindow (null, null) { + var scrolled = new Gtk.ScrolledWindow () { child = reminder_list, hexpand = true, vexpand = true, }; var add_button_box = new Gtk.Box (HORIZONTAL, 0); - add_button_box.add (new Gtk.Image.from_icon_name ("list-add-symbolic", BUTTON)); - add_button_box.add (new Gtk.Label (_("Add Reminder"))); + add_button_box.append (new Gtk.Image.from_icon_name ("list-add-symbolic")); + add_button_box.append (new Gtk.Label (_("Add Reminder"))); var add_button = new Gtk.Button () { - child = add_button_box + child = add_button_box, + has_frame = false }; - add_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); var inline_toolbar = new Gtk.ActionBar (); - inline_toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + inline_toolbar.add_css_class (Granite.STYLE_CLASS_FLAT); inline_toolbar.pack_start (add_button); var box = new Gtk.Box (VERTICAL, 0); - box.add (scrolled); - box.add (inline_toolbar); + box.append (scrolled); + box.append (inline_toolbar); var frame = new Gtk.Frame (null) { child = box, @@ -64,8 +62,8 @@ public class Maya.View.EventEdition.ReminderPanel : Gtk.Box { margin_start = margin_end = 12; orientation = VERTICAL; - add (reminder_label); - add (frame); + append (reminder_label); + append (frame); load (); @@ -76,9 +74,8 @@ public class Maya.View.EventEdition.ReminderPanel : Gtk.Box { private ReminderGrid add_reminder (string uid) { var reminder = new ReminderGrid (uid); - reminder.show_all (); - reminder_list.add (reminder); + reminder_list.append (reminder); reminders.add (reminder); @@ -188,10 +185,10 @@ public class Maya.View.EventEdition.ReminderGrid : Gtk.ListBoxRow { } }); - var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic", BUTTON) { - relief = NONE + var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") { + has_frame = false }; - remove_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + remove_button.add_css_class (Granite.CssClass.DESTRUCTIVE); var box = new Gtk.Box (HORIZONTAL, 6) { margin_top = 6, @@ -199,8 +196,8 @@ public class Maya.View.EventEdition.ReminderGrid : Gtk.ListBoxRow { margin_bottom = 6, margin_start = 6 }; - box.add (time); - box.add (remove_button); + box.append (time); + box.append (remove_button); child = box; diff --git a/src/EventEdition/RepeatPanel.vala b/src/EventEdition/RepeatPanel.vala index be88fb06a..785347957 100644 --- a/src/EventEdition/RepeatPanel.vala +++ b/src/EventEdition/RepeatPanel.vala @@ -5,13 +5,13 @@ * Authored by: Jaap Broekhuizen */ -public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { +public class Maya.View.EventEdition.RepeatPanel : Granite.Bin { private EventDialog parent_dialog; private Gtk.Switch repeat_switch; private Gtk.ComboBoxText repeat_combobox; private Gtk.ComboBoxText ends_combobox; private Gtk.SpinButton repeats_spinbutton; - private Granite.Widgets.DatePicker end_datepicker; + private Granite.DatePicker end_datepicker; private Gtk.Box week_box; private Gtk.SpinButton every_entry; private Gtk.ListBox exceptions_list; @@ -24,8 +24,8 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { private Gtk.ToggleButton sat_button; private Gtk.ToggleButton sun_button; - private Gtk.RadioButton every_radiobutton; - private Gtk.RadioButton same_radiobutton; + private Gtk.CheckButton every_radiobutton; + private Gtk.CheckButton same_radiobutton; public RepeatPanel (EventDialog parent_dialog) { this.parent_dialog = parent_dialog; @@ -47,8 +47,8 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { repeat_combobox.active = 1; var repeat_box = new Gtk.Box (HORIZONTAL, 12); - repeat_box.add (repeat_switch); - repeat_box.add (repeat_combobox); + repeat_box.append (repeat_switch); + repeat_box.append (repeat_combobox); var every_label = new Granite.HeaderLabel (_("Every:")); @@ -61,8 +61,8 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { var every_box = new Gtk.Box (HORIZONTAL, 12) { sensitive = false }; - every_box.add (every_entry); - every_box.add (every_unit_label); + every_box.append (every_entry); + every_box.append (every_unit_label); var ends_label = new Granite.HeaderLabel (_("Ends:")); @@ -84,8 +84,8 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { var repeats_label = new Gtk.Label (ngettext ("Repeat", "Repeats", 1)); var end_repeat_box = new Gtk.Box (HORIZONTAL, 12); - end_repeat_box.add (repeats_spinbutton); - end_repeat_box.add (repeats_label); + end_repeat_box.append (repeats_spinbutton); + end_repeat_box.append (repeats_label); var end_repeat_revealer = new Gtk.Revealer () { child = end_repeat_box @@ -93,18 +93,18 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { var format = Granite.DateTime.get_default_date_format (false, true, true); - end_datepicker = new Granite.Widgets.DatePicker.with_format (format); + end_datepicker = new Granite.DatePicker.with_format (format); var end_date_revealer = new Gtk.Revealer () { child = end_datepicker }; - var ends_grid = new Gtk.Box (VERTICAL, 6) { + var ends_box = new Granite.Box (VERTICAL, HALF) { sensitive = false }; - ends_grid.add (ends_combobox); - ends_grid.add (end_date_revealer); - ends_grid.add (end_repeat_revealer); + ends_box.append (ends_combobox); + ends_box.append (end_date_revealer); + ends_box.append (end_repeat_revealer); mon_button = new Gtk.ToggleButton.with_label (_("Mon")); tue_button = new Gtk.ToggleButton.with_label (_("Tue")); @@ -118,26 +118,28 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { homogeneous = true, sensitive = false }; - week_box.add (mon_button); - week_box.add (tue_button); - week_box.add (wed_button); - week_box.add (thu_button); - week_box.add (fri_button); - week_box.add (sat_button); - week_box.add (sun_button); + week_box.append (mon_button); + week_box.append (tue_button); + week_box.append (wed_button); + week_box.append (thu_button); + week_box.append (fri_button); + week_box.append (sat_button); + week_box.append (sun_button); var weekday_revealer = new Gtk.Revealer () { child = week_box }; - same_radiobutton = new Gtk.RadioButton.with_label (null, _("The same day every month")); - every_radiobutton = new Gtk.RadioButton.from_widget (same_radiobutton); + same_radiobutton = new Gtk.CheckButton.with_label (_("The same day every month")); + every_radiobutton = new Gtk.CheckButton () { + group = same_radiobutton + }; var monthly_box = new Gtk.Box (VERTICAL, 6) { sensitive = false }; - monthly_box.add (same_radiobutton); - monthly_box.add (every_radiobutton); + monthly_box.append (same_radiobutton); + monthly_box.append (every_radiobutton); var monthly_revealer = new Gtk.Revealer () { child = monthly_box @@ -149,10 +151,8 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { margin_top = 12, margin_bottom = 12 }; - no_exceptions_label.show (); - - no_exceptions_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); - no_exceptions_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + no_exceptions_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); + no_exceptions_label.add_css_class (Granite.CssClass.DIM); exceptions_list = new Gtk.ListBox () { selection_mode = NONE @@ -160,42 +160,43 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { exceptions_list.set_placeholder (no_exceptions_label); var add_button_box = new Gtk.Box (HORIZONTAL, 0); - add_button_box.add (new Gtk.Image.from_icon_name ("list-add-symbolic", BUTTON)); - add_button_box.add (new Gtk.Label (_("Add Exception"))); + add_button_box.append (new Gtk.Image.from_icon_name ("list-add-symbolic")); + add_button_box.append (new Gtk.Label (_("Add Exception"))); var add_button = new Gtk.Button () { child = add_button_box, - relief = NONE + has_frame = false }; var inline_toolbar = new Gtk.ActionBar (); - inline_toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); - inline_toolbar.add (add_button); + inline_toolbar.add_css_class (Granite.STYLE_CLASS_FLAT); + inline_toolbar.pack_start (add_button); var exceptions_box = new Gtk.Box (VERTICAL, 0) { margin_bottom = 12, + overflow = HIDDEN, sensitive = false }; - exceptions_box.add (exceptions_list); - exceptions_box.add (inline_toolbar); - exceptions_box.get_style_context ().add_class (Granite.STYLE_CLASS_CARD); + exceptions_box.append (exceptions_list); + exceptions_box.append (inline_toolbar); + exceptions_box.add_css_class (Granite.CssClass.CARD); - var main_box = new Gtk.Box (VERTICAL, 6) { + var main_box = new Granite.Box (VERTICAL, HALF) { margin_start = 12, margin_end = 12 }; - main_box.add (reminder_label); - main_box.add (repeat_box); - main_box.add (every_label); - main_box.add (every_box); - main_box.add (weekday_revealer); - main_box.add (monthly_revealer); - main_box.add (ends_label); - main_box.add (ends_grid); - main_box.add (exceptions_label); - main_box.add (exceptions_box); - - var scrolled = new Gtk.ScrolledWindow (null, null) { + main_box.append (reminder_label); + main_box.append (repeat_box); + main_box.append (every_label); + main_box.append (every_box); + main_box.append (weekday_revealer); + main_box.append (monthly_revealer); + main_box.append (ends_label); + main_box.append (ends_box); + main_box.append (exceptions_label); + main_box.append (exceptions_box); + + var scrolled = new Gtk.ScrolledWindow () { child = main_box }; @@ -206,8 +207,7 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { add_button.clicked.connect (() => { var exception_grid = new ExceptionGrid (new GLib.DateTime.now_local ()); - exception_grid.show_all (); - exceptions_list.add (exception_grid); + exceptions_list.append (exception_grid); }); repeat_switch.notify["active"].connect (() => { @@ -216,7 +216,7 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { every_box.sensitive = active; week_box.sensitive = active; monthly_box.sensitive = active; - ends_grid.sensitive = active; + ends_box.sensitive = active; exceptions_box.sensitive = active; }); repeat_switch.active = false; @@ -377,8 +377,7 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { while (property != null) { var exdate = property.get_exdate (); var exception_grid = new ExceptionGrid (Calendar.Util.icaltime_to_datetime (exdate)); - exception_grid.show_all (); - exceptions_list.add (exception_grid); + exceptions_list.append (exception_grid); property = comp.get_next_property (ICal.PropertyKind.EXDATE_PROPERTY); } } @@ -547,67 +546,60 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { private void reorder_week_box () { switch (Calendar.EventStore.get_default ().week_starts_on) { case MONDAY: - week_box.reorder_child (mon_button, 0); - week_box.reorder_child (tue_button, 1); - week_box.reorder_child (wed_button, 2); - week_box.reorder_child (thu_button, 3); - week_box.reorder_child (fri_button, 4); - week_box.reorder_child (sat_button, 5); - week_box.reorder_child (sun_button, 6); + week_box.reorder_child_after (tue_button, mon_button); + week_box.reorder_child_after (wed_button, tue_button); + week_box.reorder_child_after (thu_button, wed_button); + week_box.reorder_child_after (fri_button, thu_button); + week_box.reorder_child_after (sat_button, fri_button); + week_box.reorder_child_after (sun_button, sat_button); break; case TUESDAY: - week_box.reorder_child (tue_button, 0); - week_box.reorder_child (wed_button, 1); - week_box.reorder_child (thu_button, 2); - week_box.reorder_child (fri_button, 3); - week_box.reorder_child (sat_button, 4); - week_box.reorder_child (sun_button, 5); - week_box.reorder_child (mon_button, 6); + week_box.reorder_child_after (wed_button, tue_button); + week_box.reorder_child_after (thu_button, wed_button); + week_box.reorder_child_after (fri_button, thu_button); + week_box.reorder_child_after (sat_button, fri_button); + week_box.reorder_child_after (sun_button, sat_button); + week_box.reorder_child_after (mon_button, sun_button); break; case WEDNESDAY: - week_box.reorder_child (wed_button, 0); - week_box.reorder_child (thu_button, 1); - week_box.reorder_child (fri_button, 2); - week_box.reorder_child (sat_button, 3); - week_box.reorder_child (sun_button, 4); - week_box.reorder_child (mon_button, 5); - week_box.reorder_child (tue_button, 6); + week_box.reorder_child_after (thu_button, wed_button); + week_box.reorder_child_after (fri_button, thu_button); + week_box.reorder_child_after (sat_button, fri_button); + week_box.reorder_child_after (sun_button, sat_button); + week_box.reorder_child_after (mon_button, sun_button); + week_box.reorder_child_after (tue_button, mon_button); break; case THURSDAY: - week_box.reorder_child (thu_button, 0); - week_box.reorder_child (fri_button, 1); - week_box.reorder_child (sat_button, 2); - week_box.reorder_child (sun_button, 3); - week_box.reorder_child (mon_button, 4); - week_box.reorder_child (tue_button, 5); - week_box.reorder_child (wed_button, 6); + week_box.reorder_child_after (fri_button, thu_button); + week_box.reorder_child_after (sat_button, fri_button); + week_box.reorder_child_after (sun_button, sat_button); + week_box.reorder_child_after (mon_button, sun_button); + week_box.reorder_child_after (tue_button, mon_button); + week_box.reorder_child_after (wed_button, tue_button); break; case FRIDAY: - week_box.reorder_child (fri_button, 0); - week_box.reorder_child (sat_button, 1); - week_box.reorder_child (sun_button, 2); - week_box.reorder_child (mon_button, 3); - week_box.reorder_child (tue_button, 4); - week_box.reorder_child (wed_button, 5); - week_box.reorder_child (thu_button, 6); + week_box.reorder_child_after (sat_button, fri_button); + week_box.reorder_child_after (sun_button, sat_button); + week_box.reorder_child_after (mon_button, sun_button); + week_box.reorder_child_after (tue_button, mon_button); + week_box.reorder_child_after (wed_button, tue_button); + week_box.reorder_child_after (thu_button, wed_button); break; case SATURDAY: - week_box.reorder_child (sat_button, 0); - week_box.reorder_child (sun_button, 1); - week_box.reorder_child (mon_button, 2); - week_box.reorder_child (tue_button, 3); - week_box.reorder_child (wed_button, 4); - week_box.reorder_child (thu_button, 5); - week_box.reorder_child (fri_button, 6); + week_box.reorder_child_after (sun_button, sat_button); + week_box.reorder_child_after (mon_button, sun_button); + week_box.reorder_child_after (tue_button, mon_button); + week_box.reorder_child_after (wed_button, tue_button); + week_box.reorder_child_after (thu_button, wed_button); + week_box.reorder_child_after (fri_button, thu_button); break; case SUNDAY: - week_box.reorder_child (sun_button, 0); - week_box.reorder_child (mon_button, 1); - week_box.reorder_child (tue_button, 2); - week_box.reorder_child (wed_button, 3); - week_box.reorder_child (thu_button, 4); - week_box.reorder_child (fri_button, 5); - week_box.reorder_child (sat_button, 6); + week_box.reorder_child_after (mon_button, sun_button); + week_box.reorder_child_after (tue_button, mon_button); + week_box.reorder_child_after (wed_button, tue_button); + week_box.reorder_child_after (thu_button, wed_button); + week_box.reorder_child_after (fri_button, thu_button); + week_box.reorder_child_after (sat_button, fri_button); break; case BAD_WEEKDAY: break; @@ -761,21 +753,21 @@ public class Maya.View.EventEdition.RepeatPanel : Gtk.Bin { } public class Maya.View.EventEdition.ExceptionGrid : Gtk.ListBoxRow { - private Granite.Widgets.DatePicker date; + private Granite.DatePicker date; public ExceptionGrid (GLib.DateTime dt) { - date = new Granite.Widgets.DatePicker () { + date = new Granite.DatePicker () { date = dt, hexpand = true }; - var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic", BUTTON) { - relief = NONE + var remove_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") { + has_frame = false }; var box = new Gtk.Box (HORIZONTAL, 12); - box.add (date); - box.add (remove_button); + box.append (date); + box.append (remove_button); margin_top = 12; margin_start = 12; diff --git a/src/Grid/CalendarView.vala b/src/Grid/CalendarView.vala index 582f05222..d949b4159 100644 --- a/src/Grid/CalendarView.vala +++ b/src/Grid/CalendarView.vala @@ -21,12 +21,11 @@ public class Maya.View.CalendarView : Gtk.Box { public DateTime? selected_date { get; private set; } public Gtk.SearchEntry search_bar { get; private set; } - public Hdy.HeaderBar header_bar { get; private set; } + public Adw.HeaderBar header_bar { get; private set; } private Calendar.Widgets.DateSwitcher month_switcher; private Calendar.Widgets.DateSwitcher year_switcher; private Grid days_grid; - private Gtk.EventControllerScroll scroll_controller; private Gtk.Stack stack; private WeekLabels weeks; @@ -52,14 +51,13 @@ public class Maya.View.CalendarView : Gtk.Box { selected_date = Maya.Application.get_selected_datetime (); var error_label = new Gtk.Label (null); - error_label.show (); var error_bar = new Gtk.InfoBar () { message_type = Gtk.MessageType.ERROR, revealed = false, show_close_button = true }; - error_bar.get_content_area ().add (error_label); + error_bar.add_child (error_label); var info_label = new Gtk.Label ("%s %s".printf ( _("Network Not Available."), @@ -73,18 +71,19 @@ public class Maya.View.CalendarView : Gtk.Box { message_type = WARNING, revealed = false }; - info_bar.get_content_area ().add (info_label); + info_bar.add_child (info_label); info_bar.add_button (_("Network Settings…"), Gtk.ResponseType.ACCEPT); var application_instance = ((Gtk.Application) GLib.Application.get_default ()); - var button_today = new Gtk.Button.from_icon_name ("calendar-go-today", Gtk.IconSize.LARGE_TOOLBAR) { + var button_today = new Gtk.Button.from_icon_name ("calendar-go-today") { action_name = Maya.MainWindow.ACTION_PREFIX + Maya.MainWindow.ACTION_SHOW_TODAY }; button_today.tooltip_markup = Granite.markup_accel_tooltip ( application_instance.get_accels_for_action (button_today.action_name), _("Go to today's date") ); + button_today.add_css_class (Granite.STYLE_CLASS_LARGE_ICONS); month_switcher = new Calendar.Widgets.DateSwitcher (10) { valign = CENTER @@ -100,13 +99,22 @@ public class Maya.View.CalendarView : Gtk.Box { var source_popover = new Calendar.Widgets.SourcePopover (); var menu_button = new Gtk.MenuButton () { - image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR), + // FIXME: Workaround for stylesheet bug + child = new Gtk.Image.from_icon_name ("open-menu") { + icon_size = LARGE + }, + has_frame = false, popover = source_popover, - tooltip_text = _("Manage Calendars") + primary = true, + tooltip_markup = ("%s\n" + Granite.TOOLTIP_SECONDARY_TEXT_MARKUP).printf ( + _("Manage Calendars"), + "F10" + ) }; - header_bar = new Hdy.HeaderBar () { - show_close_button = true + header_bar = new Adw.HeaderBar () { + show_end_title_buttons = false, + show_title = false }; header_bar.pack_start (month_switcher); header_bar.pack_start (year_switcher); @@ -114,7 +122,7 @@ public class Maya.View.CalendarView : Gtk.Box { header_bar.pack_end (menu_button); header_bar.pack_end (spinner); - header_bar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + header_bar.add_css_class (Granite.STYLE_CLASS_FLAT); stack = new Gtk.Stack () { hexpand = true, @@ -132,28 +140,25 @@ public class Maya.View.CalendarView : Gtk.Box { stack.notify["transition-running"].connect (() => { if (stack.transition_running == false) { - stack.get_children ().foreach ((child) => { - if (child != stack.visible_child) { - child.destroy (); - } - }); + if (stack.get_first_child () != stack.visible_child) { + stack.get_first_child ().destroy (); + } + + if (stack.get_last_child () != stack.visible_child) { + stack.get_last_child ().destroy (); + } } }); settings.changed["show-weeks"].connect (on_show_weeks_changed); settings.get_value ("show-weeks"); - events |= Gdk.EventMask.BUTTON_PRESS_MASK; - events |= Gdk.EventMask.KEY_PRESS_MASK; - events |= Gdk.EventMask.SCROLL_MASK; - events |= Gdk.EventMask.SMOOTH_SCROLL_MASK; orientation = VERTICAL; - get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); - add (header_bar); - add (error_bar); - add (info_bar); - add (stack); - show_all (); + add_css_class (Granite.STYLE_CLASS_VIEW); + append (header_bar); + append (error_bar); + append (info_bar); + append (stack); var network_monitor = GLib.NetworkMonitor.get_default (); network_monitor.network_changed.connect (() => { @@ -191,43 +196,46 @@ public class Maya.View.CalendarView : Gtk.Box { set_switcher_date (calmodel.month_start); }); - scroll_controller = new Gtk.EventControllerScroll (this, Gtk.EventControllerScrollFlags.BOTH_AXES); + var scroll_controller = new Gtk.EventControllerScroll (Gtk.EventControllerScrollFlags.BOTH_AXES); scroll_controller.scroll.connect (GesturesUtils.on_scroll); + + add_controller (scroll_controller); } private void action_export () { var filter = new Gtk.FileFilter (); filter.add_mime_type ("text/calendar"); - var filechooser = new Gtk.FileChooserNative ( - _("Export Calendar…"), - null, - Gtk.FileChooserAction.SAVE, - _("Save"), - _("Cancel") - ); - filechooser.do_overwrite_confirmation = true; - filechooser.filter = filter; - filechooser.set_current_name (_("calendar.ics")); - - if (filechooser.run () == Gtk.ResponseType.ACCEPT) { - var events = Calendar.EventStore.get_default ().get_events (); - var builder = new StringBuilder (); - builder.append ("BEGIN:VCALENDAR\n"); - foreach (ECal.Component event in events) { - builder.append (event.get_as_string ()); - } - builder.append ("END:VCALENDAR"); + var file_dialog = new Gtk.FileDialog () { + title = _("Export Calendar…"), + accept_label = _("Save"), + default_filter = filter, + initial_name = _("calendar.ics") + }; - var file = filechooser.get_file (); + var window = (Gtk.Window) get_root (); + + file_dialog.save.begin (window, null, (obj, res) => { try { + var events = Calendar.EventStore.get_default ().get_events (); + var builder = new StringBuilder (); + builder.append ("BEGIN:VCALENDAR\n"); + builder.append ("VERSION:2.0\n"); + foreach (ECal.Component event in events) { + builder.append (event.get_as_string ()); + } + builder.append ("END:VCALENDAR"); + + var file = file_dialog.save.end (res); file.replace_contents (builder.data, null, false, FileCreateFlags.REPLACE_DESTINATION, null); } catch (Error e) { - warning ("%s\n", e.message); - } - } + if (e.matches (Gtk.DialogError.quark (), Gtk.DialogError.DISMISSED)) { + return; + } - filechooser.destroy (); + critical (e.message); + } + }); } private void set_switcher_date (DateTime date) { @@ -309,7 +317,7 @@ public class Maya.View.CalendarView : Gtk.Box { } var spacer = new Gtk.Label (""); - spacer.get_style_context ().add_class ("weeks"); + spacer.add_css_class ("weeks"); var spacer_revealer = new Gtk.Revealer () { child = spacer, @@ -336,11 +344,10 @@ public class Maya.View.CalendarView : Gtk.Box { big_grid.attach (header, 1, 0); big_grid.attach (days_grid, 1, 1); big_grid.attach (weeks, 0, 1); - big_grid.show_all (); settings.bind ("show-weeks", spacer_revealer, "reveal-child", SettingsBindFlags.GET); - stack.add (big_grid); + stack.add_child (big_grid); header.update_columns (model.week_starts_on); weeks.update (model.data_range.first_dt, model.num_weeks); diff --git a/src/Grid/EventButton.vala b/src/Grid/EventButton.vala index 98ad7119e..7fd61bddd 100644 --- a/src/Grid/EventButton.vala +++ b/src/Grid/EventButton.vala @@ -6,16 +6,13 @@ * Corentin Noël */ -public class Maya.View.EventButton : Gtk.Bin { +public class Maya.View.EventButton : Granite.Bin { public ECal.Component comp { get; construct set; } private Gtk.Revealer revealer; private Gtk.Label label; private Gtk.StyleContext grid_style_context; - private Gtk.GestureMultiPress click_gesture; - private Gtk.GestureLongPress long_press_gesture; - public EventButton (ECal.Component comp) { Object ( comp: comp @@ -31,25 +28,22 @@ public class Maya.View.EventButton : Gtk.Bin { label.show (); var internal_grid = new Gtk.Grid (); - internal_grid.add (label); + internal_grid.attach (label, 0, 0); grid_style_context = internal_grid.get_style_context (); - grid_style_context.add_class ("event"); - - var event_box = new Gtk.EventBox (); - event_box.add (internal_grid); + internal_grid.add_css_class ("event"); revealer = new Gtk.Revealer () { - child = event_box, + child = internal_grid, transition_type = CROSSFADE }; child = revealer; var context_menu = Maya.EventMenu.build (comp); - context_menu.attach_to_widget (this, null); + context_menu.set_parent (this); - click_gesture = new Gtk.GestureMultiPress (this) { + var click_gesture = new Gtk.GestureClick () { button = 0 }; click_gesture.pressed.connect ((n_press, x, y) => { @@ -64,44 +58,46 @@ public class Maya.View.EventButton : Gtk.Bin { } if (event.triggers_context_menu ()) { - context_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (context_menu, x, y); click_gesture.set_state (CLAIMED); click_gesture.reset (); } }); - long_press_gesture = new Gtk.GestureLongPress (this) { + var long_press_gesture = new Gtk.GestureLongPress () { touch_only = true }; long_press_gesture.pressed.connect ((x, y) => { - var sequence = long_press_gesture.get_current_sequence (); - var event = long_press_gesture.get_last_event (sequence); - - context_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (context_menu, x, y); long_press_gesture.set_state (CLAIMED); long_press_gesture.reset (); }); - Gtk.TargetEntry dnd = {"binary/calendar", 0, 0}; - Gtk.TargetEntry dnd2 = {"text/uri-list", 0, 0}; - Gtk.drag_source_set (event_box, Gdk.ModifierType.BUTTON1_MASK, {dnd, dnd2}, Gdk.DragAction.MOVE); - - event_box.drag_data_get.connect ( (ctx, sel, info, time) => { - Calendar.EventStore.get_default ().drag_component = comp; - unowned ICal.Component icalcomp = comp.get_icalcomponent (); - var ical_str = icalcomp.as_ical_string (); - sel.set_text (ical_str, ical_str.length); - try { - var path = GLib.Path.build_filename (GLib.Environment.get_tmp_dir (), icalcomp.get_summary () + ".ics"); - var file = File.new_for_path (path); - if (file.replace_contents (ical_str.data, null, false, FileCreateFlags.PRIVATE, null)) - sel.set_uris ({file.get_uri ()}); - } catch (Error e) { - critical (e.message); - } - }); + // Gtk.TargetEntry dnd = {"binary/calendar", 0, 0}; + // Gtk.TargetEntry dnd2 = {"text/uri-list", 0, 0}; + // Gtk.drag_source_set (event_box, Gdk.ModifierType.BUTTON1_MASK, {dnd, dnd2}, Gdk.DragAction.MOVE); + + var drag_source = new Gtk.DragSource () { + actions = MOVE + }; + drag_source.prepare.connect (on_drag_prepare); + + add_controller (click_gesture); + add_controller (long_press_gesture); + add_controller (drag_source); + + // event_box.drag_data_get.connect ( (ctx, sel, info, time) => { + // try { + // var path = GLib.Path.build_filename (GLib.Environment.get_tmp_dir (), icalcomp.get_summary () + ".ics"); + // var file = File.new_for_path (path); + // if (file.replace_contents (ical_str.data, null, false, FileCreateFlags.PRIVATE, null)) + // sel.set_uris ({file.get_uri ()}); + // } catch (Error e) { + // critical (e.message); + // } + // }); E.Source source = comp.get_data ("source"); @@ -114,6 +110,13 @@ public class Maya.View.EventButton : Gtk.Bin { }); } + private Gdk.ContentProvider? on_drag_prepare (double x, double y) { + Calendar.EventStore.get_default ().drag_component = comp; + unowned var icalcomp = comp.get_icalcomponent (); + + return new Gdk.ContentProvider.for_value (icalcomp.as_ical_string ()); + } + public string get_uid () { return comp.get_id ().get_uid (); } @@ -125,14 +128,10 @@ public class Maya.View.EventButton : Gtk.Bin { private void reload_css (string background_color) { var provider = new Gtk.CssProvider (); - try { - var colored_css = EVENT_CSS.printf (background_color.slice (0, 7)); - provider.load_from_data (colored_css, colored_css.length); + var colored_css = EVENT_CSS.printf (background_color.slice (0, 7)); + provider.load_from_string (colored_css); - grid_style_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - } catch (GLib.Error e) { - critical (e.message); - } + grid_style_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } public void destroy_button () { diff --git a/src/Grid/Grid.vala b/src/Grid/Grid.vala index 0578be955..58bb26f3e 100644 --- a/src/Grid/Grid.vala +++ b/src/Grid/Grid.vala @@ -49,8 +49,6 @@ public class Grid : Gtk.Grid { row_spacing = 0; data = new Gee.HashMap (); - events |= Gdk.EventMask.SCROLL_MASK; - events |= Gdk.EventMask.SMOOTH_SCROLL_MASK; unowned var time_manager = Calendar.TimeManager.get_default (); time_manager.on_update_today.connect (callback_update_today); @@ -160,18 +158,19 @@ public class Grid : Gtk.Grid { // Still update_day to get the color of etc. right day = update_day (new GridDay (new_date), new_date, today, month_start); day.on_event_add.connect ((date) => on_event_add (date)); - day.scroll_event.connect ((event) => {scroll_event (event); return false;}); - day.focus_in_event.connect ((event) => { + + var focus_controller = new Gtk.EventControllerFocus (); + focus_controller.enter.connect (() => { on_day_focus_in (day); - return false; }); + day.add_controller (focus_controller); + if (col == 0) { - day.get_style_context ().add_class ("firstcol"); + day.add_css_class ("firstcol"); } attach (day, col, row); - day.show_all (); } col = (col + 1) % 7; diff --git a/src/Grid/GridDay.vala b/src/Grid/GridDay.vala index 419cccc1a..a0556e125 100644 --- a/src/Grid/GridDay.vala +++ b/src/Grid/GridDay.vala @@ -9,7 +9,7 @@ /** * Represents a single day on the grid. */ -public class Maya.View.GridDay : Gtk.EventBox { +public class Maya.View.GridDay : Granite.Bin { /* * Event emitted when the day is double clicked or the ENTER key is pressed. */ @@ -21,15 +21,13 @@ public class Maya.View.GridDay : Gtk.EventBox { public bool draw_left_border = true; private VAutoHider event_box; private GLib.HashTable event_buttons; - private Gtk.EventControllerKey key_controller; - private Gtk.GestureMultiPress click_gesture; public bool in_current_month { set { if (value) { - get_style_context ().remove_class (Gtk.STYLE_CLASS_DIM_LABEL); + remove_css_class (Granite.CssClass.DIM); } else { - get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + add_css_class (Granite.CssClass.DIM); } } } @@ -54,27 +52,32 @@ public class Maya.View.GridDay : Gtk.EventBox { }; var container_box = new Gtk.Box (VERTICAL, 3); - container_box.add (label); - container_box.add (event_box); + container_box.append (label); + container_box.append (event_box); - can_focus = true; + focusable = true; child = container_box; - events |= Gdk.EventMask.SMOOTH_SCROLL_MASK; - get_style_context ().add_class ("cell"); + add_css_class ("cell"); - click_gesture = new Gtk.GestureMultiPress (this) { + var click_gesture = new Gtk.GestureClick () { button = Gdk.BUTTON_PRIMARY, propagation_phase = BUBBLE }; click_gesture.released.connect (on_button_press); - key_controller = new Gtk.EventControllerKey (this) { + var key_controller = new Gtk.EventControllerKey () { propagation_phase = BUBBLE }; key_controller.key_pressed.connect (on_key_press); - Gtk.TargetEntry dnd = {"binary/calendar", 0, 0}; - Gtk.drag_dest_set (this, Gtk.DestDefaults.MOTION, {dnd}, Gdk.DragAction.MOVE); + // Gtk.TargetEntry dnd = {"binary/calendar", 0, 0}; + var drop_target = new Gtk.DropTarget (typeof (string), Gdk.DragAction.MOVE); + drop_target.accept.connect (on_drop_accept); + drop_target.drop.connect (on_drag_drop); + + add_controller (click_gesture); + add_controller (key_controller); + add_controller (drop_target); this.bind_property ("date", label, "label", BindingFlags.SYNC_CREATE, (binding, srcval, ref targetval) => { unowned var date = (GLib.DateTime) srcval.get_boxed (); @@ -83,14 +86,11 @@ public class Maya.View.GridDay : Gtk.EventBox { }); } - public override bool drag_drop (Gdk.DragContext context, int x, int y, uint time_) { - Gtk.drag_finish (context, true, false, time_); - Gdk.Atom atom = Gtk.drag_dest_find_target (this, context, Gtk.drag_dest_get_target_list (this)); - Gtk.drag_get_data (this, context, atom, time_); + private bool on_drop_accept (Gdk.Drop drop) { return true; } - public override void drag_data_received (Gdk.DragContext context, int x, int y, Gtk.SelectionData selection_data, uint info, uint time_) { + private bool on_drag_drop (GLib.Value value, double x, double y) { var calmodel = Calendar.EventStore.get_default (); var comp = calmodel.drag_component; unowned ICal.Component icalcomp = comp.get_icalcomponent (); @@ -107,6 +107,8 @@ public class Maya.View.GridDay : Gtk.EventBox { icalcomp.set_dtstart (start); calmodel.update_event (src, comp, ECal.ObjModType.ALL); + + return true; } public void add_event (ECal.Component component) { @@ -123,7 +125,7 @@ public class Maya.View.GridDay : Gtk.EventBox { } event_box.add (button); - button.show_all (); + button.show_without_animate (); } public bool update_event (ECal.Component modified_event) { diff --git a/src/Grid/Header.vala b/src/Grid/Header.vala index 5574e9c76..509aa08c7 100644 --- a/src/Grid/Header.vala +++ b/src/Grid/Header.vala @@ -24,15 +24,12 @@ namespace Maya.View { /** * Represents the header at the top of the calendar grid. */ -public class Header : Gtk.EventBox { +public class Header : Granite.Bin { private Gtk.Grid header_grid; private Gtk.Label[] labels; private static GLib.Settings show_weeks; - private Gtk.GestureMultiPress click_gesture; - private Gtk.GestureLongPress long_press_gesture; - static construct { if (Application.wingpanel_settings != null) { show_weeks = Application.wingpanel_settings; @@ -50,21 +47,17 @@ public class Header : Gtk.EventBox { header_grid.column_spacing = 0; header_grid.row_spacing = 0; - // EventBox properties - set_visible_window (true); // needed for style - labels = new Gtk.Label[7]; for (int c = 0; c < 7; c++) { labels[c] = new Gtk.Label (""); labels[c].hexpand = true; - unowned Gtk.StyleContext label_context = labels[c].get_style_context (); - label_context.add_class ("daylabel"); + labels[c].add_css_class ("daylabel"); header_grid.attach (labels[c], c, 0); } - add (header_grid); + child = header_grid; var action_show_weeks = show_weeks.create_action ("show-weeks"); @@ -76,11 +69,12 @@ public class Header : Gtk.EventBox { var menu = new GLib.Menu (); menu.append (_("Show Week Numbers"), "header.show-weeks"); - var gtk_menu = new Gtk.Menu.from_model (menu) { - attach_widget = this + var gtk_menu = new Gtk.PopoverMenu.from_model (menu) { + has_arrow = false }; + gtk_menu.set_parent (this); - click_gesture = new Gtk.GestureMultiPress (this) { + var click_gesture = new Gtk.GestureClick () { button = 0 }; click_gesture.pressed.connect ((n_press, x, y) => { @@ -88,25 +82,25 @@ public class Header : Gtk.EventBox { var event = click_gesture.get_last_event (sequence); if (event.triggers_context_menu ()) { - gtk_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (gtk_menu, x, y); click_gesture.set_state (CLAIMED); click_gesture.reset (); } }); - long_press_gesture = new Gtk.GestureLongPress (this) { + var long_press_gesture = new Gtk.GestureLongPress () { touch_only = true }; long_press_gesture.pressed.connect ((x, y) => { - var sequence = long_press_gesture.get_current_sequence (); - var event = long_press_gesture.get_last_event (sequence); - - gtk_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (gtk_menu, x, y); long_press_gesture.set_state (CLAIMED); long_press_gesture.reset (); }); + + add_controller (click_gesture); + add_controller (long_press_gesture); } public void update_columns (int week_starts_on) { diff --git a/src/Grid/VAutoHider.vala b/src/Grid/VAutoHider.vala index aca35a0d3..ac95cb522 100644 --- a/src/Grid/VAutoHider.vala +++ b/src/Grid/VAutoHider.vala @@ -6,30 +6,29 @@ * Corentin Noël */ -public class Maya.View.VAutoHider : Gtk.Bin { +public class Maya.View.VAutoHider : Granite.Bin { + private List children; private Gtk.Label more_label; private Gtk.Box main_box; construct { + children = new List (); + more_label = new Gtk.Label ("") { valign = END }; main_box = new Gtk.Box (VERTICAL, 0); - main_box.pack_end (more_label); + main_box.append (more_label); - base.add (main_box); + child = main_box; } - public override void add (Gtk.Widget widget) { - var children = main_box.get_children (); + public void add (Gtk.Widget widget) { children.append (widget); + main_box.append (widget); - children.sort (compare_children); - - int index = children.index (widget); - main_box.add (widget); - main_box.reorder_child (widget, index); + update (widget); widget.destroy.connect (() => { queue_resize (); @@ -39,51 +38,55 @@ public class Maya.View.VAutoHider : Gtk.Bin { } public void update (Gtk.Widget widget) { - var children = main_box.get_children (); - children.sort (compare_children); - int index = children.index (widget); - main_box.reorder_child (widget, index); + while (main_box.get_first_child () != null) { + main_box.remove (main_box.get_first_child ()); + } + + foreach (var child in children) { + main_box.append (child); + } } - public override void size_allocate (Gtk.Allocation allocation) { - base.size_allocate (allocation); - int global_height = allocation.height; - int children_length = (int)main_box.get_children ().length () - 1; + public override void size_allocate (int width, int height, int baseline) { + base.size_allocate (width, height, baseline); + + int children_length = (int) children.length (); if (children_length == 0) { more_label.hide (); return; } - int height = 0; - int more_label_height; - int shown_children = 0; + + more_label.show (); more_label.vexpand = false; - more_label.get_preferred_height (out more_label_height, null); + var more_label_height = more_label.get_height (); more_label.vexpand = true; more_label.hide (); - foreach (var child in main_box.get_children ()) { + + int internal_height = 0; + int shown_children = 0; + foreach (var child in children) { if (child == more_label) continue; bool last = (shown_children == children_length - 1); - int child_height; child.show (); - child.get_preferred_height (out child_height, null); + var child_height = child.get_height (); ((Maya.View.EventButton) child).hide_without_animate (); bool should_hide; - if (global_height - more_label_height < child_height + height) { + if (height - more_label_height < child_height + internal_height) { should_hide = true; - if (last && (global_height >= child_height + height)) { + if (last && (height >= child_height + internal_height)) { should_hide = false; } } else { should_hide = false; - height += child_height; + internal_height += child_height; } if (should_hide) { @@ -103,18 +106,15 @@ public class Maya.View.VAutoHider : Gtk.Bin { } } - public override void get_preferred_width (out int minimum_width, out int natural_width) { - base.get_preferred_width (out minimum_width, out natural_width); - more_label.get_preferred_width (out minimum_width, null); - if (minimum_width > natural_width) - natural_width = minimum_width; - } + public override void measure (Gtk.Orientation orientation, int for_size, out int minimum, out int natural, out int minimum_baseline, out int natural_baseline) { + base.measure (orientation, for_size, out minimum, out natural, out minimum_baseline, out natural_baseline); - public override void get_preferred_height (out int minimum_height, out int natural_height) { - base.get_preferred_height (out minimum_height, out natural_height); - more_label.get_preferred_height (out minimum_height, null); - if (minimum_height > natural_height) - natural_height = minimum_height; + for_size = more_label.get_width (); + + minimum = more_label.get_height (); + if (minimum > natural) { + natural = minimum; + } } public static GLib.CompareFunc compare_children = (a, b) => { diff --git a/src/Grid/WeekLabels.vala b/src/Grid/WeekLabels.vala index fcdb3dbf2..fc3d4f0c5 100644 --- a/src/Grid/WeekLabels.vala +++ b/src/Grid/WeekLabels.vala @@ -21,16 +21,13 @@ /** * Represent the week labels at the left side of the grid. */ -public class Maya.View.WeekLabels : Gtk.Bin { +public class Maya.View.WeekLabels : Granite.Bin { private Gtk.Grid day_grid; private Gtk.Label[] labels; private int nr_of_weeks; private static GLib.Settings show_weeks; - private Gtk.GestureMultiPress click_gesture; - private Gtk.GestureLongPress long_press_gesture; - static construct { if (Application.wingpanel_settings != null) { show_weeks = Application.wingpanel_settings; @@ -43,7 +40,7 @@ public class Maya.View.WeekLabels : Gtk.Bin { day_grid = new Gtk.Grid () { row_homogeneous = true }; - day_grid.get_style_context ().add_class ("weeks"); + day_grid.add_css_class ("weeks"); set_nr_of_weeks (5); day_grid.insert_row (1); @@ -68,11 +65,12 @@ public class Maya.View.WeekLabels : Gtk.Bin { var menu = new GLib.Menu (); menu.append (_("Show Week Numbers"), "week-labels.show-weeks"); - var gtk_menu = new Gtk.Menu.from_model (menu) { - attach_widget = this + var gtk_menu = new Gtk.PopoverMenu.from_model (menu) { + has_arrow = false }; + gtk_menu.set_parent (this); - click_gesture = new Gtk.GestureMultiPress (revealer) { + var click_gesture = new Gtk.GestureClick () { button = 0 }; click_gesture.pressed.connect ((n_press, x, y) => { @@ -80,25 +78,25 @@ public class Maya.View.WeekLabels : Gtk.Bin { var event = click_gesture.get_last_event (sequence); if (event.triggers_context_menu ()) { - gtk_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (gtk_menu, x, y); click_gesture.set_state (CLAIMED); click_gesture.reset (); } }); - long_press_gesture = new Gtk.GestureLongPress (this) { + var long_press_gesture = new Gtk.GestureLongPress () { touch_only = true }; long_press_gesture.pressed.connect ((x, y) => { - var sequence = long_press_gesture.get_current_sequence (); - var event = long_press_gesture.get_last_event (sequence); - - gtk_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (gtk_menu, x, y); long_press_gesture.set_state (CLAIMED); long_press_gesture.reset (); }); + + add_controller (click_gesture); + add_controller (long_press_gesture); } public void update (DateTime date, int nr_of_weeks) { @@ -115,7 +113,7 @@ public class Maya.View.WeekLabels : Gtk.Bin { valign = START, width_chars = 2 }; - labels[c].get_style_context ().add_class ("weeklabel"); + labels[c].add_css_class ("weeklabel"); day_grid.attach (labels[c], 0, c); labels[c].show (); diff --git a/src/ImportDialog.vala b/src/ImportDialog.vala index d3f3911e0..ce3b15792 100644 --- a/src/ImportDialog.vala +++ b/src/ImportDialog.vala @@ -55,12 +55,12 @@ public class Maya.View.ImportDialog : Granite.MessageDialog { var frame = new Gtk.Frame (null) { child = calchooser }; - frame.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); + frame.add_css_class (Granite.STYLE_CLASS_VIEW); - custom_bin.add (frame); + custom_bin.append (frame); var ok_button = (Gtk.Button) add_button (_("Import"), Gtk.ResponseType.APPLY); - ok_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + ok_button.add_css_class (Granite.CssClass.SUGGESTED); response.connect ((response_id) => { if (response_id == Gtk.ResponseType.APPLY) { diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 128c26557..8fdf7cbf7 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -6,7 +6,7 @@ * Corentin Noël */ -public class Maya.MainWindow : Hdy.ApplicationWindow { +public class Maya.MainWindow : Gtk.ApplicationWindow { public View.CalendarView calview; public const string ACTION_PREFIX = "win."; @@ -50,16 +50,17 @@ public class Maya.MainWindow : Hdy.ApplicationWindow { width_request = 160 }; - var hpaned = new Gtk.Paned (HORIZONTAL); - hpaned.pack1 (calview, true, false); - hpaned.pack2 (sidebar, false, false); + var hpaned = new Gtk.Paned (HORIZONTAL) { + start_child = calview, + resize_start_child = true, + shrink_start_child = false, + end_child = sidebar, + resize_end_child = false, + shrink_end_child = false + }; child = hpaned; - show_all (); - - var header_group = new Hdy.HeaderGroup (); - header_group.add_header_bar (calview.header_bar); - header_group.add_header_bar (sidebar.header_bar); + titlebar = new Gtk.Grid () { visible = false }; var size_group = new Gtk.SizeGroup (VERTICAL); size_group.add_widget (calview.header_bar); @@ -96,7 +97,7 @@ public class Maya.MainWindow : Hdy.ApplicationWindow { var dialog = new Maya.View.EventDialog (comp, null, this); dialog.present (); } else { - Gdk.beep (); + Gdk.Display.get_default ().beep (); } } @@ -112,46 +113,22 @@ public class Maya.MainWindow : Hdy.ApplicationWindow { }; dialog.present (); } else { - Gdk.beep (); + Gdk.Display.get_default ().beep (); } } - public override bool configure_event (Gdk.EventConfigure event) { - if (configure_id != 0) { - GLib.Source.remove (configure_id); - } - - configure_id = Timeout.add (100, () => { - configure_id = 0; - - if (is_maximized) { - Maya.Application.saved_state.set_boolean ("window-maximized", true); - } else { - Maya.Application.saved_state.set_boolean ("window-maximized", false); - - Gdk.Rectangle rect; - get_allocation (out rect); - Maya.Application.saved_state.set ("window-size", "(ii)", rect.width, rect.height); - } + // public override bool delete_event (Gdk.EventAny event) { + // Calendar.EventStore.get_default ().delete_trashed_calendars (); - return GLib.Source.REMOVE; - }); + // ((Application) application).ask_for_background.begin ((obj, res) => { + // unowned var app = (Application) obj; + // if (app.ask_for_background.end (res)) { + // hide (); + // } else { + // destroy (); + // } + // }); - return base.configure_event (event); - } - - public override bool delete_event (Gdk.EventAny event) { - Calendar.EventStore.get_default ().delete_trashed_calendars (); - - ((Application) application).ask_for_background.begin ((obj, res) => { - unowned var app = (Application) obj; - if (app.ask_for_background.end (res)) { - hide (); - } else { - destroy (); - } - }); - - return Gdk.EVENT_STOP; - } + // return Gdk.EVENT_STOP; + // } } diff --git a/src/SourceDialog/SourceDialog.vala b/src/SourceDialog/SourceDialog.vala index a72f2a12f..502b7ee9c 100644 --- a/src/SourceDialog/SourceDialog.vala +++ b/src/SourceDialog/SourceDialog.vala @@ -34,17 +34,17 @@ public class Maya.View.SourceDialog : Granite.Dialog { private Gtk.CheckButton is_default_check; private E.Source source = null; - private Gtk.RadioButton color_button_blue; - private Gtk.RadioButton color_button_mint; - private Gtk.RadioButton color_button_green; - private Gtk.RadioButton color_button_yellow; - private Gtk.RadioButton color_button_orange; - private Gtk.RadioButton color_button_red; - private Gtk.RadioButton color_button_pink; - private Gtk.RadioButton color_button_purple; - private Gtk.RadioButton color_button_brown; - private Gtk.RadioButton color_button_slate; - private Gtk.RadioButton color_button_none; + private Gtk.CheckButton color_button_blue; + private Gtk.CheckButton color_button_mint; + private Gtk.CheckButton color_button_green; + private Gtk.CheckButton color_button_yellow; + private Gtk.CheckButton color_button_orange; + private Gtk.CheckButton color_button_red; + private Gtk.CheckButton color_button_pink; + private Gtk.CheckButton color_button_purple; + private Gtk.CheckButton color_button_brown; + private Gtk.CheckButton color_button_slate; + private Gtk.CheckButton color_button_none; public signal void go_back (); @@ -70,8 +70,8 @@ public class Maya.View.SourceDialog : Granite.Dialog { var name_box = new Gtk.Box (VERTICAL, 0) { margin_bottom = 12 }; - name_box.add (name_label); - name_box.add (name_entry); + name_box.append (name_label); + name_box.append (name_entry); list_store = new Gtk.ListStore (2, typeof (string), typeof (Backend)); @@ -98,8 +98,8 @@ public class Maya.View.SourceDialog : Granite.Dialog { var type_box = new Gtk.Box (VERTICAL, 0) { margin_bottom = 12 }; - type_box.add (type_label); - type_box.add (type_combobox); + type_box.append (type_label); + type_box.append (type_combobox); Gtk.TreeIter iter; var backends_manager = BackendsManager.get_default (); @@ -110,90 +110,90 @@ public class Maya.View.SourceDialog : Granite.Dialog { type_combobox.set_active (0); - color_button_blue = new Gtk.RadioButton (null) { + color_button_blue = new Gtk.CheckButton () { 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_blue.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_blue.add_css_class ("blue"); - color_button_mint = new Gtk.RadioButton (null) { + color_button_mint = new Gtk.CheckButton () { 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"); + color_button_mint.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_mint.add_css_class ("mint"); - color_button_green = new Gtk.RadioButton (null) { + color_button_green = new Gtk.CheckButton () { 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_green.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_green.add_css_class ("green"); - color_button_yellow = new Gtk.RadioButton (null) { + color_button_yellow = new Gtk.CheckButton () { 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"); + color_button_yellow.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_yellow.add_css_class ("yellow"); - color_button_orange = new Gtk.RadioButton (null) { + color_button_orange = new Gtk.CheckButton () { 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_orange.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_orange.add_css_class ("orange"); - color_button_red = new Gtk.RadioButton (null) { + color_button_red = new Gtk.CheckButton () { 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"); + color_button_red.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_red.add_css_class ("red"); - color_button_pink = new Gtk.RadioButton (null) { + color_button_pink = new Gtk.CheckButton () { 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_pink.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_pink.add_css_class ("pink"); - color_button_purple = new Gtk.RadioButton (null) { + color_button_purple = new Gtk.CheckButton () { 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"); + color_button_purple.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_purple.add_css_class ("purple"); - color_button_brown = new Gtk.RadioButton (null) { + color_button_brown = new Gtk.CheckButton () { 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_brown.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_brown.add_css_class ("brown"); - color_button_slate = new Gtk.RadioButton (null) { + color_button_slate = new Gtk.CheckButton () { 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"); + color_button_slate.add_css_class (Granite.STYLE_CLASS_COLOR_BUTTON); + color_button_slate.add_css_class ("slate"); - color_button_none = new Gtk.RadioButton (null) { + color_button_none = new Gtk.CheckButton () { group = color_button_blue }; var color_button_box = new Gtk.Box (HORIZONTAL, 6); - color_button_box.add (color_button_blue); - color_button_box.add (color_button_mint); - color_button_box.add (color_button_green); - color_button_box.add (color_button_yellow); - color_button_box.add (color_button_orange); - color_button_box.add (color_button_red); - color_button_box.add (color_button_pink); - color_button_box.add (color_button_purple); - color_button_box.add (color_button_brown); - color_button_box.add (color_button_slate); + color_button_box.append (color_button_blue); + color_button_box.append (color_button_mint); + color_button_box.append (color_button_green); + color_button_box.append (color_button_yellow); + color_button_box.append (color_button_orange); + color_button_box.append (color_button_red); + color_button_box.append (color_button_pink); + color_button_box.append (color_button_purple); + color_button_box.append (color_button_brown); + color_button_box.append (color_button_slate); var color_label = new Granite.HeaderLabel (_("Color")) { mnemonic_widget = color_button_box @@ -202,8 +202,8 @@ public class Maya.View.SourceDialog : Granite.Dialog { var color_box = new Gtk.Box (VERTICAL, 0) { margin_bottom = 12 }; - color_box.add (color_label); - color_box.add (color_button_box); + color_box.append (color_label); + color_box.append (color_button_box); is_default_check = new Gtk.CheckButton.with_label (_("Mark as default calendar")) { margin_bottom = 12 @@ -250,21 +250,18 @@ public class Maya.View.SourceDialog : Granite.Dialog { }); main_box = new Gtk.Box (VERTICAL, 0) { - margin_end = 12, - margin_start = 12, vexpand = true }; if (backends_manager.backends.size > 1) { - main_box.add (type_box); + main_box.append (type_box); } - main_box.add (name_box); - main_box.add (color_box); - main_box.add (is_default_check); - main_box.show_all (); + main_box.append (name_box); + main_box.append (color_box); + main_box.append (is_default_check); - get_content_area ().add (main_box); + get_content_area ().append (main_box); } public void set_source (E.Source? source = null) { @@ -370,7 +367,7 @@ public class Maya.View.SourceDialog : Granite.Dialog { widget.widget.margin_bottom = 12; } - main_box.add (widget.widget); + main_box.append (widget.widget); if (widget.needed == true && widget.widget is Gtk.Entry) { var entry = widget.widget as Gtk.Entry; @@ -379,7 +376,6 @@ public class Maya.View.SourceDialog : Granite.Dialog { } } - main_box.show_all (); check_can_validate (); } diff --git a/src/Widgets/AgendaEventRow.vala b/src/Widgets/AgendaEventRow.vala index 080fdad8f..78f82f1f0 100644 --- a/src/Widgets/AgendaEventRow.vala +++ b/src/Widgets/AgendaEventRow.vala @@ -36,9 +36,6 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { public Gtk.Revealer revealer { public get; private set; } - private Gtk.GestureMultiPress click_gesture; - private Gtk.GestureLongPress long_press_gesture; - private Gtk.Grid main_grid; private Gtk.Image event_image; private Gtk.Label name_label; @@ -173,7 +170,7 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { split_keywords ((Category)cat); } - event_image = new Gtk.Image.from_icon_name ("office-calendar-symbolic", Gtk.IconSize.MENU) { + event_image = new Gtk.Image.from_icon_name ("office-calendar-symbolic") { pixel_size = 16, valign = START }; @@ -186,9 +183,7 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { wrap_mode = WORD_CHAR, xalign = 0 }; - - var name_label_context = name_label.get_style_context (); - name_label_context.add_class ("title"); + name_label.add_css_class ("title"); datetime_label = new Gtk.Label ("") { ellipsize = END, @@ -197,8 +192,8 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { use_markup = true, xalign = 0 }; - datetime_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - datetime_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + datetime_label.add_css_class (Granite.CssClass.DIM); + datetime_label.add_css_class (Granite.CssClass.SMALL); location_label = new Gtk.Label ("") { margin_top = 6, @@ -226,21 +221,17 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { main_grid.attach (location_revealer, 1, 2); main_grid_context = main_grid.get_style_context (); - main_grid_context.add_class ("event"); - - var event_box = new Gtk.EventBox () { - child = main_grid - }; + main_grid.add_css_class ("event"); revealer = new Gtk.Revealer () { - child = event_box, + child = main_grid, transition_type = SLIDE_DOWN }; child = revealer; var context_menu = Maya.EventMenu.build (calevent); - context_menu.attach_to_widget (this, null); + context_menu.set_parent (this); var cal = (E.SourceCalendar)source.get_extension (E.SOURCE_EXTENSION_CALENDAR); @@ -254,7 +245,7 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { location_revealer.reveal_child = location_label.label != null && location_label.label != ""; }); - show.connect (() => { + map.connect (() => { revealer.set_reveal_child (true); }); @@ -262,7 +253,7 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { revealer.set_reveal_child (false); }); - click_gesture = new Gtk.GestureMultiPress (this) { + var click_gesture = new Gtk.GestureClick () { button = 0 }; click_gesture.pressed.connect ((n_press, x, y) => { @@ -270,21 +261,18 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { var event = click_gesture.get_last_event (sequence); if (event.triggers_context_menu ()) { - context_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (context_menu, x, y); click_gesture.set_state (CLAIMED); click_gesture.reset (); } }); - long_press_gesture = new Gtk.GestureLongPress (this) { + var long_press_gesture = new Gtk.GestureLongPress () { touch_only = true }; long_press_gesture.pressed.connect ((x, y) => { - var sequence = long_press_gesture.get_current_sequence (); - var event = long_press_gesture.get_last_event (sequence); - - context_menu.popup_at_pointer (event); + Maya.EventMenu.popup_at_pointer (context_menu, x, y); long_press_gesture.set_state (CLAIMED); long_press_gesture.reset (); @@ -292,6 +280,9 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { // Fill in the information update (calevent); + + add_controller (click_gesture); + add_controller (long_press_gesture); } /** @@ -325,7 +316,7 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { datetime_label.label = get_timespan_label (start_date, end_date); if (datetime_label.label != "") { main_grid.attach (datetime_label, 1, 1); - } else { + } else if (datetime_label.parent != null) { main_grid.remove (datetime_label); } @@ -401,15 +392,11 @@ public class Maya.View.AgendaEventRow : Gtk.ListBoxRow { private void reload_css (string background_color) { var provider = new Gtk.CssProvider (); - try { - var colored_css = EVENT_CSS.printf (background_color.slice (0, 7)); - provider.load_from_data (colored_css, colored_css.length); - - event_image_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - main_grid_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - } catch (GLib.Error e) { - critical (e.message); - } + var colored_css = EVENT_CSS.printf (background_color.slice (0, 7)); + provider.load_from_string (colored_css); + + event_image_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + main_grid_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } private void split_keywords (Category category) { diff --git a/src/Widgets/CalendarChooser.vala b/src/Widgets/CalendarChooser.vala index 29bab78c3..5d26f33c3 100644 --- a/src/Widgets/CalendarChooser.vala +++ b/src/Widgets/CalendarChooser.vala @@ -53,19 +53,16 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Box { placeholder_text = _("Search Calendars") }; - var placeholder = new Granite.Widgets.AlertView ( - _("No Results"), - _("Try changing search terms."), - "" - ); - placeholder.show_all (); + var placeholder = new Granite.Placeholder (_("No Results")) { + description = _("Try changing search terms.") + }; var list_box = new Gtk.ListBox () { activate_on_single_click = true }; list_box.set_placeholder (placeholder); - var scrolled = new Gtk.ScrolledWindow (null, null) { + var scrolled = new Gtk.ScrolledWindow () { child = list_box, hscrollbar_policy = NEVER, max_content_height = 300, @@ -74,9 +71,8 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Box { margin_bottom = 6; orientation = VERTICAL; - add (search_entry); - add (scrolled); - show_all (); + append (search_entry); + append (scrolled); list_box.set_filter_func (filter_function); list_box.set_header_func (header_update_func); @@ -143,9 +139,8 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Box { var row = new Gtk.ListBoxRow () { child = calrow }; - row.show_all (); - list_box.add (row); + list_box.append (row); if (source.dup_uid () == current_source.dup_uid ()) { list_box.select_row (row); @@ -176,14 +171,11 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Box { } var header = new Granite.HeaderLabel (row_location) { - margin_top = 6, - margin_end = 6, - margin_start = 6 + margin_top = 6 }; row.set_header (header); - header.show_all (); if (before == null) { header.margin_top = 0; } diff --git a/src/Widgets/CalendarRow.vala b/src/Widgets/CalendarRow.vala index 78e955a52..51f6eca6c 100644 --- a/src/Widgets/CalendarRow.vala +++ b/src/Widgets/CalendarRow.vala @@ -51,7 +51,7 @@ public class CalendarRow : Gtk.Box { width_request = 12, valign = CENTER }; - calendar_color.get_style_context ().add_class ("cal-color"); + calendar_color.add_css_class ("cal-color"); calendar_color_context = calendar_color.get_style_context (); @@ -61,7 +61,7 @@ public class CalendarRow : Gtk.Box { xalign = 0 }; - var selection_icon = new Gtk.Image.from_icon_name ("emblem-default-symbolic", MENU); + var selection_icon = new Gtk.Image.from_icon_name ("emblem-default-symbolic"); var selection_revealer = new Gtk.Revealer () { child = selection_icon, @@ -69,9 +69,9 @@ public class CalendarRow : Gtk.Box { }; spacing = 6; - add (calendar_color); - add (calendar_name_label); - add (selection_revealer); + append (calendar_color); + append (calendar_name_label); + append (selection_revealer); bind_property ("label", calendar_name_label, "label"); bind_property ("selected", selection_revealer, "reveal-child", SYNC_CREATE); @@ -85,11 +85,7 @@ public class CalendarRow : Gtk.Box { var css_color = CALENDAR_COLOR_STYLE.printf (cal.dup_color ()); var style_provider = new Gtk.CssProvider (); - try { - style_provider.load_from_data (css_color, css_color.length); - calendar_color_context.add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - } catch (Error e) { - warning ("Could not create CSS Provider: %s\nStylesheet:\n%s", e.message, css_color); - } + style_provider.load_from_string (css_color); + calendar_color_context.add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } } diff --git a/src/Widgets/DateSwitcher.vala b/src/Widgets/DateSwitcher.vala index ff4e8d705..4be436dc1 100644 --- a/src/Widgets/DateSwitcher.vala +++ b/src/Widgets/DateSwitcher.vala @@ -17,7 +17,7 @@ * Authored by: Maxwell Barvian */ -public class Calendar.Widgets.DateSwitcher : Gtk.Grid { +public class Calendar.Widgets.DateSwitcher : Granite.Box { public signal void left_clicked (); public signal void right_clicked (); @@ -38,21 +38,22 @@ public class Calendar.Widgets.DateSwitcher : Gtk.Grid { } construct { - var start_button = new Gtk.Button.from_icon_name ("pan-start-symbolic", Gtk.IconSize.MENU); + var start_button = new Gtk.Button.from_icon_name ("pan-start-symbolic"); - var end_button = new Gtk.Button.from_icon_name ("pan-end-symbolic", Gtk.IconSize.MENU); + var end_button = new Gtk.Button.from_icon_name ("pan-end-symbolic"); label = new Gtk.Label (null) { width_chars = width_chars }; - var center_button = new Gtk.Button (); - center_button.add (label); + var center_button = new Gtk.Button () { + child = label + }; - get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED); - add (start_button); - add (center_button); - add (end_button); + child_spacing = LINKED; + append (start_button); + append (center_button); + append (end_button); start_button.clicked.connect (() => left_clicked ()); end_button.clicked.connect (() => right_clicked ()); diff --git a/src/Widgets/DateTimePicker.vala b/src/Widgets/DateTimePicker.vala index 634d07191..e108051c3 100644 --- a/src/Widgets/DateTimePicker.vala +++ b/src/Widgets/DateTimePicker.vala @@ -28,13 +28,13 @@ namespace Maya.View.Widgets { time_picker.time.get_second ()); } } - public Granite.Widgets.DatePicker date_picker { get; private set; } - public Granite.Widgets.TimePicker time_picker { get; private set; } + public Granite.DatePicker date_picker { get; private set; } + public Granite.TimePicker time_picker { get; private set; } public DateTimePicker () { - date_picker = new Granite.Widgets.DatePicker (); - time_picker = new Granite.Widgets.TimePicker (); + date_picker = new Granite.DatePicker (); + time_picker = new Granite.TimePicker (); // Grid properties set_column_spacing (10); diff --git a/src/Widgets/DeleteDialog.vala b/src/Widgets/DeleteDialog.vala index f6610fe7e..3a7a67164 100644 --- a/src/Widgets/DeleteDialog.vala +++ b/src/Widgets/DeleteDialog.vala @@ -49,7 +49,7 @@ class Calendar.DeleteEventDialog : Granite.MessageDialog { } unowned var trash_button = add_button (delete_text, Gtk.ResponseType.YES); - trash_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + trash_button.add_css_class (Granite.CssClass.DESTRUCTIVE); response.connect ((response) => { if (response == Gtk.ResponseType.YES) { diff --git a/src/Widgets/DynamicSpinner.vala b/src/Widgets/DynamicSpinner.vala index 15f3afb1b..d8e901005 100644 --- a/src/Widgets/DynamicSpinner.vala +++ b/src/Widgets/DynamicSpinner.vala @@ -5,7 +5,7 @@ * Authored by: Corentin Noël */ -public class Maya.View.Widgets.DynamicSpinner : Gtk.Bin { +public class Maya.View.Widgets.DynamicSpinner : Granite.Bin { private Gtk.ListBox list_box; private Gtk.Revealer revealer; @@ -21,7 +21,7 @@ public class Maya.View.Widgets.DynamicSpinner : Gtk.Bin { selection_mode = NONE }; - var info_popover = new Gtk.Popover (null) { + var info_popover = new Gtk.Popover () { child = list_box, position = BOTTOM }; @@ -42,7 +42,6 @@ public class Maya.View.Widgets.DynamicSpinner : Gtk.Bin { }; child = revealer; - show_all (); } public async void add_source (E.Source source, Cancellable cancellable) { @@ -51,8 +50,9 @@ public class Maya.View.Widgets.DynamicSpinner : Gtk.Bin { var label = new Gtk.Label (source.get_display_name ()); - var stop_button = new Gtk.Button.from_icon_name ("process-stop-symbolic", Gtk.IconSize.BUTTON); - stop_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + var stop_button = new Gtk.Button.from_icon_name ("process-stop-symbolic") { + has_frame = false + }; stop_button.clicked.connect (() => { cancellable.cancel (); @@ -65,15 +65,14 @@ public class Maya.View.Widgets.DynamicSpinner : Gtk.Bin { margin_start = 6 }; - box.add (label); - box.add (stop_button); + box.append (label); + box.append (stop_button); lock (children_matcher) { children_matcher.insert (source.dup_uid (), box); } - list_box.add (box); - list_box.show_all (); + list_box.append (box); return false; }); diff --git a/src/Widgets/EventMenu.vala b/src/Widgets/EventMenu.vala index 8f795cc4a..998d90de5 100644 --- a/src/Widgets/EventMenu.vala +++ b/src/Widgets/EventMenu.vala @@ -7,7 +7,7 @@ */ namespace Maya.EventMenu { - public static Gtk.Menu build (ECal.Component comp) { + public static Gtk.PopoverMenu build (ECal.Component comp) { var action_edit = new GLib.SimpleAction ("edit", null); action_edit.activate.connect (() => { ((Maya.Application) GLib.Application.get_default ()).window.on_modified (comp); @@ -41,7 +41,9 @@ namespace Maya.EventMenu { menu_model.prepend (_("Remove"), "event.remove"); } - var menu = new Gtk.Menu.from_model (menu_model); + var menu = new Gtk.PopoverMenu.from_model (menu_model) { + has_arrow = false + }; menu.insert_action_group ("event", action_group); E.Source src = comp.get_data ("source"); @@ -55,6 +57,15 @@ namespace Maya.EventMenu { return menu; } + private static void popup_at_pointer (Gtk.PopoverMenu popover, double x, double y) { + var rect = Gdk.Rectangle () { + x = (int) x, + y = (int) y + }; + popover.pointing_to = rect; + popover.popup (); + } + private static void remove_event (ECal.Component comp) { var application = (Gtk.Application) GLib.Application.get_default (); var source = comp.get_data ("source"); diff --git a/src/Widgets/SourcePopover.vala b/src/Widgets/SourcePopover.vala index 5425c7667..42f2f4702 100644 --- a/src/Widgets/SourcePopover.vala +++ b/src/Widgets/SourcePopover.vala @@ -26,7 +26,7 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { } }); - var scroll = new Gtk.ScrolledWindow (null, null) { + var scroll = new Gtk.ScrolledWindow () { child = calendar_box, hscrollbar_policy = NEVER, max_content_height = 300, @@ -40,20 +40,20 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { margin_bottom = 3 }; - var add_calendar_button = new Gtk.ModelButton () { + var add_calendar_button = new PopoverMenuitem () { text = _("Add New Calendar…") }; - var import_calendar_button = new Gtk.ModelButton () { + var import_calendar_button = new PopoverMenuitem () { text = _("Import iCalendar File…") }; - var export_calendar_button = new Gtk.ModelButton () { + var export_calendar_button = new PopoverMenuitem () { action_name = "calendar.export", text = _("Export Calendar…") }; - var accounts_button = new Gtk.ModelButton () { + var accounts_button = new PopoverMenuitem () { text = _("Online Accounts Settings…") }; @@ -61,23 +61,22 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { margin_bottom = 3, }; - main_box.add (scroll); - main_box.add (separator); - main_box.add (add_calendar_button); - main_box.add (import_calendar_button); - main_box.add (export_calendar_button); - main_box.add (accounts_button); - main_box.show_all (); + main_box.append (scroll); + main_box.append (separator); + main_box.append (add_calendar_button); + main_box.append (import_calendar_button); + main_box.append (export_calendar_button); + main_box.append (accounts_button); child = main_box; + has_arrow = false; populate.begin (); - add_calendar_button.button_release_event.connect (() => { + add_calendar_button.clicked.connect (() => { edit_source (); - return Gdk.EVENT_STOP; }); - import_calendar_button.button_release_event.connect (() => { + import_calendar_button.clicked.connect (() => { var ics_filter = new Gtk.FileFilter (); ics_filter.add_mime_type ("application/ics"); @@ -88,8 +87,6 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { _("Open"), _("Cancel") ); - - file_chooser.set_local_only (true); file_chooser.set_select_multiple (true); file_chooser.set_filter (ics_filter); @@ -100,8 +97,9 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { GLib.File[] files = null; if (response_id == Gtk.ResponseType.ACCEPT) { - foreach (unowned GLib.File selected_file in file_chooser.get_files ()) { - files += selected_file; + var file_list = file_chooser.get_files (); + for (int i; i < file_list.get_n_items (); i++) { + files += (File) file_list.get_item (i); } } @@ -110,8 +108,6 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { dialog.present (); } }); - - return Gdk.EVENT_STOP; }); accounts_button.clicked.connect (() => { @@ -152,7 +148,6 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { var header = new Granite.HeaderLabel (row_location); row.set_header (header); - header.show_all (); } private void source_removed (E.Source source) { @@ -180,8 +175,7 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { source_item.edit_request.connect (edit_source); source_item.remove_request.connect (remove_source); - calendar_box.add (source_item); - calendar_box.show_all (); + calendar_box.append (source_item); src_map.set (source.dup_uid (), source_item); } @@ -208,4 +202,31 @@ public class Calendar.Widgets.SourcePopover : Gtk.Popover { src_dialog.set_source (source); src_dialog.present (); } + + private class PopoverMenuitem : Gtk.Button { + public string text { + set { + child = new Granite.AccelLabel (value) { + action_name = this.action_name + }; + + update_property (Gtk.AccessibleProperty.LABEL, value, -1); + } + } + + class construct { + set_css_name ("modelbutton"); + } + + construct { + accessible_role = MENU_ITEM; + + clicked.connect (() => { + var popover = (Gtk.Popover) get_ancestor (typeof (Gtk.Popover)); + if (popover != null) { + popover.popdown (); + } + }); + } + } } diff --git a/src/Widgets/SourceRow.vala b/src/Widgets/SourceRow.vala index e21088a99..015a43fc7 100644 --- a/src/Widgets/SourceRow.vala +++ b/src/Widgets/SourceRow.vala @@ -62,12 +62,12 @@ public class Calendar.SourceRow : Gtk.ListBoxRow { set_accent_color (cal.dup_color ()); - delete_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic", MENU) { + delete_button = new Gtk.Button.from_icon_name ("edit-delete-symbolic") { sensitive = source.removable, tooltip_text = source.removable ? _("Remove") : _("Not Removable") }; - edit_button = new Gtk.Button.from_icon_name ("edit-symbolic", MENU) { + edit_button = new Gtk.Button.from_icon_name ("edit-symbolic") { sensitive = source.writable, tooltip_text = source.writable ? _("Edit…"): _("Not Editable") }; @@ -78,17 +78,17 @@ public class Calendar.SourceRow : Gtk.ListBoxRow { margin_bottom = 3, margin_start = 12 }; - calendar_box.add (visible_checkbutton); - calendar_box.add (calendar_name_label); - calendar_box.add (delete_button); - calendar_box.add (edit_button); + calendar_box.append (visible_checkbutton); + calendar_box.append (calendar_name_label); + calendar_box.append (delete_button); + calendar_box.append (edit_button); var undo_button = new Gtk.Button.with_label (_("Undo")) { margin_end = 6 }; - var close_button = new Gtk.Button.from_icon_name ("process-stop-symbolic", SMALL_TOOLBAR) { - relief = NONE + var close_button = new Gtk.Button.from_icon_name ("process-stop-symbolic") { + has_frame = false }; message_label = new Gtk.Label (_("\"%s\" removed").printf (source.display_name)) { @@ -97,18 +97,18 @@ public class Calendar.SourceRow : Gtk.ListBoxRow { }; info_box = new Gtk.Box (HORIZONTAL, 12); - info_box.add (close_button); - info_box.add (message_label); - info_box.add (undo_button); + info_box.append (close_button); + info_box.append (message_label); + info_box.append (undo_button); stack = new Gtk.Stack () { transition_type = OVER_RIGHT_LEFT }; - stack.add (calendar_box); - stack.add (info_box); + stack.add_child (calendar_box); + stack.add_child (info_box); stack.visible_child = calendar_box; - add (stack); + child = stack; close_button.clicked.connect (() => { hide (); @@ -156,18 +156,14 @@ public class Calendar.SourceRow : Gtk.ListBoxRow { "; var style_provider = new Gtk.CssProvider (); - try { - style_provider.load_from_data (style); - - providers[color] = style_provider; - Gtk.StyleContext.add_provider_for_screen ( - Gdk.Screen.get_default (), - providers[color], - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION - ); - } catch (Error e) { - critical ("couldn't set source check color: %s", e.message); - } + style_provider.load_from_string (style); + + providers[color] = style_provider; + Gtk.StyleContext.add_provider_for_display ( + Gdk.Display.get_default (), + providers[color], + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + ); } public void source_has_changed () { diff --git a/src/meson.build b/src/meson.build index f99d0d443..7473a0cf0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -39,25 +39,22 @@ calendar_files = files( ) calendar_deps = [ + adw_dep, core_dep, glib_dep, granite_dep, gtk_dep, - handy_dep, libecal_dep, libedataserver_dep, libedataserverui_dep, libical_dep, gmodule_dep, m_dep, - champlain_dep, - champlain_gtk_dep, - clutter_dep, - clutter_gtk_dep, folks_dep, geocode_glib_dep, gclue_dep, - libportal_dep + libportal_dep, + shumate_dep, ] executable( diff --git a/vapi/champlain-0.12.deps b/vapi/champlain-0.12.deps deleted file mode 100644 index 8d3fd570a..000000000 --- a/vapi/champlain-0.12.deps +++ /dev/null @@ -1,4 +0,0 @@ -clutter-1.0 -cogl-pango-1.0 -atk -pangocairo diff --git a/vapi/champlain-0.12.vapi b/vapi/champlain-0.12.vapi deleted file mode 100644 index 58a39ba84..000000000 --- a/vapi/champlain-0.12.vapi +++ /dev/null @@ -1,841 +0,0 @@ -/* champlain-0.12.vapi generated by vapigen, do not modify. */ - -[CCode (cprefix = "Champlain", gir_namespace = "Champlain", gir_version = "0.12", lower_case_cprefix = "champlain_")] -namespace Champlain { - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_adjustment_get_type ()")] - public class Adjustment : GLib.Object { - [CCode (has_construct_function = false)] - public Adjustment (double value, double lower, double upper, double step_increment); - public bool clamp (bool interpolate, uint n_frames, uint fps); - public double get_value (); - public void get_values (double value, double lower, double upper, double step_increment); - public void interpolate (double value, uint n_frames, uint fps); - public void interpolate_stop (); - public void set_value (double value); - public void set_values (double value, double lower, double upper, double step_increment); - [NoAccessorMethod] - public double lower { get; set; } - [NoAccessorMethod] - public double step_increment { get; set; } - [NoAccessorMethod] - public double upper { get; set; } - public double value { get; set; } - public virtual signal void changed (); - } - [CCode (cheader_filename = "champlain/champlain.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "champlain_bounding_box_get_type ()")] - [Compact] - [Version (since = "0.6")] - public class BoundingBox { - public double bottom; - public double left; - public double right; - public double top; - [CCode (has_construct_function = false)] - public BoundingBox (); - [Version (since = "0.10")] - public void compose (Champlain.BoundingBox other); - public Champlain.BoundingBox copy (); - [Version (since = "0.12.4")] - public bool covers (double latitude, double longitude); - [Version (since = "0.10")] - public void extend (double latitude, double longitude); - public void free (); - public void get_center (out double latitude, out double longitude); - [Version (since = "0.10")] - public bool is_valid (); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_coordinate_get_type ()")] - [Version (since = "0.10")] - public class Coordinate : GLib.InitiallyUnowned, Champlain.Location { - [CCode (has_construct_function = false)] - public Coordinate (); - [CCode (has_construct_function = false)] - public Coordinate.full (double latitude, double longitude); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_custom_marker_get_type ()")] - [Version (deprecated = true, deprecated_since = "0.12.4", since = "0.10")] - public class CustomMarker : Champlain.Marker, Atk.Implementor, Champlain.Location, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public CustomMarker (); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_error_tile_renderer_get_type ()")] - [Version (since = "0.8")] - public class ErrorTileRenderer : Champlain.Renderer { - [CCode (has_construct_function = false)] - public ErrorTileRenderer (uint tile_size); - public uint get_tile_size (); - public void set_tile_size (uint size); - public uint tile_size { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_file_cache_get_type ()")] - [Version (since = "0.6")] - public class FileCache : Champlain.TileCache { - [CCode (has_construct_function = false)] - protected FileCache (); - [CCode (has_construct_function = false)] - [Version (since = "0.8")] - public FileCache.full (uint size_limit, string? cache_dir, Champlain.Renderer renderer); - public unowned string get_cache_dir (); - [Version (since = "0.4")] - public uint get_size_limit (); - [Version (since = "0.4")] - public void purge (); - [Version (since = "0.4")] - public void purge_on_idle (); - [Version (since = "0.4")] - public void set_size_limit (uint size_limit); - public string cache_dir { get; construct; } - [Version (since = "0.4")] - public uint size_limit { get; set construct; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_file_tile_source_get_type ()")] - [Version (since = "0.8")] - public class FileTileSource : Champlain.TileSource { - [CCode (has_construct_function = false)] - protected FileTileSource (); - [CCode (has_construct_function = false)] - public FileTileSource.full (string id, string name, string license, string license_uri, uint min_zoom, uint max_zoom, uint tile_size, Champlain.MapProjection projection, Champlain.Renderer renderer); - public void load_map_data (string map_path); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_image_renderer_get_type ()")] - [Version (since = "0.8")] - public class ImageRenderer : Champlain.Renderer { - [CCode (has_construct_function = false)] - public ImageRenderer (); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_kinetic_scroll_view_get_type ()")] - public class KineticScrollView : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public KineticScrollView (bool kinetic, Champlain.Viewport viewport); - public void stop (); - [NoAccessorMethod] - public double decel_rate { get; set; } - [NoAccessorMethod] - public bool mode { get; set; } - [NoAccessorMethod] - public uint motion_buffer { get; set; } - public signal void panning_completed (); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_label_get_type ()")] - [Version (since = "0.10")] - public class Label : Champlain.Marker, Atk.Implementor, Champlain.Location, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Label (); - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Label.from_file (string filename) throws GLib.Error; - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Label.full (string text, Clutter.Actor actor); - public Pango.Alignment get_alignment (); - public Pango.AttrList get_attributes (); - public Clutter.Color? get_color (); - public bool get_draw_background (); - [Version (since = "0.12.10")] - public bool get_draw_shadow (); - public Pango.EllipsizeMode get_ellipsize (); - public unowned string get_font_name (); - public unowned Clutter.Actor get_image (); - public bool get_single_line_mode (); - public unowned string get_text (); - public Clutter.Color? get_text_color (); - public bool get_use_markup (); - public bool get_wrap (); - public Pango.WrapMode get_wrap_mode (); - public void set_alignment (Pango.Alignment alignment); - public void set_attributes (Pango.AttrList list); - public void set_color (Clutter.Color? color); - public void set_draw_background (bool background); - [Version (since = "0.12.10")] - public void set_draw_shadow (bool shadow); - public void set_ellipsize (Pango.EllipsizeMode mode); - public void set_font_name (string? font_name); - public void set_image (Clutter.Actor? image); - public void set_single_line_mode (bool mode); - public void set_text (string text); - public void set_text_color (Clutter.Color? color); - public void set_use_markup (bool use_markup); - public void set_wrap (bool wrap); - public void set_wrap_mode (Pango.WrapMode wrap_mode); - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Label.with_image (Clutter.Actor actor); - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Label.with_text (string text, string? font, Clutter.Color? text_color, Clutter.Color? label_color); - public Pango.Alignment alignment { get; set; } - public Clutter.Color color { owned get; set; } - public bool draw_background { get; set; } - [Version (since = "0.12.10")] - public bool draw_shadow { get; set; } - public Pango.EllipsizeMode ellipsize { get; set; } - public string font_name { get; set; } - public Clutter.Actor image { get; set; } - public bool single_line_mode { get; set; } - public string text { get; set; } - public Clutter.Color text_color { owned get; set; } - public bool use_markup { get; set; } - public bool wrap { get; set; } - public Pango.WrapMode wrap_mode { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_layer_get_type ()")] - [Version (since = "0.10")] - public abstract class Layer : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false)] - protected Layer (); - public virtual Champlain.BoundingBox get_bounding_box (); - public virtual void set_view (Champlain.View view); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_license_get_type ()")] - [Version (since = "0.10")] - public class License : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public License (); - public void connect_view (Champlain.View view); - public void disconnect_view (); - public Pango.Alignment get_alignment (); - public unowned string get_extra_text (); - public void set_alignment (Pango.Alignment alignment); - public void set_extra_text (string text); - public Pango.Alignment alignment { get; set; } - public string extra_text { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_map_source_get_type ()")] - [Version (since = "0.4")] - public abstract class MapSource : GLib.InitiallyUnowned { - [CCode (has_construct_function = false)] - protected MapSource (); - public virtual void fill_tile (Champlain.Tile tile); - public uint get_column_count (uint zoom_level); - public virtual unowned string get_id (); - public double get_latitude (uint zoom_level, double y); - public virtual unowned string get_license (); - public virtual unowned string get_license_uri (); - public double get_longitude (uint zoom_level, double x); - public virtual uint get_max_zoom_level (); - [Version (since = "0.4.3")] - public double get_meters_per_pixel (uint zoom_level, double latitude, double longitude); - public virtual uint get_min_zoom_level (); - public virtual unowned string get_name (); - [Version (since = "0.6")] - public unowned Champlain.MapSource get_next_source (); - public virtual Champlain.MapProjection get_projection (); - [Version (since = "0.8")] - public unowned Champlain.Renderer get_renderer (); - public uint get_row_count (uint zoom_level); - public virtual uint get_tile_size (); - public double get_x (uint zoom_level, double longitude); - public double get_y (uint zoom_level, double latitude); - [Version (since = "0.6")] - public void set_next_source (Champlain.MapSource next_source); - [Version (since = "0.8")] - public void set_renderer (Champlain.Renderer renderer); - [Version (since = "0.6")] - public Champlain.MapSource next_source { get; set; } - [Version (since = "0.8")] - public Champlain.Renderer renderer { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_map_source_chain_get_type ()")] - [Version (since = "0.6")] - public class MapSourceChain : Champlain.MapSource { - [CCode (has_construct_function = false)] - public MapSourceChain (); - public void pop (); - public void push (Champlain.MapSource map_source); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_map_source_desc_get_type ()")] - [Version (since = "0.10")] - public class MapSourceDesc : GLib.Object { - [CCode (has_construct_function = false)] - protected MapSourceDesc (); - public void* get_data (); - public unowned string get_id (); - public unowned string get_license (); - public unowned string get_license_uri (); - public uint get_max_zoom_level (); - public uint get_min_zoom_level (); - public unowned string get_name (); - public Champlain.MapProjection get_projection (); - public uint get_tile_size (); - public unowned string get_uri_format (); - [NoAccessorMethod] - public void* constructor { get; construct; } - public void* data { get; construct; } - public string id { get; construct; } - public string license { get; construct; } - public string license_uri { get; construct; } - public uint max_zoom_level { get; construct; } - public uint min_zoom_level { get; construct; } - public string name { get; construct; } - public Champlain.MapProjection projection { get; construct; } - public uint tile_size { get; construct; } - public string uri_format { get; construct; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_map_source_factory_get_type ()")] - [Version (since = "0.4")] - public class MapSourceFactory : GLib.Object { - [CCode (has_construct_function = false)] - protected MapSourceFactory (); - public unowned Champlain.MapSource create (string id); - [Version (since = "0.6")] - public unowned Champlain.MapSource create_cached_source (string id); - [Version (since = "0.8")] - public unowned Champlain.MapSource create_error_source (uint tile_size); - [Version (since = "0.12.5")] - public unowned Champlain.MapSource create_memcached_source (string id); - public static Champlain.MapSourceFactory dup_default (); - public GLib.SList get_registered (); - [Version (since = "0.10")] - public bool register (Champlain.MapSourceDesc desc); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_marker_get_type ()")] - [Version (since = "0.10")] - public class Marker : Clutter.Actor, Atk.Implementor, Champlain.Location, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - [Version (since = "0.12.4")] - public Marker (); - public void animate_in (); - public void animate_in_with_delay (uint delay); - public void animate_out (); - public void animate_out_with_delay (uint delay); - public bool get_draggable (); - public bool get_selectable (); - public bool get_selected (); - public static unowned Clutter.Color? get_selection_color (); - public static unowned Clutter.Color? get_selection_text_color (); - public void set_draggable (bool value); - public void set_selectable (bool value); - public void set_selected (bool value); - public static void set_selection_color (Clutter.Color color); - public static void set_selection_text_color (Clutter.Color color); - public bool draggable { get; set; } - public bool selectable { get; set; } - public bool selected { get; set; } - public signal void button_press (Clutter.Event event); - public signal void button_release (Clutter.Event event); - public signal void drag_finish (Clutter.Event event); - public signal void drag_motion (double dx, double dy, Clutter.Event event); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_marker_layer_get_type ()")] - [Version (since = "0.10")] - public class MarkerLayer : Champlain.Layer, Atk.Implementor, Champlain.Exportable, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false)] - public MarkerLayer (); - public void add_marker (Champlain.Marker marker); - public void animate_in_all_markers (); - public void animate_out_all_markers (); - [CCode (has_construct_function = false)] - public MarkerLayer.full (Champlain.SelectionMode mode); - public GLib.List get_markers (); - public GLib.List get_selected (); - public Champlain.SelectionMode get_selection_mode (); - public void hide_all_markers (); - public void remove_all (); - public void remove_marker (Champlain.Marker marker); - public void select_all_markers (); - public void set_all_markers_draggable (); - public void set_all_markers_undraggable (); - public void set_selection_mode (Champlain.SelectionMode mode); - public void show_all_markers (); - public void unselect_all_markers (); - public Champlain.SelectionMode selection_mode { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_memory_cache_get_type ()")] - [Version (since = "0.8")] - public class MemoryCache : Champlain.TileCache { - [CCode (has_construct_function = false)] - protected MemoryCache (); - public void clean (); - [CCode (has_construct_function = false)] - public MemoryCache.full (uint size_limit, Champlain.Renderer renderer); - public uint get_size_limit (); - public void set_size_limit (uint size_limit); - public uint size_limit { get; set construct; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_network_bbox_tile_source_get_type ()")] - [Version (since = "0.8")] - public class NetworkBboxTileSource : Champlain.TileSource { - [CCode (has_construct_function = false)] - protected NetworkBboxTileSource (); - [CCode (has_construct_function = false)] - public NetworkBboxTileSource.full (string id, string name, string license, string license_uri, uint min_zoom, uint max_zoom, uint tile_size, Champlain.MapProjection projection, Champlain.Renderer renderer); - public unowned string get_api_uri (); - [Version (since = "0.10")] - public void load_map_data (Champlain.BoundingBox bbox); - public void set_api_uri (string api_uri); - [Version (since = "0.12.16")] - public void set_user_agent (string user_agent); - public string api_uri { get; set; } - [NoAccessorMethod] - public string proxy_uri { owned get; set; } - [NoAccessorMethod] - public Champlain.State state { get; set; } - [Version (since = "0.12.16")] - public string user_agent { set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_network_tile_source_get_type ()")] - [Version (since = "0.6")] - public class NetworkTileSource : Champlain.TileSource { - [CCode (has_construct_function = false)] - protected NetworkTileSource (); - [CCode (has_construct_function = false)] - [Version (since = "0.4")] - public NetworkTileSource.full (string id, string name, string license, string license_uri, uint min_zoom, uint max_zoom, uint tile_size, Champlain.MapProjection projection, string uri_format, Champlain.Renderer renderer); - [Version (since = "0.12.14")] - public int get_max_conns (); - public bool get_offline (); - public unowned string get_proxy_uri (); - public unowned string get_uri_format (); - [Version (since = "0.12.14")] - public void set_max_conns (int max_conns); - public void set_offline (bool offline); - public void set_proxy_uri (string proxy_uri); - [Version (since = "0.4")] - public void set_uri_format (string uri_format); - [Version (since = "0.12.16")] - public void set_user_agent (string user_agent); - [Version (since = "0.12.14")] - public int max_conns { get; set; } - [Version (since = "0.4")] - public bool offline { get; set; } - [Version (since = "0.4")] - public string proxy_uri { get; set; } - [Version (since = "0.4")] - public string uri_format { get; set construct; } - [Version (since = "0.12.16")] - public string user_agent { set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_null_tile_source_get_type ()")] - [Version (since = "0.8")] - public class NullTileSource : Champlain.TileSource { - [CCode (has_construct_function = false)] - protected NullTileSource (); - [CCode (has_construct_function = false)] - public NullTileSource.full (Champlain.Renderer renderer); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_path_layer_get_type ()")] - [Version (since = "0.10")] - public class PathLayer : Champlain.Layer, Atk.Implementor, Champlain.Exportable, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false)] - public PathLayer (); - public void add_node (Champlain.Location location); - public bool get_closed (); - [Version (since = "0.12.4")] - public GLib.List get_dash (); - public bool get_fill (); - public Clutter.Color? get_fill_color (); - public GLib.List get_nodes (); - public bool get_stroke (); - public Clutter.Color? get_stroke_color (); - public double get_stroke_width (); - public bool get_visible (); - public void insert_node (Champlain.Location location, uint position); - public void remove_all (); - public void remove_node (Champlain.Location location); - public void set_closed (bool value); - [Version (since = "0.12.4")] - public void set_dash (GLib.List dash_pattern); - public void set_fill (bool value); - public void set_fill_color (Clutter.Color? color); - public void set_stroke (bool value); - public void set_stroke_color (Clutter.Color? color); - public void set_stroke_width (double value); - public void set_visible (bool value); - public bool closed { get; set; } - public bool fill { get; set; } - public Clutter.Color fill_color { owned get; set; } - public bool stroke { get; set; } - public Clutter.Color stroke_color { owned get; set; } - public double stroke_width { get; set; } - public bool visible { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_point_get_type ()")] - [Version (since = "0.10")] - public class Point : Champlain.Marker, Atk.Implementor, Champlain.Exportable, Champlain.Location, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Point (); - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Point.full (double size, Clutter.Color color); - public Clutter.Color? get_color (); - public double get_size (); - public void set_color (Clutter.Color? color); - public void set_size (double size); - public Clutter.Color color { owned get; set; } - public double size { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_renderer_get_type ()")] - [Version (since = "0.8")] - public class Renderer : GLib.InitiallyUnowned { - [CCode (has_construct_function = false)] - protected Renderer (); - public virtual void render (Champlain.Tile tile); - public virtual void set_data ([CCode (array_length_cname = "size", array_length_pos = 1.1, array_length_type = "guint")] uint8[] data); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_scale_get_type ()")] - [Version (since = "0.10")] - public class Scale : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Scale (); - public void connect_view (Champlain.View view); - public void disconnect_view (); - public uint get_max_width (); - public Champlain.Unit get_unit (); - public void set_max_width (uint value); - public void set_unit (Champlain.Unit unit); - public uint max_width { get; set; } - public Champlain.Unit unit { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_tile_get_type ()")] - [Version (since = "0.4")] - public class Tile : Clutter.Actor, Atk.Implementor, Champlain.Exportable, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false)] - public Tile (); - [Version (since = "0.8")] - public void display_content (); - [CCode (has_construct_function = false)] - public Tile.full (uint x, uint y, uint size, uint zoom_level); - public unowned Clutter.Actor get_content (); - public unowned string get_etag (); - [Version (since = "0.6")] - public bool get_fade_in (); - public unowned GLib.TimeVal? get_modified_time (); - public uint get_size (); - public Champlain.State get_state (); - public uint get_x (); - public uint get_y (); - public uint get_zoom_level (); - public void set_content (Clutter.Actor actor); - public void set_etag (string etag); - [Version (since = "0.6")] - public void set_fade_in (bool fade_in); - public void set_modified_time (GLib.TimeVal time); - public void set_size (uint size); - public void set_state (Champlain.State state); - public void set_x (uint x); - public void set_y (uint y); - public void set_zoom_level (uint zoom_level); - public Clutter.Actor content { get; set; } - public string etag { get; set; } - [Version (since = "0.6")] - public bool fade_in { get; set; } - public uint size { get; set; } - public Champlain.State state { get; set; } - public uint x { get; set; } - public uint y { get; set; } - public uint zoom_level { get; set; } - [Version (since = "0.10")] - public signal void render_complete (void* data, uint size, bool error); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_tile_cache_get_type ()")] - [Version (since = "0.6")] - public abstract class TileCache : Champlain.MapSource { - [CCode (has_construct_function = false)] - protected TileCache (); - public virtual void on_tile_filled (Champlain.Tile tile); - public virtual void refresh_tile_time (Champlain.Tile tile); - public virtual void store_tile (Champlain.Tile tile, string contents, size_t size); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_tile_source_get_type ()")] - [Version (since = "0.6")] - public abstract class TileSource : Champlain.MapSource { - [CCode (has_construct_function = false)] - protected TileSource (); - public unowned Champlain.TileCache get_cache (); - public void set_cache (Champlain.TileCache cache); - [Version (since = "0.4")] - public void set_id (string id); - [Version (since = "0.4")] - public void set_license (string license); - [Version (since = "0.4")] - public void set_license_uri (string license_uri); - public void set_max_zoom_level (uint zoom_level); - public void set_min_zoom_level (uint zoom_level); - [Version (since = "0.4")] - public void set_name (string name); - [Version (since = "0.4")] - public void set_projection (Champlain.MapProjection projection); - public void set_tile_size (uint tile_size); - public Champlain.TileCache cache { get; set; } - [NoAccessorMethod] - [Version (since = "0.4")] - public string id { owned get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public string license { owned get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public string license_uri { owned get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public uint max_zoom_level { get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public uint min_zoom_level { get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public string name { owned get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public Champlain.MapProjection projection { get; set construct; } - [NoAccessorMethod] - [Version (since = "0.4")] - public uint tile_size { get; set construct; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_view_get_type ()")] - [Version (since = "0.1")] - public class View : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - [Version (since = "0.4")] - public View (); - [Version (since = "0.2")] - public void add_layer (Champlain.Layer layer); - [Version (since = "0.12.5")] - public void add_overlay_source (Champlain.MapSource map_source, uint8 opacity); - [Version (deprecated = true, deprecated_since = "0.12.4", since = "0.10")] - public void bin_layout_add (Clutter.Actor child, Clutter.BinAlignment x_align, Clutter.BinAlignment y_align); - public void center_on (double latitude, double longitude); - [Version (since = "0.10")] - public void ensure_layers_visible (bool animate); - [Version (since = "0.10")] - public void ensure_visible (Champlain.BoundingBox bbox, bool animate); - [Version (since = "0.12")] - public bool get_animate_zoom (); - [Version (since = "0.12.4")] - public unowned Clutter.Content get_background_pattern (); - [Version (since = "0.12.4")] - public Champlain.BoundingBox get_bounding_box (); - [Version (since = "0.12.6")] - public Champlain.BoundingBox get_bounding_box_for_zoom_level (uint zoom_level); - [Version (since = "0.10")] - public double get_center_latitude (); - [Version (since = "0.10")] - public double get_center_longitude (); - [Version (since = "0.4")] - public double get_deceleration (); - public bool get_horizontal_wrap (); - [Version (since = "0.4")] - public bool get_keep_center_on_resize (); - [Version (since = "0.10")] - public bool get_kinetic_mode (); - [Version (since = "0.10")] - public unowned Champlain.License get_license_actor (); - [Version (since = "0.4")] - public unowned Champlain.MapSource get_map_source (); - [Version (since = "0.4")] - public uint get_max_zoom_level (); - [Version (since = "0.4")] - public uint get_min_zoom_level (); - [Version (since = "0.12.5")] - public GLib.List get_overlay_sources (); - [Version (since = "0.10")] - public Champlain.State get_state (); - [Version (since = "0.12.14")] - public void get_viewport_anchor (out int anchor_x, out int anchor_y); - [Version (since = "0.10")] - public void get_viewport_origin (out int x, out int y); - [Version (since = "0.12.11")] - public unowned Champlain.BoundingBox get_world (); - [Version (since = "0.4")] - public uint get_zoom_level (); - [Version (since = "0.4")] - public bool get_zoom_on_double_click (); - [Version (since = "0.4")] - public void go_to (double latitude, double longitude); - [Version (since = "0.10")] - public double latitude_to_y (double latitude); - [Version (since = "0.10")] - public double longitude_to_x (double longitude); - [Version (since = "0.8")] - public void reload_tiles (); - [Version (since = "0.4.1")] - public void remove_layer (Champlain.Layer layer); - [Version (since = "0.12.5")] - public void remove_overlay_source (Champlain.MapSource map_source); - [Version (since = "0.12")] - public void set_animate_zoom (bool value); - [Version (since = "0.12.4")] - public void set_background_pattern (Clutter.Content background); - [Version (since = "0.4")] - public void set_deceleration (double rate); - public void set_horizontal_wrap (bool wrap); - [Version (since = "0.4")] - public void set_keep_center_on_resize (bool value); - [Version (since = "0.10")] - public void set_kinetic_mode (bool kinetic); - [Version (since = "0.4")] - public void set_map_source (Champlain.MapSource map_source); - [Version (since = "0.4")] - public void set_max_zoom_level (uint zoom_level); - [Version (since = "0.4")] - public void set_min_zoom_level (uint zoom_level); - [Version (since = "0.12.11")] - public void set_world (Champlain.BoundingBox bbox); - [Version (since = "0.4")] - public void set_zoom_level (uint zoom_level); - [Version (since = "0.4")] - public void set_zoom_on_double_click (bool value); - [Version (since = "0.4")] - public void stop_go_to (); - public Cairo.Surface to_surface (bool include_layers); - [Version (since = "0.10")] - public double x_to_longitude (double x); - [Version (since = "0.10")] - public double y_to_latitude (double y); - public void zoom_in (); - public void zoom_out (); - [Version (since = "0.12")] - public bool animate_zoom { get; set; } - [Version (since = "0.12.4")] - public Clutter.Actor background_pattern { get; set; } - [Version (since = "0.10")] - public double deceleration { get; set; } - [NoAccessorMethod] - public uint goto_animation_duration { get; set; } - [NoAccessorMethod] - public Clutter.AnimationMode goto_animation_mode { get; set; } - public bool horizontal_wrap { get; set; } - [Version (since = "0.2.7")] - public bool keep_center_on_resize { get; set; } - [Version (since = "0.10")] - public bool kinetic_mode { get; set; } - [NoAccessorMethod] - public double latitude { get; set; } - [NoAccessorMethod] - public double longitude { get; set; } - [Version (since = "0.2")] - public Champlain.MapSource map_source { get; set; } - [Version (since = "0.4")] - public uint max_zoom_level { get; set; } - [Version (since = "0.4")] - public uint min_zoom_level { get; set; } - [Version (since = "0.4")] - public Champlain.State state { get; } - [Version (since = "0.12.11")] - public Champlain.BoundingBox world { get; set; } - public uint zoom_level { get; set; } - [Version (since = "0.4")] - public bool zoom_on_double_click { get; set; } - [Version (since = "0.4")] - public signal void animation_completed (); - [Version (since = "0.10")] - public signal void layer_relocated (); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_viewport_get_type ()")] - public class Viewport : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable { - [CCode (has_construct_function = false, type = "ClutterActor*")] - public Viewport (); - public void get_adjustments (Champlain.Adjustment hadjustment, Champlain.Adjustment vadjustment); - public void get_anchor (int x, int y); - public void get_origin (double x, double y); - public void set_actor_position (Clutter.Actor actor, double x, double y); - public void set_adjustments (Champlain.Adjustment hadjustment, Champlain.Adjustment vadjustment); - public void set_child (Clutter.Actor child); - public void set_origin (double x, double y); - public void stop (); - [NoAccessorMethod] - public Champlain.Adjustment hadjustment { owned get; set; } - [NoAccessorMethod] - public Champlain.Adjustment vadjustment { owned get; set; } - [NoAccessorMethod] - public int x_origin { get; set; } - [NoAccessorMethod] - public int y_origin { get; set; } - public signal void relocated (); - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_exportable_get_type ()")] - public interface Exportable : GLib.Object { - [Version (since = "0.12.12")] - public abstract unowned Cairo.Surface get_surface (); - [Version (since = "0.12.12")] - public abstract void set_surface (Cairo.Surface surface); - [Version (since = "0.12.12")] - public abstract Cairo.Surface surface { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", type_id = "champlain_location_get_type ()")] - public interface Location : GLib.Object { - [Version (since = "0.10")] - public abstract double get_latitude (); - [Version (since = "0.10")] - public abstract double get_longitude (); - [Version (since = "0.10")] - public abstract void set_location (double latitude, double longitude); - [NoAccessorMethod] - [Version (since = "0.10")] - public abstract double latitude { get; set; } - [NoAccessorMethod] - [Version (since = "0.10")] - public abstract double longitude { get; set; } - } - [CCode (cheader_filename = "champlain/champlain.h", cprefix = "CHAMPLAIN_MAP_PROJECTION_", type_id = "champlain_map_projection_get_type ()")] - public enum MapProjection { - MERCATOR - } - [CCode (cheader_filename = "champlain/champlain.h", cprefix = "CHAMPLAIN_SELECTION_", type_id = "champlain_selection_mode_get_type ()")] - public enum SelectionMode { - NONE, - SINGLE, - MULTIPLE - } - [CCode (cheader_filename = "champlain/champlain.h", cprefix = "CHAMPLAIN_STATE_", type_id = "champlain_state_get_type ()")] - public enum State { - NONE, - LOADING, - LOADED, - DONE - } - [CCode (cheader_filename = "champlain/champlain.h", cprefix = "CHAMPLAIN_UNIT_", type_id = "champlain_unit_get_type ()")] - public enum Unit { - KM, - MILES - } - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAJOR_VERSION")] - public const int MAJOR_VERSION; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL")] - public const string MAP_SOURCE_MEMPHIS_LOCAL; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_MEMPHIS_NETWORK")] - public const string MAP_SOURCE_MEMPHIS_NETWORK; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_MFF_RELIEF")] - public const string MAP_SOURCE_MFF_RELIEF; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OAM")] - [Version (deprecated = true)] - public const string MAP_SOURCE_OAM; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OSM_AERIAL_MAP")] - [Version (deprecated = true)] - public const string MAP_SOURCE_OSM_AERIAL_MAP; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP")] - public const string MAP_SOURCE_OSM_CYCLE_MAP; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK")] - public const string MAP_SOURCE_OSM_MAPNIK; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OSM_MAPQUEST")] - [Version (deprecated = true)] - public const string MAP_SOURCE_OSM_MAPQUEST; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER")] - [Version (deprecated = true)] - public const string MAP_SOURCE_OSM_OSMARENDER; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP")] - public const string MAP_SOURCE_OSM_TRANSPORT_MAP; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OWM_CLOUDS")] - public const string MAP_SOURCE_OWM_CLOUDS; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OWM_PRECIPITATION")] - public const string MAP_SOURCE_OWM_PRECIPITATION; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OWM_PRESSURE")] - public const string MAP_SOURCE_OWM_PRESSURE; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OWM_TEMPERATURE")] - public const string MAP_SOURCE_OWM_TEMPERATURE; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAP_SOURCE_OWM_WIND")] - public const string MAP_SOURCE_OWM_WIND; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAX_LATITUDE")] - public const double MAX_LATITUDE; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MAX_LONGITUDE")] - public const double MAX_LONGITUDE; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MICRO_VERSION")] - public const int MICRO_VERSION; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MINOR_VERSION")] - public const int MINOR_VERSION; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MIN_LATITUDE")] - public const double MIN_LATITUDE; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_MIN_LONGITUDE")] - public const double MIN_LONGITUDE; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_VERSION")] - public const double VERSION; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_VERSION_HEX")] - public const int VERSION_HEX; - [CCode (cheader_filename = "champlain/champlain.h", cname = "CHAMPLAIN_VERSION_S")] - public const string VERSION_S; -} diff --git a/vapi/champlain-gtk-0.12.deps b/vapi/champlain-gtk-0.12.deps deleted file mode 100644 index 6ed23b451..000000000 --- a/vapi/champlain-gtk-0.12.deps +++ /dev/null @@ -1,6 +0,0 @@ -clutter-gtk-1.0 -cogl-pango-1.0 -gtk+-3.0 -atk -pangocairo -champlain-0.12 diff --git a/vapi/champlain-gtk-0.12.vapi b/vapi/champlain-gtk-0.12.vapi deleted file mode 100644 index 1a35aa1fa..000000000 --- a/vapi/champlain-gtk-0.12.vapi +++ /dev/null @@ -1,14 +0,0 @@ -/* champlain-gtk-0.12.vapi generated by vapigen, do not modify. */ - -[CCode (cprefix = "GtkChamplain", gir_namespace = "GtkChamplain", gir_version = "0.12", lower_case_cprefix = "gtk_champlain_")] -namespace GtkChamplain { - [CCode (cheader_filename = "champlain-gtk/champlain-gtk.h", type_id = "gtk_champlain_embed_get_type ()")] - [Version (since = "0.4")] - public class Embed : Gtk.Alignment, Atk.Implementor, Gtk.Buildable { - [CCode (has_construct_function = false, type = "GtkWidget*")] - public Embed (); - public unowned Champlain.View get_view (); - [NoAccessorMethod] - public Champlain.View champlain_view { owned get; } - } -}