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,
- ModestConfEvent event, gpointer user_data)
+on_modest_conf_update_interval_changed (ModestConf* self,
+ const gchar *key,
+ ModestConfEvent event,
+ ModestConfNotificationId id,
+ gpointer user_data)
{
if (strcmp (key, MODEST_CONF_UPDATE_INTERVAL) == 0) {
const guint update_interval_minutes =
/* Make sure that the update interval is changed whenever its gconf key
- * is changed: */
+ * is changed */
+ /* CAUTION: we're not using here the
+ modest_conf_listen_to_namespace because we know that there
+ are other parts of Modest listening for this namespace, so
+ we'll receive the notifications anyway. We basically do not
+ use it because there is no easy way to do the
+ modest_conf_forget_namespace */
ModestConf *conf = modest_runtime_get_conf ();
g_signal_connect (G_OBJECT(conf),
"key_changed",
/* Get the initial update interval from gconf: */
on_modest_conf_update_interval_changed(conf, MODEST_CONF_UPDATE_INTERVAL,
- MODEST_CONF_EVENT_KEY_CHANGED, NULL);
+ MODEST_CONF_EVENT_KEY_CHANGED, 0, NULL);
/* initialize the addressbook */
if (!osso_abook_init (&argc, &argv, osso_context)) {
GtkIconTheme *current_theme = NULL;
g_return_val_if_fail (name, NULL);
-
+
+#if 0 /* do we still need this? */
if (g_str_has_suffix (name, ".png")) { /*FIXME: hack*/
pixbuf = gdk_pixbuf_new_from_file (name, &err);
if (!pixbuf) {
}
return pixbuf;
}
-
+#endif /* */
current_theme = gtk_icon_theme_get_default ();
pixbuf = gtk_icon_theme_load_icon (current_theme, name, 26,
GTK_ICON_LOOKUP_NO_SVG,
hildon_banner_show_information (gtk_widget_get_parent (GTK_WIDGET (data)), NULL,
_CS("ckdg_ib_maximum_characters_reached"));
} else {
- gboolean is_valid = FALSE;
-
- if (!text)
- is_valid = FALSE;
- else if (strlen(text) == 0 && g_str_has_prefix (chars, " "))
- is_valid = FALSE;
- else
- is_valid = !g_str_has_prefix(text, " ");
+ GtkWidget *ok_button;
+ GList *buttons;
- /* A blank space is not valid as first character */
- if (is_valid) {
- GtkWidget *ok_button;
- GList *buttons;
-
- /* Show OK button */
- buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (data)->action_area));
- ok_button = GTK_WIDGET (buttons->next->data);
- gtk_widget_set_sensitive (ok_button, TRUE);
- g_list_free (buttons);
+ buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (data)->action_area));
+ ok_button = GTK_WIDGET (buttons->next->data);
+
+ gtk_widget_set_sensitive (ok_button,
+ modest_text_utils_validate_folder_name (chars));
+ g_list_free (buttons);
- }
-
/* Write the text in the entry */
g_signal_handlers_block_by_func (editable,
(gpointer) entry_insert_text, data);
gpointer user_data)
{
gchar *chars;
+ GtkWidget *ok_button;
+ GList *buttons;
+ buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (user_data)->action_area));
+ ok_button = GTK_WIDGET (buttons->next->data);
+
chars = gtk_editable_get_chars (editable, 0, -1);
g_return_if_fail (chars != NULL);
- /* Dimm OK button. Do not allow also the "/" */
- if (strlen (chars) == 0 || strchr (chars, '/')) {
- GtkWidget *ok_button;
- GList *buttons;
-
- buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (user_data)->action_area));
- ok_button = GTK_WIDGET (buttons->next->data);
- gtk_widget_set_sensitive (ok_button, FALSE);
-
- g_list_free (buttons);
- } else if (g_utf8_strlen (chars,-1) >= 21)
+
+ if (g_utf8_strlen (chars,-1) >= 21)
hildon_banner_show_information (gtk_widget_get_parent (GTK_WIDGET (user_data)), NULL,
- _CS("ckdg_ib_maximum_characters_reached"));
+ _CS("ckdg_ib_maximum_characters_reached"));
+ else
+ gtk_widget_set_sensitive (ok_button, modest_text_utils_validate_folder_name(chars));
+
/* Free */
+ g_list_free (buttons);
g_free (chars);
}
/* 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 */
return result;
}
-static void
-folder_name_insensitive_press (GtkWidget *widget, ModestWindow *window)
-{
- hildon_banner_show_information (NULL, NULL, _CS("ckdg_ib_enter_name"));
-}
-
gint
modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
TnyFolderStore *parent_folder,
printf ("DEBUG: %s:\n", __FUNCTION__);
TnyDevice *device = modest_runtime_get_device();
if (!tny_device_is_online (device)) {
- gdk_threads_enter();
+
+ /* This is a GDK lock because we are an idle callback and
+ * tny_maemo_conic_device_connect can contain Gtk+ code */
+
+ gdk_threads_enter(); /* CHECKED */
tny_maemo_conic_device_connect (TNY_MAEMO_CONIC_DEVICE (device), NULL);
- gdk_threads_leave();
+ gdk_threads_leave(); /* CHECKED */
}
/* Allow the function that requested this idle callback to continue: */
{
GtkWidget *widget = modest_folder_view_new (query);
- /* Show all accounts by default */
+ /* Show one account by default */
modest_folder_view_set_style (MODEST_FOLDER_VIEW (widget),
MODEST_FOLDER_VIEW_STYLE_SHOW_ONE);
+
/* Restore settings */
modest_widget_memory_restore (modest_runtime_get_conf(),
G_OBJECT (widget),