Re: GTK Problem



James Jensen wrote:

Hi, everyone. I'm writing an open-source text editor with wGLADE and Dev-C++ w/DevEx (which provides the GTK libs) named Free Notepad.

I'm having trouble with opening files. What happens is that when I click "Open File" under the "File" menu, a GTK file_selection window appears. I select the file, and it loads its contents into the editor.

The problem comes when I go to open a new file. I designed the program to open up a new window if the contents of the first have been changed (such as through opening a file). The program appears to work correctly, opening a new window with the file contents, but when I close one of the windows, they *all* close.


void
on_btnOpenFile_clicked (GtkButton *button, gpointer user_data)
{
/* This function is called when the "OK" button is clicked in the file_opener from on_mnuFileOpen_activate. */

   temp.file_selected = TRUE;
gtk_main_quit();

      ^^^^^^^^^^^^^^
Hello, this one is for terminate gtk+ application. You should use gtk_widget_destroy instead. Pass pointer to widget you want
to destroy in user_data and call gtk_widget_destroy(GTK_WIDGET(user_data))

Olexiy






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