[gnome-terminal] profile: editor: Make the profile preferences a GtkWindow



commit 5cb4714d5bb20fe94b824d4203ab113ed18608a7
Author: Christian Persch <chpe gnome org>
Date:   Sun May 10 13:32:30 2015 +0200

    profile: editor: Make the profile preferences a GtkWindow
    
    This fixes a warning whenever it's shown:
    Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

 src/profile-editor.c       |   31 +++++-------
 src/profile-preferences.ui |  114 +++++++++++++++++++++++---------------------
 2 files changed, 72 insertions(+), 73 deletions(-)
---
diff --git a/src/profile-editor.c b/src/profile-editor.c
index 3914507..c5019fd 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -532,16 +532,16 @@ init_encodings_combo (GtkWidget *widget)
 }
 
 static void
-editor_response_cb (GtkWidget *editor,
-                    int response,
-                    gpointer use_data)
+editor_help_button_clicked_cb (GtkWidget *button,
+                               GtkWidget *editor)
 {
-  if (response == GTK_RESPONSE_HELP)
-    {
-      terminal_util_show_help ("profile", GTK_WINDOW (editor));
-      return;
-    }
+  terminal_util_show_help ("profile", GTK_WINDOW (editor));
+}
 
+static void
+editor_close_button_clicked_cb (GtkWidget *button,
+                                GtkWidget *editor)
+{
   gtk_widget_destroy (editor);
 }
 
@@ -798,13 +798,6 @@ terminal_profile_edit (GSettings  *profile,
   g_object_set_data_full (G_OBJECT (editor), "builder",
                           builder, (GDestroyNotify) g_object_unref);
 
-  /* Fixup dialogue padding, #735242 */
-  w = (GtkWidget *) gtk_builder_get_object (builder, "dialog-action-area");
-  gtk_widget_set_margin_left   (w, 5);
-  gtk_widget_set_margin_right  (w, 5);
-  gtk_widget_set_margin_top    (w, 5);
-  gtk_widget_set_margin_bottom (w, 5);
-
   /* Store the dialogue on the profile, so we can acccess it above to check if
    * there's already a profile editor for this profile.
    */
@@ -814,9 +807,11 @@ terminal_profile_edit (GSettings  *profile,
                     G_CALLBACK (profile_editor_destroyed),
                     profile);
 
-  g_signal_connect (editor, "response",
-                    G_CALLBACK (editor_response_cb),
-                    NULL);
+  w = (GtkWidget *) gtk_builder_get_object  (builder, "close-button");
+  g_signal_connect (w, "clicked", G_CALLBACK (editor_close_button_clicked_cb), editor);
+
+  w = (GtkWidget *) gtk_builder_get_object  (builder, "help-button");
+  g_signal_connect (w, "clicked", G_CALLBACK (editor_help_button_clicked_cb), editor);
 
   w = (GtkWidget *) gtk_builder_get_object  (builder, "profile-editor-notebook");
   gtk_widget_add_events (w, GDK_BUTTON_PRESS_MASK | GDK_SCROLL_MASK);
diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui
index e128a54..579c28f 100644
--- a/src/profile-preferences.ui
+++ b/src/profile-preferences.ui
@@ -143,69 +143,29 @@
       </row>
     </data>
   </object>
-  <object class="GtkDialog" id="profile-editor-dialog">
-    <property name="visible">True</property>
+  <object class="GtkWindow" id="profile-editor-dialog">
+    <property name="visible">False</property>
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">0</property>
     <property name="title" translatable="yes">Profile Editor</property>
     <property name="role">gnome-terminal-profile-editor</property>
     <property name="resizable">False</property>
-    <property name="destroy_with_parent">True</property>
     <property name="type_hint">normal</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+    <child>
+      <object class="GtkBox" id="dialogue-content-box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="margin_left">12</property>
+        <property name="margin_right">12</property>
+        <property name="margin_top">12</property>
+        <property name="margin_bottom">12</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action-area">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="helpbutton2">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="closebutton2">
-                <property name="label">gtk-close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
+        <property name="spacing">12</property>
         <child>
           <object class="GtkNotebook" id="profile-editor-notebook">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="border_width">5</property>
+            <property name="border_width">0</property>
             <child>
               <object class="GtkVBox" id="vbox3">
                 <property name="visible">True</property>
@@ -1812,11 +1772,55 @@
             <property name="position">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkButtonBox" id="dialogue-buttonbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">12</property>
+            <property name="layout_style">start</property>
+            <child>
+              <object class="GtkButton" id="help-button">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">start</property>
+                <property name="position">0</property>
+                <property name="secondary">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close-button">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <property name="focus_on_click">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">1</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-11">helpbutton2</action-widget>
-      <action-widget response="-7">closebutton2</action-widget>
-    </action-widgets>
   </object>
 </interface>


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