[gnome-terminal] terminal-screen: Remove style-updated handlers



commit f38b805cce31a2c2ceb2fd93c11e04f0c18e2242
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jan 18 01:08:05 2013 -0500

    terminal-screen: Remove style-updated handlers
    
    Let the TerminalWindow tell us when the style is updated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691997

 src/terminal-screen.c |   29 +++++------------------------
 src/terminal-screen.h |    2 ++
 src/terminal-window.c |   32 ++++++++++++++++++++++++++------
 src/terminal-window.h |    6 ------
 4 files changed, 33 insertions(+), 36 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 1cf1db8..bf64ee2 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -128,7 +128,6 @@ static void terminal_screen_drag_data_received (GtkWidget        *widget,
 static void terminal_screen_system_font_changed_cb (GSettings *,
                                                     const char*,
                                                     TerminalScreen *screen);
-static void terminal_screen_change_font (TerminalScreen *screen);
 static gboolean terminal_screen_popup_menu (GtkWidget *widget);
 static gboolean terminal_screen_button_press (GtkWidget *widget,
                                               GdkEventButton *event);
@@ -245,17 +244,11 @@ terminal_screen_realize (GtkWidget *widget)
   terminal_screen_set_font (screen);
 }
 
-static void
-terminal_screen_style_updated (GtkWidget *widget)
+void
+terminal_screen_update_style (TerminalScreen *screen)
 {
-  TerminalScreen *screen = TERMINAL_SCREEN (widget);
-
-  GTK_WIDGET_CLASS (terminal_screen_parent_class)->style_updated (widget);
-
   update_color_scheme (screen);
-
-  if (gtk_widget_get_realized (widget))
-    terminal_screen_change_font (screen);
+  terminal_screen_set_font (screen);
 }
 
 #ifdef GNOME_ENABLE_DEBUG
@@ -433,7 +426,6 @@ terminal_screen_class_init (TerminalScreenClass *klass)
   object_class->set_property = terminal_screen_set_property;
 
   widget_class->realize = terminal_screen_realize;
-  widget_class->style_updated = terminal_screen_style_updated;
   widget_class->drag_data_received = terminal_screen_drag_data_received;
   widget_class->button_press_event = terminal_screen_button_press;
   widget_class->popup_menu = terminal_screen_popup_menu;
@@ -883,7 +875,7 @@ terminal_screen_profile_changed_cb (GSettings     *profile,
       (!prop_name ||
        prop_name == I_(TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY) ||
        prop_name == I_(TERMINAL_PROFILE_FONT_KEY)))
-    terminal_screen_change_font (screen);
+    terminal_screen_set_font (screen);
 
   if (!prop_name ||
       prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS_KEY) ||
@@ -1018,18 +1010,7 @@ terminal_screen_system_font_changed_cb (GSettings      *settings,
   if (!g_settings_get_boolean (settings, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY))
     return;
 
-  terminal_screen_change_font (screen);
-}
-
-static void
-terminal_screen_change_font (TerminalScreen *screen)
-{
-  TerminalWindow *window;
-
   terminal_screen_set_font (screen);
-
-  window = terminal_screen_get_window (screen);
-  terminal_window_set_size (window, screen);
 }
 
 void
@@ -1730,7 +1711,7 @@ terminal_screen_set_font_scale (TerminalScreen *screen,
   if (gtk_widget_get_realized (GTK_WIDGET (screen)))
     {
       /* Update the font */
-      terminal_screen_change_font (screen);
+      terminal_screen_set_font (screen);
     }
 }
 
diff --git a/src/terminal-screen.h b/src/terminal-screen.h
index f8b68e9..00c5062 100644
--- a/src/terminal-screen.h
+++ b/src/terminal-screen.h
@@ -132,6 +132,8 @@ void terminal_screen_save_config (TerminalScreen *screen,
                                   GKeyFile *key_file,
                                   const char *group);
 
+void terminal_screen_update_style (TerminalScreen *screen);
+
 gboolean terminal_screen_has_foreground_process (TerminalScreen *screen);
 
 /* Allow scales a bit smaller and a bit larger than the usual pango ranges */
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 1740247..5599429 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -230,6 +230,14 @@ sync_screen_icon_title (TerminalScreen *screen,
                         GParamSpec *psepc,
                         TerminalWindow *window);
 
+static void terminal_window_set_size (TerminalWindow *window,
+                                      TerminalScreen *screen);
+
+static void terminal_window_set_size_force_grid (TerminalWindow *window,
+                                                 TerminalScreen *screen,
+                                                 int force_grid_width,
+                                                 int force_grid_height);
+
 G_DEFINE_TYPE (TerminalWindow, terminal_window, GTK_TYPE_APPLICATION_WINDOW)
 
 /* Menubar mnemonics & accel settings handling */
@@ -1950,6 +1958,21 @@ terminal_window_init (TerminalWindow *window)
 }
 
 static void
+terminal_window_style_updated (GtkWidget *widget)
+{
+  TerminalWindow *window = TERMINAL_WINDOW (widget);
+  TerminalWindowPrivate *priv = window->priv;
+
+  GTK_WIDGET_CLASS (terminal_window_parent_class)->style_updated (widget);
+
+  if (priv->active_screen != NULL)
+    {
+      terminal_screen_update_style (priv->active_screen);
+      terminal_window_set_size (window, priv->active_screen);
+    }
+}
+
+static void
 terminal_window_class_init (TerminalWindowClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1963,6 +1986,7 @@ terminal_window_class_init (TerminalWindowClass *klass)
   widget_class->map_event = terminal_window_map_event;
   widget_class->window_state_event = terminal_window_state_event;
   widget_class->screen_changed = terminal_window_screen_changed;
+  widget_class->style_updated = terminal_window_style_updated;
 
   g_type_class_add_private (object_class, sizeof (TerminalWindowPrivate));
 }
@@ -2314,14 +2338,14 @@ terminal_window_get_mdi_container (TerminalWindow *window)
   return GTK_WIDGET (priv->mdi_container);
 }
 
-void
+static void
 terminal_window_set_size (TerminalWindow *window,
                           TerminalScreen *screen)
 {
   terminal_window_set_size_force_grid (window, screen, -1, -1);
 }
 
-void
+static void
 terminal_window_set_size_force_grid (TerminalWindow *window,
                                      TerminalScreen *screen,
                                      int             force_grid_width,
@@ -2330,10 +2354,6 @@ terminal_window_set_size_force_grid (TerminalWindow *window,
   int grid_width;
   int grid_height;
 
-  /* Only update the geometry from the active screen. */
-  if (window->priv->active_screen != screen)
-    return;
-
   /* be sure our geometry is up-to-date */
   terminal_window_update_geometry (window);
 
diff --git a/src/terminal-window.h b/src/terminal-window.h
index 6fdfa0a..880ec19 100644
--- a/src/terminal-window.h
+++ b/src/terminal-window.h
@@ -84,12 +84,6 @@ gboolean terminal_window_parse_geometry (TerminalWindow *window,
 					 const char     *geometry);
 
 void terminal_window_update_geometry  (TerminalWindow *window);
-void terminal_window_set_size         (TerminalWindow *window,
-                                       TerminalScreen *screen);
-void terminal_window_set_size_force_grid (TerminalWindow *window,
-                                          TerminalScreen *screen,
-                                          int             force_grid_width,
-                                          int             force_grid_height);
 
 GtkWidget* terminal_window_get_mdi_container (TerminalWindow *window);
 



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