10 + WindowManager& wm = WindowManager::Default();
11 + // delete all menu items for windows
…
29 + char menu_item_name[name_size];
30 + sprintf(menu_item_name,"w_list_%d",i);
…
44 + _menu_items[menu_item_name] = menu_item;
Please, don't add these items to _menu_items. Use instead another container (such as
std::vector<glib::Object<DbusmenuMenuitem>> _windows_menu_items and add the items you generate there in AddMenuItemsWindowList.
22 + for ( auto w: Windows() ) {
Use for (auto const& w : Windows())
At that point call it into GetMenus() putting the items you computed into the result list.
36 + _gsignals.Add(
37 + new glib::Signal<void, DbusmenuMenuitem*, int>(menu_item,
You can use the utility Add function to save some space:
_gsignals.Add<void, DbusmenuMenuitem*, int>(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED ...
39 + [w,&wm] (DbusmenuMenuitem*,int) -> void {
Just pass w, while generate the WM inside the lambda body (even if that pointer won't change, it's safer not to pass by reference inside a lambda that is going to be executed when the local variable is dead). Also it's not needed to specify the "-> void" return type. g++ will guess it for you.
Also, long quicklist items should be cut. I'll provide I way to do it as I need it also on another branch, please ping me on IRC in case you'd need help.
Fix the style to match the one we use in unity (2 spaces indentation, brackets on next line)
10 + WindowManager& wm = WindowManager: :Default( ); name[name_ size]; menu_item_ name,"w_ list_%d" ,i); menu_item_ name] = menu_item;
11 + // delete all menu items for windows
…
29 + char menu_item_
30 + sprintf(
…
44 + _menu_items[
Please, don't add these items to _menu_items. Use instead another container (such as glib::Object< DbusmenuMenuite m>> _windows_menu_items and add the items you generate there in AddMenuItemsWin dowList.
std::vector<
22 + for ( auto w: Windows() ) {
Use for (auto const& w : Windows())
At that point call it into GetMenus() putting the items you computed into the result list.
36 + _gsignals.Add(
37 + new glib::Signal<void, DbusmenuMenuitem*, int>(menu_item,
You can use the utility Add function to save some space: MENUITEM_ SIGNAL_ ITEM_ACTIVATED ...
_gsignals.Add<void, DbusmenuMenuitem*, int>(menu_item, DBUSMENU_
39 + [w,&wm] (DbusmenuMenuit em*,int) -> void {
Just pass w, while generate the WM inside the lambda body (even if that pointer won't change, it's safer not to pass by reference inside a lambda that is going to be executed when the local variable is dead). Also it's not needed to specify the "-> void" return type. g++ will guess it for you.
45 + std::string winName( ( wm.GetWindowName( w->window_id() ) ) ); menuitem_ property_ set(menu_ item, MENUITEM_ PROP_LABEL, winName.c_str() );
46 + dbusmenu_
47 + DBUSMENU_
Only use: menuitem_ property_ set(menu_ item, DBUSMENU_ MENUITEM_ PROP_LABEL, w->title( ).c_str( ));
dbusmenu_
51 + if (windows_added) {
52 + // add seperator
…
65 + }
Do this into GetMenus.
Also, long quicklist items should be cut. I'll provide I way to do it as I need it also on another branch, please ping me on IRC in case you'd need help.
Fix the style to match the one we use in unity (2 spaces indentation, brackets on next line)
Need tests.