Re: menuitem activate



http://developer.gnome.org/doc/API/2.0/gtk/GtkMenuItem.html#gtk-menu-
item-activate

It has argument of GtkMenuItem* type, i.e. you pass the menu
item object.  No path, name, or anything.  The item itself
(that's menuitem here).


I'm with you on everything you said and I feel like a severely slow 7 year old
here, it's still not clicking.

I've got a method:

dirview_popup_menu (DirView *dv, GdkEventButton *event)
{
(...)
      menuitem = gtk_item_factory_get_item (ifactory, "/Refresh Tree");
      gtk_widget_set_sensitive (menuitem, FALSE);
      menuitem = gtk_item_factory_get_item (ifactory, "/Make Directory...");
      gtk_widget_set_sensitive (menuitem, FALSE);
   }

   if (!iswritable (path)) {
      menuitem = gtk_item_factory_get_item (ifactory, "/Make Directory...");
      gtk_widget_set_sensitive (menuitem, FALSE);
   }

   if (!parent || !strcmp (parent, ".") || !iswritable (parent)
       || !strcmp (label, ".") || !strcmp (label, ".."))
   {
      menuitem = gtk_item_factory_get_item (ifactory, "/Rename Directory...");
      gtk_widget_set_sensitive (menuitem, FALSE);
      menuitem = gtk_item_factory_get_item (ifactory, "/Delete Directory...");
      gtk_widget_set_sensitive (menuitem, FALSE);
(...)

and I'm trying to activate the refresh menu item.  How would it know which
menuitem to activate?  I also have the standard menu, File, Edit, etc which
has this:

static void
create_gimv_thumb_win_menus (GimvThumbWin *tw)
{
(...)
   ifactory = gtk_item_factory_from_widget (tw->menubar);
   tw->menuitem.file = gtk_item_factory_get_item (ifactory, "/File");
   tw->menuitem.edit = gtk_item_factory_get_item (ifactory, "/Edit");
   tw->menuitem.view = gtk_item_factory_get_item (ifactory, "/View");
   tw->menuitem.tool = gtk_item_factory_get_item (ifactory, "/Tool");

   tw->menuitem.select     = gtk_item_factory_get_item (ifactory,
"/Edit/Select All");
   tw->menuitem.unselect   = gtk_item_factory_get_item (ifactory,
"/Edit/Unselect All");
   tw->menuitem.refresh    = gtk_item_factory_get_item (ifactory,
"/Edit/Refresh List");
(...)

But the Edit menu is not active at the point I want the refresh to take place.
 I also tried menuitem.refresh and tw->menuitem.refresh.  Yes, I do know I'm
probably in left field, but I figured I'd just try it all before I asked for help.

So, what the heck is "menuitem" inside the parenthases?  Back to my original
question.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]