[balsa/wip/gtk4] balsa-mime-widget-callbacks: Use GtkWidget API
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4] balsa-mime-widget-callbacks: Use GtkWidget API
- Date: Thu, 2 Aug 2018 21:05:19 +0000 (UTC)
commit 1b1e30059d0949794a27b8c8831117adc64fe6c6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Aug 2 16:59:23 2018 -0400
balsa-mime-widget-callbacks: Use GtkWidget API
to replace the use of gtk_container_set_focus_chain(); specifically,
unset can-focus on all widgets, then set can-focus on the current
widget.
src/balsa-mime-widget-callbacks.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/balsa-mime-widget-callbacks.c b/src/balsa-mime-widget-callbacks.c
index 991e3ee72..a8f5ae150 100644
--- a/src/balsa-mime-widget-callbacks.c
+++ b/src/balsa-mime-widget-callbacks.c
@@ -261,34 +261,34 @@ balsa_mime_widget_key_press_event(GtkEventControllerKey *key_controller,
}
+static void
+bmw_set_can_focus(GtkWidget *widget,
+ gpointer data)
+{
+ if (GTK_IS_CONTAINER(widget))
+ gtk_container_foreach(GTK_CONTAINER(widget), bmw_set_can_focus, data);
+ gtk_widget_set_can_focus(widget, GPOINTER_TO_INT(data));
+}
+
void
balsa_mime_widget_check_focus(GtkWidget * widget, GParamSpec * pspec, BalsaMessage * bm)
{
-#if 0
- GtkContainer *container =
- GTK_CONTAINER(balsa_mime_widget_get_container(balsa_message_get_bm_widget(bm)));
-#endif
+ GtkWidget *container =
+ balsa_mime_widget_get_container(balsa_message_get_bm_widget(bm));
BalsaMessageFocusState focus_state;
focus_state = balsa_message_get_focus_state(bm);
if (gtk_widget_has_focus(widget)) {
-#if 0
/* Disable can_focus on other message parts so that TAB does not
* attempt to move the focus on them. */
- GList *list;
-
- list = g_list_append(NULL, widget);
- gtk_container_set_focus_chain(container, list);
- g_list_free(list);
-#endif
+ bmw_set_can_focus(container, GINT_TO_POINTER(FALSE));
+ gtk_widget_set_can_focus(widget, TRUE);
if (focus_state == BALSA_MESSAGE_FOCUS_STATE_NO)
balsa_message_set_focus_state(bm, BALSA_MESSAGE_FOCUS_STATE_YES);
} else {
-#if 0
- gtk_container_unset_focus_chain(container);
-#endif
+ bmw_set_can_focus(container, GINT_TO_POINTER(TRUE));
if (balsa_message_get_message(bm) != NULL) {
if (focus_state == BALSA_MESSAGE_FOCUS_STATE_HOLD) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]