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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,6 @@
</group>
<group>
<_short>Tray</_short>
<option name="tray_smooth_scrolling_threshold" type="int">
<_short>Smooth Scrolling Threshold</_short>
<default>5</default>
<min>1</min>
</option>
<option name="tray_icon_size" type="int">
<_short>Default Icon Size</_short>
<default>0</default>
Expand Down
2 changes: 1 addition & 1 deletion src/dock/dock-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void WfDockApp::handle_toplevel_closed(zwlr_foreign_toplevel_handle_v1 *handle)
{
priv->toplevels[handle]->close();
WfOption<bool> use_close_animations{"dock/show_close"};
if (use_close_animations)
if (use_close_animations.value())
{
Glib::signal_timeout().connect([=]
{
Expand Down
4 changes: 2 additions & 2 deletions src/dock/dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class WfDock::impl

out_box.set_halign(Gtk::Align::CENTER);

if ((std::string)css_path != "")
if (css_path.value() != "")
{
auto css = load_css_from_path(css_path);
auto css = load_css_from_path(css_path.value());
if (css)
{
auto display = Gdk::Display::get_default();
Expand Down
2 changes: 1 addition & 1 deletion src/dock/toplevel-icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class WfToplevelIcon::impl
this->app_id = app_id;
IconProvider::set_image_from_icon(image,
app_id,
icon_height,
icon_height.value(),
button.get_scale_factor());
}

Expand Down
22 changes: 11 additions & 11 deletions src/panel/panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ class WayfirePanel::impl
WfOption<std::string> panel_layer{"panel/layer"};
std::function<void()> set_panel_layer = [=] ()
{
if ((std::string)panel_layer == "overlay")
if (panel_layer.value() == "overlay")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY);
}

if ((std::string)panel_layer == "top")
if (panel_layer.value() == "top")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP);
}

if ((std::string)panel_layer == "bottom")
if (panel_layer.value() == "bottom")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM);
}

if ((std::string)panel_layer == "background")
if (panel_layer.value() == "background")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND);
}
Expand All @@ -82,7 +82,7 @@ class WayfirePanel::impl
{
window = std::make_unique<WayfireAutohidingWindow>(output, "panel");

window->set_default_size(0, minimal_panel_height);
window->set_default_size(0, minimal_panel_height.value());
window->add_css_class("wf-panel");
panel_layer.set_callback(set_panel_layer);
set_panel_layer(); // initial setting
Expand Down Expand Up @@ -350,15 +350,15 @@ class WayfirePanel::impl
{
left_widgets_opt.set_callback([=] ()
{
reload_widgets((std::string)left_widgets_opt, left_widgets, left_box);
reload_widgets(left_widgets_opt.value(), left_widgets, left_box);
});
right_widgets_opt.set_callback([=] ()
{
reload_widgets((std::string)right_widgets_opt, right_widgets, right_box);
reload_widgets(right_widgets_opt.value(), right_widgets, right_box);
});
center_widgets_opt.set_callback([=] ()
{
reload_widgets((std::string)center_widgets_opt, center_widgets, center_box);
reload_widgets(center_widgets_opt.value(), center_widgets, center_box);
if (center_box.get_children().empty())
{
content_box.unset_center_widget();
Expand All @@ -368,9 +368,9 @@ class WayfirePanel::impl
}
});

reload_widgets((std::string)left_widgets_opt, left_widgets, left_box);
reload_widgets((std::string)right_widgets_opt, right_widgets, right_box);
reload_widgets((std::string)center_widgets_opt, center_widgets, center_box);
reload_widgets(left_widgets_opt.value(), left_widgets, left_box);
reload_widgets(right_widgets_opt.value(), right_widgets, right_box);
reload_widgets(center_widgets_opt.value(), center_widgets, center_box);
}

std::shared_ptr<WayfireIPC> get_ipc_server_instance()
Expand Down
2 changes: 1 addition & 1 deletion src/panel/widgets/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void WayfireClock::on_calendar_shown()
bool WayfireClock::update_label()
{
auto time = Glib::DateTime::create_now_local();
auto text = time.format((std::string)format);
auto text = time.format(format.value());

/* Sometimes GLib::DateTime will add leading spaces. This results in
* unevenly balanced padding around the text, which looks quite bad.
Expand Down
10 changes: 2 additions & 8 deletions src/panel/widgets/command-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,10 @@ WfCommandOutputButtons::CommandOutput::CommandOutput(const std::string & name,
add_css_class("icon-" + icon_position);

main_label.set_ellipsize(Pango::EllipsizeMode::END);
main_label.set_max_width_chars(max_chars_opt);
max_chars_opt.set_callback([=]
{
main_label.set_max_width_chars(max_chars_opt);
});
// main_label.set_alignment(Gtk::ALIGN_CENTER);
main_label.set_max_width_chars(max_chars_opt.value());
max_chars_opt.set_callback([this]
{
main_label.set_max_width_chars(max_chars_opt);
main_label.set_max_width_chars(max_chars_opt.value());
});

box.set_orientation(
Expand All @@ -102,7 +97,6 @@ WfCommandOutputButtons::CommandOutput::CommandOutput(const std::string & name,
}

set_child(box);
// set_relief(Gtk::RELIEF_NONE);

const auto update_output = [=] ()
{
Expand Down
48 changes: 24 additions & 24 deletions src/panel/widgets/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ WfMenuMenuItem::WfMenuMenuItem(WayfireMenu *_menu, Glib::RefPtr<Gio::DesktopAppI
m_actions = Gio::SimpleActionGroup::create();
m_extra_actions_button.hide();

if (menu->menu_list)
if (menu->menu_list.value())
{
m_padding_box.append(m_extra_actions_button);
this->set_size_request(menu->menu_min_content_width, 48);
Expand Down Expand Up @@ -451,7 +451,7 @@ void WayfireMenu::on_search_changed()
/* Text has been unset, show categories again */
populate_menu_items(category);
category_scrolled_window.show();
app_scrolled_window.set_min_content_width(int(menu_min_content_width));
app_scrolled_window.set_min_content_width(menu_min_content_width.value());
} else
{
/* User is filtering, hide categories, ignore chosen category */
Expand Down Expand Up @@ -549,25 +549,25 @@ void WayfireMenu::setup_popover_layout()
flowbox.set_sort_func(sigc::mem_fun(*this, &WayfireMenu::on_sort));
flowbox.set_filter_func(sigc::mem_fun(*this, &WayfireMenu::on_filter));
flowbox.add_css_class("app-list");
flowbox.set_size_request(int(menu_min_content_width), int(menu_min_content_height));
flowbox.set_size_request(menu_min_content_width.value(), menu_min_content_height.value());

flowbox_container.append(flowbox);

scroll_pair.append(category_scrolled_window);
scroll_pair.append(app_scrolled_window);
scroll_pair.set_homogeneous(false);

app_scrolled_window.set_min_content_width(int(menu_min_content_width));
app_scrolled_window.set_min_content_height(int(menu_min_content_height));
app_scrolled_window.set_min_content_width(menu_min_content_width.value());
app_scrolled_window.set_min_content_height(menu_min_content_height.value());
app_scrolled_window.set_child(flowbox_container);
app_scrolled_window.add_css_class("app-list-scroll");
app_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);

category_box.add_css_class("category-list");
category_box.set_orientation(Gtk::Orientation::VERTICAL);

category_scrolled_window.set_min_content_width(int(menu_min_category_width));
category_scrolled_window.set_min_content_height(int(menu_min_content_height));
category_scrolled_window.set_min_content_width(menu_min_category_width.value());
category_scrolled_window.set_min_content_height(menu_min_content_height.value());
category_scrolled_window.set_child(category_box);
category_scrolled_window.add_css_class("categtory-list-scroll");
category_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC);
Expand Down Expand Up @@ -620,22 +620,22 @@ void WayfireMenu::setup_popover_layout()
Gtk::Window *window = dynamic_cast<Gtk::Window*>(button->get_root());
WfOption<std::string> panel_layer{"panel/layer"};

if ((std::string)panel_layer == "overlay")
if (panel_layer.value() == "overlay")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY);
}

if ((std::string)panel_layer == "top")
if (panel_layer.value() == "top")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP);
}

if ((std::string)panel_layer == "bottom")
if (panel_layer.value() == "bottom")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM);
}

if ((std::string)panel_layer == "background")
if (panel_layer.value() == "background")
{
gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND);
}
Expand All @@ -651,7 +651,7 @@ void WayfireMenu::update_popover_layout()
popover_layout_box.remove(separator);
popover_layout_box.remove(box_bottom);

if ((std::string)panel_position == WF_WINDOW_POSITION_TOP)
if (panel_position.value() == WF_WINDOW_POSITION_TOP)
{
popover_layout_box.append(search_entry);
popover_layout_box.append(scroll_pair);
Expand All @@ -674,37 +674,37 @@ void WayfireMenu::update_popover_layout()
void WayfireLogoutUI::on_logout_click()
{
ui.hide();
g_spawn_command_line_async(std::string(logout_command).c_str(), NULL);
g_spawn_command_line_async(logout_command.value().c_str(), NULL);
}

void WayfireLogoutUI::on_reboot_click()
{
ui.hide();
g_spawn_command_line_async(std::string(reboot_command).c_str(), NULL);
g_spawn_command_line_async(reboot_command.value().c_str(), NULL);
}

void WayfireLogoutUI::on_shutdown_click()
{
ui.hide();
g_spawn_command_line_async(std::string(shutdown_command).c_str(), NULL);
g_spawn_command_line_async(shutdown_command.value().c_str(), NULL);
}

void WayfireLogoutUI::on_suspend_click()
{
ui.hide();
g_spawn_command_line_async(std::string(suspend_command).c_str(), NULL);
g_spawn_command_line_async(suspend_command.value().c_str(), NULL);
}

void WayfireLogoutUI::on_hibernate_click()
{
ui.hide();
g_spawn_command_line_async(std::string(hibernate_command).c_str(), NULL);
g_spawn_command_line_async(hibernate_command.value().c_str(), NULL);
}

void WayfireLogoutUI::on_switchuser_click()
{
ui.hide();
g_spawn_command_line_async(std::string(switchuser_command).c_str(), NULL);
g_spawn_command_line_async(switchuser_command.value().c_str(), NULL);
}

void WayfireLogoutUI::on_cancel_click()
Expand Down Expand Up @@ -803,9 +803,9 @@ WayfireLogoutUI::~WayfireLogoutUI()
void WayfireMenu::on_logout_click()
{
button->get_popover()->hide();
if (!std::string(menu_logout_command).empty())
if (!menu_logout_command.value().empty())
{
g_spawn_command_line_async(std::string(menu_logout_command).c_str(), NULL);
g_spawn_command_line_async(menu_logout_command.value().c_str(), NULL);
return;
}

Expand Down Expand Up @@ -941,18 +941,18 @@ void WayfireMenu::init(Gtk::Box *container)

void WayfireMenu::update_category_width()
{
category_scrolled_window.set_min_content_width(int(menu_min_category_width));
category_scrolled_window.set_min_content_width(menu_min_category_width.value());
}

void WayfireMenu::update_content_height()
{
category_scrolled_window.set_min_content_height(int(menu_min_content_height));
app_scrolled_window.set_min_content_height(int(menu_min_content_height));
category_scrolled_window.set_min_content_height(menu_min_content_height.value());
app_scrolled_window.set_min_content_height(menu_min_content_height.value());
}

void WayfireMenu::update_content_width()
{
app_scrolled_window.set_min_content_width(int(menu_min_content_width));
app_scrolled_window.set_min_content_width(menu_min_content_width.value());
}

void WayfireMenu::toggle_menu()
Expand Down
6 changes: 3 additions & 3 deletions src/panel/widgets/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void WayfireNetworkInfo::update_status()
status.remove_css_class("good");
status.remove_css_class("weak");
status.remove_css_class("none");
if (status_color_opt)
if (status_color_opt.value())
{
status.add_css_class(info->get_strength_str());
}
Expand Down Expand Up @@ -398,9 +398,9 @@ bool WayfireNetworkInfo::setup_dbus()

void WayfireNetworkInfo::on_click()
{
if ((std::string)click_command_opt != "default")
if (click_command_opt.value() != "default")
{
Glib::spawn_command_line_async((std::string)click_command_opt);
Glib::spawn_command_line_async(click_command_opt.value());
} else
{
info->spawn_control_center(nm_proxy);
Expand Down
6 changes: 3 additions & 3 deletions src/panel/widgets/notifications/notification-center.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ void WayfireNotificationCenter::newNotification(Notification::id_type id, bool s
auto & widget = notification_widgets.at(id);
box.append(*widget);
widget->set_reveal_child();
if (show_popup && !dnd_enabled || (show_critical_in_dnd && (notification.hints.urgency == 2)))
if (show_popup && !dnd_enabled || (show_critical_in_dnd.value() && (notification.hints.urgency == 2)))
{
auto *popover = button->get_popover();
if ((timeout > 0) && (!popover_timeout.empty() || !popover->is_visible()))
if ((timeout.value() > 0) && (!popover_timeout.empty() || !popover->is_visible()))
{
popover_timeout.disconnect();
popover_timeout = Glib::signal_timeout().connect(
Expand All @@ -91,7 +91,7 @@ void WayfireNotificationCenter::newNotification(Notification::id_type id, bool s
popover_timeout.disconnect();
return true;
},
timeout * 1000);
timeout.value() * 1000);
}

button->set_keyboard_interactive(false);
Expand Down
4 changes: 2 additions & 2 deletions src/panel/widgets/tray/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ void StatusNotifierItem::init_widget()
const auto ev_coords = Glib::Variant<std::tuple<int, int>>::create({0, 0});

const int primary_click = 1;
const int secondary_click = menu_on_middle_click ? 2 : 3;
const int tertiary_click = menu_on_middle_click ? 3 : 2;
const int secondary_click = menu_on_middle_click.value() ? 2 : 3;
const int tertiary_click = menu_on_middle_click.value() ? 3 : 2;
if (butt == primary_click)
{
if (get_item_property<bool>("ItemIsMenu", true))
Expand Down
1 change: 0 additions & 1 deletion src/panel/widgets/tray/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class StatusNotifierItem : public Gtk::Button
{
guint menu_handler_id;

WfOption<int> smooth_scolling_threshold{"panel/tray_smooth_scrolling_threshold"};
WfOption<bool> menu_on_middle_click{"panel/tray_menu_on_middle_click"};

Glib::ustring dbus_name, menu_path;
Expand Down
Loading