[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-377-g59b75ea

ticho at claws-mail.org ticho at claws-mail.org
Fri Oct 5 21:08:19 CEST 2018


The branch, gtk3 has been updated
       via  59b75ea19ca65bb8ab0565d5dac33d4e6ccdac1d (commit)
       via  de2f37d8c715883af74983489f63bfceeab507eb (commit)
       via  73ad30ba74873b61219301955efa29ede5ce1a32 (commit)
      from  402f9ed6111c53dbc055cb1dbd51a8d75ed96174 (commit)

Summary of changes:
 src/messageview.c  |    5 ++--
 src/mimeview.c     |   81 ++++++++++++++++++++++++++--------------------------
 src/mimeview.h     |    2 +-
 src/sourcewindow.c |    2 +-
 src/stock_pixmap.c |    3 +-
 src/textview.c     |    2 --
 6 files changed, 48 insertions(+), 47 deletions(-)


- Log -----------------------------------------------------------------
commit 59b75ea19ca65bb8ab0565d5dac33d4e6ccdac1d
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Oct 5 20:35:40 2018 +0200

    Removed a few deprecated GTK API calls in mimeview.c.

diff --git a/src/mimeview.c b/src/mimeview.c
index 258b5e2..82fac6a 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -249,12 +249,11 @@ MimeView *mimeview_create(MainWindow *mainwin)
 	GtkWidget *mime_toggle;
 	GtkWidget *icon_mainbox;
 	GtkWidget *icon_scroll;
-	GtkWidget *icon_vbox;
+	GtkWidget *icon_grid;
 	GtkWidget *arrow;
 	GtkWidget *scrollbutton;
 	GtkWidget *hbox;
 	NoticeView *siginfoview;
-	GtkRequisition r;
 	GtkTreeStore *model;
 	GtkCellRenderer *renderer;
 	GtkTreeViewColumn *column;
@@ -333,17 +332,20 @@ MimeView *mimeview_create(MainWindow *mainwin)
 			 G_CALLBACK(mimeview_drag_data_get), mimeview);
 
 	mime_notebook = gtk_notebook_new();
-        gtk_widget_show(mime_notebook);
-        gtk_widget_set_can_focus(mime_notebook, FALSE);
-        gtk_notebook_set_show_tabs(GTK_NOTEBOOK(mime_notebook), FALSE);
-        gtk_notebook_set_show_border(GTK_NOTEBOOK(mime_notebook), FALSE);
-	
-	icon_vbox = gtk_vbox_new(FALSE, 2);
-	gtk_widget_show(icon_vbox);
+	gtk_widget_show(mime_notebook);
+	gtk_widget_set_can_focus(mime_notebook, FALSE);
+	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(mime_notebook), FALSE);
+	gtk_notebook_set_show_border(GTK_NOTEBOOK(mime_notebook), FALSE);
+
+	icon_grid = gtk_grid_new();
+	gtk_orientable_set_orientation(GTK_ORIENTABLE(icon_grid),
+			GTK_ORIENTATION_VERTICAL);
+	gtk_grid_set_row_spacing(GTK_GRID(icon_grid), 0);
+	gtk_widget_show(icon_grid);
 	icon_scroll = gtk_layout_new(NULL, NULL);
 	gtk_widget_show(icon_scroll);
-	gtk_layout_put(GTK_LAYOUT(icon_scroll), icon_vbox, 0, 0);
-	scrollbutton = gtk_vscrollbutton_new(gtk_layout_get_vadjustment(GTK_LAYOUT(icon_scroll)));
+	gtk_layout_put(GTK_LAYOUT(icon_scroll), icon_grid, 0, 0);
+	scrollbutton = gtk_vscrollbutton_new(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(icon_scroll)));
 	gtk_widget_show(scrollbutton);
 
 	g_signal_connect(G_OBJECT(icon_scroll), "scroll_event",
@@ -364,7 +366,6 @@ MimeView *mimeview_create(MainWindow *mainwin)
 	mimeview->ctree_mode = FALSE;
 	arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
 	gtk_widget_show(arrow);
-	gtk_widget_size_request(arrow, &r);
 	gtk_container_add(GTK_CONTAINER(mime_toggle), arrow);
 	g_signal_connect(G_OBJECT(mime_toggle), "button_release_event", 
 			 G_CALLBACK(mime_toggle_button_cb), mimeview);
@@ -453,7 +454,7 @@ MimeView *mimeview_create(MainWindow *mainwin)
 	mimeview->type          = -1;
 	mimeview->ctree_mainbox = ctree_mainbox;
 	mimeview->icon_scroll   = icon_scroll;
-	mimeview->icon_vbox     = icon_vbox;
+	mimeview->icon_grid     = icon_grid;
 	mimeview->icon_mainbox  = icon_mainbox;
 	mimeview->icon_count    = 0;
 	mimeview->mainwin       = mainwin;
@@ -1401,6 +1402,9 @@ static void mimeview_selected(GtkTreeSelection *selection, MimeView *mimeview)
 	GtkTreePath *path;
 	MimeInfo *partinfo;
 	MainWindow *mainwin;
+	GdkDisplay *display;
+	GdkSeat *seat;
+	GdkDevice *device;
 
 	selection = gtk_tree_view_get_selection(ctree);
 	if (!gtk_tree_selection_get_selected(selection, &model, &iter))
@@ -1424,8 +1428,11 @@ static void mimeview_selected(GtkTreeSelection *selection, MimeView *mimeview)
 	/* ungrab the mouse event */
 	if (gtk_widget_has_grab(GTK_WIDGET(ctree))) {
 		gtk_grab_remove(GTK_WIDGET(ctree));
-		if (gdk_pointer_is_grabbed())
-			gdk_pointer_ungrab(GDK_CURRENT_TIME);
+		display = gdk_window_get_display(gtk_widget_get_window(GTK_WIDGET(ctree)));
+		seat = gdk_display_get_default_seat(display);
+		device = gdk_seat_get_pointer(seat);
+		if (gdk_display_device_is_grabbed(display, device))
+			gdk_seat_ungrab(seat);
 	}
 	
 	mimeview->textview->default_text = FALSE;
@@ -1526,10 +1533,9 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event,
 			main_window_set_menu_sensitive(mainwin);
 		g_object_set_data(G_OBJECT(mimeview->popupmenu),
 				  "pop_partinfo", partinfo);
-				    
-		gtk_menu_popup(GTK_MENU(mimeview->popupmenu),
-			       NULL, NULL, NULL, NULL,
-			       event->button, event->time);
+
+		gtk_menu_popup_at_pointer(GTK_MENU(mimeview->popupmenu),
+				(GdkEvent *)event);
 		return TRUE;
 	}
 
@@ -2457,16 +2463,14 @@ static gboolean icon_popup_menu(GtkWidget *widget, gpointer data)
 
 	g_object_set_data(G_OBJECT(mimeview->popupmenu),
 			  "pop_partinfo", partinfo);
-	gtk_menu_popup(GTK_MENU(mimeview->popupmenu),
-		       NULL, NULL, NULL, NULL,
-		       0, gtk_get_current_event_time());
+	gtk_menu_popup_at_pointer(GTK_MENU(mimeview->popupmenu), NULL);
 	return TRUE;
 }
 
 static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo) 
 {
 	GtkWidget *pixmap = NULL;
-	GtkWidget *vbox;
+	GtkWidget *grid;
 	GtkWidget *button;
 	gchar *tip;
 	gchar *tiptmp;
@@ -2484,7 +2488,7 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
 	if (!prefs_common.show_inline_attachments && mimeinfo->id)
 		return;
 
-	vbox = mimeview->icon_vbox;
+	grid = mimeview->icon_grid;
 	mimeview->icon_count++;
 	button = gtk_event_box_new();
 
@@ -2639,7 +2643,7 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
 			 G_CALLBACK(icon_key_pressed), mimeview);
 	g_signal_connect(G_OBJECT(button), "drag_data_get",
 			 G_CALLBACK(mimeview_drag_data_get), mimeview);
-	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(grid), button);
 #ifdef GENERIC_UMPC
 	gtk_widget_size_request(pixmap, &r);
 	gtk_widget_set_size_request(button, -1, r.height + 4);
@@ -2652,16 +2656,15 @@ static void icon_list_clear (MimeView *mimeview)
 	GList     *child, *orig;
 	GtkAdjustment *adj;
 		
-	orig = gtk_container_get_children(GTK_CONTAINER(mimeview->icon_vbox));
+	orig = gtk_container_get_children(GTK_CONTAINER(mimeview->icon_grid));
 	for (child = orig; child != NULL; child = g_list_next(child)) {
-		gtkut_container_remove(GTK_CONTAINER(mimeview->icon_vbox), 
+		gtkut_container_remove(GTK_CONTAINER(mimeview->icon_grid), 
 				       GTK_WIDGET(child->data));
 	}
 	g_list_free(orig);
 	mimeview->icon_count = 0;
-	adj  = gtk_layout_get_vadjustment(GTK_LAYOUT(mimeview->icon_scroll));
+	adj  = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(mimeview->icon_scroll));
 	gtk_adjustment_set_value(adj, gtk_adjustment_get_lower(adj));
-	gtk_adjustment_changed(adj);
 }
 
 /*!
@@ -2672,28 +2675,27 @@ static void icon_list_clear (MimeView *mimeview)
 static void icon_scroll_size_allocate_cb(GtkWidget *widget, 
 					 GtkAllocation *size, MimeView *mimeview)
 {
-	GtkAllocation vbox_size;
+	GtkAllocation grid_size;
 	GtkAllocation layout_size;
 	GtkAdjustment *adj;
 	guint width;
 	guint height;
 
-	adj = gtk_layout_get_vadjustment(GTK_LAYOUT(mimeview->icon_scroll));
+	adj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(mimeview->icon_scroll));
 
-	gtk_widget_get_allocation(mimeview->icon_vbox, &vbox_size);
+	gtk_widget_get_allocation(mimeview->icon_grid, &grid_size);
 	gtk_widget_get_allocation(mimeview->icon_scroll, &layout_size);
 		
 	gtk_layout_get_size(GTK_LAYOUT(mimeview->icon_scroll), &width, &height);
 	gtk_layout_set_size(GTK_LAYOUT(mimeview->icon_scroll), 
 			    width, 
-			    MAX(vbox_size.height, layout_size.height));
+			    MAX(grid_size.height, layout_size.height));
 	gtk_adjustment_set_step_increment(adj, 10);
 }
 
 static void icon_list_create(MimeView *mimeview, MimeInfo *mimeinfo)
 {
-	GtkRequisition size;
-	GtkRequisition requisition;
+	gint min_width, width;
 
 	cm_return_if_fail(mimeinfo != NULL);
 
@@ -2707,11 +2709,10 @@ static void icon_list_create(MimeView *mimeview, MimeInfo *mimeinfo)
 			 ? (MimeInfo *) mimeinfo->node->next->data 
 			 : NULL;
 	}
-	gtk_widget_size_request(mimeview->icon_vbox, &size);
-	gtk_widget_get_requisition(mimeview->icon_mainbox, &requisition);
-	if (size.width > requisition.width) {
+	gtk_widget_get_preferred_width(mimeview->icon_mainbox, &min_width, &width);
+	if (min_width < width) {
 		gtk_widget_set_size_request(mimeview->icon_mainbox, 
-					    size.width, -1);
+					    min_width, -1);
 	}
 	if (mimeview->opened)
 		icon_list_toggle_by_mime_info(mimeview,
@@ -2723,7 +2724,7 @@ static void icon_list_toggle_by_mime_info (MimeView	*mimeview,
 {
 	GList *children, *child;
 	
-	children = gtk_container_get_children(GTK_CONTAINER(mimeview->icon_vbox));
+	children = gtk_container_get_children(GTK_CONTAINER(mimeview->icon_grid));
 	for (child = children; child != NULL; child = g_list_next(child)) {
 		gboolean *highlight = NULL;
 		GtkWidget *icon = gtk_bin_get_child(GTK_BIN(child->data));
diff --git a/src/mimeview.h b/src/mimeview.h
index e520d55..14c4e85 100644
--- a/src/mimeview.h
+++ b/src/mimeview.h
@@ -66,7 +66,7 @@ struct _MimeView
 	GtkWidget *mime_notebook;
 	GtkWidget *ctree_mainbox;
 	GtkWidget *icon_scroll;
-	GtkWidget *icon_vbox;
+	GtkWidget *icon_grid;
 	GtkWidget *icon_mainbox;
 	GtkWidget *mime_toggle;
 	GtkWidget *scrollbutton;
diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c
index 87d640a..1e85a6c 100644
--- a/src/stock_pixmap.c
+++ b/src/stock_pixmap.c
@@ -1065,7 +1065,8 @@ GtkWidget *stock_pixmap_widget_with_overlay(StockPixmap icon,
 
 	stock_wid = stock_pixmap_widget(icon);
 	g_object_ref_sink(stock_wid);
-	gtk_widget_get_requisition(stock_wid, &requisition);
+	gtk_widget_get_preferred_height(stock_wid, NULL, &requisition.height);
+	gtk_widget_get_preferred_width(stock_wid, NULL, &requisition.width);
 
 #if !GTK_CHECK_VERSION(3, 0, 0)
 	if (gtk_image_get_storage_type(GTK_IMAGE(stock_wid)) == GTK_IMAGE_PIXMAP)

commit de2f37d8c715883af74983489f63bfceeab507eb
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Oct 5 20:08:25 2018 +0200

    Do not force textview's minimum width.

diff --git a/src/textview.c b/src/textview.c
index 29465bf..82718d8 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -307,8 +307,6 @@ TextView *textview_create(void)
 				       GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
 					    GTK_SHADOW_IN);
-	gtk_widget_set_size_request
-		(scrolledwin, prefs_common.mainview_width, -1);
 
 	/* create GtkSText widgets for single-byte and multi-byte character */
 	text = gtk_text_view_new();

commit 73ad30ba74873b61219301955efa29ede5ce1a32
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Oct 5 20:05:53 2018 +0200

    Correctly restore msgview and sourceview remembered window sizes.

diff --git a/src/messageview.c b/src/messageview.c
index 5663fd5..b696691 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -713,6 +713,9 @@ static MessageView *messageview_create_with_new_window_visible(MainWindow *mainw
 	gtk_window_set_title(GTK_WINDOW(window), _("Claws Mail - Message View"));
 	gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
 
+	gtk_window_set_default_size(GTK_WINDOW(window), prefs_common.msgwin_width,
+			prefs_common.msgwin_height);
+
 	if (!geometry.min_height) {
 		geometry.min_width = 320;
 		geometry.min_height = 200;
@@ -720,8 +723,6 @@ static MessageView *messageview_create_with_new_window_visible(MainWindow *mainw
 	gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
 				      GDK_HINT_MIN_SIZE);
 
-	gtk_widget_set_size_request(window, prefs_common.msgwin_width,
-				    prefs_common.msgwin_height);
 #ifdef G_OS_WIN32
 	gtk_window_move(GTK_WINDOW(window), 48, 48);
 #endif
diff --git a/src/sourcewindow.c b/src/sourcewindow.c
index 43c40ff..e170512 100644
--- a/src/sourcewindow.c
+++ b/src/sourcewindow.c
@@ -63,7 +63,7 @@ SourceWindow *source_window_create(void)
 	window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "sourcewindow");
 	gtk_window_set_title(GTK_WINDOW(window), _("Source of the message"));
 	gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
-	gtk_widget_set_size_request(window, prefs_common.sourcewin_width,
+	gtk_window_set_default_size(GTK_WINDOW(window), prefs_common.sourcewin_width,
 				    prefs_common.sourcewin_height);
 	
 	if (!geometry.min_height) {

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list