* fix a memleak in the msg edit window
[modest] / src / maemo / modest-platform.c
index 920f3fb..d084d7e 100644 (file)
@@ -54,6 +54,8 @@
 #define URI_ACTION_COPY "copy:"
 
 static osso_context_t *osso_context = NULL;
+
+static void  folder_name_insensitive_press (GtkWidget *widget, ModestWindow *window);
        
 static void    
 on_modest_conf_update_interval_changed (ModestConf* self, const gchar *key, 
@@ -588,8 +590,8 @@ entry_changed (GtkEditable *editable,
        chars = gtk_editable_get_chars (editable, 0, -1);
        g_return_if_fail (chars != NULL);
 
-       /* Dimm OK button */
-       if (strlen (chars) == 0) {
+       /* Dimm OK button. Do not allow also the "/" */
+       if (strlen (chars) == 0 || strchr (chars, '/')) {
                GtkWidget *ok_button;
                GList *buttons;
 
@@ -742,7 +744,9 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
                                        const gchar *suggested_name,
                                        gchar **folder_name)
 {
+       GtkWidget *accept_btn = NULL; 
        GtkWidget *dialog, *entry, *label, *hbox;
+       GList *buttons = NULL;
        gint result;
 
        /* Ask the user for the folder name */
@@ -755,6 +759,11 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
                                              GTK_RESPONSE_REJECT,
                                              NULL);
 
+       /* Add accept button (with unsensitive handler) */
+       buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
+       accept_btn = GTK_WIDGET (buttons->next->data);
+       g_signal_connect (G_OBJECT (accept_btn), "insensitive-press", G_CALLBACK (folder_name_insensitive_press), parent_window);
+
        /* Create label and entry */
        label = gtk_label_new (label_text);
        /* TODO: check that the suggested name does not exist */
@@ -798,6 +807,12 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
        return result;
 }
 
+static void  
+folder_name_insensitive_press (GtkWidget *widget, ModestWindow *window)
+{
+       hildon_banner_show_information (NULL, NULL, _("(empty)"));
+}
+
 gint
 modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
                                       TnyFolderStore *parent_folder,
@@ -832,6 +847,7 @@ modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
        gint response;
 
        dialog = hildon_note_new_confirmation (parent_window, message);
+       gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
 
        response = gtk_dialog_run (GTK_DIALOG (dialog));
 
@@ -920,26 +936,28 @@ gboolean modest_platform_set_update_interval (guint minutes)
        st_time->tm_min += minutes;
        
        /* Set the time in alarm_event_t structure: */
-       alarm_event_t event;
-       memset (&event, 0, sizeof (alarm_event_t));
-       event.alarm_time = mktime (st_time);
+       alarm_event_t *event = g_new0(alarm_event_t, 1);
+       event->alarm_time = mktime (st_time);
 
        /* Specify what should happen when the alarm happens:
         * It should call this D-Bus method: */
         
        /* Note: I am surpised that alarmd can't just use the modest.service file
         * for this. murrayc. */
-       event.dbus_path = g_strdup(PREFIX "/bin/modest");
+       event->dbus_path = g_strdup(PREFIX "/bin/modest");
        
-       event.dbus_interface = g_strdup (MODEST_DBUS_IFACE);
-       event.dbus_service = g_strdup (MODEST_DBUS_SERVICE);
-       event.dbus_name = g_strdup (MODEST_DBUS_METHOD_SEND_RECEIVE);
+       event->dbus_interface = g_strdup (MODEST_DBUS_IFACE);
+       event->dbus_service = g_strdup (MODEST_DBUS_SERVICE);
+       event->dbus_name = g_strdup (MODEST_DBUS_METHOD_SEND_RECEIVE);
 
        /* Otherwise, a dialog will be shown if exect_name or dbus_path is NULL,
        even though we have specified no dialog text: */
-       event.flags = ALARM_EVENT_NO_DIALOG;
+       event->flags = ALARM_EVENT_NO_DIALOG;
        
-       alarm_cookie = alarm_event_add (&event);
+       alarm_cookie = alarm_event_add (event);
+
+       /* now, free it */
+       alarm_event_free (event);
        
        /* Store the alarm ID in GConf, so we can remove it later:
         * This is apparently valid between application instances. */