aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog41
-rw-r--r--widgets/misc/e-calendar-item.c37
-rw-r--r--widgets/misc/e-canvas.c2
-rw-r--r--widgets/misc/e-cell-date-edit.c116
-rw-r--r--widgets/misc/e-cell-date-edit.h2
-rw-r--r--widgets/misc/e-dateedit.c8
-rw-r--r--widgets/misc/e-filter-bar.c4
7 files changed, 151 insertions, 59 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index d81e52d0a1..276f80062a 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,44 @@
+2009-04-24 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #572348
+
+ * e-dateedit.c:
+ * e-combo-button.c:
+ * e-dropdown-button.c:
+ * e-canvas.c:
+ * e-cell-date-edit.h:
+ * e-cell-date-edit.c:
+ Remove deprecated Gtk+ symbols.
+
+2009-04-13 Johnny Jacob <jjohnny@novell.com>
+
+ ** Fixes #578685 – evolution crashed with SIGSEGV.
+
+ ** Patch by Takao Fujiwara <Takao.Fujiwara@Sun.COM>
+
+ * e-attachment-bar.c (update): Copy string. Avoids SIGSEGV.
+
+2009-03-09 Chenthill Palanisamy <pchenthill@novell.com>
+
+ * widgets/misc/e-calendar-item.c: Removed the string
+ marked for translation as it not required and also breaks
+ the string freeze.
+
+2009-03-08 Chenthill Palanisamy <pchenthill@novell.com>
+
+ Fixes #342446
+ * widgets/misc/e-calendar-item.c: Check whether its
+ appropriate to use %Id format for digits. Incorporated
+ the fix from Wang Xin <jedy.wang@sun.com> to build in
+ solaris.
+
+2009-02-25 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #559027
+
+ * e-dateedit.c: (on_date_entry_focus_out):
+ Do not set date for 'None' value.
+
2009-02-12 Milan Crha <mcrha@redhat.com>
** Part of fix for bug #404232
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index da4c063175..32e74dd535 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1364,6 +1364,33 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
cairo_destroy (cr);
}
+static const char *
+get_digit_fomat ()
+{
+
+#ifdef HAVE_GNU_GET_LIBC_VERSION
+#include <gnu/libc-version.h>
+
+ const char *libc_version = gnu_get_libc_version ();
+ char **split = g_strsplit (libc_version, ".", -1);
+ int major = 0;
+ int minor = 0;
+ int revision = 0;
+
+ major = atoi (split [0]);
+ minor = atoi (split [1]);
+
+ if (g_strv_length (split) > 2)
+ revision = atoi (split [2]);
+ g_strfreev (split);
+
+ if (major > 2 || minor > 2 || (minor == 2 && revision > 2)) {
+ return "%Id";
+ }
+#endif
+
+ return "%d";
+}
static void
e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
@@ -1505,12 +1532,12 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (week_num >= 10) {
digit = week_num / 10;
text_x -= calitem->week_number_digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
}
digit = week_num % 10;
text_x -= calitem->week_number_digit_widths[digit] + 6;
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
cairo_save (cr);
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_ACTIVE]);
@@ -1618,12 +1645,12 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
if (day_num >= 10) {
digit = day_num / 10;
day_x -= calitem->digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
}
digit = day_num % 10;
day_x -= calitem->digit_widths[digit];
- num_chars += sprintf (&buffer[num_chars], "%Id", digit);
+ num_chars += sprintf (&buffer[num_chars], get_digit_fomat (), digit);
cairo_save (cr);
if (fg_color) {
@@ -1958,7 +1985,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
gchar locale_digit[5];
int locale_digit_len;
- locale_digit_len = sprintf (locale_digit, "%Id", digit);
+ locale_digit_len = sprintf (locale_digit, get_digit_fomat (), digit);
pango_layout_set_text (layout, locale_digit, locale_digit_len);
pango_layout_get_pixel_size (layout, &width, NULL);
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index a395197df7..3cb85c5839 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -994,7 +994,7 @@ void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, int x, int y)
G_CALLBACK (e_canvas_visibility), canvas);
}
}
- gtk_widget_set_uposition (widget, x, y);
+ gtk_window_move (GTK_WINDOW (widget), x, y);
gtk_widget_show (widget);
}
diff --git a/widgets/misc/e-cell-date-edit.c b/widgets/misc/e-cell-date-edit.c
index 68cbbb97d4..97947980d9 100644
--- a/widgets/misc/e-cell-date-edit.c
+++ b/widgets/misc/e-cell-date-edit.c
@@ -96,8 +96,7 @@ static void e_cell_date_edit_on_today_clicked (GtkWidget *button,
ECellDateEdit *ecde);
static void e_cell_date_edit_update_cell (ECellDateEdit *ecde,
char *text);
-static void e_cell_date_edit_on_time_selected (GtkList *list,
- ECellDateEdit *ecde);
+static void e_cell_date_edit_on_time_selected (GtkTreeSelection *selection, ECellDateEdit *ecde);
static void e_cell_date_edit_hide_popup (ECellDateEdit *ecde);
@@ -213,8 +212,9 @@ static void
e_cell_date_edit_init (ECellDateEdit *ecde)
{
GtkWidget *frame, *vbox, *hbox, *vbox2;
- GtkWidget *scrolled_window, *list, *bbox;
+ GtkWidget *scrolled_window, *bbox, *tree_view;
GtkWidget *now_button, *today_button, *none_button, *ok_button;
+ GtkListStore *store;
ecde->lower_hour = 0;
ecde->upper_hour = 24;
@@ -270,13 +270,24 @@ e_cell_date_edit_init (ECellDateEdit *ecde)
GTK_POLICY_ALWAYS);
gtk_widget_show (scrolled_window);
- list = gtk_list_new ();
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), list);
- gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
+ store = gtk_list_store_new (1, G_TYPE_STRING);
+ tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ g_object_unref (store);
+
+ gtk_tree_view_append_column (
+ GTK_TREE_VIEW (tree_view),
+ gtk_tree_view_column_new_with_attributes ("Text", gtk_cell_renderer_text_new (), "text", 0, NULL));
+
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
+
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), tree_view);
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (tree_view),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
- gtk_widget_show (list);
- ecde->time_list = list;
- g_signal_connect((list), "selection-changed",
+ gtk_container_set_focus_hadjustment (GTK_CONTAINER (tree_view),
+ gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
+ gtk_widget_show (tree_view);
+ ecde->time_tree_view = tree_view;
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)), "changed",
G_CALLBACK (e_cell_date_edit_on_time_selected),
ecde);
@@ -414,10 +425,10 @@ e_cell_date_edit_set_property (GObject *object,
case PROP_SHOW_TIME:
if (g_value_get_boolean (value)) {
gtk_widget_show (ecde->time_entry);
- gtk_widget_show (ecde->time_list);
+ gtk_widget_show (ecde->time_tree_view);
} else {
gtk_widget_hide (ecde->time_entry);
- gtk_widget_hide (ecde->time_list);
+ gtk_widget_hide (ecde->time_tree_view);
}
return;
case PROP_SHOW_NOW_BUTTON:
@@ -526,7 +537,7 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde)
if (status == E_TIME_PARSE_NONE || status == E_TIME_PARSE_INVALID) {
gtk_entry_set_text (GTK_ENTRY (ecde->time_entry), "");
e_calendar_item_set_selection (calitem, NULL, NULL);
- gtk_list_unselect_all (GTK_LIST (ecde->time_list));
+ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (ecde->time_tree_view)));
} else {
if (is_date) {
buffer[0] = '\0';
@@ -542,7 +553,7 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde)
e_calendar_item_set_selection (calitem, &date, &date);
if (is_date) {
- gtk_list_unselect_all (GTK_LIST (ecde->time_list));
+ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (ecde->time_tree_view)));
} else {
e_cell_date_edit_select_matching_time (ecde, buffer);
}
@@ -556,30 +567,39 @@ static void
e_cell_date_edit_select_matching_time (ECellDateEdit *ecde,
char *time)
{
- GtkList *list;
- GtkWidget *listitem, *label;
- GList *elem;
gboolean found = FALSE;
- const gchar *list_item_text;
+ gboolean valid;
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (ecde->time_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecde->time_tree_view));
- list = GTK_LIST (ecde->time_list);
- elem = list->children;
- while (elem) {
- listitem = GTK_WIDGET (elem->data);
- label = GTK_BIN (listitem)->child;
- list_item_text = gtk_label_get_text (GTK_LABEL (label));
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid && !found;
+ valid = gtk_tree_model_iter_next (model, &iter)) {
+ char *str = NULL;
+
+ gtk_tree_model_get (model, &iter, 0, &str, -1);
+
+ if (g_str_equal (str, time)) {
+ GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
+
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (ecde->time_tree_view), path, NULL, FALSE);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (ecde->time_tree_view), path, NULL, FALSE, 0.0, 0.0);
+ gtk_tree_path_free (path);
- if (!strcmp (list_item_text, time)) {
found = TRUE;
- gtk_list_select_child (list, listitem);
- break;
}
- elem = elem->next;
+ g_free (str);
}
- if (!found)
- gtk_list_unselect_all (list);
+ if (!found) {
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (ecde->time_tree_view), 0, 0);
+ }
}
@@ -597,7 +617,7 @@ e_cell_date_edit_show_popup (ECellDateEdit *ecde,
e_cell_date_edit_get_popup_pos (ecde, row, view_col, &x, &y, &height, &width);
- gtk_widget_set_uposition (ecde->popup_window, x, y);
+ gtk_window_move (GTK_WINDOW (ecde->popup_window), x, y);
gtk_widget_set_size_request (ecde->popup_window, width, height);
gtk_widget_realize (ecde->popup_window);
gdk_window_resize (ecde->popup_window->window, width, height);
@@ -732,15 +752,13 @@ e_cell_date_edit_button_press (GtkWidget *popup_window,
static void
e_cell_date_edit_rebuild_time_list (ECellDateEdit *ecde)
{
- GtkList *list;
- GtkWidget *listitem;
+ GtkListStore *store;
char buffer[40];
struct tm tmp_tm;
gint hour, min;
- list = GTK_LIST (ecde->time_list);
-
- gtk_list_clear_items (list, 0, -1);
+ store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (ecde->time_tree_view)));
+ gtk_list_store_clear (store);
/* Fill the struct tm with some sane values. */
tmp_tm.tm_year = 2000;
@@ -750,7 +768,6 @@ e_cell_date_edit_rebuild_time_list (ECellDateEdit *ecde)
tmp_tm.tm_isdst = 0;
for (hour = ecde->lower_hour; hour <= ecde->upper_hour; hour++) {
-
/* We don't want to display midnight at the end, since that is
really in the next day. */
if (hour == 24)
@@ -760,13 +777,15 @@ e_cell_date_edit_rebuild_time_list (ECellDateEdit *ecde)
for (min = 0;
min == 0 || (min < 60 && hour != ecde->upper_hour);
min += 30) {
+ GtkTreeIter iter;
+
tmp_tm.tm_hour = hour;
tmp_tm.tm_min = min;
e_time_format_time (&tmp_tm, ecde->use_24_hour_format,
FALSE, buffer, sizeof (buffer));
- listitem = gtk_list_item_new_with_label (buffer);
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (list), listitem);
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, buffer, -1);
}
}
@@ -940,19 +959,22 @@ e_cell_date_edit_update_cell (ECellDateEdit *ecde,
static void
-e_cell_date_edit_on_time_selected (GtkList *list,
- ECellDateEdit *ecde)
+e_cell_date_edit_on_time_selected (GtkTreeSelection *selection, ECellDateEdit *ecde)
{
- GtkWidget *listitem, *label;
- const gchar *list_item_text;
+ gchar *list_item_text = NULL;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
- if (!list->selection)
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return;
- listitem = list->selection->data;
- label = GTK_BIN (listitem)->child;
- list_item_text = gtk_label_get_text (GTK_LABEL (label));
+ gtk_tree_model_get (model, &iter, 0, &list_item_text, -1);
+
+ g_return_if_fail (list_item_text != NULL);
+
gtk_entry_set_text (GTK_ENTRY (ecde->time_entry), list_item_text);
+
+ g_free (list_item_text);
}
diff --git a/widgets/misc/e-cell-date-edit.h b/widgets/misc/e-cell-date-edit.h
index 938d356e8d..30dee535e8 100644
--- a/widgets/misc/e-cell-date-edit.h
+++ b/widgets/misc/e-cell-date-edit.h
@@ -53,7 +53,7 @@ struct _ECellDateEdit {
GtkWidget *popup_window;
GtkWidget *calendar;
GtkWidget *time_entry;
- GtkWidget *time_list;
+ GtkWidget *time_tree_view;
GtkWidget *now_button;
GtkWidget *today_button;
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 272223025e..2120483abf 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -1253,7 +1253,7 @@ position_date_popup (EDateEdit *dedit)
x = CLAMP (x, 0, MAX (0, screen_width - cal_req.width));
y = CLAMP (y, 0, MAX (0, screen_height - cal_req.height));
- gtk_widget_set_uposition (dedit->priv->cal_popup, x, y);
+ gtk_window_move (GTK_WINDOW (dedit->priv->cal_popup), x, y);
}
@@ -1638,9 +1638,11 @@ on_date_entry_focus_out (GtkEntry *entry,
e_date_edit_set_date (dedit,tmp_tm.tm_year,tmp_tm.tm_mon,tmp_tm.tm_mday);
gtk_widget_grab_focus (GTK_WIDGET (entry));
return FALSE;
- } else {
- e_date_edit_get_date (dedit,&tmp_tm.tm_year,&tmp_tm.tm_mon,&tmp_tm.tm_mday);
+ } else if (e_date_edit_get_date (dedit,&tmp_tm.tm_year,&tmp_tm.tm_mon,&tmp_tm.tm_mday)) {
e_date_edit_set_date (dedit,tmp_tm.tm_year,tmp_tm.tm_mon,tmp_tm.tm_mday);
+ } else {
+ dedit->priv->date_set_to_none = TRUE;
+ e_date_edit_update_date_entry (dedit);
}
return FALSE;
}
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index dc69b6c269..2125bdf30d 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -82,6 +82,8 @@ rule_advanced_response (GtkWidget *dialog, int response, void *data)
g_signal_emit_by_name (efb, "search_activated");
+ g_signal_emit_by_name (efb, "search_activated");
+
if (response == GTK_RESPONSE_APPLY) {
if (!rule_context_find_rule (filter_bar->context, rule->name, rule->source))
rule_context_add_rule (filter_bar->context, rule);
@@ -269,8 +271,6 @@ build_items (ESearchBar *search_bar, ESearchBarItem *items, int type, int *start
GSList *gtksux = NULL;
int num;
- /* So gtk calls a signal again if you connect to it WHILE inside a changed event.
- So this snot is to work around that shit fucked up situation */
for (i=0;i<rules->len;i++)
gtksux = g_slist_prepend(gtksux, rules->pdata[i]);