]> khamidou — GitHub mirrors - electron.git/commitdiff
linux: No need to remember root item in menubar.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 11 Jul 2014 01:09:23 +0000 (09:09 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 11 Jul 2014 01:09:23 +0000 (09:09 +0800)
atom/browser/ui/views/global_menu_bar_x11.cc
atom/browser/ui/views/global_menu_bar_x11.h

index 05e4c51aa87ef6cc0aadbe30d5e81739d3dc9f47..5ebd79bdb274be53640e2cb455a0a2e7b7e04af7 100644 (file)
@@ -162,8 +162,7 @@ void SetMenuItemID(DbusmenuMenuitem* item, int id) {
 GlobalMenuBarX11::GlobalMenuBarX11(NativeWindowViews* window)
     : window_(window),
       xid_(window_->GetNativeWindow()->GetHost()->GetAcceleratedWidget()),
-      server_(NULL),
-      root_item_(NULL) {
+      server_(NULL) {
   EnsureMethodsLoaded();
   if (server_new)
     InitServer(xid_);
@@ -187,13 +186,13 @@ void GlobalMenuBarX11::SetMenu(ui::MenuModel* menu_model) {
   if (!server_)
     return;
 
-  root_item_ = menuitem_new();
-  menuitem_property_set(root_item_, kPropertyLabel, "Root");
-  menuitem_property_set_bool(root_item_, kPropertyVisible, true);
-  BuildMenuFromModel(menu_model, root_item_);
+  DbusmenuMenuitem* root_item = menuitem_new();
+  menuitem_property_set(root_item, kPropertyLabel, "Root");
+  menuitem_property_set_bool(root_item, kPropertyVisible, true);
+  BuildMenuFromModel(menu_model, root_item);
 
-  server_set_root(server_, root_item_);
-  g_object_unref(root_item_);
+  server_set_root(server_, root_item);
+  g_object_unref(root_item);
 }
 
 void GlobalMenuBarX11::InitServer(unsigned long xid) {
index b2674ba0ba37b27efafe814770368ea1bd8c25e8..2416e02d787484dc1008cca5cdac1fe1af66c06f 100644 (file)
@@ -63,7 +63,6 @@ class GlobalMenuBarX11 {
   int xid_;
 
   DbusmenuServer* server_;
-  DbusmenuMenuitem* root_item_;
 
   DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarX11);
 };