[gnome-control-center/wip/gbsneto/list-layout: 8/17] window: remove the small screen code



commit 82e54392b88872d1da755a02e5abf09fd3ed8dc8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun May 22 11:59:58 2016 -0300

    window: remove the small screen code
    
    Because the old layout was never meant to scale well on low
    resolution displays, we had to introduce code that adapts the
    window to be usable on low res screens.
    
    The problem with this code is that it still doesn't scale down
    very well for really low resolution screens. Partially because
    of the layout itself (which, again, was never meant to), partially
    because the panels request a size bigger than e.g. 720x480. Now,
    this is an important feature and we need to support that low
    resolution by default.
    
    To push this constraint forward, remove the code that managed a
    custom mode for low resolution screens. From now on, the Control
    Center shall be adapted to scale well on any screen sizes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766922

 shell/alt/cc-window.c |  118 -------------------------------------------------
 1 files changed, 0 insertions(+), 118 deletions(-)
---
diff --git a/shell/alt/cc-window.c b/shell/alt/cc-window.c
index d7287aa..1905de4 100644
--- a/shell/alt/cc-window.c
+++ b/shell/alt/cc-window.c
@@ -39,8 +39,6 @@
 #include "cc-panel-loader.h"
 #include "cc-util.h"
 
-#define FIXED_HEIGHT 636
-
 #define MOUSE_BACK_BUTTON 8
 
 #define DEFAULT_WINDOW_TITLE N_("All Settings")
@@ -49,12 +47,6 @@
 #define SEARCH_PAGE "_search"
 #define OVERVIEW_PAGE "_overview"
 
-typedef enum {
-       SMALL_SCREEN_UNSET,
-       SMALL_SCREEN_TRUE,
-       SMALL_SCREEN_FALSE
-} CcSmallScreen;
-
 struct _CcWindow
 {
   GtkApplicationWindow parent;
@@ -88,9 +80,6 @@ struct _CcWindow
   gchar **filter_terms;
 
   CcPanel *active_panel;
-
-  int monitor_num;
-  CcSmallScreen small_screen;
 };
 
 static void     cc_shell_iface_init         (CcShellInterface      *iface);
@@ -109,8 +98,6 @@ static gboolean cc_window_set_active_panel_from_id (CcShell      *shell,
                                                     GVariant     *parameters,
                                                     GError      **err);
 
-static gint get_monitor_height (CcWindow *self);
-
 static const gchar *
 get_icon_name_from_g_icon (GIcon *gicon)
 {
@@ -1244,92 +1231,6 @@ window_key_press_event (GtkWidget   *win,
   return retval;
 }
 
-static gint
-get_monitor_height (CcWindow *self)
-{
-  GdkScreen *screen;
-  GdkRectangle rect;
-
-  if (self->monitor_num < 0)
-    return 0;
-
-  /* We cannot use workarea here, as this wouldn't
-   * be updated when we read it after a monitors-changed signal */
-  screen = gtk_widget_get_screen (GTK_WIDGET (self));
-  gdk_screen_get_monitor_geometry (screen, self->monitor_num, &rect);
-
-  return rect.height;
-}
-
-static gboolean
-update_monitor_number (CcWindow *self)
-{
-  gboolean changed = FALSE;
-  GtkWidget *widget;
-  GdkScreen *screen;
-  GdkWindow *window;
-  int monitor;
-
-  widget = GTK_WIDGET (self);
-
-  window = gtk_widget_get_window (widget);
-  screen = gtk_widget_get_screen (widget);
-  monitor = gdk_screen_get_monitor_at_window (screen, window);
-  if (self->monitor_num != monitor)
-    {
-      self->monitor_num = monitor;
-      changed = TRUE;
-    }
-
-  return changed;
-}
-
-static CcSmallScreen
-is_small (CcWindow *self)
-{
-  if (get_monitor_height (self) <= FIXED_HEIGHT)
-    return SMALL_SCREEN_TRUE;
-  return SMALL_SCREEN_FALSE;
-}
-
-static void
-update_small_screen_settings (CcWindow *self)
-{
-  CcSmallScreen small;
-
-  update_monitor_number (self);
-  small = is_small (self);
-
-  if (small == SMALL_SCREEN_TRUE)
-    {
-      gtk_window_set_resizable (GTK_WINDOW (self), TRUE);
-
-      if (self->small_screen != small)
-        gtk_window_maximize (GTK_WINDOW (self));
-    }
-  else
-    {
-      if (self->small_screen != small)
-        gtk_window_unmaximize (GTK_WINDOW (self));
-
-      gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
-    }
-
-  self->small_screen = small;
-
-  /* And update the minimum sizes */
-  stack_page_notify_cb (GTK_STACK (self->stack), NULL, self);
-}
-
-static gboolean
-main_window_configure_cb (GtkWidget *widget,
-                          GdkEvent  *event,
-                          CcWindow  *self)
-{
-  update_small_screen_settings (self);
-  return FALSE;
-}
-
 static void
 application_set_cb (GObject    *object,
                     GParamSpec *pspec,
@@ -1341,21 +1242,10 @@ application_set_cb (GObject    *object,
   if (gtk_window_get_application (GTK_WINDOW (self)))
     {
       gtk_widget_realize (GTK_WIDGET (self));
-      update_small_screen_settings (self);
     }
 }
 
 static void
-monitors_changed_cb (GdkScreen *screen,
-                     CcWindow  *self)
-{
-  /* We reset small_screen_set to make sure that the
-   * window gets maximised if need be, in update_small_screen_settings() */
-  self->small_screen = SMALL_SCREEN_UNSET;
-  update_small_screen_settings (self);
-}
-
-static void
 gdk_window_set_cb (GObject    *object,
                    GParamSpec *pspec,
                    CcWindow   *self)
@@ -1478,7 +1368,6 @@ static void
 create_window (CcWindow *self)
 {
   GtkWidget *box;
-  GdkScreen *screen;
 
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_container_add (GTK_CONTAINER (self), box);
@@ -1515,10 +1404,6 @@ create_window (CcWindow *self)
   create_search_page (self);
 
   /* connect various signals */
-  screen = gtk_widget_get_screen (GTK_WIDGET (self));
-  g_signal_connect (screen, "monitors-changed", G_CALLBACK (monitors_changed_cb), self);
-
-  g_signal_connect (self, "configure-event", G_CALLBACK (main_window_configure_cb), self);
   g_signal_connect (self, "notify::application", G_CALLBACK (application_set_cb), self);
   g_signal_connect_after (self, "key_press_event",
                           G_CALLBACK (window_key_press_event), self);
@@ -1538,9 +1423,6 @@ create_window (CcWindow *self)
 static void
 cc_window_init (CcWindow *self)
 {
-  self->monitor_num = -1;
-  self->small_screen = SMALL_SCREEN_UNSET;
-
   create_window (self);
 
   self->previous_panels = g_queue_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]