switch(result){
case GTK_RESPONSE_YES:
+ /* Check theme */
if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
if (priv->theme)
g_free(priv->theme);
priv->theme = g_strdup("Modern");
if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
priv->theme = g_strdup("Matrix");
- if (hildon_check_button_get_active (rich_animation_button))
- priv->rich_animation = TRUE;
- else
- priv->rich_animation = FALSE;
- if (hildon_check_button_get_active (enable_button)){
- if (!check_applet_state())
- start_applet();
- }else
- if (check_applet_state())
- stop_applet();
}
+ /* Check rich animation */
+ if (hildon_check_button_get_active (rich_animation_button))
+ priv->rich_animation = TRUE;
+ else
+ priv->rich_animation = FALSE;
+ /* Save config */
save_config(priv);
- send_dbus_signal (priv,
+ /* action with applet */
+ if (hildon_check_button_get_active (enable_button)){
+ if (!check_applet_state())
+ start_applet();
+ else
+ send_dbus_signal (priv,
LIVEWP_SIGNAL_INTERFACE,
LIVEWP_SIGNAL_PATH,
LIVEWP_RELOAD_CONFIG);
- break;
+ }else
+ if (check_applet_state())
+ stop_applet();
+
+ break;
default:
case GTK_RESPONSE_OK:
break;
gboolean
check_applet_state(void){
FILE *file_in;
- FILE *file_out;
gchar buffer[2048];
gboolean result = FALSE;
while (!feof(file_in)) {
memset(buffer, 0, sizeof(buffer));
fgets(buffer, sizeof(buffer) - 1, file_in);
- if (buffer &&
- !strcmp(buffer, "X-Desktop-File=/usr/share/applications/hildon-home/livewp-home-widget.desktop\n")){
+ if (!strcmp(buffer,
+ "X-Desktop-File=/usr/share/applications/hildon-home/livewp-home-widget.desktop\n")){
result = TRUE;
break;
}
return result;
}
/*******************************************************************************/
+void
start_applet(void){
- FILE *file_in;
FILE *file_out;
- gchar buffer[2048];
+
file_out = fopen("/home/user/.config/hildon-desktop/home.plugins","w+");
if (file_out){
fputs("\n", file_out);
}
}
/*******************************************************************************/
+void
stop_applet(void){
FILE *file_in;
FILE *file_out;
while (!feof(file_in)) {
memset(buffer, 0, sizeof(buffer));
fgets(buffer, sizeof(buffer) - 1, file_in);
- if (buffer && strcmp(buffer, "[livewp-home-widget.desktop-0]\n") &&
+ if (strcmp(buffer, "[livewp-home-widget.desktop-0]\n") &&
strcmp(buffer, "X-Desktop-File=/usr/share/applications/hildon-home/livewp-home-widget.desktop\n"))
fputs(buffer, file_out);
}