862
865
pDialogs->cButtonOkImage = cairo_dock_get_string_key_value (pKeyFile, "Dialogs", "button_ok image", &bFlushConfFileNeeded, NULL, NULL, NULL);
863
866
pDialogs->cButtonCancelImage = cairo_dock_get_string_key_value (pKeyFile, "Dialogs", "button_cancel image", &bFlushConfFileNeeded, NULL, NULL, NULL);
865
868
cairo_dock_get_size_key_value_helper (pKeyFile, "Dialogs", "button ", bFlushConfFileNeeded, pDialogs->iDialogButtonWidth, pDialogs->iDialogButtonHeight);
867
870
double couleur_bulle[4] = {1.0, 1.0, 1.0, 0.7};
868
cairo_dock_get_double_list_key_value (pKeyFile, "Dialogs", "background color", &bFlushConfFileNeeded, pDialogs->fDialogColor, 4, couleur_bulle, NULL, NULL);
871
cairo_dock_get_double_list_key_value (pKeyFile, "Dialogs", "bg color", &bFlushConfFileNeeded, pDialogs->fBgColor, 4, couleur_bulle, NULL, "background color");
869
872
pDialogs->iDialogIconSize = MAX (16, cairo_dock_get_integer_key_value (pKeyFile, "Dialogs", "icon size", &bFlushConfFileNeeded, 48, NULL, NULL));
874
pDialogs->cDecoratorName = cairo_dock_get_string_key_value (pKeyFile, "Dialogs", "decorator", &bFlushConfFileNeeded, "comics", NULL, NULL);
876
if (! g_key_file_has_key (pKeyFile, "Dialogs", "line color", NULL)) // old params (< 3.4)
878
// get the old params from the Dialog module's config
879
gchar *cRenderingConfFile = g_strdup_printf ("%s/plug-ins/dialog-rendering/dialog-rendering.conf", g_cCurrentThemePath);
880
GKeyFile *keyfile = cairo_dock_open_key_file (cRenderingConfFile);
881
g_free (cRenderingConfFile);
883
gchar *cRenderer = g_strdup (pDialogs->cDecoratorName);
886
cRenderer[0] = g_ascii_toupper (cRenderer[0]);
888
cairo_dock_get_double_list_key_value (keyfile, cRenderer, "line color", &bFlushConfFileNeeded, pDialogs->fLineColor, 4, NULL, NULL, NULL);
889
g_key_file_set_double_list (pKeyFile, "Dialogs", "line color", pDialogs->fLineColor, 4);
891
pDialogs->iLineWidth = g_key_file_get_integer (keyfile, cRenderer, "border", NULL);
892
g_key_file_set_integer (pKeyFile, "Dialogs", "linewidth", pDialogs->iLineWidth);
894
pDialogs->iCornerRadius = g_key_file_get_integer (keyfile, cRenderer, "corner", NULL);
895
g_key_file_set_integer (pKeyFile, "Dialogs", "corner", pDialogs->iCornerRadius);
899
g_key_file_free (keyfile);
901
bFlushConfFileNeeded = TRUE;
905
pDialogs->iCornerRadius = g_key_file_get_integer (pKeyFile, "Dialogs", "corner", NULL);
906
pDialogs->iLineWidth = g_key_file_get_integer (pKeyFile, "Dialogs", "linewidth", NULL);
907
cairo_dock_get_double_list_key_value (pKeyFile, "Dialogs", "line color", &bFlushConfFileNeeded, pDialogs->fLineColor, 4, NULL, NULL, NULL);
910
pDialogs->bUseDefaultColors = (cairo_dock_get_integer_key_value (pKeyFile, "Dialogs", "style", &bFlushConfFileNeeded, 0, NULL, NULL) == 0);
871
912
gboolean bCustomFont = cairo_dock_get_boolean_key_value (pKeyFile, "Dialogs", "custom", &bFlushConfFileNeeded, TRUE, NULL, NULL);
872
gchar *cFontDescription = (bCustomFont ? cairo_dock_get_string_key_value (pKeyFile, "Dialogs", "message police", &bFlushConfFileNeeded, NULL, "Icons", NULL) : NULL);
873
if (cFontDescription == NULL)
874
cFontDescription = cairo_dock_get_default_system_font ();
913
gchar *cFont = (bCustomFont ? cairo_dock_get_string_key_value (pKeyFile, "Dialogs", "message police", &bFlushConfFileNeeded, NULL, "Icons", NULL) : NULL);
914
gldi_text_description_set_font (&pDialogs->dialogTextDescription, cFont);
876
PangoFontDescription *fd = pango_font_description_from_string (cFontDescription);
877
pDialogs->dialogTextDescription.cFont = g_strdup (pango_font_description_get_family (fd));
878
pDialogs->dialogTextDescription.iSize = pango_font_description_get_size (fd);
879
if (!pango_font_description_get_size_is_absolute (fd))
880
pDialogs->dialogTextDescription.iSize /= PANGO_SCALE;
881
if (pDialogs->dialogTextDescription.iSize == 0)
882
pDialogs->dialogTextDescription.iSize = 14;
884
pDialogs->dialogTextDescription.iSize *= 1.33; // c'est pas beau, mais ca evite de casser tous les themes.
885
pDialogs->dialogTextDescription.iWeight = pango_font_description_get_weight (fd);
886
pDialogs->dialogTextDescription.iStyle = pango_font_description_get_style (fd);
887
916
pDialogs->dialogTextDescription.fMaxRelativeWidth = .5; // limit to half of the screen (the dialog is not placed on a given screen, it can overlap 2 screens, so it's half of the mean screen width)
889
if (g_key_file_has_key (pKeyFile, "Dialogs", "message size", NULL)) // anciens parametres.
891
pDialogs->dialogTextDescription.iSize = g_key_file_get_integer (pKeyFile, "Dialogs", "message size", NULL);
892
int iLabelWeight = g_key_file_get_integer (pKeyFile, "Dialogs", "message weight", NULL);
893
pDialogs->dialogTextDescription.iWeight = cairo_dock_get_pango_weight_from_1_9 (iLabelWeight);
894
gboolean bLabelStyleItalic = g_key_file_get_boolean (pKeyFile, "Dialogs", "message italic", NULL);
895
if (bLabelStyleItalic)
896
pDialogs->dialogTextDescription.iStyle = PANGO_STYLE_ITALIC;
898
pDialogs->dialogTextDescription.iStyle = PANGO_STYLE_NORMAL;
900
pango_font_description_set_size (fd, pDialogs->dialogTextDescription.iSize * PANGO_SCALE);
901
pango_font_description_set_weight (fd, pDialogs->dialogTextDescription.iWeight);
902
pango_font_description_set_style (fd, pDialogs->dialogTextDescription.iStyle);
904
g_free (cFontDescription);
905
cFontDescription = pango_font_description_to_string (fd);
906
g_key_file_set_string (pKeyFile, "Dialogs", "message police", cFontDescription);
907
bFlushConfFileNeeded = TRUE;
909
pango_font_description_free (fd);
910
g_free (cFontDescription);
911
pDialogs->dialogTextDescription.bOutlined = cairo_dock_get_boolean_key_value (pKeyFile, "Dialogs", "outlined", &bFlushConfFileNeeded, FALSE, NULL, NULL);
918
pDialogs->dialogTextDescription.bOutlined = FALSE;
912
919
pDialogs->dialogTextDescription.iMargin = 0;
920
pDialogs->dialogTextDescription.bNoDecorations = TRUE;
914
922
double couleur_dtext[3] = {0., 0., 0.};
915
923
cairo_dock_get_double_list_key_value (pKeyFile, "Dialogs", "text color", &bFlushConfFileNeeded, pDialogs->dialogTextDescription.fColorStart, 3, couleur_dtext, NULL, NULL);
916
memcpy (&pDialogs->dialogTextDescription.fColorStop, &pDialogs->dialogTextDescription.fColorStart, 3*sizeof (double));
918
pDialogs->cDecoratorName = cairo_dock_get_string_key_value (pKeyFile, "Dialogs", "decorator", &bFlushConfFileNeeded, "comics", NULL, NULL);
925
pDialogs->dialogTextDescription.bUseDefaultColors = pDialogs->bUseDefaultColors;
920
927
return bFlushConfFileNeeded;