8
8
waybar::modules::UI::UI (const std::string& name, const std::string& id, const Json::Value& config)
9
9
: AModule(config, " ui-" + name, id, false , false ) {
10
10
if (config_[" file-path" ].isString ()) {
11
- Glib::RefPtr<Gtk::Builder> builder{Gtk::Builder::create_from_file (config_[" file-path" ].asString ())};
12
- Glib::RefPtr<Gtk::Widget> uiWg{Glib::RefPtr<Gtk::Widget>::cast_dynamic (builder->get_object (name_))};
11
+ Glib::RefPtr<Gtk::Builder> builder{
12
+ Gtk::Builder::create_from_file (config_[" file-path" ].asString ())};
13
+ Glib::RefPtr<Gtk::Widget> uiWg{
14
+ Glib::RefPtr<Gtk::Widget>::cast_dynamic (builder->get_object (name_))};
13
15
14
16
if (uiWg) {
15
17
uiWg->set_name (name_);
@@ -19,17 +21,18 @@ waybar::modules::UI::UI(const std::string& name, const std::string& id, const Js
19
21
uiWg->get_style_context ()->add_class (MODULE_CLASS);
20
22
21
23
Glib::RefPtr<Gio::SimpleActionGroup> actionGroup{Gio::SimpleActionGroup::create ()};
22
- Glib::RefPtr<Gio::SimpleAction> action{actionGroup->add_action_with_parameter (" doAction" ,
23
- Glib::VARIANT_TYPE_STRING,
24
- [this ](const Glib::VariantBase ¶m) {
25
- assert (param.is_of_type (Glib::VARIANT_TYPE_STRING));
26
- waybar::util::command::res res = waybar::util::command::exec (Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(param).get ()," TLP" ); })};
24
+ Glib::RefPtr<Gio::SimpleAction> action{actionGroup->add_action_with_parameter (
25
+ " doAction" , Glib::VARIANT_TYPE_STRING, [this ](const Glib::VariantBase ¶m) {
26
+ assert (param.is_of_type (Glib::VARIANT_TYPE_STRING));
27
+ waybar::util::command::res res = waybar::util::command::exec (
28
+ Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(param).get ()," TLP" );
29
+ })};
27
30
28
31
uiWg->insert_action_group (name_, actionGroup);
29
32
event_box_.add (*uiWg.get ());
30
33
} else {
31
- spdlog::error (" UI: object id \" {}\" is not found at \" {}\" " ,
32
- name_, config_[" file-path" ].asString ());
34
+ spdlog::error (" UI: object id \" {}\" is not found at \" {}\" " , name_,
35
+ config_[" file-path" ].asString ());
33
36
}
34
37
}
35
38
}
0 commit comments