Hello, 

I can give you a sollution in this subject, using
UIManager and Gtk::ActionGroup for the menu and the
menuitems.
Still, i'm not using libgladem, but only gtkmm 2.4 and
glibmm 2.4. 
Here is the code :


/*MenuBar*/
                
        // create the action group
        actionGroup = Gtk::ActionGroup::create();
        
        // File Menu

actionGroup->add(Gtk::Action::create("Fichier","_Fichier"));
        
        string tipCre = "Créer un nouveau fichier";
        Glib::ustring tipp = Glib::locale_to_utf8(tipCre);
        
        // File|New

actionGroup->add(Gtk::Action::create("Nouveau",Gtk::Stock::NEW,"_Nouveau",tipp),
                sigc::mem_fun(*this,&MainPage::on_New_File));
                
        //File|Open     

actionGroup->add(Gtk::Action::create("Ouvrir",Gtk::Stock::OPEN,"_Ouvrir","Ouvrir
un fichier"),
                sigc::mem_fun(*this,&MainPage::on_Open_File));
                
        //File|Save

actionGroup->add(Gtk::Action::create("Sauvegarder",Gtk::Stock::SAVE,Glib::locale_to_utf8("Enregistrer"),"Enrégistrer
sur le disque"),
                sigc::mem_fun(*this,&MainPage::on_Save_File));  
                
        //File|Save As
        actionGroup->add(Gtk::Action::create("Save
As",Gtk::Stock::SAVE_AS,Glib::locale_to_utf8("_Enregistrer
sous..."),"Enrégistrer sur le disque"),
                sigc::mem_fun(*this,&MainPage::on_Save_As_File));       
        
        //File|Close

actionGroup->add(Gtk::Action::create("Quitter",Gtk::Stock::QUIT,"_Quitter","Quitter"),
                sigc::mem_fun(*this,&MainPage::on_Close_File));
                        
        //Editer

actionGroup->add(Gtk::Action::create("Editer","_Editer"));

        
        //Editer|Undo
        actionGroup->add(Gtk::Action::create("Select
All",Glib::locale_to_utf8("Tout
selectionner"),"Quitter"),
        
Gtk::AccelKey("<control>A"),sigc::mem_fun(*this,&MainPage::on_select_all));
                
        //Editer|Redo

actionGroup->add(Gtk::Action::create("Find",Gtk::Stock::FIND,"Rechercher","Quitter"),
                sigc::mem_fun(*this,&MainPage::on_find));
        
        //Editer|Cut

actionGroup->add(Gtk::Action::create("Cut",Gtk::Stock::CUT,"Couper","Quitter"),
                sigc::mem_fun(*this,&MainPage::on_clicked_Cut));
                
        //Editer|Copy

actionGroup->add(Gtk::Action::create("Copy",Gtk::Stock::COPY,"Copier","Quitter"),
                sigc::mem_fun(*this,&MainPage::on_clicked_Copy));
                
        //Editer|Paste

actionGroup->add(Gtk::Action::create("Paste",Gtk::Stock::PASTE,"Coller","Quitter"),
                sigc::mem_fun(*this,&MainPage::on_clicked_Paste));              
        
        
        //Outils 

actionGroup->add(Gtk::Action::create("Outils","_Outils"));
        
        //Outils|Boot LVC

actionGroup->add(Gtk::Action::create("Boot_LVC",Gtk::Stock::EXECUTE,"_Boot
BTL","Ouvrir fichier BTL"),
                sigc::mem_fun(*this,&MainPage::on_BootLVC));    
                
        //Outils|Reset OBC

actionGroup->add(Gtk::Action::create("Reset_OBC",Gtk::Stock::EXECUTE,"_Reset
OBC","Reset OBC"),
                sigc::mem_fun(*this,&MainPage::on_ResetOBC));   
        
        //Outils|Init CTX TM

actionGroup->add(Gtk::Action::create("Init_CTX_TM",Gtk::Stock::EXECUTE,"_Init
CTX TM","Init CTX TM"),
                sigc::mem_fun(*this,&MainPage::on_Init_CTX_TM));        
                
        //Outils|CFG FEPROM

actionGroup->add(Gtk::Action::create("CFG_FEPROM",Gtk::Stock::EXECUTE,"GC
FE_PROM","GC FEPROM"),
                sigc::mem_fun(*this,&MainPage::on_CFG_FEPROM));         
                
        //Outils|CFG FRAM

actionGroup->add(Gtk::Action::create("CFG_FRAM",Gtk::Stock::EXECUTE,"GC
F_RAM","GC FRAM"),
                sigc::mem_fun(*this,&MainPage::on_CFG_FRAM));                   
        
        //gestion de configuration Menu
        actionGroup->add(Gtk::Action::create("Gestion de
configuration","_Gestion de configuration"));
        
        //gestion de configuration Menu| chekin 

actionGroup->add(Gtk::Action::create("Check-In",Gtk::Stock::REDO,"Check
IN","Check in"),
                sigc::mem_fun(*this,&MainPage::check_in));      
        
        //gestion de configuration Menu| chekout

actionGroup->add(Gtk::Action::create("Check-Out",Gtk::Stock::UNDO,"Check
OUT","Check out"),
                sigc::mem_fun(*this,&MainPage::check_out));     
        
        //About
        actionGroup->add(Gtk::Action::create("?","_?"));
        
        //About|About
        actionGroup->add(Gtk::Action::create("A
Propos",Gtk::Stock::DIALOG_INFO,"_A Propos","About"),
                sigc::mem_fun(*this,&MainPage::on_About));
        
        // now create the uiManager     
        uiManager = Gtk::UIManager::create();

        uiManager->insert_action_group(actionGroup);

        // the toolbar is created from the menubar items 
        
        try{
                static const Glib::ustring uiMake = 
                        "<ui>"
                        "  <menubar name='MenuBar'>"
                        "    <menu action='Fichier'>"
                        "      <menuitem action='Nouveau'/>"
                        "      <menuitem action='Ouvrir'/>"
                        "      <menuitem action='Sauvegarder'/>"
                        "      <menuitem action='Save As'/>"
                        "      <separator/>"
                        "      <menuitem action='Quitter'/>"
                        "    </menu>"
                        "    <menu action='Editer'>"
                        "      <menuitem action='Select All'/>"
                        "      <menuitem action='Find'/>"
                        "      <separator/>"
                        "      <menuitem action='Cut'/>"
                        "      <menuitem action='Copy'/>"
                        "      <menuitem action='Paste'/>"
                        "    </menu>"
                        "    <menu action='Outils'>"
                        "      <menuitem action='Boot_LVC'/>"
                        "      <menuitem action='Reset_OBC'/>"
                        "      <menuitem action='Init_CTX_TM'/>"
                        "      <menuitem action='CFG_FEPROM'/>"
                        "      <menuitem action='CFG_FRAM'/>"
                        "    </menu>"
                        "    <menu action='Gestion de configuration'>"
                        "      <menuitem action='Check-In'/>"
                        "      <menuitem action='Check-Out'/>"
                        "    </menu>"
                        "    <menu action='?'>"
                        "      <menuitem action='A Propos'/>"
                        "    </menu>"
                        "  </menubar>"
                        "</ui>";
                
                // add menubar from string
                uiManager->add_ui_from_string(uiMake);
}catch(const Glib::Error &ex){
                cout<<"Impossible de construire le menubar"<<endl;
        }
        
        menuWidget = uiManager->get_widget("/MenuBar");

et enable/disable stuff here :
//////////////////////////////////////////////////////
Gtk::Widget *nouveau =
uiManager->get_widget("/MenuBar/Fichier/Nouveau");
disable_Widget(nouveau);
Gtk::Widget *quitter =
uiManager->get_widget("/MenuBar/Fichier/Quitter");
enable_Widget(quitter);

////////////////////////////////////////////////////////

void enable_Widget(Gtk::Widget *widget){
        
        widget->set_sensitive(true);
}

void disable_Widget(Gtk::Widget *widget){
        widget->set_sensitive(false);
}


I hope this helps.

Anca 



--- [EMAIL PROTECTED] wrote:

> Send gtkmm-list mailing list submissions to
>       [email protected]
> 
> To subscribe or unsubscribe via the World Wide Web,
> visit
>       http://mail.gnome.org/mailman/listinfo/gtkmm-list
> or, via email, send a message with subject or body
> 'help' to
>       [EMAIL PROTECTED]
> 
> You can reach the person managing the list at
>       [EMAIL PROTECTED]
> 
> When replying, please edit your Subject line so it
> is more specific
> than "Re: Contents of gtkmm-list digest..."
> 
> 
> Today's Topics:
> 
>    1. Xlib: unexpected async reply (Matthias
> Kaeppler)
>    2. Re: Xlib: unexpected async reply (Paul Davis)
>    3. Re: making menuitems insensitive by app
> context (Rob Benton)
>    4. Gtkmm-forge digest, Vol 1 #975 - 2 msgs
>       ([EMAIL PROTECTED])
>    5. The string display in diferent language
> system. (Johnson Zhao)
>    6. C++ equivalents to gdk_threads_enter() and
> related?
>       (Matthias Kaeppler)
>    7. Re: Xlib: unexpected async reply (Matthias
> Kaeppler)
>    8. RE: Xlib: unexpected async reply (Foster
> Gareth)
>    9. Re: Xlib: unexpected async reply (Matthias
> Kaeppler)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 21 Sep 2005 22:57:21 +0200
> From: Matthias Kaeppler <[EMAIL PROTECTED]>
> Subject: Xlib: unexpected async reply
> To: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowed
> 
> Hi,
> 
> I am displaying progress information about an
> asynchronous file transfer 
> (using gnome-vfsmm) in a dialog box. However, I am
> getting very weird 
> errors from the X Window System:
> 
> The program 'duality.elf' received an X Window
> System error.
> This probably reflects a bug in the program.
> The error was 'BadGC (invalid GC parameter)'.
>    (Details: serial 233809 error_code 13
> request_code 75 minor_code 0)
>    (Note to programmers: normally, X errors are
> reported asynchronously;
>     that is, you will receive the error a while
> after causing it.
>     To debug your program, run it with the --sync
> command line
>     option to change this behavior. You can then get
> a meaningful
>     backtrace from your debugger if you break on the
> gdk_x_error() 
> function.)
> 
> I tried reprodcing the error with --sync, but that
> didn't work, the 
> program will just lock up and no error message at
> all will show up.
> 
> Sometimes I'm also getting this error, which is less
> verbose:
> 
> Xlib: unexpected async reply (sequence 0x71e6)!
> 
> I googled for this last error and it turned out that
> it may occur when 
> the GUI library is not threading aware or not
> thread-safe. Can I enable 
> threading support in gtkmm somewhere? I called
> Glib::thread_init() but 
> that didn't help.
> 
> Thanks in advance,
> Matthias
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 21 Sep 2005 17:54:11 -0400
> From: Paul Davis <[EMAIL PROTECTED]>
> Subject: Re: Xlib: unexpected async reply
> To: Matthias Kaeppler <[EMAIL PROTECTED]>
> Cc: [email protected]
> Message-ID:
> <[EMAIL PROTECTED]>
> Content-Type: text/plain
> 
> On Wed, 2005-09-21 at 22:57 +0200, Matthias Kaeppler
> wrote:
> 
> please read the GTK+ FAQ entry on threads at
> www.gtk.org
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 21 Sep 2005 20:29:00 -0500
> From: Rob Benton <[EMAIL PROTECTED]>
> Subject: Re: making menuitems insensitive by app
> context
> To: Murray Cumming <[EMAIL PROTECTED]>
> Cc: [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=UTF-8;
> format=flowed
> 
> Murray Cumming wrote:
> > On Tue, 2005-09-20 at 19:34 -0500, Rob Benton
> wrote:
> > 
> >>Bob Caryl wrote:
> >>
> >>>Rob Benton wrote:
> >>>
> >>>
> >>>>I'm looking for a way, maybe a signal, to make
> my menuitems 
> >>>>sensitive/insensitive based on the state of my
> program. 
> > 
> > 
> > This is what Gtk::Actions (see Gtk::UIManager)
> make easy.
> > 
> 
> So what would be the functional difference between:
> 
> A.  Using glade to design the menus and then using
> libglademm to get 
> them at run-time with get_widget()
> 
> B.  Building the menus using UIManager at run-time
> and getting pointers 
> to them with get_action()
> 
> 
> Am I overlooking something about the UIManager?
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Wed, 21 Sep 2005 20:20:45 -0700
> From: [EMAIL PROTECTED]
> Subject: Gtkmm-forge digest, Vol 1 #975 - 2 msgs
> To: [EMAIL PROTECTED]
> Message-ID:
>
<[EMAIL PROTECTED]>
> Content-Type: text/plain
> 
> Send Gtkmm-forge mailing list submissions to
>       [EMAIL PROTECTED]
> 
> To subscribe or unsubscribe via the World Wide Web,
> visit
> 
>
https://lists.sourceforge.net/lists/listinfo/gtkmm-forge
> or, via email, send a message with subject or body
> 'help' to
>       [EMAIL PROTECTED]
> 
> You can reach the person managing the list at
>       [EMAIL PROTECTED]
> 
> When replying, please edit your Subject line so it
> is more specific
> than "Re: Contents of Gtkmm-forge digest..."
> 
> 
> gtkmm-forge is the mailing list that receives gtkmm
> bug reports from bugzilla.  A daily digest is sent
> to gtkmm-main, to encourage people to help fixing
> the 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to