~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy-proposed

« back to all changes in this revision

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

  • Committer: Jamie Strandboge
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2012-03-26 14:35:01 UTC
  • mfrom: (25.1.1 cairo-dock-plug-ins)
  • Revision ID: jamie@canonical.com-20120326143501-r3c8mq6n2vyc0e2j
* New upstream release. (LP: #961579)
* Upstream ChangeLog: (main changes)
 - Updated translations
 - MusicPlayer:
  + When choosing the player the first time, launch it and set the name
  + It seems the latest stable version of rhythmbox now re-uses this DBus
     address: org.mpris.MediaPlayer2.rhythmbox
 - Use the default bg color for always visible icons
 - GMenu: check if kde4-applications.menu and lxde-applications.menu
    are available
 - Dbus:
  + Bash interface: fixed a typo
  + Changed the third-party applets dir on the server for the 3.0
  + Enabling threads on the Python Interface
  + Modified the old SetEmblem method to use the new overlays
 - Enable GVFS if detected
 - Indicators: handle the case where the service crashes
 - Status-Notifier:
  + Indicator 0.4.90 (and newer) has a new variable (Title)
  + Display Label first if it's available instead of Title first
  + Fixed a bug with empty labels
  + KDE's watcher: if ItemIsMenu is true (e.g. Klipper) and if we only show
     the menu on left click, we emit a signal to the application to show
     its own menu
  + checked if the menu path is different that '/NO_DBUSMENU'
  + IAS: checked if an item is not already available in the systray
     (workaround) and fixed a few typos
  + Added a space between icons and fixed the wrong drawing of the icon
     on a vertical dock if the icon can be resized
  + Used cairo_dock_add_path_to_icon_theme
 - Sound control:
  + Fixed a small bug on reload (invisible icon)
  + Updated the Dbus names to match with Ubuntu 12.04
  + Backported the latest version of Ubuntu's indicator-sound into the
     Sound-Control applet
  + Make some items in the menu invisible if not available
  + Worked around a bug in libindicator, which keeps internally
     the service pointer
 - Logout:
  + Fixed a tiny memory leak
  + Look for a different icon's size if we want to display this icon in
     a menu/a dock/an emblem
 - PowerManager:
  + Removed an extraseparators in the menu
 - Clock:
  + Used the logical rectangle in order to fix the position of the text
  + Removed unused files
  + Removed useless translations (log.x and log.y = 0)
  + Only used this ratio to limit the deformation with the height
  + Fixed a problem with the ratio if this applet is displayed in
     a vertical dock
 - Remote Control: fixed a crash during the 'click' signal
 - Slider:
  + When reloading, display the changes immediately
  + Added the possibility to refresh the images list from the menu
  + Fixed the loading of the image on startup, when the applet's size is
     not yet stable
  + Code cleaning
 - Fixed an error when compiling without libindicator
 - A few minor changes (comments, factorisation, etc)
 - Recent-Events: if zeitgeist is not yet running on first search,
    try 3 times before giving up.
* debian/control:
 - Updated the version of cairo-dock-[core;data;dev].

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
        {
77
77
                CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "text color", myConfig.fTextColor, couleur);
78
78
                
79
 
                gchar *cFontDescription = CD_CONFIG_GET_STRING ("Configuration", "font");
80
 
                if (cFontDescription == NULL)
81
 
                {
82
 
                        cFontDescription = g_strdup ("Sans");  // sinon fd est NULL. On ne precise pas la taille ici pour pouvoir intercepter ce cas.
83
 
                }
84
 
                PangoFontDescription *fd = pango_font_description_from_string (cFontDescription);
85
 
                
86
 
                myConfig.cFont = g_strdup (pango_font_description_get_family (fd));
87
 
                myConfig.iWeight = pango_font_description_get_weight (fd);
88
 
                myConfig.iStyle = pango_font_description_get_style (fd);
89
 
                if (pango_font_description_get_size (fd) == 0)  // anciens parametres de font.
90
 
                {
91
 
                        int iWeight = g_key_file_get_integer (pKeyFile, "Configuration", "weight", NULL);
92
 
                        myConfig.iWeight = cairo_dock_get_pango_weight_from_1_9 (iWeight);
93
 
                        myConfig.iStyle = PANGO_STYLE_NORMAL;
94
 
                        
95
 
                        pango_font_description_set_size (fd, 16 * PANGO_SCALE);
96
 
                        pango_font_description_set_weight (fd, myConfig.iWeight);
97
 
                        pango_font_description_set_style (fd, myConfig.iStyle);
 
79
                gboolean bCustomFont = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "custom font", FALSE);  // false by default
 
80
                if (bCustomFont)
 
81
                {
 
82
                        gchar *cFontDescription = CD_CONFIG_GET_STRING ("Configuration", "font");
 
83
                        if (cFontDescription == NULL)
 
84
                        {
 
85
                                cFontDescription = g_strdup ("Sans");  // sinon fd est NULL. On ne precise pas la taille ici pour pouvoir intercepter ce cas.
 
86
                        }
 
87
                        PangoFontDescription *fd = pango_font_description_from_string (cFontDescription);
 
88
                        
 
89
                        myConfig.cFont = g_strdup (pango_font_description_get_family (fd));
 
90
                        myConfig.iWeight = pango_font_description_get_weight (fd);
 
91
                        myConfig.iStyle = pango_font_description_get_style (fd);
 
92
                        
 
93
                        if (pango_font_description_get_size (fd) == 0)  // anciens parametres de font.
 
94
                        {
 
95
                                int iWeight = g_key_file_get_integer (pKeyFile, "Configuration", "weight", NULL);
 
96
                                myConfig.iWeight = cairo_dock_get_pango_weight_from_1_9 (iWeight);
 
97
                                myConfig.iStyle = PANGO_STYLE_NORMAL;
 
98
 
 
99
                                pango_font_description_set_size (fd, 16 * PANGO_SCALE);
 
100
                                pango_font_description_set_weight (fd, myConfig.iWeight);
 
101
                                pango_font_description_set_style (fd, myConfig.iStyle);
 
102
                                g_free (cFontDescription);
 
103
                                cFontDescription = pango_font_description_to_string (fd);
 
104
                                g_key_file_set_string (pKeyFile, "Configuration", "font", cFontDescription);
 
105
                        }
 
106
                        pango_font_description_free (fd);
98
107
                        g_free (cFontDescription);
99
 
                        cFontDescription = pango_font_description_to_string (fd);
100
 
                        g_key_file_set_string (pKeyFile, "Configuration", "font", cFontDescription);
101
 
                }
102
 
                pango_font_description_free (fd);
103
 
                g_free (cFontDescription);
 
108
                }
 
109
                else  // use the same font as the labels
 
110
                {
 
111
                        myConfig.cFont = g_strdup (myIconsParam.iconTextDescription.cFont);
 
112
                        myConfig.iWeight = PANGO_WEIGHT_HEAVY;  // force to bold, it's much more readable.
 
113
                        myConfig.iStyle = myIconsParam.iconTextDescription.iStyle;
 
114
                }
104
115
                
105
116
                myConfig.cNumericBackgroundImage = CD_CONFIG_GET_STRING ("Configuration", "numeric bg");
106
117
                myConfig.fTextRatio = CD_CONFIG_GET_DOUBLE_WITH_DEFAULT ("Configuration", "text ratio", 1.);
456
467
        s_pTimeZoneList = NULL;
457
468
}
458
469
 
459
 
void cd_clock_load_custom_widget (CairoDockModuleInstance *myApplet, GKeyFile* pKeyFile)
 
470
void cd_clock_load_custom_widget (CairoDockModuleInstance *myApplet, GKeyFile* pKeyFile)  // warning: myApplet can be NULL if the applet has not been yet started.
460
471
{
461
 
        cd_debug ("%s (%s)", __func__, myIcon->cName);
462
472
        //\____________ On recupere notre widget personnalise (un simple container vide qu'on va remplir avec nos trucs).
463
473
        CairoDockGroupKeyWidget *pGroupKeyWidget = CD_APPLET_GET_CONFIG_PANEL_GROUP_KEY_WIDGET ("Alarm", "add new");
464
474
        g_return_if_fail (pGroupKeyWidget != NULL);