[anjuta] project-wizard: Replace deprecated GtkTable by GtkGrid



commit 5f83e1d3a53629f3e1870ac5c2df5784ece652c8
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Jan 27 18:43:10 2013 +0100

    project-wizard: Replace deprecated GtkTable by GtkGrid

 plugins/project-wizard/anjuta-project-wizard.ui |   75 +++++++++++++++++------
 plugins/project-wizard/druid.c                  |   28 +++-----
 plugins/project-wizard/property.c               |    1 +
 3 files changed, 67 insertions(+), 37 deletions(-)
---
diff --git a/plugins/project-wizard/anjuta-project-wizard.ui b/plugins/project-wizard/anjuta-project-wizard.ui
index 419cf94..e4a78e3 100644
--- a/plugins/project-wizard/anjuta-project-wizard.ui
+++ b/plugins/project-wizard/anjuta-project-wizard.ui
@@ -1,17 +1,20 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
-  <!-- interface-naming-policy toplevel-contextual -->
+  <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkAssistant" id="druid_window">
+    <property name="can_focus">False</property>
     <property name="window_position">center-on-parent</property>
     <property name="skip_taskbar_hint">True</property>
     <property name="skip_pager_hint">True</property>
     <child>
-      <object class="GtkVBox" id="project_page">
+      <object class="GtkBox" id="project_page">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkLabel" id="label3">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="xalign">0</property>
             <property name="yalign">0</property>
             <property name="label" translatable="yes">Select a project type</property>
@@ -23,6 +26,7 @@
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
@@ -35,8 +39,6 @@
               <object class="GtkScrolledWindow" id="scrolledwindow1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">automatic</property>
-                <property name="vscrollbar_policy">automatic</property>
                 <property name="shadow_type">in</property>
                 <child>
                   <object class="GtkIconView" id="project_list">
@@ -49,7 +51,7 @@
                     <property name="row_spacing">0</property>
                     <property name="column_spacing">12</property>
                     <property name="tooltip_column">2</property>
-                    <signal name="selection_changed" handler="on_druid_project_select_icon"/>
+                    <signal name="selection-changed" handler="on_druid_project_select_icon" swapped="no"/>
                   </object>
                 </child>
               </object>
@@ -57,6 +59,7 @@
             <child type="tab">
               <object class="GtkLabel" id="project_book_label">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="xpad">5</property>
               </object>
               <packing>
@@ -66,6 +69,7 @@
           </object>
           <packing>
             <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="padding">6</property>
             <property name="position">1</property>
           </packing>
@@ -78,11 +82,14 @@
       </packing>
     </child>
     <child>
-      <object class="GtkVBox" id="error_page">
+      <object class="GtkBox" id="error_page">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkLabel" id="error_title">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="xalign">0</property>
             <property name="yalign">0</property>
             <property name="label" translatable="yes">Select a project type</property>
@@ -94,16 +101,19 @@
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkBox" id="hbox1">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="spacing">6</property>
             <child>
               <object class="GtkImage" id="error_icon">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="yalign">0</property>
                 <property name="ypad">6</property>
                 <property name="stock">gtk-dialog-error</property>
@@ -111,16 +121,20 @@
               </object>
               <packing>
                 <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="padding">6</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="error_vbox">
+              <object class="GtkBox" id="error_vbox">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="error_message">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="label" translatable="yes">Error</property>
@@ -129,6 +143,7 @@
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="padding">6</property>
                     <property name="position">0</property>
                   </packing>
@@ -140,6 +155,7 @@
                     <child>
                       <object class="GtkLabel" id="label2">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="xalign">0</property>
                         <property name="xpad">24</property>
                         <property name="wrap">True</property>
@@ -148,6 +164,7 @@
                     <child type="label">
                       <object class="GtkLabel" id="label1">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">Details</property>
                         <attributes>
                           <attribute name="weight" value="bold"/>
@@ -156,17 +173,22 @@
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
@@ -179,6 +201,7 @@
     <child>
       <object class="GtkLabel" id="progress_page">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <property name="wrap">True</property>
       </object>
       <packing>
@@ -188,11 +211,14 @@
       </packing>
     </child>
     <child>
-      <object class="GtkVBox" id="finish_page">
+      <object class="GtkBox" id="finish_page">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkLabel" id="label4">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="xalign">0</property>
             <property name="yalign">0</property>
             <property name="label" translatable="yes">Summary</property>
@@ -204,16 +230,19 @@
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkLabel" id="finish_text">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="use_markup">True</property>
           </object>
           <packing>
             <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
@@ -226,11 +255,14 @@
       </packing>
     </child>
     <child>
-      <object class="GtkVBox" id="property_page">
+      <object class="GtkBox" id="property_page">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkLabel" id="property_title">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="xalign">0</property>
             <property name="yalign">0</property>
             <property name="use_markup">True</property>
@@ -241,6 +273,7 @@
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="padding">6</property>
             <property name="position">0</property>
           </packing>
@@ -249,20 +282,16 @@
           <object class="GtkScrolledWindow" id="scrolledwindow2">
             <property name="can_focus">True</property>
             <property name="hscrollbar_policy">never</property>
-            <property name="vscrollbar_policy">automatic</property>
             <child>
               <object class="GtkViewport" id="viewport1">
+                <property name="can_focus">False</property>
                 <property name="shadow_type">none</property>
                 <child>
-                  <object class="GtkTable" id="property_table">
+                  <object class="GtkGrid" id="property_table">
+                    <property name="can_focus">False</property>
                     <property name="border_width">5</property>
-                    <property name="n_rows">5</property>
-                    <property name="n_columns">2</property>
-                    <property name="column_spacing">6</property>
                     <property name="row_spacing">6</property>
-                    <child>
-                      <placeholder/>
-                    </child>
+                    <property name="column_spacing">6</property>
                     <child>
                       <placeholder/>
                     </child>
@@ -297,6 +326,7 @@
           </object>
           <packing>
             <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="padding">6</property>
             <property name="position">1</property>
           </packing>
@@ -309,5 +339,10 @@
     <child>
       <placeholder/>
     </child>
+    <child internal-child="action_area">
+      <object class="GtkBox" id="assistant-action_area1">
+        <property name="can_focus">False</property>
+      </object>
+    </child>
   </object>
 </interface>
diff --git a/plugins/project-wizard/druid.c b/plugins/project-wizard/druid.c
index 565f278..2f29db0 100644
--- a/plugins/project-wizard/druid.c
+++ b/plugins/project-wizard/druid.c
@@ -99,7 +99,7 @@ struct _NPWDruid
 	GtkNotebook* project_book;
 	GtkWidget *error_page;
 	GtkWidget *error_title;
-	GtkVBox *error_vbox;
+	GtkBox *error_vbox;
 	GtkWidget *error_extra_widget;
 	GtkImage *error_icon;
 	GtkLabel *error_message;
@@ -495,7 +495,7 @@ typedef struct _NPWDruidAddPropertyData
 {
 	NPWDruid* druid;
 	guint row;
-	GtkTable *table;
+	GtkGrid *table;
 	GtkWidget *first_entry;
 } NPWDruidAddPropertyData;
 
@@ -512,7 +512,6 @@ cb_druid_add_property (NPWProperty* property, gpointer user_data)
 	GtkWidget* entry;
 	NPWDruidAddPropertyData* data = (NPWDruidAddPropertyData *)user_data;
 	const gchar* description;
-	GtkAttachOptions attach = GTK_EXPAND|GTK_FILL;
 
 
 	entry = npw_property_create_widget (property);
@@ -531,27 +530,22 @@ cb_druid_add_property (NPWProperty* property, gpointer user_data)
 		gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
 		gtk_misc_set_padding (GTK_MISC (label), 6, 6);
 
+		gtk_widget_set_hexpand (entry, TRUE);
 		switch (npw_property_get_type (property))
 		{
 			case NPW_PACKAGE_PROPERTY:
-				gtk_table_resize (data->table, data->row + 2, 1);
-				gtk_table_attach (data->table, label, 0, 1, data->row, data->row + 1,
-				                  (GtkAttachOptions)(GTK_FILL), 0, 0, 0);
-				gtk_table_attach (data->table, entry, 0, 1, data->row + 1, data->row + 2,
-				                  (GtkAttachOptions)(GTK_EXPAND|GTK_FILL),
-				                  (GtkAttachOptions)(GTK_EXPAND|GTK_FILL), 0, 0);
+				gtk_widget_set_vexpand (entry, TRUE);
+				gtk_grid_attach (data->table, label, 0, data->row, 1, 1);
+				gtk_grid_attach (data->table, entry, 0, data->row + 1, 1, 1);
 				data->row += 2;
 				break;
 			case NPW_BOOLEAN_PROPERTY:
-				attach = 0;
-				/* Fall through */
+				gtk_widget_set_hexpand (entry, FALSE);
+				/* Fall through */	
 			default:
 				/* Add label and entry */
-				gtk_table_resize (data->table, data->row + 1, 2);
-				gtk_table_attach (data->table, label, 0, 1, data->row, data->row + 1,
-				                  (GtkAttachOptions)(GTK_FILL), 0, 0, 0);
-				gtk_table_attach (data->table, entry, 1, 2, data->row, data->row + 1,
-				                  (GtkAttachOptions)(attach), 0, 0, 0);
+				gtk_grid_attach (data->table, label, 0, data->row, 1, 1);
+				gtk_grid_attach (data->table, entry, 1, data->row, 1, 1);
 				data->row++;
 		}
 
@@ -584,7 +578,7 @@ npw_druid_fill_property_page (NPWDruid* druid, NPWPage* page)
 	/* Add new widget */
 	data.druid = druid;
 	data.row = 0;
-	data.table = GTK_TABLE (npw_page_get_widget (page));
+	data.table = GTK_GRID (npw_page_get_widget (page));
 	data.first_entry = NULL;
 	npw_page_foreach_property (page, (GFunc)cb_druid_add_property, &data);
 
diff --git a/plugins/project-wizard/property.c b/plugins/project-wizard/property.c
index c1331a0..05928cc 100644
--- a/plugins/project-wizard/property.c
+++ b/plugins/project-wizard/property.c
@@ -503,6 +503,7 @@ npw_property_create_widget (NPWProperty* prop)
 
 			entry = gtk_entry_new ();
 			if (value) gtk_entry_set_text (GTK_ENTRY (entry), value);
+			gtk_widget_set_hexpand (entry, TRUE);
 			gtk_container_add (GTK_CONTAINER (widget), entry);
 
 			button = gtk_button_new_from_stock (GTK_STOCK_OPEN);



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