shell: use a fixed width for the main window

Use a fixed width for the shell, since resizing horizontally is more
awkward for the user than resizing vertically.
This commit is contained in:
Thomas Wood 2010-07-22 17:48:18 +01:00
parent b7ab940c78
commit 84d07fee7a

View file

@ -73,9 +73,13 @@ struct _GnomeControlCenterPrivate
gchar *default_window_title; gchar *default_window_title;
gchar *default_window_icon; gchar *default_window_icon;
gint overview_width, overview_height; gint overview_height;
}; };
/* Use a fixed width for the shell, since resizing horizontally is more awkward
* for the user than resizing vertically */
#define FIXED_WIDTH 750
static void static void
activate_panel (GnomeControlCenter *shell, activate_panel (GnomeControlCenter *shell,
@ -140,7 +144,6 @@ activate_panel (GnomeControlCenter *shell,
GtkAllocation alloc; GtkAllocation alloc;
gtk_widget_get_allocation (priv->window, &alloc); gtk_widget_get_allocation (priv->window, &alloc);
priv->overview_width = alloc.width;
priv->overview_height = alloc.height; priv->overview_height = alloc.height;
} }
@ -158,10 +161,11 @@ activate_panel (GnomeControlCenter *shell,
gtk_widget_show (panel); gtk_widget_show (panel);
/* resize to the preferred size of the panel */ /* resize to the preferred size of the panel */
gtk_widget_set_size_request (priv->window, -1, -1); gtk_widget_set_size_request (priv->window, FIXED_WIDTH, -1);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->window), &min, gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->window), &min,
&nat); &nat);
gtk_window_resize (GTK_WINDOW (priv->window), nat.width, nat.height); gtk_window_resize (GTK_WINDOW (priv->window), FIXED_WIDTH,
nat.height);
return; return;
} }
} }
@ -223,14 +227,14 @@ shell_show_overview_page (GnomeControlCenterPrivate *priv)
gtk_window_set_icon_name (GTK_WINDOW (priv->window), gtk_window_set_icon_name (GTK_WINDOW (priv->window),
priv->default_window_icon); priv->default_window_icon);
/* resize back to the original overview size */ /* resize back to the original overview height */
if (priv->overview_width > 0 && priv->overview_height > 0) if (priv->overview_height > 0)
{ {
gtk_widget_set_size_request (priv->window, gtk_widget_set_size_request (priv->window,
priv->overview_width, FIXED_WIDTH,
priv->overview_height); priv->overview_height);
gtk_window_resize (GTK_WINDOW (priv->window), gtk_window_resize (GTK_WINDOW (priv->window),
priv->overview_width, FIXED_WIDTH,
priv->overview_height); priv->overview_height);
} }
} }