Commit 952ab095 authored by Adrien Dorsaz's avatar Adrien Dorsaz

rep_budget_balance.c: force window resize on view change

parent 2e793402
......@@ -791,8 +791,9 @@ gboolean is_visible = TRUE;
static void repbudgetbalance_view_toggle (gpointer user_data, gint view_mode)
{
struct repbudgetbalance_data *data = user_data;
GtkWidget *budget;
GtkWidget *budget, *scrolledwindow;
GtkTreeModel *model;
gint w, h;
budget = data->TV_budget;
......@@ -801,6 +802,15 @@ GtkTreeModel *model;
gtk_tree_view_set_model(GTK_TREE_VIEW(budget), model);
gtk_tree_view_expand_all(GTK_TREE_VIEW(budget));
// Resize the window to get natural width for the dialog
scrolledwindow = gtk_widget_get_parent(GTK_WIDGET(budget));
g_object_ref(budget); // Add temporary a manual ref to keep the view alive
gtk_container_remove(GTK_CONTAINER(scrolledwindow), budget);
gtk_window_get_size(GTK_WINDOW(GLOBALS->mainwindow), &w, &h);
gtk_window_resize (GTK_WINDOW(data->window), 1, h * 0.8);
gtk_container_add(GTK_CONTAINER(scrolledwindow), budget);
g_object_unref(budget);
/* to automatically destroy then model with view */
g_object_unref(model);
......@@ -994,7 +1004,7 @@ gint gridrow, w, h;
//set a nice dialog size
gtk_window_get_size(GTK_WINDOW(GLOBALS->mainwindow), &w, &h);
gtk_window_set_default_size (GTK_WINDOW(dialog), -1, h/PHI);
gtk_window_set_default_size (GTK_WINDOW(dialog), -1, h * 0.8);
// design content
grid = gtk_grid_new ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment