Switch to single object view when a row is activated in the table view.
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 23 Jan 2006 19:56:11 +0000 (19:56 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 23 Jan 2006 19:56:11 +0000 (19:56 +0000)
src/packages/kofoto/gkofoto/mainwindow.py
src/packages/kofoto/gkofoto/tableview.py

index 60bab40..b8e0e99 100644 (file)
@@ -89,7 +89,7 @@ class MainWindow(gtk.Window):
         self.__thumbnailView = ThumbnailView()
         self.__tableView = TableView()
         self.__singleObjectView = SingleObjectView()
-        self.__showTableView()
+        self.showTableView()
 
     def saveState(self):
         self.__persistentState.save()
@@ -161,17 +161,17 @@ class MainWindow(gtk.Window):
             hiddenView.hide()
         self._currentView.show(self.__currentObjectCollection)
 
-    def __showTableView(self):
+    def showTableView(self):
         self._currentView = self.__tableView
         self._hiddenViews = [self.__thumbnailView, self.__singleObjectView]
         self._viewChanged()
 
-    def __showThumbnailView(self):
+    def showThumbnailView(self):
         self._currentView = self.__thumbnailView
         self._hiddenViews = [self.__tableView, self.__singleObjectView]
         self._viewChanged()
 
-    def __showSingleObjectView(self):
+    def showSingleObjectView(self):
         self._currentView = self.__singleObjectView
         self._hiddenViews = [self.__tableView, self.__thumbnailView]
         self._viewChanged()
@@ -198,7 +198,7 @@ class MainWindow(gtk.Window):
             env.widgets["menubarThumbnailsView"].set_active(True)
             env.widgets["menubarObjectView"].set_active(False)
             env.widgets["menubarTableView"].set_active(False)
-            self.__showThumbnailView()
+            self.showThumbnailView()
             self._toggleLock = False
 
     def _toggleObjectView(self, button):
@@ -211,7 +211,7 @@ class MainWindow(gtk.Window):
             env.widgets["menubarThumbnailsView"].set_active(False)
             env.widgets["menubarObjectView"].set_active(True)
             env.widgets["menubarTableView"].set_active(False)
-            self.__showSingleObjectView()
+            self.showSingleObjectView()
             self._toggleLock = False
 
     def _toggleTableView(self, button):
@@ -224,7 +224,7 @@ class MainWindow(gtk.Window):
             env.widgets["menubarThumbnailsView"].set_active(False)
             env.widgets["menubarObjectView"].set_active(False)
             env.widgets["menubarTableView"].set_active(True)
-            self.__showTableView()
+            self.showTableView()
             self._toggleLock = False
 
     def _shelfModificationChangedCallback(self, modified):
index b60d2a4..d7880ba 100644 (file)
@@ -19,6 +19,7 @@ class TableView(ObjectCollectionView):
         self.__selectionLocked = False
         self._viewWidget.connect("drag_data_received", self._onDragDataReceived)
         self._viewWidget.connect("drag-data-get", self._onDragDataGet)
+        self._viewWidget.connect("row-activated", self._onRowActivated)
         self.__userChosenColumns = {}
         self.__createdColumns = {}
         self.__editedCallbacks = {}
@@ -301,6 +302,12 @@ class TableView(ObjectCollectionView):
                 removeSourceRowAutomatically = False
                 dragContext.finish(True, removeSourceRowAutomatically, eventtime)
 
+    def _onRowActivated(self, widget, path, view_column):
+        model = self._objectCollection.getModel()
+        row = model[path]
+        if not row[ObjectCollection.COLUMN_IS_ALBUM]:
+            env.mainwindow.showSingleObjectView()
+
     def _viewColumnToggled(self, checkMenuItem, columnName):
         if checkMenuItem.get_active():
             if columnName not in self.__createdColumns: