[evolution-patches] patch for e-categories-dialog widget (#38804)
- From: Rodrigo Moya <rodrigo novell com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] patch for e-categories-dialog widget (#38804)
- Date: Wed, 23 Feb 2005 18:02:56 +0100
--
Rodrigo Moya <rodrigo novell com>
? e-cal-editor-page.c
? e-cal-editor-page.h
? e-cal-editor.c
? e-cal-editor.h
? e-cal-editor.loT
? e-categories-dialog.gladep
? test-contact-store
? test-name-selector
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/ChangeLog,v
retrieving revision 1.29
diff -u -p -r1.29 ChangeLog
--- ChangeLog 23 Feb 2005 09:23:00 -0000 1.29
+++ ChangeLog 23 Feb 2005 17:04:05 -0000
@@ -1,3 +1,13 @@
+2005-02-23 Rodrigo Moya <rodrigo novell com>
+
+ Fixes #38408
+
+ * e-categories-dialog.c (check_category_name): new function to check
+ categories entered by the user for invalid characters.
+ (new_button_clicked_cb): added missing argument to gtk_list_store_set
+ call and category name checking. Also, run the dialog continously while
+ there are validation errors.
+
2005-02-21 Harry Lu <harry lu sun com>
Fix for 9605.
Index: e-categories-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-categories-dialog.c,v
retrieving revision 1.11
diff -u -p -r1.11 e-categories-dialog.c
--- e-categories-dialog.c 3 Feb 2005 16:35:02 -0000 1.11
+++ e-categories-dialog.c 23 Feb 2005 17:04:05 -0000
@@ -211,6 +211,30 @@ entry_changed_cb (GtkEditable *editable,
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
}
+static gboolean
+check_category_name (const char *name)
+{
+ GtkWidget *error_dialog;
+ char *p = name;
+
+ while (*p) {
+ switch (*p) {
+ case ',' :
+ error_dialog = gtk_message_dialog_new (
+ NULL,
+ 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ _("Category name contains invalid characters. Please use another name"));
+
+ gtk_dialog_run (GTK_DIALOG (error_dialog));
+ gtk_widget_destroy (error_dialog);
+ return FALSE;
+ }
+ p++;
+ }
+
+ return TRUE;
+}
+
static void
new_button_clicked_cb (GtkButton *button, gpointer user_data)
{
@@ -223,37 +247,45 @@ new_button_clicked_cb (GtkButton *button
if (!prop_dialog)
return;
- if (gtk_dialog_run (GTK_DIALOG (prop_dialog->the_dialog)) == GTK_RESPONSE_OK) {
- const char *category_name, *category_icon;
- GtkTreeIter iter;
-
- category_name = gtk_entry_get_text (GTK_ENTRY (prop_dialog->category_name));
- if (e_categories_exist (category_name)) {
- GtkWidget *error_dialog;
-
- error_dialog = gtk_message_dialog_new (
- GTK_WINDOW (prop_dialog->the_dialog),
- 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("There is already a category '%s' in the configuration. Please use another name"),
- category_name);
-
- gtk_dialog_run (GTK_DIALOG (error_dialog));
- gtk_widget_destroy (error_dialog);
- } else {
- /* FIXME: get color */
- category_icon = gtk_entry_get_text (
- GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prop_dialog->category_icon))));
-
- e_categories_add (category_name, NULL, category_icon ? category_icon : NULL, TRUE);
-
- gtk_list_store_append (
- GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (prop_dialog->parent->priv->categories_list))),
- &iter);
- gtk_list_store_set (
- GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (prop_dialog->parent->priv->categories_list))),
- 0, FALSE, 1, category_name, -1);
- }
- }
+ do {
+ if (gtk_dialog_run (GTK_DIALOG (prop_dialog->the_dialog)) == GTK_RESPONSE_OK) {
+ const char *category_name, *category_icon;
+ GtkTreeIter iter;
+
+ category_name = gtk_entry_get_text (GTK_ENTRY (prop_dialog->category_name));
+ if (e_categories_exist (category_name)) {
+ GtkWidget *error_dialog;
+
+ error_dialog = gtk_message_dialog_new (
+ GTK_WINDOW (prop_dialog->the_dialog),
+ 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ _("There is already a category '%s' in the configuration. Please use another name"),
+ category_name);
+
+ gtk_dialog_run (GTK_DIALOG (error_dialog));
+ gtk_widget_destroy (error_dialog);
+ } else {
+ if (check_category_name (category_name)) {
+ /* FIXME: get color */
+ category_icon = gtk_entry_get_text (
+ GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prop_dialog->category_icon))));
+
+ e_categories_add (category_name, NULL, category_icon ? category_icon : NULL, TRUE);
+
+ gtk_list_store_append (
+ GTK_LIST_STORE (gtk_tree_view_get_model (
+ GTK_TREE_VIEW (prop_dialog->parent->priv->categories_list))),
+ &iter);
+ gtk_list_store_set (
+ GTK_LIST_STORE (gtk_tree_view_get_model (
+ GTK_TREE_VIEW (prop_dialog->parent->priv->categories_list))),
+ &iter, 0, FALSE, 1, category_name, -1);
+ break;
+ }
+ }
+ } else
+ break;
+ } while (TRUE);
free_properties_dialog (prop_dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]