[evolution] Use gtk_widget_is_visible() instead of gtk_widget_get_visible() on some places
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Use gtk_widget_is_visible() instead of gtk_widget_get_visible() on some places
- Date: Thu, 13 Jan 2022 08:27:19 +0000 (UTC)
commit 5f7a81ac5133daea468a32ff159f1dbbd602ec85
Author: Milan Crha <mcrha redhat com>
Date: Thu Jan 13 09:24:04 2022 +0100
Use gtk_widget_is_visible() instead of gtk_widget_get_visible() on some places
The changed places rely on the visibility of the widget including
the parent widgets, not only whether the GtkWidget::visible is set
to true.
An example is when replying to a message when the preview panel is
turned off while it had been showing a different message in it
before being hid. In that case the composer opened with the message
in the hidden preview panel, instead of the message selected
in the message list.
src/calendar/gui/ea-cal-view.c | 4 ++--
src/calendar/gui/tag-calendar.c | 2 +-
src/composer/e-msg-composer.c | 4 ++--
src/e-util/e-preview-pane.c | 2 +-
src/e-util/e-proxy-preferences.c | 4 ++--
src/e-util/e-search-bar.c | 2 +-
src/mail/e-mail-reader-utils.c | 2 +-
src/mail/e-mail-reader.c | 2 +-
src/mail/message-list.c | 8 ++++----
9 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/calendar/gui/ea-cal-view.c b/src/calendar/gui/ea-cal-view.c
index c1303b43a3..4553578f4d 100644
--- a/src/calendar/gui/ea-cal-view.c
+++ b/src/calendar/gui/ea-cal-view.c
@@ -309,7 +309,7 @@ action_interface_do_action (AtkAction *action,
*/
return FALSE;
- if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
+ if (!gtk_widget_get_sensitive (widget) || !gtk_widget_is_visible (widget))
return FALSE;
cal_view = E_CALENDAR_VIEW (widget);
@@ -365,7 +365,7 @@ action_interface_get_keybinding (AtkAction *action,
*/
return NULL;
- if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
+ if (!gtk_widget_get_sensitive (widget) || !gtk_widget_is_visible (widget))
return NULL;
switch (index) {
diff --git a/src/calendar/gui/tag-calendar.c b/src/calendar/gui/tag-calendar.c
index eea5ccc718..548e5b9307 100644
--- a/src/calendar/gui/tag-calendar.c
+++ b/src/calendar/gui/tag-calendar.c
@@ -1031,7 +1031,7 @@ tag_calendar_by_comp (ECalendar *ecal,
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
/* If the ECalendar isn't visible, we just return. */
- if (!gtk_widget_get_visible (GTK_WIDGET (ecal)))
+ if (!gtk_widget_is_visible (GTK_WIDGET (ecal)))
return;
if (!prepare_tag (ecal, &closure, display_zone, clear_first))
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index 178ba8e1e4..aaa35c4652 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -2699,7 +2699,7 @@ msg_composer_map (GtkWidget *widget)
e_composer_header_table_get_header (
table, E_COMPOSER_HEADER_TO)->input_widget;
text = gtk_entry_get_text (GTK_ENTRY (input_widget));
- if (gtk_widget_get_visible (input_widget) && (text == NULL || *text == '\0')) {
+ if (gtk_widget_is_visible (input_widget) && (text == NULL || *text == '\0')) {
gtk_widget_grab_focus (input_widget);
return;
}
@@ -2709,7 +2709,7 @@ msg_composer_map (GtkWidget *widget)
e_composer_header_table_get_header (
table, E_COMPOSER_HEADER_SUBJECT)->input_widget;
text = gtk_entry_get_text (GTK_ENTRY (input_widget));
- if (gtk_widget_get_visible (input_widget) && (text == NULL || *text == '\0')) {
+ if (gtk_widget_is_visible (input_widget) && (text == NULL || *text == '\0')) {
gtk_widget_grab_focus (input_widget);
return;
}
diff --git a/src/e-util/e-preview-pane.c b/src/e-util/e-preview-pane.c
index 0f5ecec902..a2d83e56fc 100644
--- a/src/e-util/e-preview-pane.c
+++ b/src/e-util/e-preview-pane.c
@@ -86,7 +86,7 @@ preview_pane_alert_bar_visible_notify_cb (GtkWidget *alert_bar,
focused = GTK_IS_WINDOW (toplevel) ? gtk_window_get_focus (GTK_WINDOW (toplevel)) : NULL;
if (!focused && preview_pane->priv->web_view &&
- gtk_widget_get_visible (preview_pane->priv->web_view)) {
+ gtk_widget_is_visible (preview_pane->priv->web_view)) {
gtk_widget_grab_focus (preview_pane->priv->web_view);
}
}
diff --git a/src/e-util/e-proxy-preferences.c b/src/e-util/e-proxy-preferences.c
index d93d3979d8..1093cacb80 100644
--- a/src/e-util/e-proxy-preferences.c
+++ b/src/e-util/e-proxy-preferences.c
@@ -128,7 +128,7 @@ proxy_preferences_commit_stash (EProxyPreferences *preferences,
preferences->priv->toplevel = toplevel;
- if (!gtk_widget_get_visible (toplevel)) {
+ if (!gtk_widget_is_visible (toplevel)) {
start_timeout = FALSE;
commit_now = TRUE;
}
@@ -287,7 +287,7 @@ proxy_preferences_toplevel_notify_visible_cb (GtkWidget *widget,
g_return_if_fail (E_IS_PROXY_PREFERENCES (preferences));
/* The toplevel widget was hidden, save anything pending immediately */
- if (!gtk_widget_get_visible (widget))
+ if (!gtk_widget_is_visible (widget))
e_proxy_preferences_submit (preferences);
}
diff --git a/src/e-util/e-search-bar.c b/src/e-util/e-search-bar.c
index 567753184b..a3101d25d9 100644
--- a/src/e-util/e-search-bar.c
+++ b/src/e-util/e-search-bar.c
@@ -261,7 +261,7 @@ web_view_load_changed_cb (WebKitWebView *webkit_web_view,
if (load_event != WEBKIT_LOAD_FINISHED)
return;
- if (gtk_widget_get_visible (GTK_WIDGET (search_bar))) {
+ if (gtk_widget_is_visible (GTK_WIDGET (search_bar))) {
if (search_bar->priv->active_search != NULL) {
e_web_view_disable_highlights (search_bar->priv->web_view);
search_bar_find (search_bar, TRUE);
diff --git a/src/mail/e-mail-reader-utils.c b/src/mail/e-mail-reader-utils.c
index 9746d2d8eb..df95f3c83f 100644
--- a/src/mail/e-mail-reader-utils.c
+++ b/src/mail/e-mail-reader-utils.c
@@ -2782,7 +2782,7 @@ e_mail_reader_utils_get_selection_or_message (EMailReader *reader,
if (preloaded_message)
smd->preloaded_message = g_object_ref (preloaded_message);
- if (gtk_widget_get_visible (GTK_WIDGET (web_view)) &&
+ if (gtk_widget_is_visible (GTK_WIDGET (web_view)) &&
e_web_view_has_selection (web_view)) {
EMailPartList *part_list;
CamelMimeMessage *message = NULL;
diff --git a/src/mail/e-mail-reader.c b/src/mail/e-mail-reader.c
index e4c589b8e0..f387d5afd8 100644
--- a/src/mail/e-mail-reader.c
+++ b/src/mail/e-mail-reader.c
@@ -3539,7 +3539,7 @@ mail_reader_preview_pane_visible_changed_cb (EMailReader *reader,
g_return_if_fail (E_IS_MAIL_READER (reader));
g_return_if_fail (GTK_IS_WIDGET (widget));
- if (!gtk_widget_get_visible (widget))
+ if (!gtk_widget_is_visible (widget))
discard_timeout_mark_seen_cb (reader);
}
diff --git a/src/mail/message-list.c b/src/mail/message-list.c
index f2b7dceed5..fa384d2413 100644
--- a/src/mail/message-list.c
+++ b/src/mail/message-list.c
@@ -1157,7 +1157,7 @@ message_list_select (MessageList *message_list,
/* This function is usually called in response to a key
* press, so grab focus if the message list is visible. */
- if (gtk_widget_get_visible (GTK_WIDGET (message_list)))
+ if (gtk_widget_is_visible (GTK_WIDGET (message_list)))
gtk_widget_grab_focus (GTK_WIDGET (message_list));
return TRUE;
@@ -5679,7 +5679,7 @@ message_list_set_show_subject_above_sender (MessageList *message_list,
if (message_list->priv->folder &&
gtk_widget_get_realized (GTK_WIDGET (message_list)) &&
- gtk_widget_get_visible (GTK_WIDGET (message_list)))
+ gtk_widget_is_visible (GTK_WIDGET (message_list)))
mail_regen_list (message_list, NULL, NULL);
}
@@ -6659,7 +6659,7 @@ message_list_update_tree_text (MessageList *message_list)
g_return_if_fail (IS_MESSAGE_LIST (message_list));
g_return_if_fail (e_util_is_main_thread (g_thread_self ()));
- if (!gtk_widget_get_visible (GTK_WIDGET (message_list)))
+ if (!gtk_widget_is_visible (GTK_WIDGET (message_list)))
return;
tree = E_TREE (message_list);
@@ -7111,7 +7111,7 @@ message_list_regen_idle_cb (gpointer user_data)
row_count = e_table_model_row_count (E_TABLE_MODEL (adapter));
if (row_count <= 0) {
- if (gtk_widget_get_visible (GTK_WIDGET (message_list)))
+ if (gtk_widget_is_visible (GTK_WIDGET (message_list)))
e_tree_set_info_message (E_TREE (message_list), _("Generating message list…"));
} else if (regen_data->group_by_threads &&
!message_list->just_set_folder &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]