void cd_mail_retrieve_maildir_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name) { if( !mailaccount || !pKeyFile || !mailbox_name ) return; gboolean bFlushConfFileNeeded = FALSE; mailaccount->driver = MAILDIR_STORAGE; mailaccount->storage = mailstorage_new(NULL); mailaccount->folder = NULL; mailaccount->server = NULL; mailaccount->port = 0; mailaccount->connection_type = CONNECTION_TYPE_PLAIN; mailaccount->user = NULL; mailaccount->password = NULL; mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN; mailaccount->path = g_strdup("/"); mailaccount->timeout = 0; if (g_key_file_has_key (pKeyFile, mailbox_name, "path", NULL)) { mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path"); } mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10); //{"path", "mtime", "interval", NULL, NULL, NULL, NULL} }
void cd_mail_retrieve_feed_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name) { if( !mailaccount || !pKeyFile || !mailbox_name ) return; extern int mailstream_debug; mailstream_debug = 1; gboolean bFlushConfFileNeeded = FALSE; mailaccount->driver = FEED_STORAGE; mailaccount->storage = mailstorage_new(NULL); mailaccount->folder = NULL; mailaccount->server = NULL; mailaccount->port = 443; mailaccount->connection_type = CONNECTION_TYPE_PLAIN; mailaccount->user = NULL; mailaccount->password = NULL; mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN; mailaccount->path = NULL; mailaccount->timeout = 0; if (g_key_file_has_key (pKeyFile, mailbox_name, "path", NULL)) { mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path"); } mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10); }
void cd_mail_retrieve_imap_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name) { if( !mailaccount || !pKeyFile || !mailbox_name ) return; gboolean bFlushConfFileNeeded = FALSE; mailaccount->driver = IMAP_STORAGE; mailaccount->storage = mailstorage_new(NULL); mailaccount->folder = NULL; mailaccount->server = NULL; mailaccount->port = 0; mailaccount->connection_type = CONNECTION_TYPE_PLAIN; mailaccount->user = NULL; mailaccount->password = NULL; mailaccount->auth_type = IMAP_AUTH_TYPE_PLAIN; mailaccount->path = g_strdup("/"); mailaccount->timeout = 0; if (g_key_file_has_key (pKeyFile, mailbox_name, "host", NULL)) { mailaccount->server = CD_CONFIG_GET_STRING (mailbox_name, "host"); } if (g_key_file_has_key (pKeyFile, mailbox_name, "username", NULL)) { mailaccount->user = CD_CONFIG_GET_STRING (mailbox_name, "username"); } if (g_key_file_has_key (pKeyFile, mailbox_name, "password", NULL)) { gchar *encryptedPassword = CD_CONFIG_GET_STRING (mailbox_name, "password"); cairo_dock_decrypt_string( encryptedPassword, &(mailaccount->password) ); if( encryptedPassword ) g_free(encryptedPassword); } mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10); mailaccount->port = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "port", 0); mailaccount->connection_type = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT (mailbox_name, "use secure connection", FALSE)?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN; /* CONNECTION_TYPE_TLS ? CONNECTION_TYPE_STARTTLS ? */ if (g_key_file_has_key (pKeyFile, mailbox_name, "server_directory", NULL)) { mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "server_directory"); } }
******************************************************************************/ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-notifications.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN gsize length = 0; myConfig.cURI_to_load = CD_CONFIG_GET_STRING ("Configuration", "weblet URI"); myConfig.bShowScrollbars = CD_CONFIG_GET_BOOLEAN ("Configuration", "show scrollbars"); myConfig.bIsTransparent = CD_CONFIG_GET_BOOLEAN ("Configuration", "transparent background"); myConfig.iPosScrollX = CD_CONFIG_GET_INTEGER ("Configuration", "scroll x"); myConfig.iPosScrollY = CD_CONFIG_GET_INTEGER ("Configuration", "scroll y"); myConfig.iReloadTimeout = CD_CONFIG_GET_INTEGER ("Configuration", "reload timeout"); myConfig.cListURI = CD_CONFIG_GET_STRING_LIST ("Configuration", "uri list", &length); myConfig.iRightMargin = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "right margin", 5); if (myConfig.cListURI == NULL) { g_key_file_set_string (CD_APPLET_MY_KEY_FILE, "Configuration", "uri list", "www.cairo-dock.org;www.google.com;m.google.com/mail;www.rememberthemilk.com/services/modules/googleig;https://www.meebo.com/mobile;https://www.pandora.com/radio/tuner_8_7_0_0_pandora.swf;http://digg.com/iphone#_stories;http://www.bashfr.org/?sort=top50;about:plugins"); cairo_dock_write_keys_to_file (CD_APPLET_MY_KEY_FILE, CD_APPLET_MY_CONF_FILE); myConfig.cListURI = CD_CONFIG_GET_STRING_LIST ("Configuration", "uri list", &length); } CD_APPLET_GET_CONFIG_END
#include "applet-struct.h" #include "applet-disk-usage.h" #include "applet-config.h" CD_APPLET_GET_CONFIG_BEGIN myConfig.bListDrives = CD_CONFIG_GET_BOOLEAN ("Module", "list drives"); myConfig.bListNetwork = CD_CONFIG_GET_BOOLEAN ("Module", "list network"); myConfig.bListBookmarks = CD_CONFIG_GET_BOOLEAN ("Module", "list bookmarks"); myConfig.bUseSeparator = CD_CONFIG_GET_BOOLEAN ("Module", "use separator"); myConfig.iDisplayType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Module", "disk usage", CD_SHOW_USED_SPACE_PERCENT); myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Module", "check interval", 10); myConfig.bDrawBar = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Module", "draw bar", TRUE); myConfig.cRenderer = CD_CONFIG_GET_STRING ("Module", "renderer"); myConfig.iDeskletRendererType = CD_CONFIG_GET_INTEGER ("Module", "desklet renderer"); CD_APPLET_GET_CONFIG_END CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cRenderer); CD_APPLET_RESET_CONFIG_END void cd_shortcuts_reset_all_datas (CairoDockModuleInstance *myApplet) { cd_shortcuts_stop_disk_periodic_task (myApplet); cairo_dock_free_task (myData.pTask); if (myData.cDisksURI != NULL)
******************************************************************************/ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-config.h" #include "applet-musicplayer.h" #include "3dcover-draw.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.iQuickInfoType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "quick-info_type", MY_APPLET_TIME_ELAPSED); myConfig.cMusicPlayer = CD_CONFIG_GET_STRING_WITH_DEFAULT ("Configuration", "current-player", "XMMS"); myConfig.cDefaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); if (myConfig.cDefaultTitle == NULL || *myConfig.cDefaultTitle == '\0') { g_free (myConfig.cDefaultTitle); myConfig.cDefaultTitle = g_strdup (myConfig.cMusicPlayer); } myConfig.bEnableDialogs = CD_CONFIG_GET_BOOLEAN ("Configuration", "enable_dialogs"); myConfig.iDialogDuration = 1000 * CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "time_dialog", 4); myConfig.cChangeAnimation = CD_CONFIG_GET_STRING_WITH_DEFAULT ("Configuration", "change_animation", "wobbly"); myConfig.bEnableCover = CD_CONFIG_GET_BOOLEAN ("Configuration", "enable_cover"); myConfig.bOpenglThemes = g_bUseOpenGL && CD_CONFIG_GET_BOOLEAN ("Configuration", "enable_opengl_themes"); myConfig.bStealTaskBarIcon = CD_CONFIG_GET_BOOLEAN ("Configuration", "inhibate appli"); myConfig.cUserImage[PLAYER_NONE] = CD_CONFIG_GET_STRING ("Configuration", "default icon");
Written by Fabrice Rey (for any bug report, please mail me to [email protected]) ******************************************************************************/ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.bShowKbdIndicator = CD_CONFIG_GET_BOOLEAN ("Configuration", "show indic"); myConfig.cBackgroundImage = CD_CONFIG_GET_STRING ("Configuration", "bg image"); myConfig.iTransitionDuration = CD_CONFIG_GET_INTEGER ("Configuration", "transition"); myConfig.fTextRatio = CD_CONFIG_GET_DOUBLE_WITH_DEFAULT ("Configuration", "text ratio", 1.); CD_CONFIG_GET_COLOR_RVB("Configuration", "text color", myConfig.textDescription.fColorStart); CD_CONFIG_GET_COLOR_RVB("Configuration", "text color", myConfig.textDescription.fColorStop); int iWeight = CD_CONFIG_GET_INTEGER ("Configuration", "text weight"); myConfig.textDescription.iWeight = cairo_dock_get_pango_weight_from_1_9 (iWeight); myConfig.textDescription.iStyle = PANGO_STYLE_NORMAL; myConfig.textDescription.bOutlined = CD_CONFIG_GET_BOOLEAN ("Configuration", "outlined"); myConfig.textDescription.cFont = CD_CONFIG_GET_STRING ("Configuration", "font"); CD_APPLET_GET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end. CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cBackgroundImage);
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "applet-struct.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer"); myConfig.iDeskletRendererType = CD_CONFIG_GET_INTEGER ("Configuration", "desklet renderer"); gsize length = 0; myConfig.cMimeTypes = CD_CONFIG_GET_STRING_LIST ("Configuration", "mime", &length); myConfig.bFilter = CD_CONFIG_GET_BOOLEAN ("Configuration", "filter"); myConfig.iSortType = CD_CONFIG_GET_INTEGER ("Configuration", "sort by"); myConfig.bSelectionClipBoard = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "selection_", FALSE); myConfig.cTextIcon = CD_CONFIG_GET_FILE_PATH ("Configuration", "text icon", NULL); if (myConfig.cTextIcon == NULL) { myConfig.cTextIcon = cairo_dock_search_icon_s_path ("text-x-generic", MAX (myIcon->image.iWidth, myIcon->image.iHeight)); if (myConfig.cTextIcon == NULL)
#include <string.h> #include "tomboy-struct.h" #include "tomboy-dbus.h" #include "tomboy-config.h" CD_APPLET_GET_CONFIG_BEGIN myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.cIconDefault = CD_CONFIG_GET_STRING ("Icon", "default icon"); myConfig.cIconClose = CD_CONFIG_GET_STRING ("Icon", "close icon"); myConfig.cIconBroken = CD_CONFIG_GET_STRING ("Icon", "broken icon"); myConfig.bNoDeletedSignal = CD_CONFIG_GET_BOOLEAN ("Configuration", "no deleted signal"); // Ce problème n'étant vu que sur Gutsy, on pourrait le supprimer myConfig.iAppControlled = CD_CONFIG_GET_INTEGER ("Configuration", "app controlled"); myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer"); myConfig.bDrawContent = CD_CONFIG_GET_BOOLEAN ("Configuration", "draw content"); myConfig.bPopupContent = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "popup content", TRUE); myConfig.cDateFormat = CD_CONFIG_GET_STRING ("Configuration", "date format"); if (myConfig.cDateFormat == NULL) myConfig.cDateFormat = g_strdup ("%d/%m/%y"); myConfig.bAutoNaming = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "auto-naming", TRUE); myConfig.bAskBeforeDelete = CD_CONFIG_GET_BOOLEAN ("Configuration", "ask delete"); double couleur[3] = {1., 0., 0.}; CD_CONFIG_GET_COLOR_RVB_WITH_DEFAULT ("Configuration", "text color", myConfig.fTextColor, couleur); CD_APPLET_GET_CONFIG_END CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.defaultTitle); g_free (myConfig.cIconDefault);
#include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-mixer.h" #include "applet-notifications.h" #include "applet-config.h" CD_APPLET_GET_CONFIG_BEGIN //\_________________ On recupere toutes les valeurs de notre fichier de conf. myConfig.card_id = CD_CONFIG_GET_STRING ("Configuration", "card id"); if (myConfig.card_id == NULL) myConfig.card_id = g_strdup ("default"); gchar *cMixerElementName = CD_CONFIG_GET_STRING ("Configuration", "mixer element"); gchar *cMixerElementName2 = CD_CONFIG_GET_STRING ("Configuration", "mixer element 2"); if (cMixerElementName2 != NULL && strcmp (cMixerElementName, cMixerElementName2) == 0) { myConfig.cMixerElementName = g_strconcat (cMixerElementName, ",0", NULL); myConfig.cMixerElementName2 = g_strconcat (cMixerElementName, ",1", NULL); g_free (cMixerElementName); } else { myConfig.cMixerElementName = cMixerElementName; } g_free (cMixerElementName2);
* GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-notifications.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.cShortkey = CD_CONFIG_GET_STRING ("Configuration", "shortkey"); myConfig.cDockName = CD_CONFIG_GET_STRING ("Configuration", "dock name"); myConfig.iCloseDuration = CD_CONFIG_GET_INTEGER ("Configuration", "stop duration"); myConfig.cIconAnimation = CD_CONFIG_GET_STRING ("Configuration", "animation"); CD_APPLET_GET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end. CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cShortkey); CD_APPLET_RESET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end.
* GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-config.h" CD_APPLET_GET_CONFIG_BEGIN //\_________________ On recupere toutes les valeurs de notre fichier de conf. myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER ("Configuration", "delay"); myConfig.fSmoothFactor = CD_CONFIG_GET_DOUBLE ("Configuration", "smooth"); myConfig.bShowCpu = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "show cpu", TRUE); myConfig.bShowRam = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "show ram", TRUE); myConfig.bShowSwap = CD_CONFIG_GET_BOOLEAN ("Configuration", "show swap"); myConfig.bShowNvidia = CD_CONFIG_GET_BOOLEAN ("Configuration", "show nvidia"); #ifdef HAVE_SENSORS myConfig.bShowCpuTemp = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "show cpu temp", FALSE); myConfig.bShowFanSpeed = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "show fan", FALSE); #endif // donc toujours a false si non defini myConfig.bShowFreeMemory = CD_CONFIG_GET_BOOLEAN ("Configuration", "show free"); myConfig.iInfoDisplay = CD_CONFIG_GET_INTEGER ("Configuration", "info display"); myConfig.iDisplayType = CD_CONFIG_GET_INTEGER ("Configuration", "renderer");
* along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-notifications.h" #include "applet-menu.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.bHasIcons = CD_CONFIG_GET_BOOLEAN ("Configuration", "has icons"); myConfig.cMenuShortkey = CD_CONFIG_GET_STRING ("Configuration", "menu shortkey"); myConfig.cDirPath = CD_CONFIG_GET_STRING ("Configuration", "dir path"); myConfig.bFoldersFirst = CD_CONFIG_GET_BOOLEAN ("Configuration", "folders first"); myConfig.bCaseUnsensitive = CD_CONFIG_GET_BOOLEAN ("Configuration", "case unsensitive"); myConfig.bShowHiddenFiles = CD_CONFIG_GET_BOOLEAN ("Configuration", "show hidden"); myConfig.iNbSubItemsAtOnce = CD_CONFIG_GET_INTEGER ("Configuration", "granularity"); if (myConfig.iNbSubItemsAtOnce < 1) myConfig.iNbSubItemsAtOnce = 1; // On gere les chemins relatifs. if (myConfig.cDirPath != NULL && *myConfig.cDirPath == '~') { gchar *tmp = myConfig.cDirPath; myConfig.cDirPath = g_strdup_printf ("%s%s", g_getenv ("HOME"), myConfig.cDirPath+1); g_free (tmp); }
#ifdef IS_INDICATOR_NG #define IND_GEN_EXCEPTIONS_HARD "libapplication.so;libappmenu.so;" \ "libdatetime.so;libmessaging.so;libsoundmenu.so;libpower.so;libsession.so;" \ "com.canonical.indicator.sound;com.canonical.indicator.messages;" \ "com.canonical.indicator.datetime;com.canonical.indicator.power;" \ "com.canonical.indicator.session;com.canonical.indicator.application;" \ "com.canonical.indicator.appmenu" #else #define IND_GEN_EXCEPTIONS_HARD "libapplication.so;libappmenu.so;" \ "libdatetime.so;libmessaging.so;libsoundmenu.so;libpower.so;libsession.so" #endif //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.cIndicatorName = CD_CONFIG_GET_STRING ("Configuration", "indicator"); // if the indicator is not null/empty, we have the launcher if (myConfig.cIndicatorName == NULL || *myConfig.cIndicatorName == '\0') { gchar *cExceptionsHard = CD_CONFIG_GET_STRING ("Configuration", "exceptions"); if (cExceptionsHard == NULL) cExceptionsHard = g_strdup (IND_GEN_EXCEPTIONS_HARD); gchar *cExceptionsEditable = CD_CONFIG_GET_STRING ("Configuration", "except-edit"); // merge gchar *cExceptions = g_strdup_printf ("%s;%s", cExceptionsHard, cExceptionsEditable ? cExceptionsEditable : ""); myConfig.cExceptionsList = g_strsplit (cExceptions, ";", -1); if (myConfig.cExceptionsList[0] == NULL || *myConfig.cExceptionsList[0] == '\0')
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> #include "powermanager-struct.h" #include "powermanager-config.h" CD_APPLET_GET_CONFIG_BEGIN myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "check interval", 10); myConfig.quickInfoType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "quick-info_type", POWER_MANAGER_TIME); myConfig.lowBatteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "low battery", TRUE); myConfig.highBatteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "high battery", TRUE); myConfig.criticalBatteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "critical battery", TRUE); myConfig.iNotificationType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "notifications", 2) + 1; myConfig.cNotificationAnimation = CD_CONFIG_GET_STRING ("Configuration", "battery_animation"); myConfig.iNotificationDuration = CD_CONFIG_GET_INTEGER ("Configuration", "notif_duration");
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-config.h" CD_APPLET_GET_CONFIG_BEGIN myConfig.cShortkey = CD_CONFIG_GET_STRING_WITH_DEFAULT ("Configuration", "shortkey", "Print"); myConfig.cDirPath = CD_CONFIG_GET_STRING ("Configuration", "dir path"); CD_APPLET_GET_CONFIG_END CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cShortkey); g_free (myConfig.cDirPath); CD_APPLET_RESET_CONFIG_END CD_APPLET_RESET_DATA_BEGIN CD_APPLET_RESET_DATA_END
void cd_mail_retrieve_gmail_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name) { if( !mailaccount || !pKeyFile || !mailbox_name ) return; gboolean bFlushConfFileNeeded = FALSE; #if ( __WORDSIZE == 64 ) /* in 64bit libetpan crashes with RSS, so use the IMAP feature of GMail * instead of RSS. */ mailaccount->driver = IMAP_STORAGE; mailaccount->storage = mailstorage_new(NULL); mailaccount->folder = NULL; mailaccount->server = g_strdup("imap.gmail.com"); mailaccount->port = 993; mailaccount->connection_type = CONNECTION_TYPE_TLS; mailaccount->user = NULL; mailaccount->password = NULL; mailaccount->auth_type = IMAP_AUTH_TYPE_PLAIN; mailaccount->path = g_strdup("Inbox"); mailaccount->timeout = 0; if (g_key_file_has_key (pKeyFile, mailbox_name, "username", NULL)) { mailaccount->user = CD_CONFIG_GET_STRING (mailbox_name, "username"); } if (g_key_file_has_key (pKeyFile, mailbox_name, "password", NULL)) { gchar *encryptedPassword = CD_CONFIG_GET_STRING (mailbox_name, "password"); cairo_dock_decrypt_string( encryptedPassword, &(mailaccount->password) ); if( encryptedPassword ) g_free(encryptedPassword); } mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10); #else mailaccount->driver = FEED_STORAGE; mailaccount->storage = mailstorage_new(NULL); mailaccount->folder = NULL; mailaccount->server = NULL; mailaccount->port = 443; mailaccount->connection_type = CONNECTION_TYPE_PLAIN; mailaccount->user = NULL; mailaccount->password = NULL; mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN; mailaccount->path = NULL; mailaccount->timeout = 0; if (g_key_file_has_key (pKeyFile, mailbox_name, "username", NULL)) { mailaccount->user = CD_CONFIG_GET_STRING (mailbox_name, "username"); } if (g_key_file_has_key (pKeyFile, mailbox_name, "password", NULL)) { gchar *encryptedPassword = CD_CONFIG_GET_STRING (mailbox_name, "password"); cairo_dock_decrypt_string( encryptedPassword, &(mailaccount->password) ); if( encryptedPassword ) g_free(encryptedPassword); } gchar *user_without_column = NULL; gchar *password_without_column = NULL; if( mailaccount->user ) { gchar **splitString = g_strsplit(mailaccount->user, ":", 0); user_without_column = g_strjoinv("%3A", splitString); g_strfreev( splitString ); } if( mailaccount->password ) { gchar **splitString = g_strsplit(mailaccount->password, ":", 0); password_without_column = g_strjoinv("%3A", splitString); g_strfreev( splitString ); } if( user_without_column && password_without_column ) { mailaccount->path = g_strconcat("https://", user_without_column, ":", password_without_column, "@mail.google.com/mail/feed/atom", NULL); } else { mailaccount->path = g_strdup( "https://mail.google.com/mail/feed/atom" ); } mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10); g_free( user_without_column ); g_free( password_without_column ); #endif }
*/ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-notifications.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.iActionOnLeftClick = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "left click", CD_SHOW_DESKTOP); myConfig.iActionOnMiddleClick = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "middle click", CD_SHOW_DESKLETS); myConfig.cShortcut = CD_CONFIG_GET_STRING_WITH_DEFAULT ("Configuration", "shortkey", "<Ctrl>F4"); myConfig.cHiddenImage = CD_CONFIG_GET_STRING ("Icon", "icon"); if (myConfig.cHiddenImage == NULL) myConfig.cHiddenImage = g_strdup (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE); myConfig.cVisibleImage = CD_CONFIG_GET_STRING ("Icon", "icon visible"); if (myConfig.cVisibleImage == NULL) myConfig.cVisibleImage = g_strdup (MY_APPLET_SHARE_DATA_DIR"/icon-active.png"); CD_APPLET_GET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before yo get the applet's config, and when your applet is stopped. CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cShortcut); g_free (myConfig.cVisibleImage); g_free (myConfig.cHiddenImage); CD_APPLET_RESET_CONFIG_END
Written by Fabrice Rey (for any bug report, please mail me to [email protected]) ******************************************************************************/ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN myConfig.bSomeBooleanValue = CD_CONFIG_GET_BOOLEAN ("Configuration", "yes_no"); myConfig.iSomeIntegerValue = CD_CONFIG_GET_INTEGER ("Configuration", "int"); myConfig.cSomeStringValue = CD_CONFIG_GET_STRING ("Configuration", "text"); CD_APPLET_GET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end. CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cSomeStringValue); CD_APPLET_RESET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end. CD_APPLET_RESET_DATA_BEGIN
#include <string.h> #include "powermanager-struct.h" #include "powermanager-config.h" CD_APPLET_GET_CONFIG_BEGIN myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "check interval", 10); myConfig.quickInfoType = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "quick-info_type", POWER_MANAGER_TIME); myConfig.lowBatteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "low battery", TRUE); myConfig.highBatteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "high battery", TRUE); myConfig.criticalBatteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "critical battery", TRUE); myConfig.batteryWitness = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "battery witness", TRUE); myConfig.batteryWitnessAnimation = CD_CONFIG_GET_STRING ("Configuration", "battery_animation"); myConfig.lowBatteryValue = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "low value", 15); myConfig.bUseDBusFallback = CD_CONFIG_GET_BOOLEAN ("Configuration", "use_dbus"); if (! g_key_file_has_key (CD_APPLET_MY_KEY_FILE, "Configuration", "renderer", NULL)) // old version. { myConfig.iDisplayType = (g_key_file_get_boolean (CD_APPLET_MY_KEY_FILE, "Configuration", "use gauge", NULL) ? CD_POWERMANAGER_GAUGE : CD_POWERMANAGER_ICONS);
#include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-config.h" CD_APPLET_GET_CONFIG_BEGIN //\_________________ On recupere toutes les valeurs de notre fichier de conf. myConfig.defaultTitle = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.iCheckInterval = CD_CONFIG_GET_INTEGER ("Configuration", "delay"); myConfig.fSmoothFactor = CD_CONFIG_GET_DOUBLE ("Configuration", "smooth"); myConfig.cInterface = CD_CONFIG_GET_STRING ("Configuration", "interface"); if (myConfig.cInterface == NULL) myConfig.cInterface = g_strdup ("eth0"); myConfig.iStringLen = strlen (myConfig.cInterface); myConfig.iDisplayType = CD_CONFIG_GET_INTEGER ("Configuration", "renderer"); myConfig.iInfoDisplay = CD_CONFIG_GET_INTEGER ("Configuration", "info display"); myConfig.cGThemePath = CD_CONFIG_GET_GAUGE_THEME ("Configuration", "theme"); /*myConfig.fAlpha = CD_CONFIG_GET_DOUBLE ("Configuration", "watermark alpha"); if (myConfig.fAlpha != 0) { myConfig.cWatermarkImagePath = CD_CONFIG_GET_FILE_PATH ("Configuration", "watermark image", MY_APPLET_ICON_FILE); }*/ myConfig.iGraphType = CD_CONFIG_GET_INTEGER ("Configuration", "graphic type"); CD_CONFIG_GET_COLOR_RVB ("Configuration", "low color", myConfig.fLowColor);
CD_APPLET_GET_CONFIG_BEGIN //\_________________ On recupere toutes les valeurs de notre fichier de conf. myConfig.cLocationCode = CD_CONFIG_GET_STRING_WITH_DEFAULT ("Configuration", "location code", "FRXX0076"); myConfig.bISUnits = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "IS units", TRUE); myConfig.bCurrentConditions = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display cc", TRUE); myConfig.bDisplayNights = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display nights", FALSE); myConfig.iNbDays = MIN (CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "nb days", WEATHER_NB_DAYS_MAX), WEATHER_NB_DAYS_MAX); myConfig.bDisplayTemperature = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display temperature", TRUE); myConfig.cDialogDuration = 1000 * CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "dialog duration", 7); myConfig.iCheckInterval = 60 * MAX (CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "check interval", 15), 1); myConfig.cThemePath = CD_CONFIG_GET_THEME_PATH ("Configuration", "theme", "themes", "Classic"); myConfig.bDesklet3D = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "3D desket", FALSE); myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer"); gchar *cName = CD_CONFIG_GET_STRING ("Icon", "name"); myConfig.bSetName = (cName == NULL); g_free (cName); CD_APPLET_GET_CONFIG_END CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cLocationCode); g_free (myConfig.cRenderer); g_free (myConfig.cThemePath); CD_APPLET_RESET_CONFIG_END void cd_weather_reset_all_datas (GldiModuleInstance *myApplet)
*/ #include <string.h> #include <cairo-dock.h> #include "applet-struct.h" #include "applet-notifications.h" #include "applet-config.h" //\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload. CD_APPLET_GET_CONFIG_BEGIN CD_CONFIG_RENAME_GROUP ("Configuration", "Drag and drop indicator"); myConfig.fRotationSpeed = CD_CONFIG_GET_DOUBLE ("Drag and drop indicator", "rotation speed"); myConfig.iSpeed = CD_CONFIG_GET_INTEGER ("Drag and drop indicator", "speed"); myConfig.cDropIndicatorImageName = CD_CONFIG_GET_STRING ("Drag and drop indicator", "drop indicator"); myConfig.cHoverIndicatorImageName = CD_CONFIG_GET_STRING ("Drag and drop indicator", "hover indicator"); CD_APPLET_GET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end. CD_APPLET_RESET_CONFIG_BEGIN g_free (myConfig.cDropIndicatorImageName); g_free (myConfig.cHoverIndicatorImageName); CD_APPLET_RESET_CONFIG_END //\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end. static void _reset_data_on_one_dock (const gchar *cDockName, CairoDock *pDock, gpointer data) { CDDropIndicatorData *pData = CD_APPLET_GET_MY_DOCK_DATA (pDock);