void global_config_save(FILE *fp) { GdkColor c; fprintf(fp, "# fbpanel <profile> config file\n"); fprintf(fp, "# see http://fbpanel.sf.net/docs.html for complete configuration guide\n"); fprintf(fp, "\n\n"); fprintf(fp, "Global {\n"); fprintf(fp, " edge = %s\n", num2str(edge_pair, gtk_combo_box_get_active(GTK_COMBO_BOX(edge_opt)) + 1, "none")); fprintf(fp, " allign = %s\n", num2str(allign_pair, gtk_combo_box_get_active(GTK_COMBO_BOX(allign_opt)) + 1, "none")); fprintf(fp, " margin = %d\n", (int) margin_adj->value); fprintf(fp, " widthtype = %s\n", num2str(width_pair, gtk_combo_box_get_active(GTK_COMBO_BOX(width_opt)) + 1, "none")); fprintf(fp, " width = %d\n", (int) width_adj->value); fprintf(fp, " height = %d\n", (int) height_adj->value); fprintf(fp, " transparent = %s\n", num2str(bool_pair, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tr_checkb)), "false")); gtk_color_button_get_color(GTK_COLOR_BUTTON(tr_colorb), &c); fprintf(fp, " tintcolor = #%06x\n", gcolor2rgb24(&c)); fprintf(fp, " alpha = %d\n", gtk_color_button_get_alpha(GTK_COLOR_BUTTON(tr_colorb)) * 0xff / 0xffff); fprintf(fp, " setdocktype = %s\n", num2str(bool_pair, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prop_dt_checkb)), "true")); fprintf(fp, " setpartialstrut = %s\n", num2str(bool_pair, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prop_st_checkb)), "true")); fprintf(fp, "}\n\n"); }
static void update_display(thermal *th) { char buffer [60]; int i; int temp; GdkColor color; gchar *separator; temp = get_temperature(th, &i); if (i >= 2) color = th->cl_warning2; else if (i >= 1) color = th->cl_warning1; else color = th->cl_normal; if(temp == -1) lxpanel_draw_label_text(th->panel, th->namew, "NA", TRUE, 1, TRUE); else { snprintf(buffer, sizeof(buffer), "<span color=\"#%06x\"><b>%02d</b></span>", gcolor2rgb24(&color), temp); gtk_label_set_markup (GTK_LABEL(th->namew), buffer) ; } g_string_truncate(th->tip, 0); separator = ""; for (i = 0; i < th->numsensors; i++){ g_string_append_printf(th->tip, "%s%s:\t%2d°C", separator, th->sensor_name[i], th->temperature[i]); separator = "\n"; } gtk_widget_set_tooltip_text(th->namew, th->tip->str); }
static int panel_parse_global(panel *p, FILE *fp) { line s; s.len = 256; ENTER; while (get_line(fp, &s) != LINE_NONE) { if (s.type == LINE_VAR) { if (!g_ascii_strcasecmp(s.t[0], "edge")) { p->edge = str2num(edge_pair, s.t[1], EDGE_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "allign")) { p->allign = str2num(allign_pair, s.t[1], ALLIGN_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "margin")) { p->margin = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "widthtype")) { p->widthtype = str2num(width_pair, s.t[1], WIDTH_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "width")) { p->width = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "heighttype")) { p->heighttype = str2num(height_pair, s.t[1], HEIGHT_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "height")) { p->height = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "spacing")) { p->spacing = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "SetDockType")) { p->setdocktype = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "SetPartialStrut")) { p->setstrut = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "RoundCorners")) { p->round_corners = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "Transparent")) { p->transparent = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "Alpha")) { p->alpha = atoi(s.t[1]); if (p->alpha > 255) p->alpha = 255; } else if (!g_ascii_strcasecmp(s.t[0], "TintColor")) { if (!gdk_color_parse (s.t[1], &p->gtintcolor)) gdk_color_parse ("white", &p->gtintcolor); p->tintcolor = gcolor2rgb24(&p->gtintcolor); DBG("tintcolor=%x\n", p->tintcolor); } else { ERR( "fbpanel: %s - unknown var in Global section\n", s.t[0]); RET(0); } } else if (s.type == LINE_BLOCK_END) { break; } else { ERR( "fbpanel: illegal in this context %s\n", s.str); RET(0); } } p->orientation = (p->edge == EDGE_TOP || p->edge == EDGE_BOTTOM) ? ORIENT_HORIZ : ORIENT_VERT; if (p->orientation == ORIENT_HORIZ) { p->my_box_new = gtk_hbox_new; p->my_separator_new = gtk_vseparator_new; } else { p->my_box_new = gtk_vbox_new; p->my_separator_new = gtk_hseparator_new; } if (p->width < 0) p->width = 100; if (p->widthtype == WIDTH_PERCENT && p->width > 100) p->width = 100; p->heighttype = HEIGHT_PIXEL; if (p->heighttype == HEIGHT_PIXEL) { if (p->height < PANEL_HEIGHT_MIN) p->height = PANEL_HEIGHT_MIN; else if (p->height > PANEL_HEIGHT_MAX) p->height = PANEL_HEIGHT_MAX; } p->curdesk = get_net_current_desktop(); p->desknum = get_net_number_of_desktops(); p->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->wa_len); print_wmdata(p); panel_start_gui(p); RET(1); }
static int panel_parse_global(xconf *xc) { ENTER; /* Set default values */ p->allign = ALLIGN_CENTER; p->edge = EDGE_BOTTOM; p->widthtype = WIDTH_PERCENT; p->width = 100; p->heighttype = HEIGHT_PIXEL; p->height = PANEL_HEIGHT_DEFAULT; p->max_elem_height = PANEL_HEIGHT_MAX; p->setdocktype = 1; p->setstrut = 1; p->round_corners = 1; p->round_corners_radius = 7; p->autohide = 0; p->height_when_hidden = 2; p->transparent = 0; p->alpha = 127; p->tintcolor_name = "white"; p->spacing = 0; p->setlayer = FALSE; p->layer = LAYER_ABOVE; /* Read config */ /* geometry */ XCG(xc, "edge", &p->edge, enum, edge_enum); XCG(xc, "allign", &p->allign, enum, allign_enum); XCG(xc, "widthtype", &p->widthtype, enum, widthtype_enum); XCG(xc, "heighttype", &p->heighttype, enum, heighttype_enum); XCG(xc, "width", &p->width, int); XCG(xc, "height", &p->height, int); XCG(xc, "margin", &p->margin, int); /* properties */ XCG(xc, "setdocktype", &p->setdocktype, enum, bool_enum); XCG(xc, "setpartialstrut", &p->setstrut, enum, bool_enum); XCG(xc, "autohide", &p->autohide, enum, bool_enum); XCG(xc, "heightwhenhidden", &p->height_when_hidden, int); XCG(xc, "setlayer", &p->setlayer, enum, bool_enum); XCG(xc, "layer", &p->layer, enum, layer_enum); /* effects */ XCG(xc, "roundcorners", &p->round_corners, enum, bool_enum); XCG(xc, "roundcornersradius", &p->round_corners_radius, int); XCG(xc, "transparent", &p->transparent, enum, bool_enum); XCG(xc, "alpha", &p->alpha, int); XCG(xc, "tintcolor", &p->tintcolor_name, str); XCG(xc, "maxelemheight", &p->max_elem_height, int); /* Sanity checks */ if (!gdk_color_parse(p->tintcolor_name, &p->gtintcolor)) gdk_color_parse("white", &p->gtintcolor); p->tintcolor = gcolor2rgb24(&p->gtintcolor); DBG("tintcolor=%x\n", p->tintcolor); if (p->alpha > 255) p->alpha = 255; p->orientation = (p->edge == EDGE_TOP || p->edge == EDGE_BOTTOM) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; if (p->orientation == GTK_ORIENTATION_HORIZONTAL) { p->my_box_new = gtk_hbox_new; p->my_separator_new = gtk_vseparator_new; } else { p->my_box_new = gtk_vbox_new; p->my_separator_new = gtk_hseparator_new; } if (p->width < 0) p->width = 100; if (p->widthtype == WIDTH_PERCENT && p->width > 100) p->width = 100; p->heighttype = HEIGHT_PIXEL; if (p->heighttype == HEIGHT_PIXEL) { if (p->height < PANEL_HEIGHT_MIN) p->height = PANEL_HEIGHT_MIN; else if (p->height > PANEL_HEIGHT_MAX) p->height = PANEL_HEIGHT_MAX; } if (p->max_elem_height > p->height || p->max_elem_height < PANEL_HEIGHT_MIN) p->max_elem_height = p->height; p->curdesk = get_net_current_desktop(); p->desknum = get_net_number_of_desktops(); //p->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, // XA_CARDINAL, &p->wa_len); //print_wmdata(p); panel_start_gui(p); RET(1); }