ui_notebook.c 2.79 KB
Newer Older
1 2 3 4 5
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

Cedric Roux's avatar
 
Cedric Roux committed
22 23 24 25 26 27
#if HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <stdint.h>
28 29
#define G_LOG_DOMAIN ("UI")

30 31
#include <gtk/gtk.h>

32
#include "rc.h"
Cedric Roux's avatar
 
Cedric Roux committed
33 34 35

#include "ui_notebook.h"
#include "ui_tree_view.h"
36 37 38 39
#include "ui_signal_dissect_view.h"

static ui_text_view_t *terminal_view;

40 41 42 43 44
void ui_notebook_terminal_clear(void)
{
     ui_signal_dissect_clear_view(terminal_view);
}

45 46
void ui_notebook_terminal_append_data(gchar *text, gint length)
{
47
    ui_signal_set_text(terminal_view, text, length);
48
}
Cedric Roux's avatar
 
Cedric Roux committed
49 50 51 52

int ui_notebook_create(GtkWidget *vbox)
{
    GtkWidget *notebook;
53
    GtkWidget *vbox_notebook, *vbox_terminal;
Cedric Roux's avatar
 
Cedric Roux committed
54 55 56 57 58 59 60 61 62 63

    if (!vbox)
        return RC_BAD_PARAM;

    notebook = gtk_notebook_new();

    vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
    ui_tree_view_create(NULL, vbox_notebook);

    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL);
64
    gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Messages list");
Cedric Roux's avatar
 
Cedric Roux committed
65

winckel's avatar
winckel committed
66
#if defined (FILTERS_TAB)
winckel's avatar
winckel committed
67 68 69 70
    vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);

    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL);
    gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Filters");
winckel's avatar
winckel committed
71
#endif
winckel's avatar
winckel committed
72

73 74 75 76 77 78 79 80 81 82 83
    vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);

    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL);
    gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Terminal");

    vbox_terminal = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);

    terminal_view = ui_signal_dissect_new(vbox_terminal);

    gtk_box_pack_start (GTK_BOX(vbox_notebook), vbox_terminal, TRUE, TRUE, 5);

Cedric Roux's avatar
 
Cedric Roux committed
84 85 86 87 88
    /* Add the notebook to the vbox of the main window */
    gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);

    return RC_OK;
}