[gnome-dvb-daemon] Replace deprecated Gtk.Table with Gtk.Grid



commit 0d31697fce7f5df792505c17a30c154f13c06f1f
Author: Sebastian PÃlsterl <sebp k-d-w org>
Date:   Sun Oct 30 13:54:03 2011 +0100

    Replace deprecated Gtk.Table with Gtk.Grid

 client/gnomedvb/ui/preferences/Dialogs.py          |   18 ++++----
 client/gnomedvb/ui/timers/TimerDialog.py           |   29 +++++++------
 client/gnomedvb/ui/widgets/DetailsDialog.py        |   42 +++++++++++---------
 client/gnomedvb/ui/wizard/pages/ChannelScanPage.py |   20 +++++----
 .../ui/wizard/pages/InitialTuningDataPage.py       |   34 ++++++++++------
 5 files changed, 80 insertions(+), 63 deletions(-)
---
diff --git a/client/gnomedvb/ui/preferences/Dialogs.py b/client/gnomedvb/ui/preferences/Dialogs.py
index 1493ef4..22aa258 100644
--- a/client/gnomedvb/ui/preferences/Dialogs.py
+++ b/client/gnomedvb/ui/preferences/Dialogs.py
@@ -101,9 +101,9 @@ class NewGroupDialog (Gtk.Dialog):
         self.vbox_main.show()
         self.get_content_area().pack_start(self.vbox_main, True, True, 0)
         
-        self.table = Gtk.Table(3, 2)
-        self.table.set_col_spacings(18)
-        self.table.set_row_spacings(6)
+        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
+        self.table.set_column_spacing(18)
+        self.table.set_row_spacing(6)
         self.table.show()
         
         general_frame = BaseFrame("<b>%s</b>" % _("General"), self.table)
@@ -114,18 +114,18 @@ class NewGroupDialog (Gtk.Dialog):
         name.set_markup_with_mnemonic(_("_Name:"))
         name.show()
         
-        self.name_entry = Gtk.Entry()
+        self.name_entry = Gtk.Entry(hexpand=True)
         self.name_entry.show()
         name.set_mnemonic_widget(self.name_entry)
         
-        self.table.attach(name, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
-        self.table.attach(self.name_entry, 1, 2, 0, 1, yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(name)
+        self.table.attach_next_to(self.name_entry, name, Gtk.PositionType.RIGHT, 1, 1)
         
         self.channels = TextFieldLabel()
         self.channels.set_markup_with_mnemonic(_("Channels _file:"))
         self.channels.show()
         
-        self.channelsbox = Gtk.Box(spacing=6)
+        self.channelsbox = Gtk.Box(spacing=6, hexpand=True)
         self.channelsbox.show()
 
         self.channels_entry = Gtk.Entry()
@@ -139,8 +139,8 @@ class NewGroupDialog (Gtk.Dialog):
         channels_open.show()
         self.channelsbox.pack_start(channels_open, False, False, 0)
         
-        self.table.attach(self.channels, 0, 1, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
-        self.table.attach(self.channelsbox, 1, 2, 1, 2, yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(self.channels)
+        self.table.attach_next_to(self.channelsbox, self.channels, Gtk.PositionType.RIGHT, 1, 1)
         
         recbox = Gtk.Box(spacing=18)
         recbox.show()
diff --git a/client/gnomedvb/ui/timers/TimerDialog.py b/client/gnomedvb/ui/timers/TimerDialog.py
index cdc1457..71efdeb 100644
--- a/client/gnomedvb/ui/timers/TimerDialog.py
+++ b/client/gnomedvb/ui/timers/TimerDialog.py
@@ -48,14 +48,14 @@ class TimerDialog(Gtk.Dialog):
 
         self.set_border_width(5)
         
-        table = Gtk.Table(rows=4, columns=2)
-        table.set_col_spacings(18)
-        table.set_row_spacings(6)
+        table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
+        table.set_column_spacing(18)
+        table.set_row_spacing(6)
         table.set_border_width(5)
         self.get_content_area().pack_start(table, True, True, 0)
                          
         label_channel = TextFieldLabel()
-        table.attach(label_channel, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
+        table.add(label_channel)
         
         if channel == None:
             self.channel_selected = False
@@ -65,10 +65,11 @@ class TimerDialog(Gtk.Dialog):
             label_channel.set_markup_with_mnemonic(_("_Channel:"))
             self.channels = ChannelsStore(device_group)
         
-            scrolledchannels = Gtk.ScrolledWindow()
+            scrolledchannels = Gtk.ScrolledWindow(expand=True)
             scrolledchannels.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
             scrolledchannels.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
-            table.attach(scrolledchannels, 0, 2, 1, 2)
+            table.attach_next_to(scrolledchannels, label_channel,
+                Gtk.PositionType.BOTTOM, 2, 1)
             
             self.channelsview = ChannelsView(self.channels)
             self.channelsview.set_headers_visible(False)
@@ -86,14 +87,15 @@ class TimerDialog(Gtk.Dialog):
             self.channels = None
             self.channelsview = None
             channel_label = TextFieldLabel(channel)
-            table.attach(channel_label, 1, 2, 0, 1, yoptions=Gtk.AttachOptions.FILL)
+            table.attach_next_to(channel_label, label_channel,
+                Gtk.PositionType.RIGHT, 1, 1)
         
         label_start = TextFieldLabel()
         label_start.set_markup_with_mnemonic(_("_Start time:"))
-        table.attach(label_start, 0, 1, 2, 3)
+        table.add(label_start)
         
-        hbox = Gtk.Box(spacing=6)
-        table.attach(hbox, 1, 2, 2, 3, yoptions=0)
+        hbox = Gtk.Box(spacing=6, hexpand=True)
+        table.attach_next_to(hbox, label_start, Gtk.PositionType.RIGHT, 1, 1)
 
         if starttime == None:
             starttime = datetime.datetime.now()
@@ -105,10 +107,11 @@ class TimerDialog(Gtk.Dialog):
         
         label_duration = TextFieldLabel()
         label_duration.set_markup_with_mnemonic(_("_Duration:"))
-        table.attach(label_duration, 0, 1, 3, 4, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
+        table.add(label_duration)
         
-        duration_hbox = Gtk.Box(spacing=6)
-        table.attach(duration_hbox, 1, 2, 3, 4)
+        duration_hbox = Gtk.Box(spacing=6, hexpand=True)
+        table.attach_next_to(duration_hbox, label_duration,
+            Gtk.PositionType.RIGHT, 1, 1)
         
         self.duration = Gtk.SpinButton()
         self.duration.set_range(1, 65535)
diff --git a/client/gnomedvb/ui/widgets/DetailsDialog.py b/client/gnomedvb/ui/widgets/DetailsDialog.py
index 16457c8..2c4951d 100644
--- a/client/gnomedvb/ui/widgets/DetailsDialog.py
+++ b/client/gnomedvb/ui/widgets/DetailsDialog.py
@@ -40,49 +40,53 @@ class DetailsDialog(Gtk.Dialog):
         close_button = self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
         close_button.grab_default()
         
-        self.table = Gtk.Table(6, 2)
-        self.table.set_col_spacings(18)
-        self.table.set_row_spacings(6)
+        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
+        self.table.set_column_spacing(18)
+        self.table.set_row_spacing(6)
         self.table.set_border_width(5)
         self.get_content_area().pack_start(self.table, True, True, 0)
         
-        self._title = TextFieldLabel()
-        self._channel = TextFieldLabel()
-        self._date = TextFieldLabel()
-        self._duration = TextFieldLabel()
+        self._title = TextFieldLabel(hexpand=True)
+        self._channel = TextFieldLabel(hexpand=True)
+        self._date = TextFieldLabel(hexpand=True)
+        self._duration = TextFieldLabel(hexpand=True)
         
         title_label = TextFieldLabel("<i>%s</i>" % _("Title:"))
-        self.table.attach(title_label, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
-        self.table.attach(self._title, 1, 2, 0, 1, yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(title_label)
+        self.table.attach_next_to(self._title, title_label,
+            Gtk.PositionType.RIGHT, 1, 1)
         
         channel_label = TextFieldLabel("<i>%s</i>" % _("Channel:"))
-        self.table.attach(channel_label, 0, 1, 1, 2, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
-        self.table.attach(self._channel, 1, 2, 1, 2, yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(channel_label)
+        self.table.attach_next_to(self._channel, channel_label,
+            Gtk.PositionType.RIGHT, 1, 1)
         
         date_label = TextFieldLabel("<i>%s</i>" % _("Date:"))
-        self.table.attach(date_label, 0, 1, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
-        self.table.attach(self._date, 1, 2, 2, 3, yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(date_label)
+        self.table.attach_next_to(self._date, date_label,
+            Gtk.PositionType.RIGHT, 1, 1)
         
         duration_label = TextFieldLabel("<i>%s</i>" % _("Duration:"))
-        self.table.attach(duration_label, 0, 1, 3, 4, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
-        self.table.attach(self._duration, 1, 2, 3, 4, yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(duration_label)
+        self.table.attach_next_to(self._duration, duration_label,
+            Gtk.PositionType.RIGHT, 1, 1)
         
         description_label = TextFieldLabel("<i>%s</i>" % _("Description:"))
-        self.table.attach(description_label, 0, 1, 4, 5, Gtk.AttachOptions.FILL,
-            yoptions=Gtk.AttachOptions.FILL)
+        self.table.add(description_label)
             
         self.textview = Gtk.TextView()
         self.textview.set_editable(False)
         self.textview.set_wrap_mode(Gtk.WrapMode.WORD)
         self.textview.show()
 
-        scrolledwin = Gtk.ScrolledWindow()
+        scrolledwin = Gtk.ScrolledWindow(expand=True)
         scrolledwin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
         scrolledwin.set_shadow_type(Gtk.ShadowType.IN)
         scrolledwin.set_margin_left(12)
         scrolledwin.add(self.textview)
         scrolledwin.show()
-        self.table.attach(scrolledwin, 0, 2, 5, 6)
+        self.table.attach_next_to(scrolledwin, description_label,
+            Gtk.PositionType.BOTTOM, 2, 1)
         
         self.table.show_all()
         
diff --git a/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py b/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
index bed99b8..8abee1f 100644
--- a/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
+++ b/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
@@ -125,28 +125,30 @@ class ChannelScanPage(BasePage):
         self.pack_start(self.progressbar, False, True, 0)
 
     def create_signal_box(self):
-        self.progress_table = Gtk.Table(rows=3, columns=2)
-        self.progress_table.set_row_spacings(6)
-        self.progress_table.set_col_spacings(12)
+        self.progress_table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
+        self.progress_table.set_row_spacing(6)
+        self.progress_table.set_column_spacing(12)
         self.pack_start(self.progress_table, False, True, 0)
 
         label = TextFieldLabel(_("Signal quality:"))
-        self.progress_table.attach(label, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.FILL)
+        self.progress_table.add(label)
 
-        frame = Gtk.Frame()
+        frame = Gtk.Frame(hexpand=True)
         frame.set_shadow_type(Gtk.ShadowType.NONE)
-        self.progress_table.attach(frame, 1, 2, 0, 1)
+        self.progress_table.attach_next_to(frame, label, Gtk.PositionType.RIGHT,
+            1, 1)
 
         self.signal_quality_bar = Gtk.ProgressBar()
         self.signal_quality_bar.set_size_request(-1, 10)
         frame.add(self.signal_quality_bar)
 
         label = TextFieldLabel(_("Signal strength:"))
-        self.progress_table.attach(label, 0, 1, 1, 2, xoptions=Gtk.AttachOptions.FILL)
+        self.progress_table.add(label)
 
-        frame = Gtk.Frame()
+        frame = Gtk.Frame(hexpand=True)
         frame.set_shadow_type(Gtk.ShadowType.NONE)
-        self.progress_table.attach(frame, 1, 2, 1, 2)
+        self.progress_table.attach_next_to(frame, label, Gtk.PositionType.RIGHT,
+            1, 1)
 
         self.signal_strength_bar = Gtk.ProgressBar()
         self.signal_strength_bar.set_size_request(-1, 10)
diff --git a/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py b/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
index e12fc5e..44ee584 100644
--- a/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
+++ b/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
@@ -171,9 +171,9 @@ class InitialTuningDataPage(BasePage):
         return self.__tuning_data
         
     def _create_table(self):
-        self.table = Gtk.Table(rows=4, columns=2)
-        self.table.set_row_spacings(6)
-        self.table.set_col_spacings(18)
+        self.table = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
+        self.table.set_row_spacing(6)
+        self.table.set_column_spacing(18)
         self.table.show()
         self.pack_start(self.table, True, True, 0)
 
@@ -210,10 +210,10 @@ class InitialTuningDataPage(BasePage):
         
         self._create_table()
 
-        country = Gtk.Label()
+        country = Gtk.Label(halign=Gtk.Align.START)
         country.set_markup_with_mnemonic(_("_Country:"))
         country.show()
-        self.table.attach(country, 0, 1, 0, 1, yoptions=0, xoptions=Gtk.AttachOptions.FILL)
+        self.table.add(country)
 
         # name, code    
         self.countries = Gtk.ListStore(str, str)
@@ -224,20 +224,22 @@ class InitialTuningDataPage(BasePage):
             self.countries.append([name, code])
     
         self.country_combo = Gtk.ComboBox.new_with_model_and_entry(self.countries)
+        self.country_combo.set_hexpand(True)
         self.country_combo.connect('changed', self.on_country_changed)
         self.__data_dir = "dvb-t"
         cell = Gtk.CellRendererText()
         self.country_combo.pack_start(cell, True)
         self.country_combo.set_entry_text_column(0)
         self.country_combo.show()
-        self.table.attach(self.country_combo, 1, 2, 0, 1, yoptions=0)
+        self.table.attach_next_to(self.country_combo, country,
+            Gtk.PositionType.RIGHT, 1, 1)
         self.country_combo.set_active(0)
         country.set_mnemonic_widget(self.country_combo)
         
         providers = Gtk.Label()
         providers.set_markup_with_mnemonic(_("_Antenna:"))
         providers.show()
-        self.table.attach(providers, 0, 1, 1, 2, yoptions=0, xoptions=Gtk.AttachOptions.FILL)
+        self.table.add(providers)
         
         self.providers = Gtk.ListStore(str, str)
         self.providers.set_sort_column_id(0, Gtk.SortType.ASCENDING)
@@ -249,7 +251,9 @@ class InitialTuningDataPage(BasePage):
             self.on_providers_changed)
         providers.set_mnemonic_widget(self.providers_view)
         
-        self.table.attach(scrolledview, 0, 2, 2, 3)
+        scrolledview.set_property("expand", True)
+        self.table.attach_next_to(scrolledview, providers,
+            Gtk.PositionType.BOTTOM, 2, 1)
         
         self.providers_view.set_sensitive(False)
    
@@ -280,10 +284,10 @@ class InitialTuningDataPage(BasePage):
 
         self._create_table()
 
-        country = Gtk.Label()
+        country = Gtk.Label(halign=Gtk.Align.START)
         country.set_markup_with_mnemonic(_("_Country:"))
         country.show()
-        self.table.attach(country, 0, 1, 0, 1, yoptions=0, xoptions=Gtk.AttachOptions.FILL)
+        self.table.add(country)
 
         self.countries = Gtk.ListStore(str, str)
         self.countries.set_sort_column_id(0, Gtk.SortType.ASCENDING)
@@ -293,19 +297,21 @@ class InitialTuningDataPage(BasePage):
             self.countries.append([name, code])
     
         self.country_combo = Gtk.ComboBox.new_with_model_and_entry(self.countries)
+        self.country_combo.set_hexpand(True)
         self.country_combo.connect('changed', self.on_country_changed)
         self.__data_dir = "dvb-c"
         cell = Gtk.CellRendererText()
         self.country_combo.pack_start(cell, True)
         self.country_combo.set_entry_text_column(0)
         self.country_combo.show()
-        self.table.attach(self.country_combo, 1, 2, 0, 1, yoptions=0)
+        self.table.attach_next_to(self.country_combo, country,
+            Gtk.PositionType.RIGHT, 1, 1)
         country.set_mnemonic_widget(self.country_combo)
         
         providers = Gtk.Label()
         providers.set_markup_with_mnemonic(_("_Providers:"))
         providers.show()
-        self.table.attach(providers, 0, 1, 1, 2, yoptions=0, xoptions=Gtk.AttachOptions.FILL)
+        self.table.add(providers)
         
         self.providers = Gtk.ListStore(str, str)
         self.providers.set_sort_column_id(0, Gtk.SortType.ASCENDING)
@@ -316,7 +322,9 @@ class InitialTuningDataPage(BasePage):
             self.on_providers_changed)
         providers.set_mnemonic_widget(self.providers_view)
         
-        self.table.attach(scrolledview, 0, 2, 2, 3)
+        scrolledview.set_property("expand", True)
+        self.table.attach_next_to(scrolledview, providers,
+            Gtk.PositionType.BOTTOM, 2, 1)
         self.providers_view.set_sensitive(False)
          
     def _create_providers_treeview(self, providers, col_name):



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