aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-datespec.c
diff options
context:
space:
mode:
Diffstat (limited to 'filter/filter-datespec.c')
-rw-r--r--filter/filter-datespec.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index 4989fc59b8..fcfc877dc0 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -69,33 +69,27 @@ typedef struct _timespan {
gfloat max;
} timespan;
-#if 0
-ngettext("1 second ago", "%d seconds ago")
-ngettext("1 second in the future", "%d seconds in the future")
-ngettext("1 minute ago", "%d minutes ago")
-ngettext("1 minute in the future", "%d minutes in the future")
-ngettext("1 hour ago", "%d hours ago")
-ngettext("1 hour in the future", "%d hours in the future")
-ngettext("1 day ago", "%d days ago")
-ngettext("1 day in the future", "%d days in the future")
-ngettext("1 week ago", "%d weeks ago")
-ngettext("1 week in the future", "%d weeks in the future")
-ngettext("1 month ago", "%d months ago")
-ngettext("1 month in the future", "%d months in the future")
-ngettext("1 year ago", "%d years ago")
-ngettext("1 year in the future", "%d years in the future")
+#ifdef ngettext
+#undef ngettext
#endif
+/* This is a nasty hack trying to keep both ngettext function and xgettext tool happy */
+/* It *will* cause problems if ngettext is a macro */
+#define ngettext(a, b) a, b
+
static const timespan timespans[] = {
- { 1, "1 second ago", "%d seconds ago", "1 second in the future", "%d seconds in the future", 59.0 },
- { 60, "1 minute ago", "%d minutes ago", "1 minute in the future", "%d minutes in the future", 59.0 },
- { 3600, "1 hour ago", "%d hours ago", "1 hour in the future", "%d hours in the future", 23.0 },
- { 86400, "1 day ago", "%d days ago", "1 day in the future", "%d days in the future", 31.0 },
- { 604800, "1 week ago", "%d weeks ago", "1 week in the future", "%d weeks in the future", 52.0 },
- { 2419200, "1 month ago", "%d months ago", "1 month in the future", "%d months in the future", 12.0 },
- { 31557600, "1 year ago", "%d years ago", "1 year in the future", "%d years in the future", 1000.0 },
+ { 1, ngettext("1 second ago", "%d seconds ago"), ngettext("1 second in the future", "%d seconds in the future"), 59.0 },
+ { 60, ngettext("1 minute ago", "%d minutes ago"), ngettext("1 minute in the future", "%d minutes in the future"), 59.0 },
+ { 3600, ngettext("1 hour ago", "%d hours ago"), ngettext("1 hour in the future", "%d hours in the future"), 23.0 },
+ { 86400, ngettext("1 day ago", "%d days ago"), ngettext("1 day in the future", "%d days in the future"), 31.0 },
+ { 604800, ngettext("1 week ago", "%d weeks ago"), ngettext("1 week in the future", "%d weeks in the future"), 52.0 },
+ { 2419200, ngettext("1 month ago", "%d months ago"), ngettext("1 month in the future", "%d months in the future"), 12.0 },
+ { 31557600, ngettext("1 year ago", "%d years ago"), ngettext("1 year in the future", "%d years in the future"), 1000.0 },
};
+/* now we let the compiler see the real function call */
+#undef ngettext
+
#define DAY_INDEX 3
#define N_TIMESPANS (sizeof (timespans) / sizeof (timespans[0]))
@@ -432,6 +426,7 @@ static void
button_clicked (GtkButton *button, FilterDatespec *fds)
{
struct _FilterDatespecPrivate *p = PRIV(fds);
+ GtkWidget *content_area;
GtkWidget *toplevel;
GtkDialog *dialog;
GladeXML *gui;
@@ -464,7 +459,8 @@ button_clicked (GtkButton *button, FilterDatespec *fds)
g_signal_connect (p->combobox_relative, "changed", G_CALLBACK (set_combobox_relative), fds);
g_signal_connect (p->combobox_past_future, "changed", G_CALLBACK (set_combobox_past_future), fds);
- gtk_box_pack_start ((GtkBox *) dialog->vbox, toplevel, TRUE, TRUE, 3);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_box_pack_start (GTK_BOX (content_area), toplevel, TRUE, TRUE, 3);
if (gtk_dialog_run (dialog) == GTK_RESPONSE_OK) {
get_values (fds);