예제 #1
0
void cb_generate_report()
{
    Shell *shell = shell_get_main_shell();
    gboolean btn_refresh = shell_action_get_enabled("RefreshAction");
    gboolean btn_copy = shell_action_get_enabled("CopyAction");

    report_dialog_show(shell->tree->model, shell->window);

    shell_action_set_enabled("RefreshAction", btn_refresh);
    shell_action_set_enabled("CopyAction", btn_copy);
}
예제 #2
0
void
shell_view_set_enabled(gboolean setting)
{
    if (setting) {
        widget_set_cursor(shell->window, GDK_LEFT_PTR);
    } else {
        widget_set_cursor(shell->window, GDK_WATCH);
    }

    gtk_widget_set_sensitive(shell->hpaned, setting);
    shell_action_set_enabled("ViewMenuAction", setting);
    shell_action_set_enabled("RefreshAction", setting);
    shell_action_set_enabled("ReportAction", setting);
}
예제 #3
0
void
shell_do_reload(void)
{
    shell_action_set_enabled("RefreshAction", FALSE);
    shell_action_set_enabled("ReportAction", FALSE);

    if (shell->selected && shell->selected->reloadfunc) {
        GtkTreeSelection *ts;

        ts = gtk_tree_view_get_selection(GTK_TREE_VIEW(shell->tree->view));
        shell_status_set_enabled(TRUE);

        shell->selected->reloadfunc(shell->selected->number);
        module_selected(ts, NULL);
    }

    shell_action_set_enabled("RefreshAction", TRUE);
    shell_action_set_enabled("ReportAction", TRUE);
}
예제 #4
0
void
shell_init(void)
{
    if (shell) {
        g_error("Shell already created");
        return;
    }

    create_window();

    shell->tree = tree_new();
    shell->info = info_tree_new(FALSE);
    shell->moreinfo = info_tree_new(TRUE);
    shell->loadgraph = load_graph_new(75);

    gtk_paned_pack1(GTK_PANED(shell->hpaned), shell->tree->scroll,
                    SHELL_PACK_RESIZE, SHELL_PACK_SHRINK);
    gtk_paned_pack1(GTK_PANED(shell->vpaned), shell->info->scroll,
                    SHELL_PACK_RESIZE, SHELL_PACK_SHRINK);

    gtk_notebook_append_page(GTK_NOTEBOOK(shell->notebook),
                             shell->moreinfo->scroll, NULL);
    gtk_notebook_append_page(GTK_NOTEBOOK(shell->notebook),
                             load_graph_get_framed(shell->loadgraph), NULL);

    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(shell->notebook), FALSE);
    gtk_notebook_set_show_border(GTK_NOTEBOOK(shell->notebook), FALSE);

    shell_status_set_enabled(TRUE);
    shell_status_update("Loading modules...");

    shell_tree_modules_load(shell->tree);
    g_slist_foreach(shell->tree->modules, add_modules_to_gui, shell->tree);
    gtk_tree_view_expand_all(GTK_TREE_VIEW(shell->tree->view));

    shell_status_update("Done.");
    shell_status_set_enabled(FALSE);

    gtk_widget_show_all(shell->hpaned);

    load_graph_configure_expose(shell->loadgraph);

    gtk_widget_hide(shell->notebook);

    shell_action_set_enabled("RefreshAction", FALSE);
    shell_action_set_active("LeftPaneAction", TRUE);
    shell_action_set_active("ToolbarAction", TRUE);
    shell_action_set_property("RefreshAction", "is-important", TRUE);
    shell_action_set_property("ReportAction", "is-important", TRUE);
}
예제 #5
0
static void
module_selected(GtkTreeSelection * ts, gpointer data)
{
    ShellTree			*shelltree = shell->tree;
    GtkTreeModel		*model = GTK_TREE_MODEL(shelltree->model);
    GtkTreeIter			 parent;
    ShellModuleEntry		*entry;
    static ShellModuleEntry	*current = NULL;
    static gboolean		updating = FALSE;

    if (updating)
        return;

    updating = TRUE;

    /* Gets the currently selected item on the left-side TreeView; if there is no
       selection, silently return */
    if (!gtk_tree_selection_get_selected(ts, &model, &parent))
        return;

    /* Mark the currently selected module as "unselected"; this is used to kill the
       update timeout. */
    if (current)
        current->selected = FALSE;

    /* Get the current selection and shows its related info */
    gtk_tree_model_get(model, &parent, TREE_COL_DATA, &entry, -1);
    if (entry && entry->func && !entry->selected) {
        shell_status_set_enabled(TRUE);
        shell_status_update("Updating...");

        entry->selected = TRUE;
        shell->selected = entry;
        module_selected_show_info(entry, FALSE);

        info_selected_show_extra(NULL);	/* clears the more info store */
        gtk_tree_view_columns_autosize(GTK_TREE_VIEW(shell->info->view));

        /* urgh. why don't GTK do this when the model is cleared? */
        gtk_range_set_value(GTK_RANGE(GTK_SCROLLED_WINDOW(shell->info->scroll)->vscrollbar), 0.0);
        gtk_range_set_value(GTK_RANGE(GTK_SCROLLED_WINDOW(shell->info->scroll)->hscrollbar), 0.0);
        gtk_range_set_value(GTK_RANGE(GTK_SCROLLED_WINDOW(shell->moreinfo->scroll)->vscrollbar), 0.0);
        gtk_range_set_value(GTK_RANGE(GTK_SCROLLED_WINDOW(shell->moreinfo->scroll)->hscrollbar), 0.0);

        shell_status_update("Done.");
        shell_status_set_enabled(FALSE);

        gchar *tmp = g_strdup_printf("%s - System Information", entry->name);
        gtk_window_set_title(GTK_WINDOW(shell->window), tmp);
        g_free(tmp);

        shell_action_set_enabled("RefreshAction", entry->reloadfunc ? TRUE : FALSE);
    } else {
        gtk_window_set_title(GTK_WINDOW(shell->window), "System Information");
        shell_action_set_enabled("RefreshAction", FALSE);

        gtk_tree_store_clear(GTK_TREE_STORE(shell->info->model));
        set_view_type(SHELL_VIEW_NORMAL);
    }

    current = entry;
    updating = FALSE;
}