~ubuntu-branches/ubuntu/trusty/mysql-workbench/trusty

« back to all changes in this revision

Viewing changes to backend/wbprivate/workbench/wb_command_ui.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-06-05 09:13:55 UTC
  • mfrom: (5.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20130605091355-lz0oqppmlovk587y
Tags: 5.2.47+dfsg-1
* Upload to unstable.
* New patch to get libpython flags using `python-config`
  (Closes: #710627).
* Build-Depends:
  - python-all-dev
  + python-dev (provides `python-config`)
  - libboost-dev
  + libboost1.53-dev | libboost-dev (needed to avoid FTBFS since
    libmysqlcppconn depends on boost1.53 which conflicts with older
    boost that is pulled by libboost-dev).
* rules: added "-v" to `mv` command (more build-time verbosity).
* rules: get-orig-source improvements.
* Dropped unused lintian-overrides

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
2
 
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 
2
 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU General Public License as
19
19
 
20
20
#include "stdafx.h"
21
21
 
 
22
#include <string>
22
23
#include "wb_context_ui.h"
23
24
#include "wb_command_ui.h"
24
25
#include "wb_module.h"
221
222
}
222
223
 
223
224
 
224
 
bool CommandUI::validate_plugin_command(const std::string &name)
 
225
bool CommandUI::validate_plugin_command(app_PluginRef plugin)
225
226
{
226
 
  app_PluginRef plugin(_wb->get_plugin_manager()->get_plugin(name));
 
227
//  app_PluginRef plugin(_wb->get_plugin_manager()->get_plugin(name));
227
228
  if (plugin.is_valid())
228
229
  {
229
 
    bec::ArgumentPool argpool;
230
 
    _wb->update_plugin_arguments_pool(argpool);
231
 
    argpool["app.PluginInputDefinition:string"]= grt::StringRef("");
232
 
    if (!_wb->get_grt_manager()->check_plugin_runnable(plugin, argpool))
 
230
    //bec::ArgumentPool argpool;
 
231
    //_wb->update_plugin_arguments_pool(argpool);
 
232
    //argpool["app.PluginInputDefinition:string"]= grt::StringRef("");
 
233
    if (!_wb->get_grt_manager()->check_plugin_runnable(plugin, _argpool))
233
234
    {
234
235
      //g_message("plugin %s is not runnable", name.c_str());
235
236
      return false;
486
487
  {
487
488
    mforms::MenuItem *item = mforms::manage(new mforms::MenuItem((*iter)->caption()));
488
489
    item->set_name(std::string("plugin:").append(*(*iter)->name()));
489
 
    item->set_validator(boost::bind(&CommandUI::validate_plugin_command, this, *(*iter)->name()));
 
490
    item->set_validator(boost::bind(&CommandUI::validate_plugin_command, this, *iter));
490
491
    item->validate();
491
492
    scoped_connect(item->signal_clicked(),boost::bind((void(CommandUI::*)(const std::string&))&CommandUI::activate_command, this, item->get_name()));
492
493
    parent->add_item(item);
645
646
#endif
646
647
          }
647
648
          else
648
 
            validator = boost::bind(&CommandUI::validate_plugin_command, this, cmd.name);
 
649
            validator = boost::bind(&CommandUI::validate_plugin_command, this, plugin);
649
650
        }
650
651
        else if (cmd.type == "builtin")
651
652
        {
708
709
    item->remove_all();
709
710
    add_recent_menu(item);
710
711
  }
 
712
  else
 
713
    if (item->get_name() == "edit")
 
714
      revalidate_edit_menu_items();
711
715
}
712
716
 
713
717
 
752
756
    
753
757
    if (mitem->name() == "edit")
754
758
      connect_validate_to_signal(_validate_edit_menu_items, item->get_subitems());
755
 
    
756
 
    mitem->reset_references();
757
759
  }
 
760
  main_menu->reset_references();
758
761
  
759
762
  return menubar;
760
763
}
1091
1094
}
1092
1095
 
1093
1096
 
 
1097
void CommandUI::revalidate_menu_bar(mforms::MenuBar *menu)
 
1098
{
 
1099
  _argpool.clear();
 
1100
  _wb->update_plugin_arguments_pool(_argpool);
 
1101
  _argpool["app.PluginInputDefinition:string"]= grt::StringRef("");
 
1102
  menu->validate();
 
1103
}
 
1104
 
1094
1105
void CommandUI::revalidate_edit_menu_items()
1095
1106
{
 
1107
  _argpool.clear();
 
1108
  _wb->update_plugin_arguments_pool(_argpool);
 
1109
  _argpool["app.PluginInputDefinition:string"]= grt::StringRef("");
 
1110
 
1096
1111
  if (mforms::Utilities::in_main_thread())
1097
 
    (*signal_validate_edit_menu_items())();
 
1112
    _validate_edit_menu_items();
1098
1113
  else
1099
1114
      _wb->get_grt_manager()->run_once_when_idle(boost::bind(&CommandUI::revalidate_edit_menu_items, this));
1100
1115
  //mforms::Utilities::perform_from_main_thread((boost::bind(&CommandUI::revalidate_edit_menu_items, this), (void*)0));