[gtk/wip/matthiasc/focus2: 25/32] inspector: Stop using ::set-focus



commit 45e4527c474c6687ffea5fb1c9d60940b29f873d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 3 07:55:14 2019 -0500

    inspector: Stop using ::set-focus
    
    The focus-widget is just a regular property now that shows
    up on the property page. No need to special-case it on
    the misc page anymore.

 gtk/inspector/misc-info.c  | 50 ----------------------------------------------
 gtk/inspector/misc-info.ui | 37 ----------------------------------
 2 files changed, 87 deletions(-)
---
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index f352894daf..1d9d053d7d 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -46,9 +46,6 @@ struct _GtkInspectorMiscInfoPrivate {
   GtkWidget *default_widget_row;
   GtkWidget *default_widget;
   GtkWidget *default_widget_button;
-  GtkWidget *focus_widget_row;
-  GtkWidget *focus_widget;
-  GtkWidget *focus_widget_button;
   GtkWidget *mnemonic_label_row;
   GtkWidget *mnemonic_label;
   GtkWidget *request_mode_row;
@@ -217,43 +214,6 @@ show_default_widget (GtkWidget *button, GtkInspectorMiscInfo *sl)
     show_object (sl, G_OBJECT (widget), "properties"); 
 }
 
-static void
-update_focus_widget (GtkInspectorMiscInfo *sl)
-{
-  GtkWidget *widget;
-
-  widget = gtk_root_get_focus (GTK_ROOT (sl->priv->object));
-  if (widget)
-    {
-      gchar *tmp;
-      tmp = g_strdup_printf ("%p", widget);
-      gtk_label_set_label (GTK_LABEL (sl->priv->focus_widget), tmp);
-      g_free (tmp);
-      gtk_widget_set_sensitive (sl->priv->focus_widget_button, TRUE);
-    }
-  else
-    {
-      gtk_label_set_label (GTK_LABEL (sl->priv->focus_widget), "NULL");   
-      gtk_widget_set_sensitive (sl->priv->focus_widget_button, FALSE);
-    }
-}
-
-static void
-set_focus_cb (GtkWindow *window, GtkWidget *focus, GtkInspectorMiscInfo *sl)
-{
-  update_focus_widget (sl);
-}
-
-static void
-show_focus_widget (GtkWidget *button, GtkInspectorMiscInfo *sl)
-{
-  GtkWidget *widget;
-
-  widget = gtk_root_get_focus (GTK_ROOT (sl->priv->object));
-  if (widget)
-    show_object (sl, G_OBJECT (widget), "properties");
-}
-
 static void
 show_mnemonic_label (GtkWidget *button, GtkInspectorMiscInfo *sl)
 {
@@ -358,7 +318,6 @@ update_info (gpointer data)
   if (GTK_IS_WINDOW (sl->priv->object))
     {
       update_default_widget (sl);
-      update_focus_widget (sl);
     }
 
   if (GDK_IS_FRAME_CLOCK (sl->priv->object))
@@ -408,7 +367,6 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
   if (sl->priv->object)
     {
       g_signal_handlers_disconnect_by_func (sl->priv->object, state_flags_changed, sl);
-      g_signal_handlers_disconnect_by_func (sl->priv->object, set_focus_cb, sl);
       g_signal_handlers_disconnect_by_func (sl->priv->object, allocation_changed, sl);
       disconnect_each_other (sl->priv->object, G_OBJECT (sl));
       disconnect_each_other (sl, sl->priv->object);
@@ -475,14 +433,10 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
   if (GTK_IS_WINDOW (object))
     {
       gtk_widget_show (sl->priv->default_widget_row);
-      gtk_widget_show (sl->priv->focus_widget_row);
-
-      g_signal_connect_object (object, "set-focus", G_CALLBACK (set_focus_cb), sl, G_CONNECT_AFTER);
     }
   else
     {
       gtk_widget_hide (sl->priv->default_widget_row);
-      gtk_widget_hide (sl->priv->focus_widget_row);
     }
 
   if (GDK_IS_FRAME_CLOCK (object))
@@ -595,9 +549,6 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, default_widget_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, default_widget);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, default_widget_button);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, focus_widget_row);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, focus_widget);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, focus_widget_button);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, mnemonic_label_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, mnemonic_label);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, request_mode_row);
@@ -631,7 +582,6 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible);
 
   gtk_widget_class_bind_template_callback (widget_class, show_default_widget);
-  gtk_widget_class_bind_template_callback (widget_class, show_focus_widget);
   gtk_widget_class_bind_template_callback (widget_class, show_frame_clock);
 }
 
diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui
index 0ee5082e24..cbb3ef65b4 100644
--- a/gtk/inspector/misc-info.ui
+++ b/gtk/inspector/misc-info.ui
@@ -157,42 +157,6 @@
                     </child>
                   </object>
                 </child>
-                <child>
-                  <object class="GtkListBoxRow" id="focus_widget_row">
-                    <property name="activatable">0</property>
-                    <child>
-                      <object class="GtkBox">
-                        <property name="margin">10</property>
-                        <property name="spacing">40</property>
-                        <child>
-                          <object class="GtkLabel" id="focus_widget_label">
-                            <property name="label" translatable="yes">Focus Widget</property>
-                            <property name="halign">start</property>
-                            <property name="valign">baseline</property>
-                            <property name="xalign">0.0</property>
-                            <property name="hexpand">1</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="focus_widget">
-                            <property name="selectable">1</property>
-                            <property name="halign">end</property>
-                            <property name="valign">baseline</property>
-                            <property name="ellipsize">end</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="focus_widget_button">
-                            <property name="halign">end</property>
-                            <property name="valign">baseline</property>
-                            <property name="label" translatable="yes">Properties</property>
-                            <signal name="clicked" handler="show_focus_widget"/>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
                 <child>
                   <object class="GtkListBoxRow" id="mnemonic_label_row">
                     <property name="activatable">0</property>
@@ -616,7 +580,6 @@
       <widget name="state_label"/>
       <widget name="buildable_id_label"/>
       <widget name="default_widget_label"/>
-      <widget name="focus_widget_label"/>
       <widget name="frame_clock_label"/>
     </widgets>
   </object>


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