mackx avatar mackx committed 12aa9ab

Adding open with functionality

Comments (0)

Files changed (11)

ctb/include/ctb_actions.h

  *--------------------------------------------------------------------------*/
 int edit_properties_item (const filelist_entry_t *fileinfo);
 
+int open_with_item(const filelist_entry_t *fileinfo);
+
 G_END_DECLS
 
 #endif

ctb/include/filetypes.h

 #define DIR_NOTES                "Notes"
 #define DIR_ADE_THUMBS           "Digital Editions/Thumbnails"
 
+//----------------------------------------------------------------------------
+// Type Declarations
+//----------------------------------------------------------------------------
+
+// detailed info per filetype
+typedef struct _alttype_info_t
+        {
+            gchar       *extension;             // file extension excluding the '.'
+            gchar       *icon_name;             // name of the icon, also used for bitmap filename
+            gchar       *description;           // type description for this extension
+            gchar       *viewer_cmd;            // command to start the corresponding viewer application
+            GdkPixbuf   *pixbuf_icon    [N_FILEMODEL_THUMB_SIZES];  // cache for bitmaps loaded from icon files
+            struct _alttype_info_t *next;
+        } alttype_info_t;
+
+
 
 void filetypes_init(gboolean watch);
 
  *--------------------------------------------------------------------------*/
 const char* g_extension_pointer ( const char *path );
 
+// For Open With
+alttype_info_t* filetypes_find_alttype_info (const gchar *file_ext );
+
 
 G_END_DECLS
 

ctb/include/fileview.h

 #include <gtk/gtk.h>
 
 #include "filemodel.h"
+#include "filetypes.h"
 
 G_BEGIN_DECLS
 
 // Startup View
 void fileview_set_as_startup_view( void );
 
+// Open With
+void fileview_open_with( void );
+gint fileview_show_open_with_dialog(const gchar          *title,
+                                    const alttype_info_t *info);
+
 G_END_DECLS
 
 #endif

ctb/po/POTFILES.in

 src/index_db.c
 src/index_ipc.c
 src/ipc.c
+src/lastapps.c
 src/main.c
 src/mdbindex.c
 src/menu.c
 src/shortcut.c
 src/tags.c
-
+src/views.c
 # Copyright (C) 2008 iRex Technologies B.V.
 # This file is distributed under the same license as the ctb package.
 # Automatically generated, 2008.
-#
+#  <>, 2011.
 msgid ""
 msgstr ""
 "Project-Id-Version: ctb 0.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2010-04-16 15:25+0200\n"
-"PO-Revision-Date: 2009-12-18 13:23+0100\n"
-"Last-Translator: \n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2011-02-11 09:41-0500\n"
+"Last-Translator:  <>\n"
+"Language-Team: none <>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
 #: ../data/ctb.schemas.in.h:1
 msgid "BMP Image"
-msgstr "BMP Image"
+msgstr "BMP Bild"
 
 #: ../data/ctb.schemas.in.h:2
 msgid "GIF Image"
-msgstr "GIF Image"
+msgstr "GIF Bild"
 
 #: ../data/ctb.schemas.in.h:3
 msgid "HTML"
 
 #: ../data/ctb.schemas.in.h:4
 msgid "Inp"
-msgstr ""
+msgstr "Inp"
 
 #: ../data/ctb.schemas.in.h:5
 msgid "JPEG Image"
-msgstr "JPEG Image"
+msgstr "JPEG Bild"
 
 #: ../data/ctb.schemas.in.h:6
 msgid "Newspaper"
 
 #: ../data/ctb.schemas.in.h:7
 msgid "Note"
-msgstr ""
+msgstr "Notiz"
 
 #: ../data/ctb.schemas.in.h:8
 msgid "PDF"
 
 #: ../data/ctb.schemas.in.h:9
 msgid "PNG Image"
-msgstr "PNG Image"
+msgstr "PNG Bild"
 
 #: ../data/ctb.schemas.in.h:10
 msgid "TIFF Image"
-msgstr "TIFF Image"
+msgstr "TIFF Bild"
 
 #: ../data/ctb.schemas.in.h:11
 msgid "Text"
 #: ../data/ebookmall.desktop.in.h:1 ../src/filemodel.c:1698
 msgid "Browse the eBook Mall for new books and much more"
 msgstr ""
-"Durchsuchen Sie das eBook Einkaufszentrum nach neuen Büchern und vielem mehr"
+"Durchsuchen Sie das eBook Einkaufszentrum nach neuen Büchern und vieles mehr"
 
 #: ../data/ebookmall.desktop.in.h:2 ../src/filemodel.c:1691
 msgid "eBook Mall"
 
 #: ../data/settings/flipbar.desktop.in.h:1
 msgid "Change the way the flipbar turns pages"
-msgstr "Ändern Sie die Art wie der Blätterleiste die Seiten umblättert"
+msgstr "Ändern Sie die Art wie die Blätterleiste die Seiten umblättert"
 
 #: ../data/settings/flipbar.desktop.in.h:2
 msgid "Flipbar Setup"
 
 #: ../data/settings/margins.desktop.in.h:1
 msgid "Adjust the margin that surrounds text"
-msgstr "Stellen Sie den Rand ein, der den Text umgibt"
+msgstr "Stellen Sie den Rand ein der den Text umgibt"
 
 #: ../data/settings/margins.desktop.in.h:2
 msgid "Page Margins"
 
 #: ../data/settings/power.desktop.in.h:1
 msgid "Customize power consumption settings"
-msgstr ""
+msgstr "Anpassen der Stromverbrauchseinstellungen"
 
 #: ../data/settings/power.desktop.in.h:2
 msgid "Power Management"
 msgstr "Geräteverwaltung"
 
 #: ../data/settings/reset.desktop.in.h:2
-#, fuzzy
 msgid "Reset device settings, format card, and more"
-msgstr ""
-"Einstellungen zurücksetzen, Adobe ID entfernen, Karte formatieren und mehr"
+msgstr "Einstellungen zurücksetzen, Karte formatieren und mehr"
 
 #: ../data/settings/sdcard.desktop.in.h:1
 msgid "SD Card Information "
 
 #: ../data/settings/stylus.desktop.in.h:1
 msgid "Calibrate your stylus to improve accuracy"
-msgstr "Kalibrieren Sie Ihren Stylus, um die Genauigkeit zu verbessern"
+msgstr "Kalibrieren Sie Ihren Stylus um die Genauigkeit zu verbessern"
 
 #: ../data/settings/stylus.desktop.in.h:2
 msgid "Stylus Calibration"
 
 #: ../data/settings/language.desktop.in.h:2
 msgid "Switch the language used on the device interface"
-msgstr "Wechseln Sie die Sprache, die auf der Geräteschnittstelle genutzt wird"
+msgstr "Wechseln Sie die Sprache die auf der Geräteschnittstelle genutzt wird"
 
 #: ../data/settings/wifi.desktop.in.h:1
 msgid "WiFi"
 
 #: ../data/settings/advanced.desktop.in.h:1
 msgid "Advanced Settings"
-msgstr ""
+msgstr "Fortgeschrittene Einstellungen"
 
 #: ../data/settings/advanced.desktop.in.h:2
 msgid "Learn about advanced features for the Digital Reader"
 msgstr ""
+"Lernen Sie die fortgeschrittenen Eigenschaften des Digital Readers kennen"
 
 #: ../data/settings/reset2.desktop.in.h:2
-#, fuzzy
 msgid "Reset settings, remove DRM, format card, and more"
-msgstr ""
-"Einstellungen zurücksetzen, Adobe ID entfernen, Karte formatieren und mehr"
+msgstr "Einstellungen zurücksetzen, DRM entfernen, Karte formatieren und mehr"
 
 #: ../data/settings/rotation.desktop.in.h:1
 msgid "Change the rotation direction of the display"
-msgstr ""
+msgstr "Ändern Sie die Drehrichtung der Anzeige"
 
 #: ../data/settings/rotation.desktop.in.h:2
 msgid "Screen Rotation"
-msgstr ""
+msgstr "Drehung der Anzeige"
 
 #: ../data/settings/sensors.desktop.in.h:1
 msgid "Change the behavior of the sensors"
-msgstr ""
+msgstr "Ändern Sie die Eigenschaften der Sensoren"
 
 #: ../data/settings/sensors.desktop.in.h:2
 msgid "Navigation Sensors"
-msgstr ""
+msgstr "Navigationssensoren"
 
 #: ../src/ctb_actions.c:108 ../src/ctb_actions.c:113
 #, c-format
 msgstr "Die Webseite '%s' kann nicht geöffnet werden."
 
 #: ../src/ctb_actions.c:146
-#, fuzzy, c-format
+#, c-format
 msgid ""
 "The '%s' application cannot be opened.\n"
 "Possibly the application is already open. Close it first and try again."
 msgstr ""
 "Die '%s' Anwendung kann nicht geöffnet werden.\n"
-"Versuchen Sie einige Dokumente zu schließen oder installieren Sie die "
-"Software erneut und versuchen Sie es noch einmal."
+"Viellecht ist die Anwendung schon geöffnet. Schließen Sie sie zuerst and "
+"versuchen Sie es dann noch einmal. "
 
 #: ../src/ctb_actions.c:152
 #, c-format
 "%s appears to no longer exist.\n"
 "Try connecting and ejecting the device from the computer."
 msgstr ""
+"%s scheint nicht mehr zu existieren.\n"
+"Versuchen Sie zuerst die Verbindung mit dem Rechner herzustellen und dann zu "
+"trennen."
 
 #: ../src/ctb_actions.c:261
 #, c-format
 #: ../src/ctb_actions.c:379
 #, c-format
 msgid "A shortcut cannot be created for this item"
-msgstr ""
+msgstr "Es kann kein Kürzel für dieses Element erzeugt werden"
 
 #: ../src/filefind.c:165
 msgid ""
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:60
-#, fuzzy
 msgid "- by type"
-msgstr "- nach Titel"
+msgstr "- nach Art"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:62
-#, fuzzy
 msgid "- by size"
-msgstr "- nach Titel"
+msgstr "- nach Größe"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:64
 
 #: ../src/filemodel.c:95 ../src/fileview.c:175
 msgid "Home"
-msgstr "Home"
+msgstr "Hauptmenü"
 
 #: ../src/filemodel.c:96 ../src/filemodel.c:1748
 msgid "Settings"
 msgid "SD Card"
 msgstr "SD Karte"
 
+#
 #: ../src/filemodel.c:102 ../src/filemodel.c:1742
-#, fuzzy
 msgid "Shortcuts"
 msgstr "Kürzel"
 
 #: ../src/filemodel.c:103 ../src/filemodel.c:1738
-#, fuzzy
 msgid "Notes"
-msgstr "Zeitung"
+msgstr "Notizen"
 
 #: ../src/filemodel.c:104 ../src/filemodel.c:1747
 msgid "Help"
 
 #: ../src/filemodel.c:1364
 msgid "New Note"
-msgstr ""
+msgstr "Neue Notiz"
 
 #: ../src/filemodel.c:1371
 msgid "Open a new notepad to write on"
-msgstr ""
+msgstr "Öffnen Sie einen neuen Notizblock zum schreiben"
 
 #: ../src/filemodel.c:1378
 msgid "Up a Level"
 
 #: ../src/filemodel.c:1730
 msgid "Read the latest newspapers and other periodicals"
-msgstr "Lesen Sie die aktuelle Zeitung und andere Zeitschriften"
+msgstr "Lesen Sie die aktuellen Zeitungen und andere Zeitschriften"
 
 #: ../src/filemodel.c:1731
 msgid "View your saved pictures and images"
 
 #: ../src/filemodel.c:1735
 msgid "See all the files saved in Personal Documents"
-msgstr "Siehe alle Dateien die in den persönlichen Dokumenten gespeichert sind"
+msgstr ""
+"Ansehen aller Dateien, die in den persönlichen Dokumenten gespeichert sind"
 
 #: ../src/filemodel.c:1738
 msgid "Keep track of your notes with this handy notepad"
-msgstr ""
+msgstr "Behalten sie ihre Notizen mit diesem nützlichen Notizblock im Auge"
 
 #: ../src/filemodel.c:1739
 msgid "View the last 15 items added to the device"
-msgstr "Zeige die letzen 15 Elemente, die dem Gerät hinzugefügt wurden"
+msgstr "Anzeige der letzen 15 Elemente, die dem Gerät hinzugefügt wurden"
 
 #: ../src/filemodel.c:1742
 msgid "Shortcuts that you've made to your documents are found here"
-msgstr ""
+msgstr "Kürzel zu ihren Dokumenten befinden sich hier"
 
 #: ../src/filemodel.c:1745
 msgid "Browse and navigate the folders saved on the SD card"
-msgstr ""
+msgstr "Navigieren der Ordner auf der SD Karte"
 
 #: ../src/filemodel.c:1746
 msgid "Search"
-msgstr "Suchergebnis"
+msgstr "Suchen"
 
 #: ../src/filemodel.c:1746
 msgid "Search for books, news items, or images"
 #: ../src/filemodel.c:1748
 msgid "Find and edit the settings used on this device"
 msgstr ""
-"Finden und editieren Sie die Einstellungen, die auf diesem Gerät genutzt "
+"Finden und editieren Sie die Einstellungen die auf diesem Gerät benutzt "
 "werden"
 
 #. TRANSLATORS: %s in this string will be replaced by the author of the book.
 #: ../src/filemodel.c:1852
 #, c-format
 msgid "shortcut to %s"
-msgstr ""
+msgstr "Kürzel zu %s"
 
 #. TRANSLATORS: This is a date and time format specifier, according to the strftime(3) man page.
 #. The result will be used to identify date and time of a file, e.g. '02/03/2010 11:13:01'.
 
 #: ../src/filemodel.c:1947
 msgid "broken shortcut"
-msgstr ""
+msgstr "unterbrochenes Kürzel"
 
 #: ../src/filemodel.c:1951
 msgid "This file will be downloaded to your device."
 
 #: ../src/fileview.c:156
 msgid "Date Modified"
-msgstr "Datum modifiziert"
+msgstr "Modifizierungsdatum"
 
 #: ../src/fileview.c:213 ../src/fileview.c:1095
 msgid "Finish Delete"
-# Italian translations for ctb package.
+# Spanish translations for ctb package.
 # Copyright (C) 2009 THE ctb'S COPYRIGHT HOLDER
 # This file is distributed under the same license as the ctb package.
 # Automatically generated, 2009.
+# 
+# 
+# Francisco Sierra <carsier@iies.es>, 2011.
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: ctb 1.6\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2010-04-16 15:25+0200\n"
-"PO-Revision-Date: 2009-12-29 14:18+0100\n"
-"Last-Translator: Laura <helpfe@tin.it>\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2011-02-17 20:42+0100\n"
+"Last-Translator: Francisco Sierra <carsier@iies.es>\n"
+"Language-Team: Español (Spanish) <carsier@iies.es>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
 #: ../data/ctb.schemas.in.h:4
 msgid "Inp"
-msgstr ""
+msgstr "Inp"
 
 #: ../data/ctb.schemas.in.h:5
 msgid "JPEG Image"
 
 #: ../data/ctb.schemas.in.h:7
 msgid "Note"
-msgstr ""
+msgstr "Nota"
 
 #: ../data/ctb.schemas.in.h:8
 msgid "PDF"
 
 #: ../data/ebookmall.desktop.in.h:1 ../src/filemodel.c:1698
 msgid "Browse the eBook Mall for new books and much more"
-msgstr "Recorra el eBook Mall para encontrar libros y mucho más"
+msgstr ""
+"Recorra la tienda de libros electrónicos para encontrar libros y mucho más"
 
 #: ../data/ebookmall.desktop.in.h:2 ../src/filemodel.c:1691
 msgid "eBook Mall"
-msgstr "eBook Mall"
+msgstr "Tienda de libros electrónicos"
 
 #: ../data/settings/myirex.desktop.in.h:1
 msgid "MYIREX Account"
 
 #: ../data/settings/deviceinfo.desktop.in.h:2
 msgid "Find information such as serial numbers here"
-msgstr "Encuentre aquí información como los números de serie"
+msgstr "Encuentre aquí información tal como los números de serie"
 
 #: ../data/settings/flipbar.desktop.in.h:1
 msgid "Change the way the flipbar turns pages"
 msgstr ""
-"Cambio de la manera con la cual la barra de deslizamiento cambia las páginas"
+"Cambio de la manera con la cual la barra de deslizamiento pasa las páginas"
 
 #: ../data/settings/flipbar.desktop.in.h:2
 msgid "Flipbar Setup"
 
 #: ../data/settings/power.desktop.in.h:1
 msgid "Customize power consumption settings"
-msgstr ""
+msgstr "Personalización de la configuración de consumo de energía"
 
 #: ../data/settings/power.desktop.in.h:2
 msgid "Power Management"
 msgstr "Gestión del aparato"
 
 #: ../data/settings/reset.desktop.in.h:2
-#, fuzzy
 msgid "Reset device settings, format card, and more"
 msgstr ""
-"Reseteo de configuraciones, eliminación de ID de Adobe, formateo de tarjetas "
-"y mucho más"
+"Recuperación de configuraciones originales, formateo de tarjetas y mucho más"
 
 #: ../data/settings/sdcard.desktop.in.h:1
 msgid "SD Card Information "
 msgstr "WiFi"
 
 #: ../data/settings/advanced.desktop.in.h:1
-#, fuzzy
 msgid "Advanced Settings"
-msgstr "Configuraciones"
+msgstr "Configuraciones avanzadas"
 
 #: ../data/settings/advanced.desktop.in.h:2
 msgid "Learn about advanced features for the Digital Reader"
-msgstr ""
+msgstr "Aprenda sobre características avanzadas del Lector Digital"
 
 #: ../data/settings/reset2.desktop.in.h:2
-#, fuzzy
 msgid "Reset settings, remove DRM, format card, and more"
 msgstr ""
-"Reseteo de configuraciones, eliminación de ID de Adobe, formateo de tarjetas "
-"y mucho más"
+"Recuperación de configuraciones originales, formateo de tarjetas y mucho más"
 
 #: ../data/settings/rotation.desktop.in.h:1
 msgid "Change the rotation direction of the display"
-msgstr ""
+msgstr "Cambio de la dirección de rotación de la pantalla"
 
 #: ../data/settings/rotation.desktop.in.h:2
 msgid "Screen Rotation"
-msgstr ""
+msgstr "Rotación de la pantalla"
 
 #: ../data/settings/sensors.desktop.in.h:1
 msgid "Change the behavior of the sensors"
-msgstr ""
+msgstr "Cambio del comportamiento de los sensores"
 
 #: ../data/settings/sensors.desktop.in.h:2
 msgid "Navigation Sensors"
-msgstr ""
+msgstr "Sensores de navegación"
 
 #: ../src/ctb_actions.c:108 ../src/ctb_actions.c:113
 #, c-format
 msgstr "No se puede abrir la página web '%s'."
 
 #: ../src/ctb_actions.c:146
-#, fuzzy, c-format
+#, c-format
 msgid ""
 "The '%s' application cannot be opened.\n"
 "Possibly the application is already open. Close it first and try again."
 msgstr ""
 "La aplicación '%s' no se puede abrir.\n"
-"Cierre algunos documentos o reinstale el software e inténtelo de nuevo."
+"Posiblemente la aplicación ya está abierta. Ciérrela primero e inténtelo de "
+"nuevo."
 
 #: ../src/ctb_actions.c:152
 #, c-format
 "%s appears to no longer exist.\n"
 "Try connecting and ejecting the device from the computer."
 msgstr ""
+"Parece que ya no existe %s.\n"
+"Intente conectar y expulsar el dispositivo desde el ordenador."
 
 #: ../src/ctb_actions.c:261
 #, c-format
 #: ../src/ctb_actions.c:379
 #, c-format
 msgid "A shortcut cannot be created for this item"
-msgstr ""
+msgstr "No se puede crear un acceso directo para este elemento"
 
 #: ../src/filefind.c:165
 msgid ""
 
 #: ../src/filefind.c:168
 msgid "Cancel"
-msgstr "Anular"
+msgstr "Cancelar"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:58
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:60
-#, fuzzy
 msgid "- by type"
-msgstr "- por título"
+msgstr "- por tipo"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:62
-#, fuzzy
 msgid "- by size"
-msgstr "- por título"
+msgstr "- por tamaño"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:64
 msgid "- by date added"
-msgstr "- por fecha añadida"
+msgstr "- por fecha añadido"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:66
 msgstr "Tarjeta SD"
 
 #: ../src/filemodel.c:102 ../src/filemodel.c:1742
-#, fuzzy
 msgid "Shortcuts"
-msgstr "Acceso directo"
+msgstr "Accesos directos"
 
 #: ../src/filemodel.c:103 ../src/filemodel.c:1738
-#, fuzzy
 msgid "Notes"
-msgstr "Noticias"
+msgstr "Notas"
 
 #: ../src/filemodel.c:104 ../src/filemodel.c:1747
 msgid "Help"
 
 #: ../src/filemodel.c:106
 msgid "Search Results"
-msgstr "Buscar Resultados"
+msgstr "Resultados de búsqueda"
 
 #: ../src/filemodel.c:1354 ../src/filemodel.c:1357
 msgid "to Home"
 
 #: ../src/filemodel.c:1364
 msgid "New Note"
-msgstr ""
+msgstr "Nueva nota"
 
 #: ../src/filemodel.c:1371
 msgid "Open a new notepad to write on"
-msgstr ""
+msgstr "Abra un nuevo cuaderno para escribir"
 
 #: ../src/filemodel.c:1378
 msgid "Up a Level"
 
 #: ../src/filemodel.c:1729
 msgid "See all the books that have been saved to your library"
-msgstr "Vea todos los libros que han sido guardados en su librería"
+msgstr "Vea todos los libros que han sido guardados en su biblioteca"
 
 #: ../src/filemodel.c:1730
 msgid "Read the latest newspapers and other periodicals"
 
 #: ../src/filemodel.c:1731
 msgid "View your saved pictures and images"
-msgstr "Mire sus fotos e imágenes guardadas"
+msgstr "Vea sus fotos e imágenes guardadas"
 
 #: ../src/filemodel.c:1735
 msgid "See all the files saved in Personal Documents"
-msgstr "Vea todos los ficheros guardados en Documentos Personales"
+msgstr "Vea todos los archivos guardados en Documentos Personales"
 
 #: ../src/filemodel.c:1738
 msgid "Keep track of your notes with this handy notepad"
-msgstr ""
+msgstr "Siga la pista de sus notas con este manejable cuaderno"
 
 #: ../src/filemodel.c:1739
 msgid "View the last 15 items added to the device"
 #: ../src/filemodel.c:1742
 msgid "Shortcuts that you've made to your documents are found here"
 msgstr ""
+"Los accesos directos establecidos para sus documentos se encuentran aquí"
 
 #: ../src/filemodel.c:1745
 msgid "Browse and navigate the folders saved on the SD card"
-msgstr ""
+msgstr "Navegar por las carpetas guardadas en la tarjeta SD"
 
 #: ../src/filemodel.c:1746
 msgid "Search"
 #. TRANSLATORS: %s in this string will be replaced by the filename.
 #. For Example: 'shortcut to files/foo/bar.pdf'
 #: ../src/filemodel.c:1852
-#, fuzzy, c-format
+#, c-format
 msgid "shortcut to %s"
-msgstr "Acceso directo"
+msgstr "acceso directo a %s"
 
 #. TRANSLATORS: This is a date and time format specifier, according to the strftime(3) man page.
 #. The result will be used to identify date and time of a file, e.g. '02/03/2010 11:13:01'.
 msgstr "%x %X"
 
 #: ../src/filemodel.c:1947
-#, fuzzy
 msgid "broken shortcut"
-msgstr "Acceso directo"
+msgstr "acceso directo roto"
 
 #: ../src/filemodel.c:1951
 msgid "This file will be downloaded to your device."
 
 #: ../src/filemodel.c:2023 ../src/filemodel.c:2033
 msgid "MB"
-msgstr "Mb"
+msgstr "MB"
 
 #: ../src/filemodel.c:2043 ../src/filemodel.c:2053
 msgid "KB"
-msgstr "Kb"
+msgstr "KB"
 
 #: ../src/filemodel.c:2060
 msgid "B"
 
 #: ../src/menu.c:156
 msgid "Cancel Delete"
-msgstr "Anular Borrar"
+msgstr "Cancelar Borrar"
 
 #. TRANSLATORS: %s is replaced by the current category
 #. Example: 'Back to Books'
 # French translations for ctb package.
 # Copyright (C) 2008 iRex Technologies B.V.
 # This file is distributed under the same license as the ctb package.
-# Automatically generated, 2008.
-# 
+# Automatically generated, 2008.
+# Automatically generated <>, 2011.
 msgid ""
 msgstr ""
 "Project-Id-Version: ctb 0.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2010-04-16 15:25+0200\n"
-"PO-Revision-Date: 2008-08-27 08:26+0200\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2011-02-12 22:58-0500\n"
+"Last-Translator: Automatically generated <>\n"
+"Language-Team: none <>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
 #: ../data/ctb.schemas.in.h:4
 msgid "Inp"
-msgstr ""
+msgstr "Inp"
 
 #: ../data/ctb.schemas.in.h:5
 msgid "JPEG Image"
 
 #: ../data/ctb.schemas.in.h:7
 msgid "Note"
-msgstr ""
+msgstr "Note"
 
 #: ../data/ctb.schemas.in.h:8
 msgid "PDF"
 
 #: ../data/settings/power.desktop.in.h:1
 msgid "Customize power consumption settings"
-msgstr ""
+msgstr "Personnaliser les paramètres de consommation de courant"
 
 #: ../data/settings/power.desktop.in.h:2
 msgid "Power Management"
 msgstr "Gestion du lecteur"
 
 #: ../data/settings/reset.desktop.in.h:2
-#, fuzzy
 msgid "Reset device settings, format card, and more"
-msgstr ""
-"Réinitialiser les paramètres, retirer l'Adobe ID, formater la carte et plus"
+msgstr "Réinitialiser les paramètres, formater la carte, et plus"
 
 #: ../data/settings/sdcard.desktop.in.h:1
 msgid "SD Card Information "
 msgstr "WiFi"
 
 #: ../data/settings/advanced.desktop.in.h:1
-#, fuzzy
 msgid "Advanced Settings"
-msgstr "Paramètres"
+msgstr "Paramètres avancés"
 
 #: ../data/settings/advanced.desktop.in.h:2
 msgid "Learn about advanced features for the Digital Reader"
-msgstr ""
+msgstr "Appendre les fonctions avancées du lecteur"
 
 #: ../data/settings/reset2.desktop.in.h:2
-#, fuzzy
 msgid "Reset settings, remove DRM, format card, and more"
 msgstr ""
-"Réinitialiser les paramètres, retirer l'Adobe ID, formater la carte et plus"
+"Réinitialiser les paramètres, retirer le DRM, formater la carte et plus"
 
 #: ../data/settings/rotation.desktop.in.h:1
 msgid "Change the rotation direction of the display"
-msgstr ""
+msgstr "Changer la direction de pivotage de l'écran"
 
 #: ../data/settings/rotation.desktop.in.h:2
 msgid "Screen Rotation"
-msgstr ""
+msgstr "Pivotage de l'écran"
 
 #: ../data/settings/sensors.desktop.in.h:1
 msgid "Change the behavior of the sensors"
-msgstr ""
+msgstr "Changer le comportement des senseurs"
 
 #: ../data/settings/sensors.desktop.in.h:2
 msgid "Navigation Sensors"
-msgstr ""
+msgstr "Senseurs de navigation"
 
 #: ../src/ctb_actions.c:108 ../src/ctb_actions.c:113
 #, c-format
 msgstr "La page web '%s' ne peut être ouverte."
 
 #: ../src/ctb_actions.c:146
-#, fuzzy, c-format
+#, c-format
 msgid ""
 "The '%s' application cannot be opened.\n"
 "Possibly the application is already open. Close it first and try again."
 msgstr ""
 "L'application '%s' ne peut être ouverte.\n"
-"Essayez de fermer certains documents ou réinstallez le logiciel et réessayez."
+"L'application est peut-être déjà ouverte. Essayez de la fermer et réessayez."
 
 #: ../src/ctb_actions.c:152
 #, c-format
 "%s appears to no longer exist.\n"
 "Try connecting and ejecting the device from the computer."
 msgstr ""
+"%s ne semble plus exister.\n"
+"Essayez de connecter et d'éjecter le lecteur de l'ordinateur. "
 
 #: ../src/ctb_actions.c:261
 #, c-format
 #: ../src/ctb_actions.c:379
 #, c-format
 msgid "A shortcut cannot be created for this item"
-msgstr ""
+msgstr "Un raccourci ne peut être créé pour cet élément"
 
 #: ../src/filefind.c:165
 msgid ""
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:60
-#, fuzzy
 msgid "- by type"
-msgstr "- par titre"
+msgstr "- par genre"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:62
-#, fuzzy
 msgid "- by size"
-msgstr "- par titre"
+msgstr "- par taille"
 
 #. TRANSLATORS: this is a document sorting option
 #: ../src/filemodel.c:64
 msgstr "Carte SD"
 
 #: ../src/filemodel.c:102 ../src/filemodel.c:1742
-#, fuzzy
 msgid "Shortcuts"
-msgstr "Raccourci"
+msgstr "Raccourcis"
 
 #: ../src/filemodel.c:103 ../src/filemodel.c:1738
-#, fuzzy
 msgid "Notes"
-msgstr "Nouvelles"
+msgstr "Notes"
 
 #: ../src/filemodel.c:104 ../src/filemodel.c:1747
 msgid "Help"
 
 #: ../src/filemodel.c:1364
 msgid "New Note"
-msgstr ""
+msgstr "Nouvelle note"
 
 #: ../src/filemodel.c:1371
 msgid "Open a new notepad to write on"
-msgstr ""
+msgstr "Ouvrir un nouveau bloc-notes pour écriture"
 
 #: ../src/filemodel.c:1378
 msgid "Up a Level"
 
 #: ../src/filemodel.c:1731
 msgid "View your saved pictures and images"
-msgstr "Afficher les images sauvées"
+msgstr "Afficher vos photos et images sauvées"
 
 #: ../src/filemodel.c:1735
 msgid "See all the files saved in Personal Documents"
 
 #: ../src/filemodel.c:1738
 msgid "Keep track of your notes with this handy notepad"
-msgstr ""
+msgstr "Rester au courant des vos notes grâce à ce bloc-notes pratique"
 
 #: ../src/filemodel.c:1739
 msgid "View the last 15 items added to the device"
 
 #: ../src/filemodel.c:1742
 msgid "Shortcuts that you've made to your documents are found here"
-msgstr ""
+msgstr "Les raccourcis que vous avez créés se trouvent ici"
 
 #: ../src/filemodel.c:1745
 msgid "Browse and navigate the folders saved on the SD card"
-msgstr ""
+msgstr "Naviguer les dossiers sauvés sur la carte SD"
 
 #: ../src/filemodel.c:1746
 msgid "Search"
 #. TRANSLATORS: %s in this string will be replaced by the filename.
 #. For Example: 'shortcut to files/foo/bar.pdf'
 #: ../src/filemodel.c:1852
-#, fuzzy, c-format
+#, c-format
 msgid "shortcut to %s"
-msgstr "Raccourci"
+msgstr "Raccourci vers %s"
 
 #. TRANSLATORS: This is a date and time format specifier, according to the strftime(3) man page.
 #. The result will be used to identify date and time of a file, e.g. '02/03/2010 11:13:01'.
 msgstr "%x %X"
 
 #: ../src/filemodel.c:1947
-#, fuzzy
 msgid "broken shortcut"
-msgstr "Raccourci"
+msgstr "Raccourci coupé"
 
 #: ../src/filemodel.c:1951
 msgid "This file will be downloaded to your device."
 
 #: ../src/menu.c:150
 msgid "Delete..."
-msgstr "Supprimer"
+msgstr "Supprimer..."
 
 #: ../src/menu.c:156
 msgid "Cancel Delete"

ctb/src/ctb_actions.c

     
     return rc;
 }
+
+int open_with_item(const filelist_entry_t *item)
+{
+    alttype_info_t *alternatives;
+    int choice = -1;
+    
+    g_assert(item);
+    g_assert(item->filename          && item->filename->str        );
+    g_assert(item->filename_display  && item->filename_display->str);
+    g_assert(item->filetype          && item->filetype->str        );
+    g_assert(item->directory_path    && item->directory_path->str  );
+
+    WARNPRINTF("Open with for: %s/%s type:%s\n", item->directory_path->str, item->filename->str, item->filetype->str);
+    // Check if allowed to change title
+    if (!properties_allowed(item)) {
+        // TODO: now reusing properties_allowed()-function, needs own function in future?
+        
+        // gchar *error_msg = g_strdup_printf(_("Properties cannot be changed for this item"));
+        // show_error_dialog(error_msg);
+        // g_free(error_msg);
+        return ER_FORBIDDEN;
+    }
+
+    // get alternatices
+    alternatives = filetypes_find_alttype_info(item->filetype->str);
+    
+    if (!alternatives)
+    {
+        // No alternatives installed
+        gchar *error_msg = g_strdup_printf(_("There are no alternative programs installed for this filetype"));
+        show_error_dialog(error_msg);
+        g_free(error_msg);
+        return ER_FORBIDDEN;
+    }
+
+    // Pick one of the alternatives
+    choice = fileview_show_open_with_dialog(_("Open With ..."), alternatives);
+
+    if (choice > 0)
+    {
+        WARNPRINTF("Selected: %d", choice);
+        
+        while (choice != 1)
+        {
+            if (alternatives) alternatives = alternatives->next;
+            choice--;
+        }
+        
+        if (alternatives)
+        {
+            WARNPRINTF("Opening with: %s", alternatives->viewer_cmd);
+            // Use code that allows the viewer_cmd to be used, copied from activate_item()
+            gchar *cmd_line = g_strdup_printf("%s \"%s/%s\"", 
+                        alternatives->viewer_cmd, item->directory_path->str, item->filename->str);
+            gchar *ret_message = NULL;
+            gint errcode = ipc_sys_start_task(cmd_line, item->directory_path->str,
+                                              item->filename_display->str, NULL, &ret_message);
+            if (errcode > 0 && ret_message && ret_message[0] != '\0')
+            {
+                ERRORPRINTF("cannot launch viewer, cmd_line [%s], errcode %d [%s]", cmd_line, errcode, ret_message);
+                show_error_dialog(ret_message);
+            }
+        //MH: bug in original code, (sorting on last read date is not working)
+        //#if MACHINE_IS_DR800S || MACHINE_IS_DR800SG || MACHINE_IS_DR800SW
+            else if (errcode == 0) filemodel_update_last_read(item);
+        //#endif
+
+            g_free(ret_message);
+            g_free(cmd_line);
+        }
+    }
+    
+    return ER_OK;
+}
+

ctb/src/filetypes.c

 // Type Declarations
 //----------------------------------------------------------------------------
 
-// detailed info per filetype
 typedef struct
         {
             gchar       *extension;             // file extension excluding the '.'
 #define CTB_GCONF_PATH  "/apps/er/sys/ctb"
 #define REGKEY_SHOW_SDCARD  "show_sdcard"
 static const gchar      *REGKEY_FILETYPE_DIR = CTB_GCONF_PATH "/filetypes";
+static const gchar      *REGKEY_ALTTYPE_DIR  = CTB_GCONF_PATH "/alternatives";
 
 // known filetypes
 static filetype_info_t  g_hardcoded_filetypes[] =
 //----------------------------------------------------------------------------
 
 static GArray           *g_filetype_info = NULL;    // element: filetype_info_t*
+static GArray           *g_alttype_info = NULL;     // element: alttype_info_t*
 static GTree            *g_icon_cache = NULL;
 static GConfClient      *g_gconfclient = NULL;
 static gboolean         g_showdir = FALSE;
 }
 
 
+static void add_alttype_from_gconf(const gchar *dir,
+        GConfClient *client)
+{
+    gchar buffer[GCONF_BUFFER_SIZE];
+    gchar *descr = NULL;
+    gchar *viewer_cmd = NULL;
+    gchar *icon_name = NULL;
+    GSList *ext = NULL;
+
+    descr = read_gconf_value(dir, "descr", client);
+    if (!descr) goto out_error;
+
+    viewer_cmd = read_gconf_value(dir, "viewer_cmd", client);
+    if (!viewer_cmd) goto out_error;
+
+    icon_name = read_gconf_value(dir, "icon_name", client);
+    if (!icon_name) goto out_error;
+
+    g_assert(strlen(dir) + strlen("/extensions") < GCONF_BUFFER_SIZE);
+    snprintf(buffer, GCONF_BUFFER_SIZE-1, "%s/extensions", dir);
+    GSList *extensions = gconf_client_get_list(client, buffer, GCONF_VALUE_STRING, NULL);
+    if (extensions == NULL) {
+        ERRORPRINTF("gconf: cannot read %s", buffer);
+        goto out_error;
+    }
+
+    for (ext = extensions; ext; ext = g_slist_next(ext)) {
+        alttype_info_t newtype;
+        memset(&newtype, 0x00, sizeof(newtype));
+        newtype.extension          = g_strdup(ext->data);
+        newtype.icon_name          = g_strdup(icon_name);
+        newtype.description        = g_strdup(descr);
+        newtype.viewer_cmd         = g_strdup(viewer_cmd);
+        newtype.next               = NULL;
+        // check if there is already a list for the extension
+        alttype_info_t *parent = filetypes_find_alttype_info(newtype.extension);
+        
+        LOGPRINTF("New item: 0x%x", (int)&newtype);
+        if (parent)
+        {
+            // extension already found, adding to list
+            // TODO: add at end, so it is always clear in which order the items appear
+            //       or sort on description??
+
+            // need to create a copy
+            alttype_info_t *p_newtype = g_memdup(&newtype, sizeof(alttype_info_t) );
+            LOGPRINTF("Adding to list[0x%x]:%s-%s", (int)parent, p_newtype->extension, p_newtype->description);
+            p_newtype->next = parent->next;
+            parent->next = p_newtype;
+        }
+        else
+        {
+            LOGPRINTF("Adding to array:%s-%s", newtype.extension, newtype.description);
+            g_array_append_val(g_alttype_info, newtype);
+        }
+    }
+    g_slist_foreach (extensions, (GFunc)g_free, NULL);
+    g_slist_free(extensions);
+out_error:
+    g_free(icon_name);
+    g_free(viewer_cmd);
+    g_free(descr);
+}
+
+
+static void add_alttypes_from_gconf()
+{
+    GSList *types = NULL;
+    GConfClient *client = gconf_client_get_default();
+
+    LOGPRINTF("STARTED");
+    gboolean exists = gconf_client_dir_exists(client, REGKEY_ALTTYPE_DIR, NULL);
+    if (exists == FALSE) {
+        ERRORPRINTF("gconf: %s does not exist", REGKEY_ALTTYPE_DIR);
+        goto unref;
+    }
+
+    types = gconf_client_all_dirs(client, REGKEY_ALTTYPE_DIR, NULL);
+    if (types == NULL) {
+        ERRORPRINTF("gconf: cannot read dir entries of %s", REGKEY_ALTTYPE_DIR);
+        goto unref;
+    }
+
+    g_slist_foreach (types, (GFunc)add_alttype_from_gconf, client);
+    g_slist_foreach (types, (GFunc)g_free, NULL);
+    g_slist_free(types);
+unref:
+    g_object_unref(client);
+}
+
+
 static void add_hardcoded_filetypes()
 {
     filetype_info_t   *known_type = NULL;
     add_hardcoded_filetypes();
     add_filetypes_from_gconf();
 
+    g_alttype_info = g_array_new( TRUE, TRUE, sizeof(alttype_info_t) );
+    g_assert(g_alttype_info);
+
+    add_alttypes_from_gconf();
+
     if (watch) {
         g_gconfclient = gconf_client_get_default();
         g_assert(g_gconfclient);
 }
 
 
+alttype_info_t* filetypes_find_alttype_info (const gchar *file_ext )
+{
+
+    g_assert(g_alttype_info);
+
+    LOGPRINTF("file_ext [%s]", file_ext);
+    if (file_ext == NULL)
+    {
+        file_ext = "";
+    }
+
+    alttype_info_t *ret = NULL;
+    alttype_info_t *details = (alttype_info_t*) g_alttype_info->data;
+    while (details->extension)
+    {
+        if (g_ascii_strcasecmp( details->extension, file_ext ) == 0 )
+        {
+            ret = details;
+            break;
+        }
+        else
+        {
+            details++;
+        }
+    }
+
+    return ret;
+}
+
+
 GdkPixbuf* get_icon_from_file_extension (const gchar                *file_ext,
                                          const gboolean              is_directory,
                                          const filemodel_thumbsize_t icon_size     )

ctb/src/fileview.c

 static ViewMode gStartupViewMode = -1;
 static gchar    *gStartupViewDir = NULL;
 
+// open with dialog
+static GtkDialog *g_dialog;
 //============================================================================
 // Local Function Definitions
 //============================================================================
     return new_value;
 }
 
+/* Our usual callback function */
+static void callback( GtkWidget *widget,
+                      gpointer   data )
+{
+    gint number = (gint)data;
+    
+    if (g_dialog)
+    {
+        gtk_dialog_response(g_dialog, number);
+    }
+}
+
+gint fileview_show_open_with_dialog(const gchar          *title,
+                                    const alttype_info_t *info)
+{
+    GtkWidget *dialog;
+    GtkWidget *button;
+    gint      index = 1;
+
+    LOGPRINTF("entry");
+    // object hierarchy:
+    //       dialog
+    //         |
+    /* Create the widgets */
+    dialog = gtk_dialog_new_with_buttons (title,
+                                          GTK_WINDOW(g_main_window),
+                                          GTK_DIALOG_DESTROY_WITH_PARENT,
+                                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                          NULL);
+    gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+    gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+    gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); /* 2 * 5 + 2 = 12 */
+    gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
+    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+
+    //--------------------------------------------------------------------------
+    while(info)
+    {
+        LOGPRINTF("Button: 0x%x %s", (int)info, info->description);
+        button = gtk_button_new_with_label(info->description);
+        /* Connect the "clicked" signal of the button to our callback */
+        gtk_signal_connect (GTK_OBJECT (button), "clicked",
+                            GTK_SIGNAL_FUNC (callback), (gpointer) index);
+        index++;
+        gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), button, TRUE, TRUE, 0);
+        gtk_widget_show(button);
+        
+        info = info->next;
+    }
+
+    index = -1;
+    g_dialog = GTK_DIALOG (dialog); // fill global var for callback
+    index = gtk_dialog_run (GTK_DIALOG (dialog));
+    g_dialog = NULL;
+
+    gtk_widget_destroy(dialog);
+    
+    return index;
+}
+
 void fileview_refresh(gboolean force_reload)
 {
     LOGPRINTF("");
     }
 }
 
+void fileview_open_with( void )
+{
+    filelist_entry_t *entry = get_entry_at_cursor();
+    if (entry) {
+        open_with_item(entry);
+        filelist_entry_free(entry);
+    }
+}
+
 void fileview_set_as_startup_view( void )
 {
     // Accepting all views here, see fileview_media_mounted() for the supported views
 
 //   group "Tools"
 static const char *ITEM_TOOLS_PROPERTIES    = "properties";
+static const char *ITEM_TOOLS_OPENWITH      = "open_with";
 static const char *ITEM_TOOLS_STARTPAGE     = "startpage";
 
 // item states                              
     ipc_menu_add_group( GROUP_TOOLS2,           group, "folder"          );
     ipc_menu_add_group( GROUP_TOOLS_ACTIONS,    GROUP_TOOLS2, "folder"          );
     ipc_menu_add_item ( ITEM_TOOLS_PROPERTIES,  GROUP_TOOLS_ACTIONS, "view_bookinfo"   );
+    ipc_menu_add_item ( ITEM_TOOLS_OPENWITH,    GROUP_TOOLS_ACTIONS, "open"   );
     ipc_menu_add_item ( ITEM_TOOLS_STARTPAGE,   group, "startpage"       );
 
     group = GROUP_EXTRA;
     group = GROUP_TOOLS_ACTIONS;
     ipc_menu_set_group_label( GROUP_TOOLS2,                  _("Tools")             );
     ipc_menu_set_item_label ( ITEM_TOOLS_PROPERTIES,  group, _("Properties...")     );
+    ipc_menu_set_item_label ( ITEM_TOOLS_OPENWITH,    group, _("Open With...")      );
     ipc_menu_set_item_label ( ITEM_TOOLS_STARTPAGE,   group, _("Set as StartPage")  );
     //
     group = GROUP_EXTRA;
             {
                 fileview_edit_properties();
             }
+            else if ( strcmp(item, ITEM_TOOLS_OPENWITH  ) == 0 )
+            {
+                fileview_open_with();
+            }
             else if ( strcmp(item, ITEM_TOOLS_STARTPAGE  ) == 0 )
             {
                 fileview_set_as_startup_view();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.