[gedit] Use GtkGrid in the replace dialog.



commit e19c39e72c67e4c737db15bd42d153b7e778d8ff
Author: Paolo Borelli <pborelli gnome org>
Date:   Fri Sep 30 23:00:51 2011 +0200

    Use GtkGrid in the replace dialog.

 gedit/dialogs/gedit-replace-dialog.c  |   38 ++++++++++++++------------------
 gedit/dialogs/gedit-replace-dialog.ui |   22 ++++++++++++-------
 2 files changed, 31 insertions(+), 29 deletions(-)
---
diff --git a/gedit/dialogs/gedit-replace-dialog.c b/gedit/dialogs/gedit-replace-dialog.c
index 7607295..a21ee28 100644
--- a/gedit/dialogs/gedit-replace-dialog.c
+++ b/gedit/dialogs/gedit-replace-dialog.c
@@ -48,7 +48,7 @@
 
 struct _GeditReplaceDialogPrivate
 {
-	GtkWidget *table;
+	GtkWidget *grid;
 	GtkWidget *search_label;
 	GtkWidget *search_entry;
 	GtkWidget *search_text_entry;
@@ -226,7 +226,7 @@ gedit_replace_dialog_init (GeditReplaceDialog *dlg)
 					  root_objects,
 					  &error_widget,
 					  "replace_dialog_content", &content,
-					  "table", &dlg->priv->table,
+					  "grid", &dlg->priv->grid,
 					  "search_label", &dlg->priv->search_label,
 					  "replace_with_label", &dlg->priv->replace_label,
 					  "match_case_checkbutton", &dlg->priv->match_case_checkbutton,
@@ -251,36 +251,32 @@ gedit_replace_dialog_init (GeditReplaceDialog *dlg)
 		return;
 	}
 
-	gtk_table_set_row_spacings (GTK_TABLE (dlg->priv->table), 12);
-
-	dlg->priv->search_entry = gedit_history_entry_new ("search-for-entry",
-							   TRUE);
+	dlg->priv->search_entry = gedit_history_entry_new ("search-for-entry", TRUE);
 	gtk_widget_set_size_request (dlg->priv->search_entry, 300, -1);
 	gedit_history_entry_set_escape_func
 			(GEDIT_HISTORY_ENTRY (dlg->priv->search_entry),
 			 (GeditHistoryEntryEscapeFunc) gedit_utils_escape_search_text);
-
+	gtk_widget_set_hexpand (GTK_WIDGET (dlg->priv->search_entry), TRUE);
 	dlg->priv->search_text_entry = gedit_history_entry_get_entry
 			(GEDIT_HISTORY_ENTRY (dlg->priv->search_entry));
-	gtk_entry_set_activates_default (GTK_ENTRY (dlg->priv->search_text_entry),
-					 TRUE);
-	gtk_table_attach_defaults (GTK_TABLE (dlg->priv->table),
-				   dlg->priv->search_entry,
-				   1, 2, 0, 1);
-
-	dlg->priv->replace_entry = gedit_history_entry_new ("replace-with-entry",
-							    TRUE);
+	gtk_entry_set_activates_default (GTK_ENTRY (dlg->priv->search_text_entry), TRUE);
+	gtk_grid_attach_next_to (GTK_GRID (dlg->priv->grid),
+				 dlg->priv->search_entry,
+				 dlg->priv->search_label,
+				 GTK_POS_RIGHT, 1, 1);
+
+	dlg->priv->replace_entry = gedit_history_entry_new ("replace-with-entry", TRUE);
 	gedit_history_entry_set_escape_func
 			(GEDIT_HISTORY_ENTRY (dlg->priv->replace_entry),
 			 (GeditHistoryEntryEscapeFunc) gedit_utils_escape_search_text);
-
+	gtk_widget_set_hexpand (GTK_WIDGET (dlg->priv->replace_entry), TRUE);
 	dlg->priv->replace_text_entry = gedit_history_entry_get_entry
 			(GEDIT_HISTORY_ENTRY (dlg->priv->replace_entry));
-	gtk_entry_set_activates_default (GTK_ENTRY (dlg->priv->replace_text_entry),
-					 TRUE);
-	gtk_table_attach_defaults (GTK_TABLE (dlg->priv->table),
-				   dlg->priv->replace_entry,
-				   1, 2, 1, 2);
+	gtk_entry_set_activates_default (GTK_ENTRY (dlg->priv->replace_text_entry), TRUE);
+	gtk_grid_attach_next_to (GTK_GRID (dlg->priv->grid),
+				 dlg->priv->replace_entry,
+				 dlg->priv->replace_label,
+				 GTK_POS_RIGHT, 1, 1);
 
 	gtk_label_set_mnemonic_widget (GTK_LABEL (dlg->priv->search_label),
 				       dlg->priv->search_entry);
diff --git a/gedit/dialogs/gedit-replace-dialog.ui b/gedit/dialogs/gedit-replace-dialog.ui
index 547b56d..1f20a38 100644
--- a/gedit/dialogs/gedit-replace-dialog.ui
+++ b/gedit/dialogs/gedit-replace-dialog.ui
@@ -96,13 +96,13 @@
             <property name="orientation">vertical</property>
             <property name="spacing">18</property>
             <child>
-              <object class="GtkTable" id="table">
+              <object class="GtkGrid" id="grid">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="row_spacing">12</property>
+                <property name="column_spacing">12</property>
                 <property name="n_rows">2</property>
                 <property name="n_columns">2</property>
-                <property name="column_spacing">12</property>
-                <property name="row_spacing">12</property>
                 <child>
                   <object class="GtkLabel" id="search_label">
                     <property name="visible">True</property>
@@ -112,8 +112,10 @@
                     <property name="use_underline">True</property>
                   </object>
                   <packing>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -125,10 +127,10 @@
                     <property name="use_underline">True</property>
                   </object>
                   <packing>
+                    <property name="left_attach">0</property>
                     <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
@@ -158,6 +160,7 @@
                     <property name="receives_default">False</property>
                     <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
                   </object>
                   <packing>
@@ -174,6 +177,7 @@
                     <property name="receives_default">False</property>
                     <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
                   </object>
                   <packing>
@@ -190,6 +194,7 @@
                     <property name="receives_default">False</property>
                     <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
                   </object>
                   <packing>
@@ -206,6 +211,7 @@
                     <property name="receives_default">False</property>
                     <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
                   </object>



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