mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-21 05:00:19 +00:00
Merge pull request #137 from ZoiteChat/network-tree-width-stacked
Preserve saved right pane size on first layout
This commit is contained in:
@@ -3376,6 +3376,23 @@ mg_rightpane_cb (GtkPaned *pane, GParamSpec *param, session_gui *gui)
|
|||||||
prefs.hex_gui_pane_right_size = allocation.width - gtk_paned_get_position (pane) - handle_size;
|
prefs.hex_gui_pane_right_size = allocation.width - gtk_paned_get_position (pane) - handle_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_restore_rightpane_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
|
||||||
|
{
|
||||||
|
int handle_size;
|
||||||
|
int saved_size;
|
||||||
|
/* only restore once, then disconnect */
|
||||||
|
g_signal_handlers_disconnect_by_func (widget, mg_restore_rightpane_cb, data);
|
||||||
|
/* use the value captured at connect time, since notify::position may
|
||||||
|
* have already overwritten prefs.hex_gui_pane_right_size during the
|
||||||
|
* initial layout pass */
|
||||||
|
saved_size = GPOINTER_TO_INT (data);
|
||||||
|
if (saved_size < 1)
|
||||||
|
return;
|
||||||
|
gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
|
||||||
|
gtk_paned_set_position (GTK_PANED (widget), allocation->width - saved_size - handle_size);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mg_add_pane_signals (session_gui *gui)
|
mg_add_pane_signals (session_gui *gui)
|
||||||
{
|
{
|
||||||
@@ -3409,6 +3426,13 @@ mg_create_center (session *sess, session_gui *gui, GtkWidget *box)
|
|||||||
/* sep between xtext and right side */
|
/* sep between xtext and right side */
|
||||||
gui->hpane_right = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
gui->hpane_right = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
|
||||||
|
/* restore right pane position after first allocation (needs widget width).
|
||||||
|
* capture the saved size now because notify::position will overwrite the
|
||||||
|
* pref during the initial layout before size-allocate fires. */
|
||||||
|
g_signal_connect (gui->hpane_right, "size-allocate",
|
||||||
|
G_CALLBACK (mg_restore_rightpane_cb),
|
||||||
|
GINT_TO_POINTER (prefs.hex_gui_pane_right_size));
|
||||||
|
|
||||||
if (prefs.hex_gui_win_swap)
|
if (prefs.hex_gui_win_swap)
|
||||||
{
|
{
|
||||||
gtk_paned_pack2 (GTK_PANED (gui->hpane_left), gui->vpane_left, FALSE, FALSE);
|
gtk_paned_pack2 (GTK_PANED (gui->hpane_left), gui->vpane_left, FALSE, FALSE);
|
||||||
|
|||||||
Reference in New Issue
Block a user