+2006-02-01 [colin] 2.0.0cvs6
+
+ * src/mimeview.c
+ Try to get mime type by extension if it is
+ application/octet-stream
+ Display a window with possible choices when
+ encountering unknown mime types
+ * src/gtk/filesel.c
+ * src/gtk/filesel.h
+ Add preview
+ Allow multiple selection in filtered filesel
+ (patch by Fabien Vantard)
+ * src/gtk/pluginwindow.c
+ Use it (patch by Fabien Vantard)
+
2006-02-01 [paul] 2.0.0cvs5
* src/jpilot.c
( cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/plugins/pgpcore/passphrase.c; cvs diff -u -r 1.382.2.230 -r 1.382.2.231 src/compose.c; ) > 2.0.0cvs3.patchset
( cvs diff -u -r 1.382.2.231 -r 1.382.2.232 src/compose.c; cvs diff -u -r 1.274.2.93 -r 1.274.2.94 src/mainwindow.c; cvs diff -u -r 1.94.2.75 -r 1.94.2.76 src/messageview.c; cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/prefs_send.c; ) > 2.0.0cvs4.patchset
( cvs diff -u -r 1.18.2.15 -r 1.18.2.16 src/jpilot.c; cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/prefs_summaries.c; cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/prefs_wrapping.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/gtk/icon_legend.c; cvs diff -u -r 1.1.2.32 -r 1.1.2.33 src/gtk/quicksearch.c; ) > 2.0.0cvs5.patchset
+( cvs diff -u -r 1.83.2.59 -r 1.83.2.60 src/mimeview.c; cvs diff -u -r 1.2.2.20 -r 1.2.2.21 src/gtk/filesel.c; cvs diff -u -r 1.1.4.7 -r 1.1.4.8 src/gtk/filesel.h; cvs diff -u -r 1.5.2.25 -r 1.5.2.26 src/gtk/pluginwindow.c; ) > 2.0.0cvs6.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=5
+EXTRA_VERSION=6
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
#include "codeconv.h"
#include "prefs_common.h"
+static void
+update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
+{
+ GtkWidget *preview;
+ char *filename;
+ GdkPixbuf *pixbuf;
+ gboolean have_preview;
+
+ preview = GTK_WIDGET (data);
+ filename = gtk_file_chooser_get_preview_filename (file_chooser);
+
+ if (filename == NULL)
+ return;
+
+ pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL);
+ have_preview = (pixbuf != NULL);
+ g_free (filename);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf);
+ if (pixbuf)
+ gdk_pixbuf_unref (pixbuf);
+
+ gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview);
+}
+
static GList *filesel_create(const gchar *title, const gchar *path,
gboolean multiple_files,
gboolean open, gboolean folder_mode,
file_filter);
}
+ if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
+ GtkImage *preview;
+ preview = gtk_image_new ();
+ gtk_file_chooser_set_preview_widget (chooser, preview);
+ g_signal_connect (chooser, "update-preview",
+ G_CALLBACK (update_preview_cb), preview);
+
+ }
+
manage_window_set_transient (GTK_WINDOW(chooser));
gtk_window_set_modal(GTK_WINDOW(chooser), TRUE);
return filesel_create(title, NULL, TRUE, TRUE, FALSE, NULL);
}
+GList *filesel_select_multiple_files_open_with_filter( const gchar *title,
+ const gchar *path,
+ const gchar *filter)
+{
+ return filesel_create (title, path, TRUE, TRUE, FALSE, filter);
+}
+
/**
* This function lets the user select one file.
* This opens an Open type dialog if "file" is NULL,
gchar *filesel_select_file_save_folder(const gchar *title, const gchar *path);
GList *filesel_select_multiple_files_open(const gchar *title);
+GList *filesel_select_multiple_files_open_with_filter( const gchar *title,
+ const gchar *path,
+ const gchar *filter);
#endif /* __FILESEL_H__ */
static void load_cb(GtkButton *button, PluginWindow *pluginwindow)
{
- gchar *file, *error = NULL;
-
- file = filesel_select_file_open_with_filter(_("Select Plugin to load"),
- get_plugin_dir(),
- "*." G_MODULE_SUFFIX);
- if (file == NULL)
- return;
-
- plugin_load(file, &error);
- if (error != NULL) {
- alertpanel_error(_("The following error occured while loading the plugin:\n%s\n"), error);
- g_free(error);
- }
+ GList *file_list;
+
+ file_list = filesel_select_multiple_files_open_with_filter(
+ _("Select Plugin to load"), get_plugin_dir(),
+ "*." G_MODULE_SUFFIX);
+
+ if (file_list) {
+ GList *tmp;
+
+ for ( tmp = file_list; tmp; tmp = tmp->next) {
+ gchar *file, *error = NULL;
+
+ file = (gchar *) tmp->data;
+ if (!file) continue;
+ plugin_load(file, &error);
+ if (error != NULL) {
+ alertpanel_error(
+ _("The following error occured while loading the plugin [%s] :\n%s\n"),
+ file, error);
+ g_free(error);
+ }
+
+ /* FIXME: globally or atom-ly : ? */
+ set_plugin_list(pluginwindow);
+ g_free(file);
+ }
- set_plugin_list(pluginwindow);
- g_free(file);
+ g_list_free(file_list);
+ }
}
static gboolean pluginwindow_key_pressed(GtkWidget *widget, GdkEventKey *event,
model = GTK_TREE_MODEL(pluginwindow_create_data_store());
list_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model));
g_object_unref(model);
-
+
gtk_tree_view_set_rules_hint(list_view, prefs_common.enable_rules_hint);
-
+ gtk_tree_view_set_search_column (list_view, 0);
+
selector = gtk_tree_view_get_selection(list_view);
gtk_tree_selection_set_mode(selector, GTK_SELECTION_BROWSE);
gtk_tree_selection_set_select_function(selector, pluginwindow_selected,
MimeView *mimeview)
{
MimeInfo *partinfo;
-
+ AlertValue val;
if (mimeview->opened == node) return;
mimeview->opened = node;
gtk_ctree_node_moveto(ctree, node, -1, 0.5, 0);
break;
default:
- mimeview->textview->default_text = TRUE;
+ mimeview->textview->default_text = TRUE;
mimeview_change_view_type(mimeview, MIMEVIEW_TEXT);
- textview_show_mime_part(mimeview->textview, partinfo);
+ textview_clear(mimeview->textview);
+ val = alertpanel_full(_("Unknown part type"),
+ _("The type of this part is unknown. What would you like "
+ "to do with it?"),
+ GTK_STOCK_SAVE, GTK_STOCK_OPEN, _("Display as text"),
+ FALSE, NULL, ALERT_WARNING, G_ALERTALTERNATE);
+ switch (val) {
+ case G_ALERTDEFAULT:
+ mimeview_save_as(mimeview);
+ break;
+ case G_ALERTALTERNATE:
+ mimeview_open_with(mimeview);
+ break;
+ case G_ALERTOTHER:
+ mimeview_display_as_text(mimeview);
+ break;
+ default:
+ textview_show_mime_part(mimeview->textview, partinfo);
+ }
+
break;
}
}
prefs_common.mime_open_cmd_history =
add_history(NULL, prefs_common.mime_open_cmd);
- content_type = procmime_get_content_type_str(partinfo->type,
+ if ((partinfo->type == MIMETYPE_APPLICATION) &&
+ (!g_ascii_strcasecmp(partinfo->subtype, "octet-stream"))) {
+ /* guess content-type from filename */
+ content_type = procmime_get_mime_type(filename);
+ }
+ if (content_type == NULL) {
+ content_type = procmime_get_content_type_str(partinfo->type,
partinfo->subtype);
+ }
mime_command = mailcap_get_command_for_type(content_type);
g_free(content_type);
cmd = input_dialog_combo