Re: Disabling menu And Modal dialog boxes!



On Wed, 2005-03-23 at 14:34 +0530, APR Trainees wrote:
Hello,

We're making an application using gnome 2.0 that adds an icon on the
statusbar.We've added a context menu to display the menu when the icon
is clicked using the right mouse button.
tride to do the follwoing in glade too but cudnt!

2 QUERIES
1.   Now we need to disable(i.e. gray the menuitem) a particular menu item
      in this menu when a certain condition occurs.
      We thought probably the following function wud be useful:

     applet_widget_callback_set_sensitive defined in applet-widget.h but
     this is for gnome 1.0
     and when we include the .h in our application,a zillion errors are
     generated!!!!!!!!

     Then we tried applet_object_callback_set_sensitive which is
defined for 2.0
     But again we aren't able to compile it.Says the function used is
     UNREFERENCED.Probably an extra header is required.

Could some1 pls help us with this ..........suggest how to remove the
eerror....orr disable the context menu's menuitem.

Save the menu item in any sort of structure, or set it as data for any
accesible object and use gtk_widget_set_sensitive(menu_item, FALSE)

2)    ALso,we need to make the dialog boxes modal.........i.e when a
menu item is clicked,a
     dialog box1 opens and until the user responds i.e clicks
ok...........the other menuitem
      in the context menu cant be clicked..............

Where is this context menu attached ?

If it's attached to the panel applet It won't work. Your dialog won't be
children of the applet so the modal state in the dialog won't affect the
applet at all.

      i used set_window_modal but still the context menu items can be
clicked though the dialog is modal..............
had used gnome_dialog_new for creating the dialog.Tried in glade and
if  theres a window and the dialog box,it acts modal bt not when
instead of window theres a context menubar attched!!

Frankly I don't completely understand you.

If you need a modal dialog try gtk_dialog_run()

But this won't disable a panel applet. You should set insensitive all
items you want to be disabled on dialog's construction and unset them on
it's destroy.
-- 
Iago Rubio



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