2006-08-17 [colin] 2.4.0cvs58

* src/mimeview.c
	* src/prefs_common.c
	* src/prefs_common.h
	* src/prefs_ext_prog.c
	* src/textview.c
		Fix issues with previous patch (text/html)
		Remove outdated prefs
This commit is contained in:
Colin Leroy 2006-08-17 19:07:36 +00:00
parent 4424929ba9
commit 233e271a62
8 changed files with 39 additions and 80 deletions

View file

@ -1,3 +1,13 @@
2006-08-17 [colin] 2.4.0cvs58
* src/mimeview.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_ext_prog.c
* src/textview.c
Fix issues with previous patch (text/html)
Remove outdated prefs
2006-08-17 [colin] 2.4.0cvs57
* src/imap.c

View file

@ -1749,3 +1749,4 @@
( cvs diff -u -r 1.654.2.1793 -r 1.654.2.1794 configure.ac; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 manual/Makefile.am; diff -u /dev/null manual/es/Makefile.am; diff -u /dev/null manual/es/account.xml; diff -u /dev/null manual/es/ack.xml; diff -u /dev/null manual/es/addrbook.xml; diff -u /dev/null manual/es/advanced.xml; diff -u /dev/null manual/es/faq.xml; diff -u /dev/null manual/es/glossary.xml; diff -u /dev/null manual/es/gpl.xml; diff -u /dev/null manual/es/handling.xml; diff -u /dev/null manual/es/intro.xml; diff -u /dev/null manual/es/keyboard.xml; diff -u /dev/null manual/es/plugins.xml; diff -u /dev/null manual/es/starting.xml; diff -u /dev/null manual/es/sylpheed-claws-manual.xml; diff -u /dev/null manual/es/dist/Makefile.am; diff -u /dev/null manual/es/dist/html/Makefile.am; diff -u /dev/null manual/es/dist/pdf/Makefile.am; diff -u /dev/null manual/es/dist/ps/Makefile.am; diff -u /dev/null manual/es/dist/txt/Makefile.am; ) > 2.4.0cvs55.patchset
( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/es/sylpheed-claws-manual.xml; ) > 2.4.0cvs56.patchset
( cvs diff -u -r 1.179.2.128 -r 1.179.2.129 src/imap.c; cvs diff -u -r 1.83.2.78 -r 1.83.2.79 src/mimeview.c; cvs diff -u -r 1.150.2.71 -r 1.150.2.72 src/procmsg.c; cvs diff -u -r 1.36.2.74 -r 1.36.2.75 src/common/utils.c; cvs diff -u -r 1.20.2.34 -r 1.20.2.35 src/common/utils.h; cvs diff -u -r 1.2.2.16 -r 1.2.2.17 src/gtk/inputdialog.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/gtk/inputdialog.h; cvs diff -u -r 1.1.2.15 -r 1.1.2.16 src/plugins/pgpinline/pgpinline.c; ) > 2.4.0cvs57.patchset
( cvs diff -u -r 1.83.2.79 -r 1.83.2.80 src/mimeview.c; cvs diff -u -r 1.204.2.96 -r 1.204.2.97 src/prefs_common.c; cvs diff -u -r 1.103.2.57 -r 1.103.2.58 src/prefs_common.h; cvs diff -u -r 1.3.2.10 -r 1.3.2.11 src/prefs_ext_prog.c; cvs diff -u -r 1.96.2.137 -r 1.96.2.138 src/textview.c; ) > 2.4.0cvs58.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=4
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=57
EXTRA_VERSION=58
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -1643,11 +1643,15 @@ static void mimeview_open_part_with(MimeView *mimeview, MimeInfo *partinfo, gboo
partinfo->subtype);
}
if (partinfo->type != MIMETYPE_TEXT || !prefs_common.ext_editor_cmd
if ((partinfo->type == MIMETYPE_TEXT && !strcmp(partinfo->subtype, "html"))
&& prefs_common.uri_cmd && prefs_common.uri_cmd[0])
mime_command = g_strdup(prefs_common.uri_cmd);
else if (partinfo->type != MIMETYPE_TEXT || !prefs_common.ext_editor_cmd
|| !prefs_common.ext_editor_cmd[0])
mime_command = mailcap_get_command_for_type(content_type, filename);
else
mime_command = g_strdup(prefs_common.ext_editor_cmd);
if (mime_command == NULL) {
/* try with extension this time */
g_free(content_type);

View file

@ -109,12 +109,8 @@ static PrefParam param_os_specific[] = {
&prefs_common.attach_load_dir, P_STRING, NULL, NULL, NULL},
/* MIME viewer */
{"mime_image_viewer", NULL,
&prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
{"mime_textviewer", NULL,
&prefs_common.mime_textviewer, P_STRING, NULL, NULL, NULL},
{"mime_audio_player", NULL,
&prefs_common.mime_audio_player, P_STRING, NULL, NULL, NULL},
{"mime_open_command", "notepad '%s'",
&prefs_common.mime_open_cmd, P_STRING, NULL, NULL, NULL},
@ -584,12 +580,8 @@ static PrefParam param[] = {
&SPECIFIC_PREFS.attach_load_dir, P_STRING, NULL, NULL, NULL},
/* MIME viewer */
{"mime_image_viewer", DEFAULT_IMAGE_VIEWER_CMD,
&SPECIFIC_PREFS.mime_image_viewer, P_STRING, NULL, NULL, NULL},
{"mime_textviewer", NULL,
&SPECIFIC_PREFS.mime_textviewer, P_STRING, NULL, NULL, NULL},
{"mime_audio_player", DEFAULT_AUDIO_PLAYER_CMD,
&SPECIFIC_PREFS.mime_audio_player, P_STRING, NULL, NULL, NULL},
{"mime_open_command", "gedit '%s'",
&SPECIFIC_PREFS.mime_open_cmd, P_STRING, NULL, NULL, NULL},

View file

@ -278,9 +278,7 @@ struct _PrefsCommon
gboolean attach_desc;
/* MIME viewer */
gchar *mime_image_viewer;
gchar *mime_textviewer;
gchar *mime_audio_player;
gchar *mime_open_cmd;
gchar *attach_save_dir;
gchar *attach_load_dir;

View file

@ -57,14 +57,8 @@ typedef struct _ExtProgPage
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;
} ExtProgPage;
void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
@ -82,12 +76,8 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
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;
@ -180,28 +170,10 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
gtk_entry_set_text(GTK_ENTRY(exteditor_entry),
prefs_common.ext_editor_cmd ? prefs_common.ext_editor_cmd : "");
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, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 2);
gtk_label_set_justify(GTK_LABEL (image_viewer_label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment(GTK_MISC (image_viewer_label), 1, 0.5);
image_viewer_entry = gtk_entry_new ();
gtk_widget_show(image_viewer_entry);
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,
gtk_table_attach(GTK_TABLE (table2), astextviewer_label, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 2);
gtk_label_set_justify(GTK_LABEL (astextviewer_label), GTK_JUSTIFY_RIGHT);
@ -215,35 +187,17 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
"contextual menu item"),
NULL);
gtk_table_attach(GTK_TABLE (table2), astextviewer_entry, 1, 2, 3, 4,
gtk_table_attach(GTK_TABLE (table2), astextviewer_entry, 1, 2, 2, 3,
(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);
gtk_table_attach(GTK_TABLE (table2), audio_player_label, 0, 1, 4, 5,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 2);
gtk_label_set_justify(GTK_LABEL (audio_player_label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment(GTK_MISC (audio_player_label), 1, 0.5);
audio_player_entry = gtk_entry_new ();
gtk_widget_show(audio_player_entry);
gtk_table_attach(GTK_TABLE (table2), audio_player_entry, 1, 2, 4, 5,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
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,
gtk_table_attach(GTK_TABLE (table2), printcmd_label, 0, 1, 3, 4,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 2);
gtk_label_set_justify(GTK_LABEL (printcmd_label), GTK_JUSTIFY_RIGHT);
@ -253,7 +207,7 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
#ifndef USE_GNOMEPRINT
gtk_widget_show(printcmd_entry);
#endif
gtk_table_attach(GTK_TABLE (table2), printcmd_entry, 1, 2, 5, 6,
gtk_table_attach(GTK_TABLE (table2), printcmd_entry, 1, 2, 3, 4,
(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 : "");
@ -262,9 +216,7 @@ void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
prefs_ext_prog->window = GTK_WIDGET(window);
prefs_ext_prog->uri_entry = uri_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;
@ -280,12 +232,8 @@ void prefs_ext_prog_save(PrefsPage *_page)
(GTK_EDITABLE(ext_prog->printcmd_entry), 0, -1);
prefs_common.ext_editor_cmd = gtk_editable_get_chars
(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);
}
static void prefs_ext_prog_destroy_widget(PrefsPage *_page)

View file

@ -2578,10 +2578,8 @@ static void open_image_cb (TextView *textview, guint action, void *data)
ClickableText *uri = g_object_get_data(G_OBJECT(textview->file_popup_menu),
"menu_button");
static gchar *default_cmdline = DEFAULT_IMAGE_VIEWER_CMD;
gchar *cmd = NULL;
gchar buf[1024];
const gchar *cmd;
const gchar *def_cmd;
const gchar *p;
gchar *filename = NULL;
gchar *tmp_filename = NULL;
@ -2606,24 +2604,32 @@ static void open_image_cb (TextView *textview, guint action, void *data)
copy_file(tmp_filename, filename, FALSE);
g_free(tmp_filename);
cmd = prefs_common.mime_image_viewer;
def_cmd = default_cmdline;
cmd = mailcap_get_command_for_type("image/jpeg", filename);
if (cmd == NULL) {
gboolean remember = FALSE;
cmd = input_dialog_combo_remember
(_("Open with"),
_("Enter the command line to open file:\n"
"('%s' will be replaced with file name)"),
prefs_common.mime_open_cmd,
prefs_common.mime_open_cmd_history,
TRUE, &remember);
if (cmd && remember) {
mailcap_update_default("image/jpeg", cmd);
}
}
if (cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's' &&
!strchr(p + 2, '%'))
g_snprintf(buf, sizeof(buf), cmd, filename);
else {
if (cmd)
g_warning("Image viewer command line is invalid: '%s'", cmd);
if (def_cmd)
g_snprintf(buf, sizeof(buf), def_cmd, filename);
else
return;
g_warning("Image viewer command line is invalid: '%s'", cmd);
return;
}
execute_command_line(buf, TRUE);
g_free(filename);
g_free(cmd);
g_object_set_data(G_OBJECT(textview->file_popup_menu), "menu_button",
NULL);