Ejemplo n.º 1
0
static gboolean
cb_main_window_state_changed (GtkWidget *window, GdkEventWindowState *event, gpointer data)
{
    GsmApplication *app = (GsmApplication *) data;
    auto current_page = app->settings->get_string (GSM_SETTING_CURRENT_TAB);
    if (event->new_window_state & GDK_WINDOW_STATE_BELOW ||
        event->new_window_state & GDK_WINDOW_STATE_ICONIFIED ||
        event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
    {
        if (current_page == "processes") {
            proctable_freeze (app);
        } else if (current_page == "resources") {
            load_graph_stop (app->cpu_graph);
            load_graph_stop (app->mem_graph);
            load_graph_stop (app->net_graph);
        } else if (current_page == "disks") {
            disks_freeze (app);
        }
    } else  {
        if (current_page == "processes") {
            proctable_update (app);
            proctable_thaw (app);
        } else if (current_page == "resources") {
            load_graph_start (app->cpu_graph);
            load_graph_start (app->mem_graph);
            load_graph_start (app->net_graph);
        } else if (current_page == "disks") {
            disks_update (app);
            disks_thaw (app);
        }
    }
    return FALSE;
}
Ejemplo n.º 2
0
void
update_page_activities (GsmApplication *app)
{
    const char *current_page = gtk_stack_get_visible_child_name (app->stack);

    if (strcmp (current_page, "processes") == 0) {
        GAction *search_action = g_action_map_lookup_action (G_ACTION_MAP (app->main_window),
                                                             "search");
        proctable_update (app);
        proctable_thaw (app);

        gtk_widget_show (GTK_WIDGET (app->end_process_button));
        gtk_widget_show (GTK_WIDGET (app->search_button));
        gtk_widget_show (GTK_WIDGET (app->process_menu_button));

        update_sensitivity (app);

        if (g_variant_get_boolean (g_action_get_state (search_action)))
            gtk_widget_grab_focus (GTK_WIDGET (app->search_entry));
        else
            gtk_widget_grab_focus (GTK_WIDGET (app->tree));
    } else {
        proctable_freeze (app);

        gtk_widget_hide (GTK_WIDGET (app->end_process_button));
        gtk_widget_hide (GTK_WIDGET (app->search_button));
        gtk_widget_hide (GTK_WIDGET (app->process_menu_button));

        update_sensitivity (app);
    }

    if (strcmp (current_page, "resources") == 0) {
        load_graph_start (app->cpu_graph);
        load_graph_start (app->mem_graph);
        load_graph_start (app->net_graph);
    } else {
        load_graph_stop (app->cpu_graph);
        load_graph_stop (app->mem_graph);
        load_graph_stop (app->net_graph);
    }

    if (strcmp (current_page, "disks") == 0) {
        disks_update (app);
        disks_thaw (app);
    } else {
        disks_freeze (app);
    }
}
Ejemplo n.º 3
0
void
disks_reset_timeout (GsmApplication *app)
{
    disks_freeze (app);
    disks_thaw (app);
}