[console/wip/msandova/remember-window-size: 2/2] window: Remove kgx_window_get_size




commit c21fc7e7173c347ae1a831d7780f25aac99ab279
Author: Maximiliano Sandoval R <msandova gnome org>
Date:   Fri Jul 29 22:48:27 2022 +0200

    window: Remove kgx_window_get_size
    
    This is a gtk 3 leftover, gtk_window_get_default_size does the same.

 src/kgx-pages.c  |  2 +-
 src/kgx-window.c | 33 ++++-----------------------------
 src/kgx-window.h |  6 ------
 3 files changed, 5 insertions(+), 36 deletions(-)
---
diff --git a/src/kgx-pages.c b/src/kgx-pages.c
index 8137fee..d745314 100644
--- a/src/kgx-pages.c
+++ b/src/kgx-pages.c
@@ -441,7 +441,7 @@ create_window (AdwTabView *view,
   window = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self)));
   app = gtk_window_get_application (window);
 
-  kgx_window_get_size (KGX_WINDOW (window), &width, &height);
+  gtk_window_get_default_size (GTK_WINDOW (window), &width, &height);
 
   new_window = g_object_new (KGX_TYPE_WINDOW,
                              "application", app,
diff --git a/src/kgx-window.c b/src/kgx-window.c
index 6f779e8..1424e84 100644
--- a/src/kgx-window.c
+++ b/src/kgx-window.c
@@ -267,7 +267,7 @@ active_changed (GObject *object, GParamSpec *pspec, gpointer data)
 
 
 static void
-state_or_size_changed (KgxWindow  *self)
+state_changed (KgxWindow  *self)
 {
   GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
   GdkToplevelState state = gdk_toplevel_get_state (GDK_TOPLEVEL (surface));
@@ -288,10 +288,6 @@ state_or_size_changed (KgxWindow  *self)
   } else {
     gtk_widget_remove_css_class (GTK_WIDGET (self), "opaque");
   }
-
-  gtk_window_get_default_size (GTK_WINDOW (self),
-                               &self->current_width,
-                               &self->current_height);
 }
 
 
@@ -375,13 +371,9 @@ kgx_window_realize (GtkWidget *widget)
   surface = gtk_native_get_surface (GTK_NATIVE (self));
 
   g_signal_connect_swapped (surface, "notify::state",
-                            G_CALLBACK (state_or_size_changed), self);
-  g_signal_connect_swapped (self, "notify::default-width",
-                            G_CALLBACK (state_or_size_changed), self);
-  g_signal_connect_swapped (self, "notify::default-height",
-                            G_CALLBACK (state_or_size_changed), self);
+                            G_CALLBACK (state_changed), self);
 
-  state_or_size_changed (self);
+  state_changed (self);
 }
 
 
@@ -392,10 +384,7 @@ kgx_window_unrealize (GtkWidget *widget)
   GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
 
   g_signal_handlers_disconnect_by_func (surface,
-                                        G_CALLBACK (state_or_size_changed),
-                                        self);
-  g_signal_handlers_disconnect_by_func (self,
-                                        G_CALLBACK (state_or_size_changed),
+                                        G_CALLBACK (state_changed),
                                         self);
 
   GTK_WIDGET_CLASS (kgx_window_parent_class)->unrealize (widget);
@@ -736,17 +725,3 @@ kgx_window_get_pages (KgxWindow *self)
 
   return KGX_PAGES (self->pages);
 }
-
-
-void
-kgx_window_get_size (KgxWindow *self,
-                     int       *width,
-                     int       *height)
-{
-  g_return_if_fail (KGX_IS_WINDOW (self));
-
-  if (width)
-    *width = self->current_width;
-  if (height)
-    *height = self->current_height;
-}
diff --git a/src/kgx-window.h b/src/kgx-window.h
index 94bff51..d337ea6 100644
--- a/src/kgx-window.h
+++ b/src/kgx-window.h
@@ -97,8 +97,6 @@ struct _KgxWindow
   GtkWidget            *pages;
   GMenu                *primary_menu;
 
-  int                   current_width;
-  int                   current_height;
   gboolean              is_maximized_or_tiled;
 
   GActionMap           *tab_actions;
@@ -111,8 +109,4 @@ void        kgx_window_show_status     (KgxWindow    *self,
                                         const char   *status);
 KgxPages   *kgx_window_get_pages       (KgxWindow    *self);
 
-void        kgx_window_get_size        (KgxWindow    *self,
-                                        int          *width,
-                                        int          *height);
-
 G_END_DECLS


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