void gui_layout_buffer_reset (struct t_gui_layout_buffer **layout_buffers, struct t_gui_layout_buffer **last_layout_buffer) { struct t_gui_buffer *ptr_buffer; gui_layout_buffer_remove_all (layout_buffers, last_layout_buffer); for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { ptr_buffer->layout_number = 0; } }
void gui_main_end (int clean_exit) { if (clean_exit) { /* remove bar items and bars */ gui_bar_item_end (); gui_bar_free_all (); /* remove filters */ gui_filter_free_all (); /* free clipboard buffer */ if (gui_input_clipboard) free(gui_input_clipboard); /* delete layout saved */ gui_layout_window_remove_all (&gui_layout_windows); gui_layout_buffer_remove_all (&gui_layout_buffers, &last_gui_layout_buffer); /* delete all windows */ while (gui_windows) { gui_window_free (gui_windows); /* TODO: destroy Gtk widgets */ } gui_window_tree_free (&gui_windows_tree); /* delete all buffers */ while (gui_buffers) { gui_buffer_close (gui_buffers); } /* delete global history */ gui_history_global_free (); /* reset title */ if (CONFIG_BOOLEAN(config_look_set_title)) gui_window_set_title (NULL); /* end color */ gui_color_end (); /* free chat buffer */ gui_chat_free_buffer (); } }
void gui_layout_free (struct t_gui_layout *layout) { if (!layout) return; /* remove current layout if this is the layout we are removing */ if (gui_layout_current == layout) gui_layout_current = NULL; /* remove buffers and windows */ gui_layout_buffer_remove_all (layout); gui_layout_window_remove (layout->layout_windows); /* free data */ if (layout->name) free (layout->name); free (layout); }
int upgrade_weechat_load () { int rc; struct t_upgrade_file *upgrade_file; upgrade_file = upgrade_file_new (WEECHAT_UPGRADE_FILENAME, 0); rc = upgrade_file_read (upgrade_file, &upgrade_weechat_read_cb, NULL); if (!hotlist_reset) gui_hotlist_clear (); gui_color_buffer_assign (); gui_color_buffer_display (); if (upgrade_layout_buffers) { gui_layout_buffer_apply (upgrade_layout_buffers); gui_layout_buffer_remove_all (&upgrade_layout_buffers, &last_upgrade_layout_buffer); } if (upgrade_layout_windows) { gui_layout_window_apply (upgrade_layout_windows, -1); gui_layout_window_remove_all (&upgrade_layout_windows); } if (upgrade_set_current_window > 0) gui_window_switch_by_number (upgrade_set_current_window); if (upgrade_set_current_buffer) { gui_window_switch_to_buffer (gui_current_window, upgrade_set_current_buffer, 0); } gui_layout_buffer_get_number_all (gui_layout_buffers); return rc; }
void gui_layout_buffer_store (struct t_gui_layout *layout) { struct t_gui_buffer *ptr_buffer; if (!layout) return; gui_layout_buffer_remove_all (layout); for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { gui_layout_buffer_add (layout, gui_buffer_get_plugin_name (ptr_buffer), ptr_buffer->name, ptr_buffer->number); } /* get layout number for all buffers */ gui_layout_buffer_get_number_all (layout); }
void gui_layout_buffer_save (struct t_gui_layout_buffer **layout_buffers, struct t_gui_layout_buffer **last_layout_buffer) { struct t_gui_buffer *ptr_buffer; if (!layout_buffers || !last_layout_buffer) return; gui_layout_buffer_remove_all (layout_buffers, last_layout_buffer); for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { gui_layout_buffer_add (layout_buffers, last_layout_buffer, gui_buffer_get_plugin_name (ptr_buffer), ptr_buffer->name, ptr_buffer->number); } /* get layout number for all buffers */ gui_layout_buffer_get_number_all (*layout_buffers); }
void gui_main_end (int clean_exit) { if (clean_exit) { /* * final refreshs, to see messages just before exiting * (if we are upgrading, don't refresh anything!) */ if (!weechat_upgrading) { gui_main_refreshs (); if (gui_window_refresh_needed) gui_main_refreshs (); } /* disable mouse */ gui_mouse_disable (); /* remove bar items and bars */ gui_bar_item_end (); gui_bar_free_all (); /* remove filters */ gui_filter_free_all (); /* free clipboard buffer */ if (gui_input_clipboard) free (gui_input_clipboard); /* delete layout saved */ gui_layout_window_remove_all (&gui_layout_windows); gui_layout_buffer_remove_all (&gui_layout_buffers, &last_gui_layout_buffer); /* delete all windows */ while (gui_windows) { gui_window_free (gui_windows); } gui_window_tree_free (&gui_windows_tree); /* delete all buffers */ while (gui_buffers) { gui_buffer_close (gui_buffers); } gui_ok = 0; gui_init_ok = 0; /* delete global history */ gui_history_global_free (); /* reset title */ if (CONFIG_BOOLEAN(config_look_set_title)) gui_window_set_title (NULL); /* end color */ gui_color_end (); /* free some variables used for chat area */ gui_chat_end (); } /* end of Curses output */ refresh (); endwin (); }