示例#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;
}
示例#2
0
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;
}