~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/3.0.0.0rc1

« back to all changes in this revision

Viewing changes to clock/src/applet-config.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne, Matthieu Baerts (matttbe), Julien Lavergne
  • Date: 2009-10-05 19:27:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091005192717-mvqvb395guktr401
Tags: 2.0.9-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New upstream release (LP: #435590)
* debian/control: 
 - Remove ${shlibs:Depends} for integration plug-ins to avoid
   pulling shared libraries which are detected automatically.
 - Added curl as depends for cairo-dock-plug-ins
* debian/rules:
 - Add --enable-dnd2share and --enable-musicplayer to enable new applets.
 - Remove --enable-rhythmbox and --enable-nvidia to remove those applets,
   not maintained upstream.
* Update *.install to take all generated applets.

[ Julien Lavergne ]
* Adjust changelog with Daniel Holbach suggestions.
* cairo-dock-plug-ins.changelogs:  Install specific changelog for 2.0.9
* Build-depends on cairo-dock-dev (>= 2.0.9)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
*/
19
19
 
20
 
/**********************************************************************************
21
 
 
22
 
This file is a part of the cairo-dock clock applet, 
23
 
released under the terms of the GNU General Public License.
24
 
 
25
 
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
26
 
 
27
 
**********************************************************************************/
28
20
#include <string.h>
29
21
#include <stdlib.h>
30
22
 
45
37
        myConfig.bShowSeconds           = CD_CONFIG_GET_BOOLEAN ("Module", "show seconds");
46
38
        myConfig.iSmoothAnimationDuration = CD_CONFIG_GET_INTEGER_WITH_DEFAULT  ("Module", "smooth", 500);
47
39
        myConfig.b24Mode                        = CD_CONFIG_GET_BOOLEAN ("Module", "24h mode");
48
 
        myConfig.bOldStyle              = CD_CONFIG_GET_BOOLEAN ("Module", "old fashion style");
 
40
        myConfig.cLocation              = CD_CONFIG_GET_STRING ("Module", "location");
 
41
        myConfig.cSetupTimeCommand      = CD_CONFIG_GET_STRING ("Module", "setup command");
 
42
        
 
43
        //\_______________ On recupere les parametres d'apparence.
 
44
        int iStyle = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Module", "style", -1);  // dans le .conf par defaut c'est aussi -1, donc si cette cle n'existait pas, on est sur qu'elle a ete rajoutee avec la valeur -1.
 
45
        if (iStyle == -1)
 
46
        {
 
47
                g_print ("*** pas de cle 'style'\n");
 
48
                myConfig.bOldStyle = CD_CONFIG_GET_BOOLEAN ("Module", "old fashion style");
 
49
                g_key_file_set_integer (pKeyFile, "Module", "style", myConfig.bOldStyle ? 0 : 1);
 
50
                bFlushConfFileNeeded = TRUE;  // petit hack pas mechant, en effet si il y a eu changement de version, le fichier a deja ete mis a jour.
 
51
        }
 
52
        else
 
53
        {
 
54
                myConfig.bOldStyle = (iStyle == 0);
 
55
        }
 
56
        
49
57
        double couleur[4] = {0., 0., 0.5, 1.};
50
 
        CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Module", "text color", myConfig.fTextColor, couleur);
51
 
        CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Module", "date color", myConfig.fDateColor, couleur);
52
 
        myConfig.cSetupTimeCommand      = CD_CONFIG_GET_STRING ("Module", "setup command");
53
 
        myConfig.cFont = CD_CONFIG_GET_STRING ("Module", "font");
54
 
        int iWeight = CD_CONFIG_GET_INTEGER_WITH_DEFAULT  ("Module", "weight", 5);
55
 
        myConfig.iWeight = cairo_dock_get_pango_weight_from_1_9 (iWeight);
56
 
        if (myConfig.cFont == NULL)
57
 
                myConfig.cFont = g_strdup (myLabels.iconTextDescription.cFont);
58
 
        
59
 
        myConfig.cLocation              = CD_CONFIG_GET_STRING ("Module", "location");
60
 
        
61
 
        //myConfig.cDigital             = CD_CONFIG_GET_STRING ("Module", "digital");
 
58
        if (myConfig.bOldStyle)
 
59
        {
 
60
                myConfig.cThemePath = CD_CONFIG_GET_THEME_PATH ("Module", "theme", "themes", "glassy");
 
61
                CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Module", "date color", myConfig.fDateColor, couleur);
 
62
        }
 
63
        else
 
64
        {
 
65
                CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Module", "text color", myConfig.fTextColor, couleur);
 
66
                
 
67
                gchar *cFontDescription = CD_CONFIG_GET_STRING ("Module", "font");
 
68
                if (cFontDescription == NULL)
 
69
                {
 
70
                        cFontDescription = g_strdup ("Sans");  // sinon fd est NULL.
 
71
                }
 
72
                PangoFontDescription *fd = pango_font_description_from_string (cFontDescription);
 
73
                
 
74
                myConfig.cFont = g_strdup (pango_font_description_get_family (fd));
 
75
                myConfig.iWeight = pango_font_description_get_weight (fd);
 
76
                myConfig.iStyle = pango_font_description_get_style (fd);
 
77
                if (pango_font_description_get_size (fd) == 0)  // anciens parametres de font.
 
78
                {
 
79
                        int iWeight = g_key_file_get_integer (pKeyFile, "Module", "weight", NULL);
 
80
                        myConfig.iWeight = cairo_dock_get_pango_weight_from_1_9 (iWeight);
 
81
                        myConfig.iStyle = PANGO_STYLE_NORMAL;
 
82
                        
 
83
                        pango_font_description_set_size (fd, 12 * PANGO_SCALE);
 
84
                        pango_font_description_set_weight (fd, myConfig.iWeight);
 
85
                        pango_font_description_set_style (fd, myConfig.iStyle);
 
86
                        g_free (cFontDescription);
 
87
                        cFontDescription = pango_font_description_to_string (fd);
 
88
                        g_key_file_set_string (pKeyFile, "Module", "font", cFontDescription);
 
89
                        bFlushConfFileNeeded = TRUE;
 
90
                }
 
91
                pango_font_description_free (fd);
 
92
                g_free (cFontDescription);
 
93
                
 
94
                myConfig.cNumericBackgroundImage = CD_CONFIG_GET_STRING ("Module", "numeric bg");
 
95
        }
62
96
        
63
97
        //\_______________ On recupere les alarmes.
64
98
        myConfig.pAlarms = g_ptr_array_new ();
110
144
                }
111
145
        } while (1);
112
146
        g_string_free (sKeyName, TRUE);
113
 
        
114
 
        
115
 
        //\_______________ On on recupere le thme choisi.
116
 
        if (myConfig.bOldStyle)
117
 
                myConfig.cThemePath = CD_CONFIG_GET_THEME_PATH ("Module", "theme", "themes", "glassy");
118
147
CD_APPLET_GET_CONFIG_END
119
148
 
120
149
 
123
152
        g_free (myConfig.cFont);
124
153
        g_free (myConfig.cLocation);
125
154
        g_free (myConfig.cDigital);
126
 
 
 
155
        g_free (myConfig.cNumericBackgroundImage);
 
156
        
127
157
        CDClockAlarm *pAlarm;
128
158
        int i;
129
159
        if (myConfig.pAlarms != NULL)
320
350
                pMenuItem = gtk_menu_item_new_with_label (cFileName);
321
351
                pLocalData = g_new (gpointer, 2);
322
352
                pLocalData[0] = pMenuItem;
323
 
                pLocalData[1] = cFileName;
 
353
                pLocalData[1] = (gpointer)cFileName;
324
354
                pLocalList = g_list_insert_sorted (pLocalList, pLocalData, (GCompareFunc) _cd_clock_compare_path_order);
325
355
                
326
356
                // location de cette entree.
401
431
 
402
432
void cd_clock_load_custom_widget (CairoDockModuleInstance *myApplet, GKeyFile* pKeyFile)
403
433
{
404
 
        g_print ("%s (%s)\n", __func__, myIcon->acName);
 
434
        g_print ("%s (%s)\n", __func__, myIcon->cName);
405
435
        //\____________ On recupere notre widget personnalise (un simple container vide qu'on va remplir avec nos trucs).
406
436
        GtkWidget *pCustomWidgetBox = cairo_dock_get_widget_from_name ("Alarm", "add new");
407
437
        g_return_if_fail (pCustomWidgetBox != NULL);
446
476
 
447
477
void cd_clock_save_custom_widget (CairoDockModuleInstance *myApplet, GKeyFile *pKeyFile)
448
478
{
449
 
        g_print ("%s (%s)\n", __func__, myIcon->acName);
 
479
        g_print ("%s (%s)\n", __func__, myIcon->cName);
450
480
        // ca c'est si on avait des valeurs a recuperer dans nos widgets personnalises, et a stocker dans le pKeyFile. mais ici ils sont simple, et donc tous pris en charge par le dock.
451
481
}