aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-04-24 17:45:21 +0800
committerMilan Crha <mcrha@redhat.com>2009-04-24 17:45:21 +0800
commit8a072ffc7c0ddcde472877a51ace0bb14f86fb0a (patch)
tree5c49c7807f24cd118e32e11ad52482b0ce65d0e6 /widgets
parentf6792a6f1e60b04ee1c137c9232802df437580f6 (diff)
downloadgsoc2013-evolution-8a072ffc7c0ddcde472877a51ace0bb14f86fb0a.tar.gz
gsoc2013-evolution-8a072ffc7c0ddcde472877a51ace0bb14f86fb0a.tar.zst
gsoc2013-evolution-8a072ffc7c0ddcde472877a51ace0bb14f86fb0a.zip
GN-bug #572348 - Removed deprecated Gtk+ symbols
Some still left, because those gone in kill-bonobo branch.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog12
-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-combo-button.c4
-rw-r--r--widgets/misc/e-dateedit.c2
-rw-r--r--widgets/misc/e-dropdown-button.c8
-rw-r--r--widgets/table/ChangeLog9
-rw-r--r--widgets/table/e-cell-combo.c173
-rw-r--r--widgets/table/e-cell-combo.h2
-rw-r--r--widgets/table/e-table-header-item.c4
11 files changed, 182 insertions, 152 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 92d26c8333..276f80062a 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,15 @@
+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.
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-combo-button.c b/widgets/misc/e-combo-button.c
index 788008a10f..aabb7073f1 100644
--- a/widgets/misc/e-combo-button.c
+++ b/widgets/misc/e-combo-button.c
@@ -573,7 +573,9 @@ e_combo_button_set_label (EComboButton *combo_button,
if (label == NULL)
label = "";
- gtk_label_parse_uline (GTK_LABEL (priv->label), label);
+ gtk_label_set_label (GTK_LABEL (priv->label), label);
+ gtk_label_set_use_markup (GTK_LABEL (priv->label), FALSE);
+ gtk_label_set_use_underline (GTK_LABEL (priv->label), TRUE);
}
void
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 5169781870..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);
}
diff --git a/widgets/misc/e-dropdown-button.c b/widgets/misc/e-dropdown-button.c
index aa5f84f6c8..6008f64ad9 100644
--- a/widgets/misc/e-dropdown-button.c
+++ b/widgets/misc/e-dropdown-button.c
@@ -173,7 +173,7 @@ e_dropdown_button_construct (EDropdownButton *dropdown_button,
GtkWidget *hbox;
GtkWidget *arrow;
GtkWidget *label;
- unsigned int accel_key;
+ guint accel_key;
g_return_if_fail (dropdown_button != NULL);
g_return_if_fail (E_IS_DROPDOWN_BUTTON (dropdown_button));
@@ -188,7 +188,11 @@ e_dropdown_button_construct (EDropdownButton *dropdown_button,
gtk_widget_show (hbox);
label = gtk_label_new ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (label), label_text);
+ gtk_label_set_label (GTK_LABEL (label), label_text);
+ gtk_label_set_use_markup (GTK_LABEL (label), FALSE);
+ gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
+
+ accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
gtk_widget_add_accelerator (GTK_WIDGET (dropdown_button), "clicked",
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog
index df2e783606..7d556367a8 100644
--- a/widgets/table/ChangeLog
+++ b/widgets/table/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-24 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #572348
+
+ * e-table-header-item.c:
+ * e-cell-combo.h:
+ * e-cell-combo.c:
+ Remove deprecated Gtk+ symbols.
+
2009-03-26 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #576694
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index 34de0fb29e..84d58200d2 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -74,10 +74,6 @@
/* The height to make the popup list if there aren't any items in it. */
#define E_CELL_COMBO_LIST_EMPTY_HEIGHT 15
-/* The object data key used to store the UTF-8 text of the popup list items. */
-#define E_CELL_COMBO_UTF8_KEY "UTF-8-TEXT"
-
-
static void e_cell_combo_class_init (ECellComboClass *klass);
static void e_cell_combo_init (ECellCombo *ecc);
static void e_cell_combo_dispose (GObject *object);
@@ -98,9 +94,7 @@ static void e_cell_combo_get_popup_pos (ECellCombo *ecc,
gint *height,
gint *width);
-static void e_cell_combo_selection_changed (GtkWidget *popup_list, ECellCombo *ecc);
-
-static gint e_cell_combo_list_button_press (GtkWidget *popup_list, GdkEvent *event, ECellCombo *ecc);
+static void e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc);
static gint e_cell_combo_button_press (GtkWidget *popup_window,
GdkEvent *event,
@@ -134,6 +128,8 @@ e_cell_combo_init (ECellCombo *ecc)
{
GtkWidget *frame;
AtkObject *a11y;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
/* We create one popup window for the ECell, since there will only
ever be one popup in use at a time. */
@@ -156,27 +152,32 @@ e_cell_combo_init (ECellCombo *ecc)
gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window);
gtk_widget_show (ecc->popup_scrolled_window);
- ecc->popup_list = gtk_list_new ();
- gtk_list_set_selection_mode (GTK_LIST (ecc->popup_list),
- GTK_SELECTION_BROWSE);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), ecc->popup_list);
- gtk_container_set_focus_vadjustment (GTK_CONTAINER (ecc->popup_list),
+ store = gtk_list_store_new (1, G_TYPE_STRING);
+ ecc->popup_tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ g_object_unref (store);
+
+ gtk_tree_view_append_column (
+ GTK_TREE_VIEW (ecc->popup_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 (ecc->popup_tree_view), FALSE);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), ecc->popup_tree_view);
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (ecc->popup_tree_view),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
- gtk_container_set_focus_hadjustment (GTK_CONTAINER (ecc->popup_list),
+ gtk_container_set_focus_hadjustment (GTK_CONTAINER (ecc->popup_tree_view),
gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
- gtk_widget_show (ecc->popup_list);
+ gtk_widget_show (ecc->popup_tree_view);
- a11y = gtk_widget_get_accessible (ecc->popup_list);
+ a11y = gtk_widget_get_accessible (ecc->popup_tree_view);
atk_object_set_name (a11y, _("popup list"));
- g_signal_connect (ecc->popup_list,
- "selection_changed",
+ g_signal_connect (selection,
+ "changed",
G_CALLBACK (e_cell_combo_selection_changed),
ecc);
- g_signal_connect (ecc->popup_list,
- "button_press_event",
- G_CALLBACK (e_cell_combo_list_button_press),
- ecc);
g_signal_connect (ecc->popup_window,
"button_press_event",
G_CALLBACK (e_cell_combo_button_press),
@@ -231,26 +232,20 @@ e_cell_combo_set_popdown_strings (ECellCombo *ecc,
GList *strings)
{
GList *elem;
- GtkWidget *listitem;
+ GtkListStore *store;
g_return_if_fail (E_IS_CELL_COMBO (ecc));
g_return_if_fail (strings != NULL);
- gtk_list_clear_items (GTK_LIST (ecc->popup_list), 0, -1);
- elem = strings;
- while (elem) {
- char *utf8_text = elem->data;
-
- listitem = gtk_list_item_new_with_label (utf8_text);
+ store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view)));
+ gtk_list_store_clear (store);
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (ecc->popup_list), listitem);
-
- g_object_set_data_full (G_OBJECT (listitem),
- E_CELL_COMBO_UTF8_KEY,
- g_strdup (utf8_text), g_free);
+ for (elem = strings; elem; elem = elem->next) {
+ GtkTreeIter iter;
+ char *utf8_text = elem->data;
- elem = elem->next;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, utf8_text, -1);
}
}
@@ -264,20 +259,22 @@ e_cell_combo_do_popup (ECellPopup *ecp,
ECellCombo *ecc = E_CELL_COMBO (ecp);
guint32 time;
gint error_code;
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view));
- g_signal_handlers_block_by_func(ecc->popup_list, e_cell_combo_selection_changed, ecc);
+ g_signal_handlers_block_by_func (selection, e_cell_combo_selection_changed, ecc);
e_cell_combo_show_popup (ecc, row, view_col);
e_cell_combo_select_matching_item (ecc);
- g_signal_handlers_unblock_by_func(ecc->popup_list, e_cell_combo_selection_changed, ecc);
+ g_signal_handlers_unblock_by_func (selection, e_cell_combo_selection_changed, ecc);
if (event->type == GDK_BUTTON_PRESS) {
- GTK_LIST (ecc->popup_list)->drag_selection = TRUE;
time = event->button.time;
} else {
time = event->key.time;
}
- error_code = gdk_pointer_grab (ecc->popup_list->window, TRUE,
+ error_code = gdk_pointer_grab (gtk_widget_get_window (ecc->popup_tree_view), TRUE,
GDK_ENTER_NOTIFY_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
@@ -287,7 +284,7 @@ e_cell_combo_do_popup (ECellPopup *ecp,
if (error_code != 0)
g_warning ("Failed to get pointer grab (%i)", error_code);
gtk_grab_add (ecc->popup_window);
- gdk_keyboard_grab (ecc->popup_list->window, TRUE, time);
+ gdk_keyboard_grab (gtk_widget_get_window (ecc->popup_tree_view), TRUE, time);
return TRUE;
}
@@ -301,45 +298,45 @@ e_cell_combo_select_matching_item (ECellCombo *ecc)
ECellText *ecell_text = E_CELL_TEXT (ecp->child);
ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
ETableCol *ecol;
- GtkList *list;
- GtkWidget *listitem;
- GList *elem;
gboolean found = FALSE;
- char *cell_text, *list_item_text;
+ char *cell_text;
+ gboolean valid;
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
ecol->col_idx, ecp->popup_row);
- list = GTK_LIST (ecc->popup_list);
- elem = list->children;
- while (elem) {
- listitem = GTK_WIDGET (elem->data);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view));
+
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid && !found;
+ valid = gtk_tree_model_iter_next (model, &iter)) {
+ char *str = NULL;
- /* We need to compare against the UTF-8 text. */
- list_item_text = g_object_get_data (G_OBJECT (listitem),
- E_CELL_COMBO_UTF8_KEY);
+ gtk_tree_model_get (model, &iter, 0, &str, -1);
+
+ if (str && g_str_equal (str, cell_text)) {
+ GtkTreePath *path = gtk_tree_model_get_path (model, &iter);
+
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (ecc->popup_tree_view), path, NULL, FALSE);
+ gtk_tree_path_free (path);
- if (list_item_text && !strcmp (list_item_text, cell_text)) {
found = TRUE;
- gtk_list_select_child (list, listitem);
- gtk_widget_grab_focus (listitem);
- break;
}
- elem = elem->next;
+ g_free (str);
}
- if (!found) {
- gtk_list_unselect_all (list);
- if (list->children)
- gtk_widget_grab_focus (GTK_WIDGET (list->children->data));
- }
+ if (!found)
+ gtk_tree_selection_unselect_all (selection);
e_cell_text_free_text (ecell_text, cell_text);
}
-
static void
e_cell_combo_show_popup (ECellCombo *ecc, int row, int view_col)
{
@@ -357,7 +354,7 @@ e_cell_combo_show_popup (ECellCombo *ecc, int row, int view_col)
gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar);
}
- gtk_widget_set_uposition (ecc->popup_window, x, y);
+ gtk_window_move (GTK_WINDOW (ecc->popup_window), x, y);
gtk_widget_set_size_request (ecc->popup_window, width, height);
gtk_widget_realize (ecc->popup_window);
gdk_window_resize (ecc->popup_window->window, width, height);
@@ -429,10 +426,10 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
screen_width = gdk_screen_width ();
avail_width = screen_width - scrollbar_width;
- gtk_widget_size_request (ecc->popup_list, &list_requisition);
+ gtk_widget_size_request (ecc->popup_tree_view, &list_requisition);
min_height = MIN (list_requisition.height,
popup->vscrollbar->requisition.height);
- if (!GTK_LIST (ecc->popup_list)->children)
+ if (!gtk_tree_model_iter_n_children (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view)), NULL))
list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT;
/* Calculate the desired width. */
@@ -503,32 +500,16 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
}
static void
-e_cell_combo_selection_changed(GtkWidget *popup_list, ECellCombo *ecc)
+e_cell_combo_selection_changed (GtkTreeSelection *selection, ECellCombo *ecc)
{
- if (!GTK_LIST(popup_list)->selection || !GTK_WIDGET_REALIZED(ecc->popup_window))
- return;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
- e_cell_combo_restart_edit (ecc);
-}
-
-static gint
-e_cell_combo_list_button_press(GtkWidget *popup_list, GdkEvent *event, ECellCombo *ecc)
-{
- g_return_val_if_fail (GTK_IS_LIST(popup_list), FALSE);
+ if (!GTK_WIDGET_REALIZED (ecc->popup_window) || !gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
e_cell_combo_update_cell (ecc);
- gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (event->button.time);
- gdk_keyboard_ungrab (event->button.time);
- gtk_widget_hide (ecc->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
- d(g_print("%s: popup_shown = FALSE\n", __FUNCTION__));
-
e_cell_combo_restart_edit (ecc);
-
- return TRUE;
-
}
/* This handles button press events in the popup window.
@@ -553,7 +534,7 @@ e_cell_combo_button_press (GtkWidget *popup_window,
which is why we hide the popup in this case. */
while (event_widget) {
event_widget = event_widget->parent;
- if (event_widget == ecc->popup_list)
+ if (event_widget == ecc->popup_tree_view)
return FALSE;
}
@@ -590,11 +571,11 @@ e_cell_combo_button_release (GtkWidget *popup_window,
event_widget = gtk_get_event_widget ((GdkEvent*) event);
/* See if the button was released in the list (or its children). */
- while (event_widget && event_widget != ecc->popup_list)
+ while (event_widget && event_widget != ecc->popup_tree_view)
event_widget = event_widget->parent;
/* If it wasn't, then we just ignore the event. */
- if (event_widget != ecc->popup_list)
+ if (event_widget != ecc->popup_tree_view)
return FALSE;
/* The button was released inside the list, so we hide the popup and
@@ -657,18 +638,17 @@ e_cell_combo_update_cell (ECellCombo *ecc)
ECellText *ecell_text = E_CELL_TEXT (ecp->child);
ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view);
ETableCol *ecol;
- GtkList *list = GTK_LIST (ecc->popup_list);
- GtkListItem *listitem;
- gchar *text, *old_text;
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ecc->popup_tree_view));
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *text = NULL, *old_text;
/* Return if no item is selected. */
- if (list->selection == NULL)
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
return;
/* Get the text of the selected item. */
- listitem = list->selection->data;
- text = g_object_get_data (G_OBJECT (listitem),
- E_CELL_COMBO_UTF8_KEY);
+ gtk_tree_model_get (model, &iter, 0, &text, -1);
g_return_if_fail (text != NULL);
/* Compare it with the existing cell contents. */
@@ -684,6 +664,7 @@ e_cell_combo_update_cell (ECellCombo *ecc)
}
e_cell_text_free_text (ecell_text, old_text);
+ g_free (text);
}
diff --git a/widgets/table/e-cell-combo.h b/widgets/table/e-cell-combo.h
index b7cc928e25..2e801f3711 100644
--- a/widgets/table/e-cell-combo.h
+++ b/widgets/table/e-cell-combo.h
@@ -45,7 +45,7 @@ typedef struct {
GtkWidget *popup_window;
GtkWidget *popup_scrolled_window;
- GtkWidget *popup_list;
+ GtkWidget *popup_tree_view;
} ECellCombo;
typedef struct {
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 7ffb1776ae..7aa7a92351 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -509,10 +509,10 @@ ethi_add_drop_marker (ETableHeaderItem *ethi, int col, gboolean recreate)
rx -= gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
ry -= gtk_layout_get_vadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
- gtk_widget_set_uposition (arrow_down, rx + x - ARROW_PTR, ry - ARROW_DOWN_HEIGHT);
+ gtk_window_move (GTK_WINDOW (arrow_down), rx + x - ARROW_PTR, ry - ARROW_DOWN_HEIGHT);
gtk_widget_show_all (arrow_down);
- gtk_widget_set_uposition (arrow_up, rx + x - ARROW_PTR, ry + ethi->height);
+ gtk_window_move (GTK_WINDOW (arrow_up), rx + x - ARROW_PTR, ry + ethi->height);
gtk_widget_show_all (arrow_up);
}