[gnome-packagekit] Don't use a large package screen on notebooks with small displays
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-packagekit] Don't use a large package screen on notebooks with small displays
- Date: Sun, 28 Jun 2009 17:39:16 +0000 (UTC)
commit 5d80f51e0ef80f654dd56668a4179efeb2846fe7
Author: Richard Hughes <richard hughsie com>
Date: Fri Jun 26 16:15:29 2009 +0100
Don't use a large package screen on notebooks with small displays
src/gpk-common.c | 19 +++++++++++++++++--
src/gpk-common.h | 1 +
src/gpk-dialog.c | 20 ++++++++++++++------
3 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/gpk-common.c b/src/gpk-common.c
index 4e69e5e..57c6942 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -48,6 +48,9 @@
/* if the dialog is going to cover more than this much of the screen, then maximise it at startup */
#define GPK_SMALL_FORM_FACTOR_SCREEN_PERCENT 75 /* % */
+/* static, so local to process */
+static gboolean small_form_factor_mode = FALSE;
+
#if (!PK_CHECK_VERSION(0,5,0))
/**
* gpk_error_code_is_need_untrusted:
@@ -198,6 +201,15 @@ gtk_text_buffer_insert_markup (GtkTextBuffer *buffer, GtkTextIter *iter, const g
}
/**
+ * gpk_window_get_small_form_factor_mode:
+ **/
+gboolean
+gpk_window_get_small_form_factor_mode (void)
+{
+ return small_form_factor_mode;
+}
+
+/**
* gpk_window_set_size_request:
**/
gboolean
@@ -224,13 +236,16 @@ gpk_window_set_size_request (GtkWindow *window, guint width, guint height)
egg_debug ("using small form factor mode as %ix%i and requested %ix%i",
screen_w, screen_h, width, height);
gtk_window_maximize (window);
- return FALSE;
+ small_form_factor_mode = TRUE;
+ goto out;
}
/* normal size laptop panel */
egg_debug ("using native mode: %ix%i", width, height);
gtk_window_set_default_size (window, width, height);
- return TRUE;
+ small_form_factor_mode = FALSE;
+out:
+ return !small_form_factor_mode;
}
/**
diff --git a/src/gpk-common.h b/src/gpk-common.h
index 7f558d0..35eb5e3 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -106,6 +106,7 @@ gboolean gpk_window_set_size_request (GtkWindow *window,
guint width,
guint height);
gboolean gpk_ignore_session_error (GError *error);
+gboolean gpk_window_get_small_form_factor_mode (void);
#if (!PK_CHECK_VERSION(0,5,0))
gboolean gpk_error_code_is_need_untrusted (PkErrorCodeEnum error_code);
#endif
diff --git a/src/gpk-dialog.c b/src/gpk-dialog.c
index a6e8a9b..768471a 100644
--- a/src/gpk-dialog.c
+++ b/src/gpk-dialog.c
@@ -176,6 +176,7 @@ gpk_dialog_embed_package_list_widget (GtkDialog *dialog, PkPackageList *list)
GtkListStore *store;
GtkWidget *widget;
guint length;
+ gboolean sffm;
/* convert to a store */
store = gpk_dialog_package_list_to_list_store (list);
@@ -194,16 +195,23 @@ gpk_dialog_embed_package_list_widget (GtkDialog *dialog, PkPackageList *list)
/* add some spacing to conform to the GNOME HIG */
gtk_container_set_border_width (GTK_CONTAINER (scroll), 6);
- length = pk_package_list_get_size (list);
- if (length > 5) {
- gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 300);
- } else if (length > 1) {
- gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 150);
+ /* are we a normal size desktop, in which case, give the package list more space */
+ sffm = gpk_window_get_small_form_factor_mode ();
+ if (!sffm) {
+ length = pk_package_list_get_size (list);
+ if (length > 5) {
+ gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 300);
+ } else if (length > 1) {
+ gtk_widget_set_size_request (GTK_WIDGET (scroll), -1, 150);
+ }
}
/* add scrolled window */
widget = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
- gtk_container_add (GTK_CONTAINER (widget), scroll);
+ gtk_container_add_with_properties (GTK_CONTAINER (widget), scroll,
+ "expand", TRUE,
+ "fill", TRUE,
+ NULL);
/* free the store */
g_signal_connect (G_OBJECT (dialog), "unrealize",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]