Exemplo n.º 1
0
int
upgrade_weechat_load ()
{
    int rc;
    struct t_upgrade_file *upgrade_file;

    upgrade_layout = gui_layout_alloc (GUI_LAYOUT_UPGRADE);

    upgrade_file = upgrade_file_new (WEECHAT_UPGRADE_FILENAME,
                                     &upgrade_weechat_read_cb, NULL, NULL);
    if (!upgrade_file)
        return 0;

    rc = upgrade_file_read (upgrade_file);

    upgrade_file_close (upgrade_file);

    if (!hotlist_reset)
        gui_hotlist_clear (GUI_HOTLIST_MASK_MAX);

    gui_color_buffer_assign ();
    gui_color_buffer_display ();

    secure_buffer_assign ();
    secure_buffer_display ();

    if (upgrade_layout->layout_buffers)
        gui_layout_buffer_apply (upgrade_layout);
    if (upgrade_layout->layout_windows)
        gui_layout_window_apply (upgrade_layout, -1);

    gui_layout_free (upgrade_layout);
    upgrade_layout = NULL;

    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_current);

    return rc;
}
Exemplo n.º 2
0
int
upgrade_weechat_save ()
{
    int rc;
    struct t_upgrade_file *upgrade_file;

    upgrade_file = upgrade_file_new (WEECHAT_UPGRADE_FILENAME, 1);
    if (!upgrade_file)
        return 0;

    rc = 1;
    rc &= upgrade_weechat_save_history (upgrade_file, last_gui_history);
    rc &= upgrade_weechat_save_buffers (upgrade_file);
    rc &= upgrade_weechat_save_misc (upgrade_file);
    rc &= upgrade_weechat_save_hotlist (upgrade_file);
    rc &= upgrade_weechat_save_layout_window (upgrade_file);

    upgrade_file_close (upgrade_file);

    return rc;
}