diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/Makefile.am | 1 | ||||
-rw-r--r-- | filter/filter-datespec.c | 42 | ||||
-rw-r--r-- | filter/filter-rule.c | 8 | ||||
-rw-r--r-- | filter/rule-context.c | 4 | ||||
-rw-r--r-- | filter/rule-editor.c | 17 |
5 files changed, 41 insertions, 31 deletions
diff --git a/filter/Makefile.am b/filter/Makefile.am index ea996c839f..0a94811d46 100644 --- a/filter/Makefile.am +++ b/filter/Makefile.am @@ -4,7 +4,6 @@ glade_DATA = filter.glade AM_CPPFLAGS = \ -I $(top_srcdir) \ -I $(top_srcdir)/e-util \ - -I $(top_srcdir)/widgets/misc \ -DEVOLUTION_GLADEDIR=\"$(gladedir)\" \ -DG_LOG_DOMAIN=\"filter\" \ $(LIBFILTER_CFLAGS) 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); diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 354d276fe8..7d28881fb4 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -807,8 +807,12 @@ more_parts (GtkWidget *button, struct _rule_data *data) GtkAdjustment *adjustment; adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (w)); - if (adjustment) - gtk_adjustment_set_value (adjustment, adjustment->upper); + if (adjustment) { + gdouble upper; + + upper = gtk_adjustment_get_upper (adjustment); + gtk_adjustment_set_value (adjustment, upper); + } } } diff --git a/filter/rule-context.c b/filter/rule-context.c index 84cf2e4e92..b6e7df47de 100644 --- a/filter/rule-context.c +++ b/filter/rule-context.c @@ -711,6 +711,7 @@ rule_context_add_rule_gui(RuleContext *rc, FilterRule *rule, const gchar *title, { GtkDialog *dialog; GtkWidget *widget; + GtkWidget *content_area; d(printf("add rule gui '%s'\n", rule->name)); @@ -731,7 +732,8 @@ rule_context_add_rule_gui(RuleContext *rc, FilterRule *rule, const gchar *title, gtk_window_set_default_size((GtkWindow *) dialog, 600, 400); gtk_window_set_resizable((GtkWindow *) dialog, TRUE); - gtk_box_pack_start((GtkBox *) dialog->vbox, widget, TRUE, TRUE, 0); + content_area = gtk_dialog_get_content_area (dialog); + gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0); g_object_set_data_full((GObject *) dialog, "rule", rule, g_object_unref); if (path) diff --git a/filter/rule-editor.c b/filter/rule-editor.c index 59006f7597..7a9335990f 100644 --- a/filter/rule-editor.c +++ b/filter/rule-editor.c @@ -363,6 +363,7 @@ static void rule_add (GtkWidget *widget, RuleEditor *re) { GtkWidget *rules; + GtkWidget *content_area; if (re->edit != NULL) return; @@ -384,7 +385,8 @@ rule_add (GtkWidget *widget, RuleEditor *re) gtk_window_set_transient_for ((GtkWindow *) re->dialog, (GtkWindow *) re); gtk_container_set_border_width ((GtkContainer *) re->dialog, 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 3); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (re->dialog)); + gtk_box_pack_start (GTK_BOX (content_area), rules, TRUE, TRUE, 3); g_signal_connect (re->dialog, "response", G_CALLBACK (add_editor_response), re); g_object_weak_ref ((GObject *) re->dialog, (GWeakNotify) editor_destroy, re); @@ -442,6 +444,7 @@ static void rule_edit (GtkWidget *widget, RuleEditor *re) { GtkWidget *rules; + GtkWidget *content_area; update_selected_rule(re); @@ -465,7 +468,8 @@ rule_edit (GtkWidget *widget, RuleEditor *re) gtk_widget_set_parent_window (GTK_WIDGET (re->dialog), GTK_WIDGET (re)->window); gtk_container_set_border_width ((GtkContainer *) re->dialog, 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 3); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (re->dialog)); + gtk_box_pack_start (GTK_BOX (content_area), rules, TRUE, TRUE, 3); g_signal_connect (re->dialog, "response", G_CALLBACK (edit_editor_response), re); g_object_weak_ref ((GObject *) re->dialog, (GWeakNotify) editor_destroy, re); @@ -828,19 +832,24 @@ void rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, const gchar *source, const gchar *label) { GtkWidget *w; + GtkWidget *action_area; + GtkWidget *content_area; gint i; gchar *tmp; re->context = context; g_object_ref (context); + action_area = gtk_dialog_get_action_area (GTK_DIALOG (re)); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (re)); + gtk_window_set_resizable ((GtkWindow *) re, TRUE); gtk_window_set_default_size ((GtkWindow *) re, 350, 400); gtk_widget_realize ((GtkWidget *) re); - gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) re)->action_area, 12); + gtk_container_set_border_width (GTK_CONTAINER (action_area), 12); w = glade_xml_get_widget(gui, "rule_editor"); - gtk_box_pack_start((GtkBox *)((GtkDialog *)re)->vbox, w, TRUE, TRUE, 3); + gtk_box_pack_start (GTK_BOX (content_area), w, TRUE, TRUE, 3); for (i = 0; i < BUTTON_LAST; i++) { re->priv->buttons[i] = (GtkButton *) (w = glade_xml_get_widget (gui, edit_buttons[i].name)); |