osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activated)
{
-char a = 'y';
-char b = 'y';
-char c = 'y';
-GtkWidget *dialog;
-GtkWidget *btnVisual;
-GtkWidget *btnVibrate;
-GtkWidget *btnSound;
-GtkWidget *slider;
-GtkWidget *lblText;
-- Show quoted text -
-GtkAdjustment * adj;
-gdouble sldValue = 0.0;
-gdouble newValue = 0.0;
-char *fileContent;
-char *fileDouble;
-int i;
-gint response;
-
-/* Create dialog with OK and Cancel buttons. Leave the separator out,
-* as we do not have any content. */
-dialog = gtk_dialog_new_with_buttons(
-"Call Notify Settings",
-GTK_WINDOW(data),
-GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
-GTK_STOCK_OK,
-GTK_RESPONSE_OK,
-GTK_STOCK_CANCEL,
-GTK_RESPONSE_CANCEL,
-NULL);
-
-/* ... add something to the dialog ... */
-//btnVisual = gtk_check_button_new_with_label();
-btnVisual = (GtkWidget*)hildon_check_button_new(HILDON_SIZE_FULLSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
-gtk_button_set_label (GTK_BUTTON (btnVisual), "Visual Notification");
-
-btnVibrate = (GtkWidget*)hildon_check_button_new(HILDON_SIZE_FULLSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
-gtk_button_set_label (GTK_BUTTON (btnVibrate), "Vibrate Notification");
-
-btnSound = (GtkWidget*)hildon_check_button_new(HILDON_SIZE_FULLSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
-gtk_button_set_label (GTK_BUTTON (btnSound), "Sound Notification");
-
-lblText = (GtkWidget*)gtk_label_new("Please select notification interval:");
-
-
-slider = gtk_hscale_new_with_range(0.0, 60.0, 0.1);
-
-
-FILE *inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "r");
-
-if (inputFilePtr != NULL)
-{
+ char a = 'y';
+ char b = 'y';
+ char c = 'y';
+ GtkWidget *dialog;
+ GtkWidget *btnVisual;
+ GtkWidget *btnVibrate;
+ GtkWidget *btnSound;
+ GtkWidget *slider;
+ GtkWidget *lblText;
+ GtkAdjustment * adj;
+ gdouble sldValue = 0.0;
+ gdouble newValue = 0.0;
+ char *fileContent;
+ char *fileDouble;
+ int i;
+ gint response;
+ /* Create dialog with OK and Cancel buttons. Leave the separator out,
+ * as we do not have any content. */
+ dialog = gtk_dialog_new_with_buttons(
+ "Call Notify Settings",
+ GTK_WINDOW(data),
+ GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_OK,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ NULL);
- fgets(fileContent, 12,inputFilePtr);
+ /* ... add something to the dialog ... */
+ //btnVisual = gtk_check_button_new_with_label();
+ btnVisual = (GtkWidget*)hildon_check_button_new(HILDON_SIZE_FULLSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
+ gtk_button_set_label (GTK_BUTTON (btnVisual), "Visual Notification");
+ btnVibrate = (GtkWidget*)hildon_check_button_new(HILDON_SIZE_FULLSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
+ gtk_button_set_label (GTK_BUTTON (btnVibrate), "Vibrate Notification");
- if (fileContent[0]=='y')
- hildon_check_button_set_active (GTK_BUTTON(btnVisual), TRUE);
- if (fileContent[2]=='y')
- hildon_check_button_set_active (GTK_BUTTON(btnVibrate) , TRUE);
- if (fileContent[4]=='y')
- hildon_check_button_set_active (GTK_BUTTON(btnSound), TRUE);
+ btnSound = (GtkWidget*)hildon_check_button_new(HILDON_SIZE_FULLSCREEN_WIDTH | HILDON_SIZE_FINGER_HEIGHT);
+ gtk_button_set_label (GTK_BUTTON (btnSound), "Sound Notification");
-(char*)strtok(fileContent, ";");
-(char*)strtok(NULL, ";");
-(char*)strtok(NULL, ";");
+ lblText = (GtkWidget*)gtk_label_new("Please select notification interval:");
-fileDouble = strtok(NULL, ";");
-// replace , with .
-for (i=0; i<strlen(fileDouble); i++)
-if (fileDouble[i]==',')
-fileDouble[i] = '.';
+ slider = gtk_hscale_new_with_range(0.0, 60.0, 0.1);
- sldValue = g_strtod(fileDouble, NULL);
- adj = gtk_range_get_adjustment(GTK_RANGE(slider));
- gtk_adjustment_set_value(adj, sldValue);
+ FILE *inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "r");
-}
+ if (inputFilePtr != NULL)
+ {
-fclose(inputFilePtr);
+ fgets(fileContent, 12,inputFilePtr);
-gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnVisual);
-gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnVibrate);
-gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnSound);
-gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), lblText);
-gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), slider);
-gtk_widget_show_all(dialog);
+ if (fileContent[0]=='y')
+ hildon_check_button_set_active (GTK_BUTTON(btnVisual), TRUE);
+ if (fileContent[2]=='y')
+ hildon_check_button_set_active (GTK_BUTTON(btnVibrate) , TRUE);
+ if (fileContent[4]=='y')
+ hildon_check_button_set_active (GTK_BUTTON(btnSound), TRUE);
-/* Wait until user finishes the dialog. */
-response = gtk_dialog_run(GTK_DIALOG(dialog));
+ (char*)strtok(fileContent, ";");
+ (char*)strtok(NULL, ";");
+ (char*)strtok(NULL, ";");
-if (response == GTK_RESPONSE_OK)
-{
-/* ... do something with the dialog stuff ... */
-//FILE *f_write =
-inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "w");
+ fileDouble = strtok(NULL, ";");
+ // replace , with .
+ for (i=0; i<strlen(fileDouble); i++)
+ if (fileDouble[i]==',')
+ fileDouble[i] = '.';
-a = hildon_check_button_get_active(GTK_BUTTON(btnVisual)) ? 'y' : 'n';
-b = hildon_check_button_get_active(GTK_BUTTON(btnVibrate)) ? 'y' : 'n';
-c = hildon_check_button_get_active(GTK_BUTTON(btnSound)) ? 'y' : 'n';
+ sldValue = g_strtod(fileDouble, NULL);
-newValue = gtk_adjustment_get_value(adj);
+ adj = gtk_range_get_adjustment(GTK_RANGE(slider));
+ gtk_adjustment_set_value(adj, sldValue);
+ }
-fprintf(inputFilePtr, "%c;%c;%c;%.1f\n",a,b,c,newValue);
+ fclose(inputFilePtr);
-fclose(inputFilePtr);
-}
+ gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnVisual);
+ gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnVibrate);
+ gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnSound);
+ gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), lblText);
+ gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), slider);
+
+ gtk_widget_show_all(dialog);
+
+ /* Wait until user finishes the dialog. */
+ response = gtk_dialog_run(GTK_DIALOG(dialog));
+
+ if (response == GTK_RESPONSE_OK)
+ {
+ /* ... do something with the dialog stuff ... */
+ //FILE *f_write =
+ inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "w");
+
-/* Free the dialog (and it's children) */
+ a = hildon_check_button_get_active(GTK_BUTTON(btnVisual)) ? 'y' : 'n';
+ b = hildon_check_button_get_active(GTK_BUTTON(btnVibrate)) ? 'y' : 'n';
+ c = hildon_check_button_get_active(GTK_BUTTON(btnSound)) ? 'y' : 'n';
-gtk_widget_destroy(GTK_WIDGET(dialog));
+ newValue = gtk_adjustment_get_value(adj);
-return OSSO_OK;
+
+ fprintf(inputFilePtr, "%c;%c;%c;%.1f\n",a,b,c,newValue);
+
+ fclose(inputFilePtr);
+
+ }
+
+ /* Free the dialog (and it's children) */
+
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+
+ return OSSO_OK;
}
osso_return_t save_state(osso_context_t *osso, gpointer data)
{
-/* ... save state ... */
+ /* ... save state ... */
-return OSSO_OK;
+ return OSSO_OK;
}
-
-