void on_tab_close_activate(GtkWidget *widget, Document *document) { gphpedit_debug(DEBUG_MAIN_WINDOW); document_manager_try_close_document(main_window.docmg, document); classbrowser_update(GPHPEDIT_CLASSBROWSER(main_window.classbrowser)); update_app_title(document_manager_get_current_document(main_window.docmg)); }
void main_window_create(void) { gnome_window_icon_set_default_from_file(PIXMAP_DIR "/" GPHPEDIT_PIXMAP_ICON); main_window.window = gnome_app_new ("gPHPEdit", "gPHPEdit"); preferences_apply(); gnome_app_create_menus (GNOME_APP (main_window.window), menubar1_uiinfo); main_window_create_appbar(); gnome_app_install_menu_hints (GNOME_APP (main_window.window), menubar1_uiinfo); main_window_update_reopen_menu(); plugin_setup_menu(); main_window_create_toolbars(); main_window_create_panes(); main_window_fill_panes(); function_list_prepare(); gtk_signal_connect (GTK_OBJECT (main_window.window), "delete_event", GTK_SIGNAL_FUNC(main_window_delete_event), NULL); gtk_signal_connect (GTK_OBJECT (main_window.window), "destroy", GTK_SIGNAL_FUNC (main_window_destroy_event), NULL); gtk_signal_connect (GTK_OBJECT (main_window.window), "key_press_event", GTK_SIGNAL_FUNC (main_window_key_press_event), NULL); gtk_signal_connect (GTK_OBJECT (main_window.window), "size_allocate", GTK_SIGNAL_FUNC (main_window_resize), NULL); gtk_signal_connect (GTK_OBJECT (main_window.window), "window-state-event", GTK_SIGNAL_FUNC (main_window_state_changed), NULL); main_window.clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_widget_show(main_window.window); update_app_title(); }
void set_active_tab(page_num) { gphpedit_debug(DEBUG_MAIN_WINDOW); if(document_manager_set_current_document_from_position(main_window.docmg, page_num)) { gtk_notebook_set_current_page(GTK_NOTEBOOK(main_window.notebook_editor), page_num); } update_app_title(document_manager_get_current_document(main_window.docmg)); }
static void document_manager_change_document_cb (DocumentManager *docmg, Documentable *doc, gpointer user_data) { MainWindow *main_window = (MainWindow *) user_data; if (!main_window->is_app_closing) { update_app_title(main_window, doc); documentable_check_externally_modified(doc); } }
void on_close1_activate(GtkWidget *widget) { document_manager_try_close_current_document(main_window.docmg); if(document_manager_get_document_count(main_window.docmg)!=0) { classbrowser_update(GPHPEDIT_CLASSBROWSER(main_window.classbrowser)); update_app_title(document_manager_get_current_document(main_window.docmg)); update_zoom_level(); classbrowser_force_label_update(GPHPEDIT_CLASSBROWSER(main_window.classbrowser)); } }
gboolean main_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { gboolean cancel_quit = FALSE; is_app_closing = TRUE; cancel_quit = !document_manager_can_all_tabs_be_saved(main_window.docmg); is_app_closing = FALSE; if (cancel_quit) { update_app_title(document_manager_get_current_document(main_window.docmg)); } return cancel_quit; }
static void document_manager_close_document_cb (DocumentManager *docmg, Documentable *doc, gpointer user_data) { MainWindow *main_window = (MainWindow *) user_data; close_page(main_window, DOCUMENT(doc)); update_app_title(main_window, document_manager_get_current_documentable(docmg)); gchar *filename = documentable_get_filename (doc); gint ftype; g_object_get(doc, "type", &ftype, NULL); symbol_manager_purge_file (main_window->symbolmg, filename, ftype); g_free(filename); }
void on_notebook_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, gint page_num, gpointer user_data) { GtkWidget *child; child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(main_window.notebook_editor), page_num); if(!document_manager_set_current_document_from_widget (main_window.docmg, child)) { gphpedit_debug_message(DEBUG_MAIN_WINDOW,_("Unable to get data for page %d"), page_num); } if (!is_app_closing) { // Change the title of the main application window to the full filename update_app_title(document_manager_get_current_document(main_window.docmg)); on_tab_change_update_classbrowser(main_window.notebook_editor); } check_externally_modified(document_manager_get_current_document(main_window.docmg)); }
void main_window_create(char **argv, gint argc) { main_window.is_app_closing = FALSE; main_window.prefmg = preferences_manager_new(); main_window.tempmg = templates_manager_new(); create_app_main_window(&main_window, _("gPHPEdit")); main_window.pbuilder = gtk_builder_new (); GError *error = NULL; guint res = gtk_builder_add_from_file (main_window.pbuilder, GPHPEDIT_UI_DIR "/gphpedit.ui", &error); if (!res) { g_critical ("Unable to load the UI file!"); g_error_free(error); return ; } GtkWidget *prinbox = get_widget_from_builder(&main_window, "prinbox"); gtk_widget_reparent (prinbox, GTK_WIDGET(main_window.window)); /* add menu bar to main window */ GtkWidget *menubox = get_widget_from_builder(&main_window, "menubox"); gtk_widget_show (menubox); main_window.pmenu_hints = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL); main_window.pmenu = menubar_new (&main_window); gtk_box_pack_start (GTK_BOX (menubox), main_window.pmenu, FALSE, FALSE, 0); gtk_widget_show_all (main_window.pmenu); GtkWidget *toolbox = get_widget_from_builder(&main_window, "toolbox"); gtk_widget_show (toolbox); main_window.toolbar_main = toolbar_new (&main_window); gtk_box_pack_start (GTK_BOX (toolbox), main_window.toolbar_main, FALSE, FALSE, 0); if (get_preferences_manager_show_maintoolbar(main_window.prefmg)) gtk_widget_show (main_window.toolbar_main); main_window.symbolmg = symbol_manager_new(); main_window_create_panes(&main_window); main_window_fill_panes(&main_window); main_window_create_appbar(&main_window); g_signal_connect (G_OBJECT (main_window.window), "delete_event", G_CALLBACK(main_window_delete_event), &main_window); g_signal_connect (G_OBJECT (main_window.window), "destroy", G_CALLBACK (main_window_destroy_event), &main_window); g_signal_connect (G_OBJECT (main_window.window), "key_press_event", G_CALLBACK (main_window_key_press_event), &main_window); g_signal_connect (G_OBJECT (main_window.window), "size_allocate", G_CALLBACK (main_window_resize), &main_window); g_signal_connect (G_OBJECT (main_window.window), "window-state-event", G_CALLBACK (main_window_state_changed), &main_window); g_signal_connect (G_OBJECT (main_window.window), "focus-in-event", G_CALLBACK (main_window_activate_focus), &main_window); main_window.stylemg = gtk_source_style_scheme_manager_new (); gchar *theme_dir = g_build_path (G_DIR_SEPARATOR_S, API_DIR, "themes", NULL); gtk_source_style_scheme_manager_prepend_search_path (main_window.stylemg, theme_dir); g_free(theme_dir); main_window.docmg = document_manager_new_full(argv, argc, &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "new_document", G_CALLBACK(document_manager_new_document_cb), &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "change_document", G_CALLBACK(document_manager_change_document_cb), &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "close_document", G_CALLBACK(document_manager_close_document_cb), &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "zoom_change", G_CALLBACK(document_manager_zoom_change_cb), &main_window); /* create side panel */ create_side_panel(&main_window); update_app_title(&main_window, document_manager_get_current_documentable(main_window.docmg)); gtk_widget_show(main_window.window); }