2006-06-28 [paul] 2.3.1cvs29
[claws.git] / src / prefs_ext_prog.c
index cf7036c..4ddd994 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -59,6 +59,9 @@ typedef struct _ExtProgPage
 
        GtkWidget *image_viewer_label;
        GtkWidget *image_viewer_entry;
+       
+       GtkWidget *astextviewer_label;
+       GtkWidget *astextviewer_entry;
 
        GtkWidget *audio_player_label;
        GtkWidget *audio_player_entry;
@@ -76,15 +79,20 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *uri_label;
        GtkWidget *uri_combo;
        GtkWidget *uri_entry;
-       GtkWidget *printcmd_label;
-       GtkWidget *printcmd_entry;
        GtkWidget *exteditor_label;
        GtkWidget *exteditor_combo;
        GtkWidget *exteditor_entry;
        GtkWidget *image_viewer_label;
        GtkWidget *image_viewer_entry;
+       GtkWidget *astextviewer_label;
+       GtkWidget *astextviewer_entry;
        GtkWidget *audio_player_label;
        GtkWidget *audio_player_entry;
+       GtkWidget *printcmd_label;
+       GtkWidget *printcmd_entry;
+       GtkTooltips *tooltip;
+
+       tooltip = gtk_tooltips_new();
 
        table = gtk_table_new(2, 1, FALSE);
        gtk_widget_show(table);
@@ -106,7 +114,7 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_box_pack_start(GTK_BOX (vbox),
                           hint_label, FALSE, FALSE, 4);
 
-       table2 = gtk_table_new(5, 2, FALSE);
+       table2 = gtk_table_new(6, 2, FALSE);
        gtk_widget_show(table2);
        gtk_container_set_border_width(GTK_CONTAINER(table2), 8);
        gtk_table_set_row_spacings(GTK_TABLE(table2), 4);
@@ -145,26 +153,10 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        uri_entry = GTK_COMBO (uri_combo)->entry;
        gtk_entry_set_text(GTK_ENTRY(uri_entry), prefs_common.uri_cmd ? prefs_common.uri_cmd : "");
        
-       printcmd_label = gtk_label_new (_("Print command"));
-       gtk_widget_show(printcmd_label);
-
-       gtk_table_attach(GTK_TABLE (table2), printcmd_label, 0, 1, 1, 2,
-                        (GtkAttachOptions) (GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 2);
-       gtk_label_set_justify(GTK_LABEL (printcmd_label), GTK_JUSTIFY_RIGHT);
-       gtk_misc_set_alignment(GTK_MISC (printcmd_label), 1, 0.5);
-
-       printcmd_entry = gtk_entry_new ();
-       gtk_widget_show (printcmd_entry);
-       gtk_table_attach(GTK_TABLE (table2), printcmd_entry, 1, 2, 1, 2,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 0);
-       gtk_entry_set_text(GTK_ENTRY(printcmd_entry), prefs_common.print_cmd ? prefs_common.print_cmd : "");
-
        exteditor_label = gtk_label_new (_("Text editor"));
        gtk_widget_show(exteditor_label);
 
-       gtk_table_attach(GTK_TABLE (table2), exteditor_label, 0, 1, 2, 3,
+       gtk_table_attach(GTK_TABLE (table2), exteditor_label, 0, 1, 1, 2,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 2);
        gtk_label_set_justify(GTK_LABEL (exteditor_label), GTK_JUSTIFY_RIGHT);
@@ -172,7 +164,7 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
 
        exteditor_combo = gtk_combo_new ();
        gtk_widget_show (exteditor_combo);
-       gtk_table_attach (GTK_TABLE (table2), exteditor_combo, 1, 2, 2, 3,
+       gtk_table_attach (GTK_TABLE (table2), exteditor_combo, 1, 2, 1, 2,
                          GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtkut_combo_set_items (GTK_COMBO (exteditor_combo),
                               "gedit %s",
@@ -191,7 +183,7 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        image_viewer_label = gtk_label_new (_("Image viewer"));
        gtk_widget_show(image_viewer_label);
 
-       gtk_table_attach(GTK_TABLE (table2), image_viewer_label, 0, 1, 3, 4,
+       gtk_table_attach(GTK_TABLE (table2), image_viewer_label, 0, 1, 2, 3,
                         (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 2);
        gtk_label_set_justify(GTK_LABEL (image_viewer_label), GTK_JUSTIFY_RIGHT);
@@ -200,12 +192,35 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        image_viewer_entry = gtk_entry_new ();
        gtk_widget_show(image_viewer_entry);
        
-       gtk_table_attach(GTK_TABLE (table2), image_viewer_entry, 1, 2, 3, 4,
+       gtk_table_attach(GTK_TABLE (table2), image_viewer_entry, 1, 2, 2, 3,
                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
        gtk_entry_set_text(GTK_ENTRY(image_viewer_entry), 
                           prefs_common.mime_image_viewer ? prefs_common.mime_image_viewer : "");
 
+       astextviewer_label = gtk_label_new(_("Command for 'Display as text'"));
+       gtk_widget_show(astextviewer_label);
+
+       gtk_table_attach(GTK_TABLE (table2), astextviewer_label, 0, 1, 3, 4,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 2);
+       gtk_label_set_justify(GTK_LABEL (astextviewer_label), GTK_JUSTIFY_RIGHT);
+       gtk_misc_set_alignment(GTK_MISC (astextviewer_label), 1, 0.5);
+
+       astextviewer_entry = gtk_entry_new ();
+       gtk_widget_show(astextviewer_entry);
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltip), astextviewer_entry,
+                            _("This option enables MIME parts to be displayed in the "
+                              "message view via a script when using the 'Display as text' "
+                              "contextual menu item"),
+                            NULL);
+       
+       gtk_table_attach(GTK_TABLE (table2), astextviewer_entry, 1, 2, 3, 4,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_entry_set_text(GTK_ENTRY(astextviewer_entry), 
+                          prefs_common.mime_textviewer ? prefs_common.mime_textviewer : "");
+
        audio_player_label = gtk_label_new (_("Audio player"));
        gtk_widget_show(audio_player_label);
 
@@ -224,12 +239,33 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_entry_set_text(GTK_ENTRY(audio_player_entry), 
                           prefs_common.mime_audio_player ? prefs_common.mime_audio_player : "");
 
+       printcmd_label = gtk_label_new (_("Print command"));
+       #ifndef USE_GNOMEPRINT
+               gtk_widget_show(printcmd_label);
+       #endif
+       gtk_table_attach(GTK_TABLE (table2), printcmd_label, 0, 1, 5, 6,
+                        (GtkAttachOptions) (GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 2);
+       gtk_label_set_justify(GTK_LABEL (printcmd_label), GTK_JUSTIFY_RIGHT);
+       gtk_misc_set_alignment(GTK_MISC (printcmd_label), 1, 0.5);
+
+       printcmd_entry = gtk_entry_new ();
+       #ifndef USE_GNOMEPRINT
+               gtk_widget_show(printcmd_entry);
+       #endif
+       gtk_table_attach(GTK_TABLE (table2), printcmd_entry, 1, 2, 5, 6,
+                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                        (GtkAttachOptions) (0), 0, 0);
+       gtk_entry_set_text(GTK_ENTRY(printcmd_entry), prefs_common.print_cmd ? prefs_common.print_cmd : "");
+
+
        prefs_ext_prog->window                  = GTK_WIDGET(window);
        prefs_ext_prog->uri_entry               = uri_entry;
-       prefs_ext_prog->printcmd_entry          = printcmd_entry;
        prefs_ext_prog->exteditor_entry         = exteditor_entry;
        prefs_ext_prog->image_viewer_entry      = image_viewer_entry;
+       prefs_ext_prog->astextviewer_entry      = astextviewer_entry;
        prefs_ext_prog->audio_player_entry      = audio_player_entry;
+       prefs_ext_prog->printcmd_entry          = printcmd_entry;
 
        prefs_ext_prog->page.widget = table;
 }
@@ -246,6 +282,8 @@ void prefs_ext_prog_save(PrefsPage *_page)
                (GTK_EDITABLE(ext_prog->exteditor_entry), 0, -1);
        prefs_common.mime_image_viewer = gtk_editable_get_chars
                (GTK_EDITABLE(ext_prog->image_viewer_entry), 0, -1);
+       prefs_common.mime_textviewer = gtk_editable_get_chars
+               (GTK_EDITABLE(ext_prog->astextviewer_entry), 0, -1);
        prefs_common.mime_audio_player = gtk_editable_get_chars
                (GTK_EDITABLE(ext_prog->audio_player_entry), 0, -1);
 }
@@ -272,7 +310,7 @@ void prefs_ext_prog_init(void)
        page->page.create_widget = prefs_ext_prog_create_widget;
        page->page.destroy_widget = prefs_ext_prog_destroy_widget;
        page->page.save_page = prefs_ext_prog_save;
-       page->page.weight = 45.0;
+       page->page.weight = 155.0;
        prefs_gtk_register_page((PrefsPage *) page);
        prefs_ext_prog = page;
 }