[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-45-g332a9b895
jonathan at claws-mail.org
jonathan at claws-mail.org
Tue Aug 17 12:11:57 UTC 2021
The branch, gtk3 has been updated
via 332a9b8958a333c368e432651339c9fb7deddb20 (commit)
via 2816d7dbdcd2c81fe1097dfecc6dc8208f3c9245 (commit)
from 5e237aee3c9075b0a68003cc753ecf74233747f7 (commit)
Summary of changes:
src/folderview.c | 3 +++
src/gtk/gtkutils.c | 1 +
src/headerview.c | 1 +
src/mainwindow.c | 1 +
src/messageview.c | 1 +
src/mimeview.c | 5 ++++
src/noticeview.c | 1 +
src/summaryview.c | 3 +++
src/textview.c | 69 ++++++++++++++++++++++++++++++++++++++----------------
9 files changed, 65 insertions(+), 20 deletions(-)
- Log -----------------------------------------------------------------
commit 332a9b8958a333c368e432651339c9fb7deddb20
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date: Sun Aug 15 03:03:54 2021 -0700
Fix the initial position of the textview image
The textview image is sometimes mispositioned on the initial load of
the message because it was first positioned using buffer coordinates
rather than window coordinates.
Also move the call to gtk_text_view_move_child out of the size_allocate
handler and into an immediate, oneshot timeout.
gtk_text_view_move_child() calls gtk_widget_queue_resize() internally.
The GTK docs say you can't call gtk_widget_queue_resize from inside
size_allocate, and that the call to gtk_widget_queue_resize() will be
silently ignored.
diff --git a/src/textview.c b/src/textview.c
index 9bd0c9a78..087eca702 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -228,22 +228,32 @@ static GtkActionEntry textview_mail_popup_entries[] =
{"TextviewPopupMail/Copy", NULL, N_("Copy this add_ress"), NULL, NULL, G_CALLBACK(copy_mail_to_uri_cb) },
};
-static void scrolled_cb (GtkAdjustment *adj, TextView *textview)
+static gboolean move_textview_image_cb (gpointer data)
{
#ifndef WIDTH
# define WIDTH 48
# define HEIGHT 48
#endif
+ TextView *textview = (TextView *)data;
+ GtkAllocation allocation;
+ gint x, wx, wy;
+ gtk_widget_get_allocation(textview->text, &allocation);
+ x = allocation.width - WIDTH - 5;
+ gtk_text_view_buffer_to_window_coords(
+ GTK_TEXT_VIEW(textview->text),
+ GTK_TEXT_WINDOW_TEXT, x, 5, &wx, &wy);
+ gtk_text_view_move_child(GTK_TEXT_VIEW(textview->text),
+ textview->image, wx, wy);
+
+ return G_SOURCE_REMOVE;
+}
+
+static void scrolled_cb (GtkAdjustment *adj, gpointer data)
+{
+ TextView *textview = (TextView *)data;
+
if (textview->image) {
- GtkAllocation allocation;
- gint x, y, x1;
- gtk_widget_get_allocation(textview->text, &allocation);
- x1 = allocation.width - WIDTH - 5;
- gtk_text_view_buffer_to_window_coords(
- GTK_TEXT_VIEW(textview->text),
- GTK_TEXT_WINDOW_TEXT, x1, 5, &x, &y);
- gtk_text_view_move_child(GTK_TEXT_VIEW(textview->text),
- textview->image, x1, y);
+ move_textview_image_cb(textview);
}
}
@@ -251,7 +261,11 @@ static void textview_size_allocate_cb (GtkWidget *widget,
GtkAllocation *allocation,
gpointer data)
{
- scrolled_cb(NULL, (TextView *)data);
+ TextView *textview = (TextView *)data;
+
+ if (textview->image) {
+ g_timeout_add(0, &move_textview_image_cb, textview);
+ }
}
TextView *textview_create(void)
@@ -1937,7 +1951,7 @@ static void textview_show_avatar(TextView *textview)
GtkAllocation allocation;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
MsgInfo *msginfo = textview->messageview->msginfo;
- int x = 0;
+ gint x, wx, wy;
AvatarRender *avatarr;
if (prefs_common.display_header_pane || !prefs_common.display_xface)
@@ -1963,10 +1977,14 @@ static void textview_show_avatar(TextView *textview)
gtk_widget_show(textview->image);
gtk_widget_get_allocation(textview->text, &allocation);
- x = allocation.width - WIDTH -5;
+ x = allocation.width - WIDTH - 5;
+
+ gtk_text_view_buffer_to_window_coords(
+ GTK_TEXT_VIEW(textview->text),
+ GTK_TEXT_WINDOW_TEXT, x, 5, &wx, &wy);
gtk_text_view_add_child_in_window(text, textview->image,
- GTK_TEXT_WINDOW_TEXT, x, 5);
+ GTK_TEXT_WINDOW_TEXT, wx, wy);
gtk_widget_show_all(textview->text);
@@ -1982,7 +2000,7 @@ void textview_show_icon(TextView *textview, const gchar *stock_id)
{
GtkAllocation allocation;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
- int x = 0;
+ gint x, wx, wy;
if (textview->image)
gtk_widget_destroy(textview->image);
@@ -1994,10 +2012,14 @@ void textview_show_icon(TextView *textview, const gchar *stock_id)
gtk_widget_show(textview->image);
gtk_widget_get_allocation(textview->text, &allocation);
- x = allocation.width - WIDTH -5;
+ x = allocation.width - WIDTH - 5;
+
+ gtk_text_view_buffer_to_window_coords(
+ GTK_TEXT_VIEW(textview->text),
+ GTK_TEXT_WINDOW_TEXT, x, 5, &wx, &wy);
gtk_text_view_add_child_in_window(text, textview->image,
- GTK_TEXT_WINDOW_TEXT, x, 5);
+ GTK_TEXT_WINDOW_TEXT, wx, wy);
gtk_widget_show_all(textview->text);
@@ -2044,7 +2066,7 @@ static void textview_show_contact_pic(TextView *textview)
#ifndef USE_ALT_ADDRBOOK
MsgInfo *msginfo = textview->messageview->msginfo;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
- int x = 0;
+ gint x, wx, wy;
gchar *filename = NULL;
GError *error = NULL;
GdkPixbuf *picture = NULL;
@@ -2096,10 +2118,14 @@ static void textview_show_contact_pic(TextView *textview)
gtk_widget_show(textview->image);
gtk_widget_get_allocation(textview->text, &allocation);
- x = allocation.width - WIDTH -5;
+ x = allocation.width - WIDTH - 5;
+
+ gtk_text_view_buffer_to_window_coords(
+ GTK_TEXT_VIEW(textview->text),
+ GTK_TEXT_WINDOW_TEXT, x, 5, &wx, &wy);
gtk_text_view_add_child_in_window(text, textview->image,
- GTK_TEXT_WINDOW_TEXT, x, 5);
+ GTK_TEXT_WINDOW_TEXT, wx, wy);
gtk_widget_show_all(textview->text);
commit 2816d7dbdcd2c81fe1097dfecc6dc8208f3c9245
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date: Sat Aug 14 18:44:35 2021 -0700
Set name on GTK widgets
GTK+3 themes can use widget names as a selector, so add names to some
windows and widgets to make positively identifying CSS nodes easier
diff --git a/src/folderview.c b/src/folderview.c
index 9b2e364e9..a3f549236 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -455,6 +455,8 @@ static GtkWidget *folderview_ctree_create(FolderView *folderview)
ctree = gtk_sctree_new_with_titles(N_FOLDER_COLS, col_pos[F_COL_FOLDER],
titles);
+ gtk_widget_set_name(GTK_WIDGET(ctree), "folderview_sctree");
+
if (prefs_common.show_col_headers == FALSE)
gtk_cmclist_column_titles_hide(GTK_CMCLIST(ctree));
@@ -608,6 +610,7 @@ FolderView *folderview_create(MainWindow *mainwin)
folderview = g_new0(FolderView, 1);
scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_set_name(GTK_WIDGET(scrolledwin), "folderview");
gtk_scrolled_window_set_policy
(GTK_SCROLLED_WINDOW(scrolledwin),
GTK_POLICY_AUTOMATIC,
diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c
index 3512e97cd..da8325717 100644
--- a/src/gtk/gtkutils.c
+++ b/src/gtk/gtkutils.c
@@ -1524,6 +1524,7 @@ GtkWidget *gtkut_window_new (GtkWindowType type,
{
GtkWidget *window = gtk_window_new(type);
gtk_window_set_role(GTK_WINDOW(window), class);
+ gtk_widget_set_name(GTK_WIDGET(window), class);
return window;
}
diff --git a/src/headerview.c b/src/headerview.c
index 69d0d407c..433c26386 100644
--- a/src/headerview.c
+++ b/src/headerview.c
@@ -72,6 +72,7 @@ HeaderView *headerview_create(void)
headerview = g_new0(HeaderView, 1);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_name(GTK_WIDGET(hbox), "headerview");
gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
diff --git a/src/mainwindow.c b/src/mainwindow.c
index d8d0388de..440bc28b9 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1916,6 +1916,7 @@ MainWindow *main_window_create()
#ifndef GENERIC_UMPC
hbox_stat = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+ gtk_widget_set_name(GTK_WIDGET(hbox_stat), "hbox_stat");
gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
warning_icon = gtkut_stock_button("dialog-warning", NULL);
diff --git a/src/messageview.c b/src/messageview.c
index 36dad2799..6b187d619 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -416,6 +416,7 @@ MessageView *messageview_create(MainWindow *mainwin)
mimeview->messageview = messageview;
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_name(GTK_WIDGET(vbox), "messageview");
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(headerview),
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(noticeview),
diff --git a/src/mimeview.c b/src/mimeview.c
index 83b103a5f..9b2fa0ec1 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -362,6 +362,7 @@ MimeView *mimeview_create(MainWindow *mainwin)
G_CALLBACK(mimeview_drag_data_get), mimeview);
mime_notebook = gtk_notebook_new();
+ gtk_widget_set_name(GTK_WIDGET(mime_notebook), "mime_notebook");
gtk_widget_show(mime_notebook);
gtk_widget_set_can_focus(mime_notebook, FALSE);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(mime_notebook), FALSE);
@@ -401,6 +402,7 @@ MimeView *mimeview_create(MainWindow *mainwin)
G_CALLBACK(mime_toggle_button_cb), mimeview);
icon_mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_name(GTK_WIDGET(icon_mainbox), "mimeview_icon_mainbox");
gtk_widget_show(icon_mainbox);
gtk_widget_set_size_request(icon_mainbox, 32, -1);
gtk_box_pack_start(GTK_BOX(icon_mainbox), mime_toggle, FALSE, FALSE, 0);
@@ -410,6 +412,7 @@ MimeView *mimeview_create(MainWindow *mainwin)
G_CALLBACK(icon_scroll_size_allocate_cb), mimeview);
ctree_mainbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_name(GTK_WIDGET(ctree_mainbox), "mimeview_ctree_mainbox");
gtk_box_pack_start(GTK_BOX(ctree_mainbox), scrolledwin, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(ctree_mainbox), "size_allocate",
G_CALLBACK(ctree_size_allocate_cb), mimeview);
@@ -459,6 +462,7 @@ MimeView *mimeview_create(MainWindow *mainwin)
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show(vbox);
siginfoview = noticeview_create(mainwin);
+ gtk_widget_set_name(GTK_WIDGET(siginfoview->vgrid), "siginfoview");
noticeview_hide(siginfoview);
noticeview_set_icon_clickable(siginfoview, TRUE);
gtk_box_pack_start(GTK_BOX(vbox), mime_notebook, TRUE, TRUE, 0);
@@ -470,6 +474,7 @@ MimeView *mimeview_create(MainWindow *mainwin)
gtk_paned_pack2(GTK_PANED(paned), vbox, TRUE, TRUE);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_widget_set_name(GTK_WIDGET(hbox), "mimeview");
gtk_box_pack_start(GTK_BOX(hbox), paned, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(hbox), icon_mainbox, FALSE, FALSE, 0);
diff --git a/src/noticeview.c b/src/noticeview.c
index 60c51b037..1b7e925be 100644
--- a/src/noticeview.c
+++ b/src/noticeview.c
@@ -86,6 +86,7 @@ NoticeView *noticeview_create(MainWindow *mainwin)
noticeview->window = mainwin->window;
vgrid = gtk_grid_new();
+ gtk_widget_set_name(GTK_WIDGET(vgrid), "noticeview");
gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing(GTK_GRID(vgrid), 4);
diff --git a/src/summaryview.c b/src/summaryview.c
index 9d0b9a433..ada78d7e3 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -570,6 +570,7 @@ SummaryView *summary_create(MainWindow *mainwin)
#define SUMMARY_VBOX_SPACING 3
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, SUMMARY_VBOX_SPACING);
+ gtk_widget_set_name(GTK_WIDGET(vbox), "summaryview");
/* create status label */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
@@ -6692,6 +6693,8 @@ static GtkWidget *summary_ctree_create(SummaryView *summaryview)
ctree = gtk_sctree_new_with_titles
(N_SUMMARY_COLS, col_pos[S_COL_SUBJECT], titles);
+ gtk_widget_set_name(GTK_WIDGET(ctree), "summaryview_sctree");
+
if (prefs_common.show_col_headers == FALSE)
gtk_cmclist_column_titles_hide(GTK_CMCLIST(ctree));
diff --git a/src/textview.c b/src/textview.c
index 74ba34dfa..9bd0c9a78 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1959,6 +1959,7 @@ static void textview_show_avatar(TextView *textview)
avatarr->image = NULL; /* avoid destroying */
avatars_avatarrender_free(avatarr);
+ gtk_widget_set_name(GTK_WIDGET(textview->image), "textview_avatar");
gtk_widget_show(textview->image);
gtk_widget_get_allocation(textview->text, &allocation);
@@ -1989,6 +1990,7 @@ void textview_show_icon(TextView *textview, const gchar *stock_id)
textview->image = gtk_image_new_from_icon_name(stock_id, GTK_ICON_SIZE_DIALOG);
cm_return_if_fail(textview->image != NULL);
+ gtk_widget_set_name(GTK_WIDGET(textview->image), "textview_icon");
gtk_widget_show(textview->image);
gtk_widget_get_allocation(textview->text, &allocation);
@@ -2090,6 +2092,7 @@ static void textview_show_contact_pic(TextView *textview)
}
cm_return_if_fail(textview->image != NULL);
+ gtk_widget_set_name(GTK_WIDGET(textview->image), "textview_contact_pic");
gtk_widget_show(textview->image);
gtk_widget_get_allocation(textview->text, &allocation);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list