Пример #1
0
static inline void xlog_write_stop_info(void)
{
  /*
   * time format "%F %T" expands to "YYYY-MM-DD hh:mm:ss" : always 20 chars
   * including the terminal \0 
   */
  const char start_time_format[]="%F %T";
  char start_time[20]={0};
  time_t rawtime;
  struct tm* timeinfo;

  time(&rawtime);
  timeinfo = localtime(&rawtime);
  strftime(start_time,sizeof(start_time),start_time_format,timeinfo);
  xlog_debug("stopwatch stoped at %s", start_time);
}
Пример #2
0
void appconf_load(struct app_t *app)
{
    PanelApplet *applet = app->applet;
    CfaPreferences *prefs;
    gchar *s;
    gint nconds, i;
    GdkColormap *cmap = gtk_widget_get_colormap(GTK_WIDGET(applet));
    
    prefs = cfa_preferences_new(cmap);
    
    s = panel_applet_gconf_get_string(applet, "font_auto", NULL);
    cfa_preferences_set_font_name(prefs, CFA_DESIGN_FONT_NAME_AUTO, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet,"bg_color_auto", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_BG_COLOR_AUTO, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet,"font_color_auto", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_FONT_COLOR_AUTO, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet, "arc_color_auto", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_ARC_COLOR_AUTO, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet, "hand_color_auto", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_HAND_COLOR_AUTO, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet, "font_manual", NULL);
    cfa_preferences_set_font_name(prefs, CFA_DESIGN_FONT_NAME_MANUAL, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet,"bg_color_manual", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_BG_COLOR_MANUAL, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet,"font_color_manual", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_FONT_COLOR_MANUAL, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet, "arc_color_manual", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_ARC_COLOR_MANUAL, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet, "hand_color_manual", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_HAND_COLOR_MANUAL, cmap, s);
    g_free(s);
    
    s = panel_applet_gconf_get_string(applet, "drag_color_manual", NULL);
    cfa_preferences_set_color_name(prefs, CFA_DESIGN_DRAG_COLOR_MANUAL, cmap, s);
    g_free(s);
    
    nconds = panel_applet_gconf_get_int(applet, "nconds", NULL);
    
    for (i = 0; i < nconds; i++) {
	gchar key[64];
	CfaCond *cond = cfa_cond_new();
	gboolean b;
	gint n;
	
	make_cond_key(key, sizeof key, i, "use_cpu");
	b = panel_applet_gconf_get_bool(applet, key, NULL);
	cfa_cond_set_use_cpu(cond, b);
	
	make_cond_key(key, sizeof key, i, "cpu_id");
	n = panel_applet_gconf_get_int(applet, key, NULL);
	cfa_cond_set_cpu_id(cond, n);
	
	make_cond_key(key, sizeof key, i, "use_ac");
	b = panel_applet_gconf_get_bool(applet, key, NULL);
	cfa_cond_set_use_ac(cond, b);
	
	make_cond_key(key, sizeof key, i, "ac");
	b = panel_applet_gconf_get_bool(applet, key, NULL);
	cfa_cond_set_ac(cond, b);
	
	make_cond_key(key, sizeof key, i, "use_battery");
	b = panel_applet_gconf_get_bool(applet, key, NULL);
	cfa_cond_set_use_battery(cond, b);
	
	make_cond_key(key, sizeof key, i, "battery");
	s = panel_applet_gconf_get_string(applet, key, NULL);
	if (s == NULL)
	    s = g_strdup("0-100");
	cfa_cond_set_battery(cond, s);
	g_free(s);
	
	make_cond_key(key, sizeof key, i, "use_load");
	b = panel_applet_gconf_get_bool(applet, key, NULL);
	cfa_cond_set_use_load(cond, b);
	
	make_cond_key(key, sizeof key, i, "load");
	s = panel_applet_gconf_get_string(applet, key, NULL);
	if (s == NULL)
	    s = g_strdup("0-100");
	cfa_cond_set_load(cond, s);
	g_free(s);
	
	make_cond_key(key, sizeof key, i, "use_process");
	b = panel_applet_gconf_get_bool(applet, key, NULL);
	cfa_cond_set_use_process(cond, b);
	
	make_cond_key(key, sizeof key, i, "process");
	s = panel_applet_gconf_get_string(applet, key, NULL);
	if (s == NULL)
	    s = g_strdup("");
	cfa_cond_set_process(cond, s);
	g_free(s);
	
	make_cond_key(key, sizeof key, i, "freq");
	s = panel_applet_gconf_get_string(applet, key, NULL);
	if (s == NULL)
	    s = g_strdup("0");
	cfa_cond_set_freq(cond, s);
	g_free(s);
	
	cfa_preferences_add_cond(prefs, cond);
    }
    
    cfa_preferences_set_smooth(prefs,
	    panel_applet_gconf_get_bool(applet, "smooth", NULL));
    
    xlog_debug(1, "appconf_load successful.");
    app->prefs = prefs;
}