By default visual, sound and vibration events are enabled, default timeout interval...
authorPali Rohár <pali.rohar@gmail.com>
Fri, 20 Jul 2012 09:06:36 +0000 (11:06 +0200)
committerPali Rohár <pali.rohar@gmail.com>
Fri, 20 Jul 2012 09:40:53 +0000 (11:40 +0200)
src/usr/lib/hildon-control-panel/libcallnotify.c
src/usr/lib/hildon-desktop/CallNotify.py

index 5e60b96..4d5754c 100644 (file)
@@ -18,7 +18,7 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat
        GtkWidget *slider;
        GtkWidget *lblText;
        GtkAdjustment * adj;
-       gdouble sldValue = 0.0;
+       gdouble sldValue = 5.0;
        gdouble newValue = 0.0;
        char fileContent[64];
        char *fileDouble;
@@ -54,6 +54,9 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat
        slider = gtk_hscale_new_with_range(0.0, 60.0, 0.1);
        adj = gtk_range_get_adjustment(GTK_RANGE(slider));
 
+       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVisual), TRUE);
+       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVibrate) , TRUE);
+       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnSound), TRUE);
 
        inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "r");
 
@@ -63,12 +66,12 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat
                fgets(fileContent, 12,inputFilePtr);
 
 
-               if (fileContent[0]=='y')
-                       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVisual), TRUE);
-               if (fileContent[2]=='y')
-                       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVibrate) , TRUE);
-               if (fileContent[4]=='y')
-                       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnSound), TRUE);
+               if (fileContent[0]=='n')
+                       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVisual), FALSE);
+               if (fileContent[2]=='n')
+                       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVibrate) , FALSE);
+               if (fileContent[4]=='n')
+                       hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnSound), FALSE);
 
                (char*)strtok(fileContent, ";");
                (char*)strtok(NULL, ";");
index e9ae6bf..399b5cd 100644 (file)
@@ -74,7 +74,11 @@ class CallNotify(hildondesktop.StatusMenuItem):
                self.soundCall = self.soundFile
                self.soundSMS = self.soundFile
                self.soundBoth = self.soundFile
-               self.volume = 1.0
+               self.volume = 0.5
+               self.visual = True
+               self.sound = True
+               self.vibration = True
+               self.interval = float(5.0)
                self.readConfigurationFile()
 
                self.dbg('constructor')
@@ -121,6 +125,7 @@ class CallNotify(hildondesktop.StatusMenuItem):
                        self.sound = raw_set[1] in ('y')
                        self.vibration = raw_set[2] in ('y')
                        self.interval = float(raw_set[3].replace(',','.'))
+                       self.dbg('visual='+str(self.visual)+' sound='+str(self.sound)+' vibration='+str(self.vibration)+' interval='+str(self.interval))
                        f.close()
 
                        # read sound config file
@@ -169,7 +174,7 @@ class CallNotify(hildondesktop.StatusMenuItem):
                if self.vibration and profiled.get_value("", "vibrating.alert.enabled") == "On":
                        self.dbg('vibrate:')
                        mce.req_vibrator_pattern_activate("PatternIncomingCall")
-                       time.sleep(1);
+                       time.sleep(0.5);
                        mce.req_vibrator_pattern_deactivate("PatternIncomingCall")
                return True