[Glade-users] globals vs locals... again



G'day David,

Record in the filedialog widget the pointer to the widget that created
it, just after you call the create_filedialog() function.

Choices for what to save:

(a) pointer to the widget that activated the handler that caused the
creation of the new filedialog,

(b) pointer to the toplevel widget of the activating widget,

(c) pointer to a struct containing other information about the toplevel
widget (in the same way previously mentioned, struct mw *).

In the filedialog OK handler, from (c) you can derive (b), and from
either (b) or (a) you can derive the pointer to the widget you need to
set.

However, it might be more correct to create a function in the handlers
for the main window that would be called by the filedialog OK handler to
do the work, given only the pointer to the main window widget.

You could isolate these into functions ...

menu button handler ...
{
  GtkWidget *filedialog = create_filedialog();
  app_set_filedialog_parent(filedialog, widget);
}

filedialog ok button handler
{
  GtkWidget *main = app_get_filedialog_parent(filedialog);
  app_choose_file(main, file);
}

-- 
James Cameron                                      (cameron stl dec com)





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