[ontv] Replaced right-click channel menu with a button in preferences dialog
- From: Olof Kindgren <olki src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ontv] Replaced right-click channel menu with a button in preferences dialog
- Date: Sun, 26 Sep 2010 13:41:49 +0000 (UTC)
commit 64f688ede4c3e2fb12c835d22a0e263c19b2a1c6
Author: Olof Kindgren <olki src gnome org>
Date: Thu Sep 16 09:35:34 2010 +0200
Replaced right-click channel menu with a button in preferences dialog
Removing right-click options makes it easier to port OnTV to touch-
screen devices.
data/preferences_dialog.ui | 22 +++++++---------------
ontv/dialogs.py | 26 ++++++++++++--------------
2 files changed, 19 insertions(+), 29 deletions(-)
---
diff --git a/data/preferences_dialog.ui b/data/preferences_dialog.ui
index bba1591..3c8b633 100644
--- a/data/preferences_dialog.ui
+++ b/data/preferences_dialog.ui
@@ -382,12 +382,13 @@
<object class="GtkHBox" id="hbox12">
<property name="visible">True</property>
<child>
- <object class="GtkImage" id="channels_image">
+ <object class="GtkButton" id="channel_properties_button">
+ <property name="label">gtk-properties</property>
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="stock">gtk-dialog-info</property>
- <property name="icon-size">6</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_channel_properties_button_clicked"/>
</object>
<packing>
<property name="expand">False</property>
@@ -395,16 +396,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label29">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Right-click on a channel to set logo</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</object>
<packing>
diff --git a/ontv/dialogs.py b/ontv/dialogs.py
index 5c29b04..8b4fd61 100644
--- a/ontv/dialogs.py
+++ b/ontv/dialogs.py
@@ -194,7 +194,6 @@ class PreferencesDialog:
# Channels tab
self.channels_treeview = builder.get_object("channels_treeview")
-
self.channels_model = builder.get_object("channels_model")
builder.get_object("col_ch_selected").set_cell_data_func(builder.get_object("cr_toggle"),
@@ -204,6 +203,7 @@ class PreferencesDialog:
builder.get_object("col_ch_name").set_cell_data_func(builder.get_object("cr_name"),
self.__crtext_cell_data_func)
+ self.channel_properties_button = builder.get_object("channel_properties_button")
# Reminders tab
self.reminders_treeview = builder.get_object("reminders_treeview")
self.program_entry = builder.get_object("program_entry")
@@ -219,12 +219,6 @@ class PreferencesDialog:
self.channels_model.set_sort_column_id(0, gtk.SORT_ASCENDING)
self.channels_treeview.set_search_equal_func(self.__channels_treeview_search_equal)
- self.channels_treeview_menu = gtk.Menu()
- self.edit_channel_imi = gtk.ImageMenuItem(gtk.STOCK_EDIT)
- self.edit_channel_imi.child.set_markup_with_mnemonic(_("_Properties"))
- self.edit_channel_imi.show()
- self.channels_treeview_menu.append(self.edit_channel_imi)
-
def __channels_model_sort_func(self, model, iter1, iter2, object=True):
channel = model.get_value(iter1, 0)
other_channel = model.get_value(iter2, 0)
@@ -309,12 +303,9 @@ class PreferencesDialog:
self.dialog.connect("delete-event", self.__dialog_delete)
self.dialog.connect("response", self.__dialog_response)
- # Channels tab
- self.channels_treeview.connect("button-press-event",
- self.__channels_treeview_button_press,
- self.channels_treeview_menu)
- self.edit_channel_imi.connect("activate",
- self.__edit_channel_imi_activate)
+ #Channels tab
+ selection = self.channels_treeview.get_selection()
+ selection.connect("changed", self.__channels_treeview_selection_changed)
# Reminders tab
self.reminders_treeview.connect("key-press-event", self.__reminders_treeview_key_press_event)
@@ -341,6 +332,13 @@ class PreferencesDialog:
def __dialog_delete(self, dialog, event):
return True
+ def __channels_treeview_selection_changed(self, selection):
+ (search_model, search_iter) = selection.get_selected()
+ if search_iter:
+ self.channel_properties_button.set_sensitive(True)
+ else:
+ self.channel_properties_button.set_sensitive(False)
+
def on_grabber_command_entry_changed(self, entry):
self.config.grabber_command = entry.get_text()
@@ -386,7 +384,7 @@ class PreferencesDialog:
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
menu.popup(None, None, None, event.button, event.time)
- def __edit_channel_imi_activate(self, menuitem):
+ def on_channel_properties_button_clicked(self, button):
selection = self.channels_treeview.get_selection()
(model, iter) = selection.get_selected()
channel = model.get_value(iter,0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]