[gimp] app: small code reorganization.



commit 02220766b08ce72673c3b8969de2237c34b41ad1
Author: Jehan <jehan girinstud io>
Date:   Tue Feb 1 23:36:40 2022 +0100

    app: small code reorganization.
    
    Signal handler to the end with other private functions.

 app/widgets/gimpcontainerpopup.c | 66 +++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 31 deletions(-)
---
diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index 82ff7c2f9b..0639e5455d 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -61,6 +61,10 @@ static void   gimp_container_popup_view_type_toggled(GtkWidget          *button,
 static void   gimp_container_popup_dialog_clicked   (GtkWidget          *button,
                                                      GimpContainerPopup *popup);
 
+static void   gimp_container_popup_context_changed  (GimpContext        *context,
+                                                     GimpViewable       *viewable,
+                                                     GimpContainerPopup *popup);
+
 
 G_DEFINE_TYPE (GimpContainerPopup, gimp_container_popup, GIMP_TYPE_POPUP)
 
@@ -121,37 +125,6 @@ gimp_container_popup_confirm (GimpPopup *popup)
   GIMP_POPUP_CLASS (parent_class)->confirm (popup);
 }
 
-static void
-gimp_container_popup_context_changed (GimpContext        *context,
-                                      GimpViewable       *viewable,
-                                      GimpContainerPopup *popup)
-{
-  GdkEvent  *current_event;
-  GtkWidget *current_widget = GTK_WIDGET (popup);
-  gboolean   confirm        = FALSE;
-
-  current_event = gtk_get_current_event ();
-
-  if (current_event && gtk_widget_get_window (current_widget))
-    {
-      GdkWindow *event_window = gdk_window_get_effective_toplevel (((GdkEventAny *) current_event)->window);
-      GdkWindow *popup_window = gdk_window_get_effective_toplevel (gtk_widget_get_window (current_widget));
-
-      /* We need to differentiate a context change as a consequence of
-       * an event on another widget.
-       */
-      if ((((GdkEventAny *) current_event)->type == GDK_BUTTON_PRESS ||
-           ((GdkEventAny *) current_event)->type == GDK_BUTTON_RELEASE) &&
-          event_window == popup_window)
-        confirm = TRUE;
-
-      gdk_event_free (current_event);
-    }
-
-  if (confirm)
-    g_signal_emit_by_name (popup, "confirm");
-}
-
 GtkWidget *
 gimp_container_popup_new (GimpContainer     *container,
                           GimpContext       *context,
@@ -433,3 +406,34 @@ gimp_container_popup_dialog_clicked (GtkWidget          *button,
                                              popup->dialog_identifier);
   g_signal_emit_by_name (popup, "confirm");
 }
+
+static void
+gimp_container_popup_context_changed (GimpContext        *context,
+                                      GimpViewable       *viewable,
+                                      GimpContainerPopup *popup)
+{
+  GdkEvent  *current_event;
+  GtkWidget *current_widget = GTK_WIDGET (popup);
+  gboolean   confirm        = FALSE;
+
+  current_event = gtk_get_current_event ();
+
+  if (current_event && gtk_widget_get_window (current_widget))
+    {
+      GdkWindow *event_window = gdk_window_get_effective_toplevel (((GdkEventAny *) current_event)->window);
+      GdkWindow *popup_window = gdk_window_get_effective_toplevel (gtk_widget_get_window (current_widget));
+
+      /* We need to differentiate a context change as a consequence of
+       * an event on another widget.
+       */
+      if ((((GdkEventAny *) current_event)->type == GDK_BUTTON_PRESS ||
+           ((GdkEventAny *) current_event)->type == GDK_BUTTON_RELEASE) &&
+          event_window == popup_window)
+        confirm = TRUE;
+
+      gdk_event_free (current_event);
+    }
+
+  if (confirm)
+    g_signal_emit_by_name (popup, "confirm");
+}


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