[gimp/gtk3-port: 217/228] app: implement GtkContainer::get_path_for_child() in GimpMessageBox



commit 9cac06918303cd41a254bf05137d860658d62b76
Author: Michael Natterer <mitch gimp org>
Date:   Mon Sep 26 01:15:36 2011 +0200

    app: implement GtkContainer::get_path_for_child() in GimpMessageBox
    
    and handle our internal icon child ourselves.

 app/widgets/gimpmessagebox.c |   43 +++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 9 deletions(-)
---
diff --git a/app/widgets/gimpmessagebox.c b/app/widgets/gimpmessagebox.c
index e624bda..48a457e 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -66,6 +66,9 @@ static void   gimp_message_box_forall               (GtkContainer   *container,
                                                      gboolean        include_internals,
                                                      GtkCallback     callback,
                                                      gpointer        callback_data);
+static GtkWidgetPath *
+              gimp_message_box_get_path_for_child   (GtkContainer   *container,
+                                                     GtkWidget      *child);
 
 
 G_DEFINE_TYPE (GimpMessageBox, gimp_message_box, GTK_TYPE_BOX)
@@ -80,17 +83,18 @@ gimp_message_box_class_init (GimpMessageBoxClass *klass)
   GtkWidgetClass    *widget_class    = GTK_WIDGET_CLASS (klass);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
 
-  object_class->constructed          = gimp_message_box_constructed;
-  object_class->dispose              = gimp_message_box_dispose;
-  object_class->finalize             = gimp_message_box_finalize;
-  object_class->set_property         = gimp_message_box_set_property;
-  object_class->get_property         = gimp_message_box_get_property;
+  object_class->constructed           = gimp_message_box_constructed;
+  object_class->dispose               = gimp_message_box_dispose;
+  object_class->finalize              = gimp_message_box_finalize;
+  object_class->set_property          = gimp_message_box_set_property;
+  object_class->get_property          = gimp_message_box_get_property;
 
-  widget_class->get_preferred_width  = gimp_message_box_get_preferred_width;
-  widget_class->get_preferred_height = gimp_message_box_get_preferred_height;
-  widget_class->size_allocate        = gimp_message_box_size_allocate;
+  widget_class->get_preferred_width   = gimp_message_box_get_preferred_width;
+  widget_class->get_preferred_height  = gimp_message_box_get_preferred_height;
+  widget_class->size_allocate         = gimp_message_box_size_allocate;
 
-  container_class->forall            = gimp_message_box_forall;
+  container_class->forall             = gimp_message_box_forall;
+  container_class->get_path_for_child = gimp_message_box_get_path_for_child;
 
   gtk_container_class_handle_border_width (container_class);
 
@@ -341,6 +345,27 @@ gimp_message_box_forall (GtkContainer *container,
                                               callback, callback_data);
 }
 
+static GtkWidgetPath *
+gimp_message_box_get_path_for_child (GtkContainer *container,
+                                     GtkWidget    *child)
+{
+  GimpMessageBox *box = GIMP_MESSAGE_BOX (container);
+
+  if (child == box->image)
+    {
+      GtkWidgetPath *path;
+
+      path = gtk_widget_path_copy (gtk_widget_get_path (GTK_WIDGET (container)));
+
+      gtk_widget_path_append_for_widget (path, child);
+
+      return path;
+    }
+
+  return GTK_CONTAINER_CLASS (parent_class)->get_path_for_child (container,
+                                                                 child);
+}
+
 static void
 gimp_message_box_set_label_text (GimpMessageBox *box,
                                  gint            n,



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