aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Ewing <lewing@ximian.com>2004-05-05 13:10:11 +0800
committerLarry Ewing <lewing@src.gnome.org>2004-05-05 13:10:11 +0800
commitfbfae5946347f753226ac100e60d0ffe9aecc3ba (patch)
treeb2f54b9b4d3c46d04303b3109f261abade22f4fd
parentd0967f5098f247ff60eda44097568eff590af66e (diff)
downloadgsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.tar
gsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.tar.gz
gsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.tar.bz2
gsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.tar.lz
gsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.tar.xz
gsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.tar.zst
gsoc2013-evolution-fbfae5946347f753226ac100e60d0ffe9aecc3ba.zip
make sure that we don't crash if there are no sources.
2004-05-05 Larry Ewing <lewing@ximian.com> * gui/dialogs/calendar-setup.c: make sure that we don't crash if there are no sources. svn path=/trunk/; revision=25798
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/dialogs/calendar-setup.c25
2 files changed, 25 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 6e4ed7f378..1e4da7b719 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-05 Larry Ewing <lewing@ximian.com>
+
+ * gui/dialogs/calendar-setup.c: make sure that we don't crash if
+ there are no sources.
+
2004-05-04 Larry Ewing <lewing@ximian.com>
* gui/dialogs/calendar-setup.c: fix logic error.
diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c
index f2a8db178d..4aed80ff77 100644
--- a/calendar/gui/dialogs/calendar-setup.c
+++ b/calendar/gui/dialogs/calendar-setup.c
@@ -120,6 +120,9 @@ source_group_is_remote (ESourceGroup *group)
{
EUri *uri;
gboolean is_remote = FALSE;
+
+ if (!group)
+ return FALSE;
uri = e_uri_new (e_source_group_peek_base_uri (group));
if (!uri)
@@ -202,6 +205,9 @@ source_group_can_add (ESourceGroup *source_group)
gboolean can_add;
EUri *uri;
+ if (!source_group)
+ return FALSE;
+
can_add = !e_source_group_is_readonly (source_group);
if (can_add) {
@@ -223,6 +229,9 @@ source_group_menu_add_groups (GtkMenuShell *menu_shell, ESourceList *source_list
GSList *groups, *sl;
int index=-1, i=0;
+ if (source_list == NULL)
+ return index;
+
groups = e_source_list_peek_groups (source_list);
for (sl = groups; sl; sl = g_slist_next (sl)) {
GtkWidget *menu_item;
@@ -351,11 +360,13 @@ general_entry_modified (SourceDialog *source_dialog)
{
const char *text = gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry));
gboolean sensitive = text && *text != '\0';
+
+ sensitive &= (source_dialog->source_group != NULL);
if (source_group_is_remote (source_dialog->source_group)) {
sensitive &= remote_page_verify (source_dialog);
}
-
+
gtk_widget_set_sensitive (source_dialog->add_button, sensitive);
}
@@ -684,8 +695,10 @@ calendar_setup_new_calendar (GtkWindow *parent)
* on startup of the calendar component. */
index = source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu (
GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog->source_list);
- gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index);
- source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data;
+ if (index > -1) {
+ gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index);
+ source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data;
+ }
g_signal_connect_swapped (source_dialog->group_optionmenu, "changed",
G_CALLBACK (source_group_changed_sensitive), source_dialog);
@@ -847,8 +860,10 @@ calendar_setup_new_task_list (GtkWindow *parent)
* on startup of the calendar component. */
index = source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu (
GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog->source_list);
- gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index);
- source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data;
+ if (index > -1) {
+ gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index);
+ source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data;
+ }
g_signal_connect_swapped (source_dialog->group_optionmenu, "changed",
G_CALLBACK (source_group_changed_sensitive), source_dialog);