void cb_change_current_page (GtkNotebook *nb, gint num, gpointer data) { ProcData * const procdata = static_cast<ProcData*>(data); procdata->config.current_tab = num; if (num == PROCMAN_TAB_PROCESSES) { cb_timeout (procdata); if (!procdata->timeout) procdata->timeout = g_timeout_add ( procdata->config.update_interval, cb_timeout, procdata); update_sensitivity(procdata); } else { if (procdata->timeout) { g_source_remove (procdata->timeout); procdata->timeout = 0; } update_sensitivity(procdata); } if (num == PROCMAN_TAB_RESOURCES) { load_graph_start (procdata->cpu_graph); load_graph_start (procdata->mem_graph); load_graph_start (procdata->net_graph); } else { load_graph_stop (procdata->cpu_graph); load_graph_stop (procdata->mem_graph); load_graph_stop (procdata->net_graph); } if (num == PROCMAN_TAB_DISKS) { cb_update_disks (procdata); if(!procdata->disk_timeout) { procdata->disk_timeout = g_timeout_add (procdata->config.disks_update_interval, cb_update_disks, procdata); } } else { if(procdata->disk_timeout) { g_source_remove (procdata->disk_timeout); procdata->disk_timeout = 0; } } }
static gboolean cb_button_press (GtkWidget *widget, GdkEventButton *button, gpointer data) { MateVolumeAppletDock *dock = data; dock->direction = (GTK_BUTTON (widget) == dock->plus) ? 1 : -1; destroy_source (dock); dock->timeout = g_timeout_add (100, cb_timeout, data); cb_timeout (data); return TRUE; }