aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-10-25 05:55:54 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-10-27 21:25:01 +0800
commit58166e645971a4812fef23702f45cacc8e64e419 (patch)
treebedad70e39e2215a53105e0303c168e86140371a /calendar/gui
parentc58b70659747967568a536e217b9440424709f92 (diff)
downloadgsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.gz
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.bz2
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.lz
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.xz
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.zst
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.zip
Prefer G_N_ELEMENTS over sizeof calculations.
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/recurrence-page.c6
-rw-r--r--calendar/gui/e-day-view-time-item.c3
-rw-r--r--calendar/gui/e-day-view.c13
3 files changed, 10 insertions, 12 deletions
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index a94fe9e37f..8b341f5bc8 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -1050,7 +1050,7 @@ make_recur_month_num_combo (gint month_index)
store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_INT);
/* Relation */
- for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) {
+ for (i = 0; i < G_N_ELEMENTS (options); i++) {
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, 0, _(options [i]), 1, month_num_options_map [i], -1);
}
@@ -1120,7 +1120,7 @@ make_recur_month_combobox (void)
combo = gtk_combo_box_new_text ();
- for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) {
+ for (i = 0; i < G_N_ELEMENTS (options); i++) {
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(options[i]));
}
@@ -1635,7 +1635,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
/* Any funky shit? */
-#define N_HAS_BY(field) (count_by_xxx (field, sizeof (field) / sizeof (field[0])))
+#define N_HAS_BY(field) (count_by_xxx (field, G_N_ELEMENTS (field)))
n_by_second = N_HAS_BY (r->by_second);
n_by_minute = N_HAS_BY (r->by_minute);
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 5068ed47e0..ff0f6406a4 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -733,7 +733,6 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
{
static gint divisions[] = { 60, 30, 15, 10, 5 };
EDayView *day_view;
- gint num_divisions = sizeof (divisions) / sizeof (divisions[0]);
GtkWidget *menu, *item, *submenu;
gchar buffer[256];
GSList *group = NULL, *recent_zones, *s;
@@ -752,7 +751,7 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *time_item,
menu, "selection-done",
G_CALLBACK (gtk_widget_destroy), NULL);
- for (i = 0; i < num_divisions; i++) {
+ for (i = 0; i < G_N_ELEMENTS (divisions); i++) {
g_snprintf (buffer, sizeof (buffer),
/* TO TRANSLATORS: %02i is the number of minutes; this is a context menu entry
* to change the length of the time division in the calendar day view, e.g.
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index af6fdc66e7..46a37ddc46 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -112,7 +112,6 @@ static GtkTargetEntry target_table[] = {
{ (gchar *) "text/x-calendar", 0, TARGET_VCALENDAR },
{ (gchar *) "text/calendar", 0, TARGET_VCALENDAR }
};
-static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
static void e_day_view_destroy (GtkObject *object);
static void e_day_view_realize (GtkWidget *widget);
@@ -1336,11 +1335,11 @@ e_day_view_init (EDayView *day_view)
/* Set up the drop sites. */
gtk_drag_dest_set (day_view->top_canvas,
GTK_DEST_DEFAULT_ALL,
- target_table, n_targets,
+ target_table, G_N_ELEMENTS (target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
gtk_drag_dest_set (day_view->main_canvas,
GTK_DEST_DEFAULT_ALL,
- target_table, n_targets,
+ target_table, G_N_ELEMENTS (target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK);
/* connect to ECalendarView's signals */
@@ -3927,8 +3926,8 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
day_view->resize_bars_event_num = -1;
}
- target_list = gtk_target_list_new (target_table,
- n_targets);
+ target_list = gtk_target_list_new (
+ target_table, G_N_ELEMENTS (target_table));
gtk_drag_begin (widget, target_list,
GDK_ACTION_COPY | GDK_ACTION_MOVE,
1, (GdkEvent*)mevent);
@@ -4030,8 +4029,8 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
day_view->resize_bars_event_num = -1;
}
- target_list = gtk_target_list_new (target_table,
- n_targets);
+ target_list = gtk_target_list_new (
+ target_table, G_N_ELEMENTS (target_table));
gtk_drag_begin (widget, target_list,
GDK_ACTION_COPY | GDK_ACTION_MOVE,
1, (GdkEvent*)mevent);