Exemple #1
0
static void
on_activate_priority (GSimpleAction *action, GVariant *parameter, gpointer data)
{
    GsmApplication *app = (GsmApplication *) data;

    g_action_change_state (G_ACTION (action), parameter);

    const gint32 priority = g_variant_get_int32 (parameter);
    switch (priority) {
        case 32: 
            procdialog_create_renice_dialog (app);
            break;
        default:
            renice (app, priority);
            break;
    }

}
Exemple #2
0
void
cb_renice (GtkAction *action, GtkRadioAction *current, gpointer data)
{
    ProcData * const procdata = static_cast<ProcData*>(data);

    gint selected = gtk_radio_action_get_current_value(current);

    if (selected == CUSTOM_PRIORITY)
    {
       procdialog_create_renice_dialog (procdata);
    } else {
       gint new_nice_value = 0;
       switch (selected) {
           case VERY_HIGH_PRIORITY: new_nice_value = -20; break;
           case HIGH_PRIORITY: new_nice_value = -5; break;
           case NORMAL_PRIORITY: new_nice_value = 0; break;
           case LOW_PRIORITY: new_nice_value = 5; break;
           case VERY_LOW_PRIORITY: new_nice_value = 19; break;
       }
       renice(procdata, new_nice_value);
    }
}