/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "manage_window.h"
#include "privacy.h"
-#ifdef MAEMO
-#include <libosso.h>
-#ifndef CHINOOK
-#include <osso-mime.h>
-#else
-#include <hildon-mime.h>
-#endif
-#endif
-
typedef enum
{
COL_MIMETYPE = 0,
static GtkActionEntry mimeview_menu_actions[] = {
{ "MimeView", NULL, "MimeView" },
{ "MimeView/Open", NULL, N_("_Open"), NULL, "Open MIME part", G_CALLBACK(mimeview_launch_cb) },
-#if (!defined MAEMO && !defined G_OS_WIN32)
+#if (!defined G_OS_WIN32)
{ "MimeView/OpenWith", NULL, N_("Open _with..."), NULL, "Open MIME part with...", G_CALLBACK(mimeview_open_with_cb) },
#endif
{ "MimeView/SendTo", NULL, N_("Send to..."), NULL, "Send to", G_CALLBACK(mimeview_send_to_cb) },
MENUITEM_ADDUI_MANAGER(mimeview->ui_manager,
"/Menus/MimeView/", "Open", "MimeView/Open",
GTK_UI_MANAGER_MENUITEM);
-#if (!defined MAEMO && !defined G_OS_WIN32)
+#if (!defined G_OS_WIN32)
MENUITEM_ADDUI_MANAGER(mimeview->ui_manager,
"/Menus/MimeView/", "OpenWith", "MimeView/OpenWith",
GTK_UI_MANAGER_MENUITEM);
mimeview_change_view_type(mimeview, MIMEVIEW_TEXT);
}
+gchar * get_message_check_signature_shortcut(MessageView *messageview) {
+ GtkUIManager *ui_manager;
+
+ if (messageview->window != NULL)
+ ui_manager = messageview->ui_manager;
+ else
+ ui_manager = messageview->mainwin->ui_manager;
+
+ return cm_menu_item_get_shortcut(ui_manager, "Menu/Message/CheckSignature");
+}
+
static void check_signature_cb(GtkWidget *widget, gpointer user_data);
static void display_full_info_cb(GtkWidget *widget, gpointer user_data);
break;
}
if (mycode == SIGNATURE_UNCHECKED) {
- GtkUIManager *ui_manager;
gchar *tmp = privacy_mimeinfo_sig_info_short(mimeinfo);
- gchar *shortcut;
+ gchar *shortcut = get_message_check_signature_shortcut(mimeview->messageview);
- if (mimeview->messageview->window != NULL)
- ui_manager = mimeview->messageview->ui_manager;
+ if (*shortcut == '\0')
+ text = g_strdup_printf(_("%s Click the icon to check it."), tmp);
else
- ui_manager = mimeview->messageview->mainwin->ui_manager;
-
- shortcut = cm_menu_item_get_shortcut(ui_manager, "Menu/Message/CheckSignature");
-
- text = g_strdup_printf(_("%s Click the icon or hit '%s' to check it."),
- tmp, shortcut);
+ text = g_strdup_printf(_("%s Click the icon or hit '%s' to check it."),
+ tmp, shortcut);
g_free(tmp);
g_free(shortcut);
} else if (mycode != SIGNATURE_CHECK_TIMEOUT) {
text = privacy_mimeinfo_sig_info_short(mimeinfo);
} else if (mycode == SIGNATURE_CHECK_TIMEOUT) {
- text = g_strdup(_("Timeout checking the signature. Click the icon or hit 'C' to try again."));
+ gchar *shortcut = get_message_check_signature_shortcut(mimeview->messageview);
+
+ if (*shortcut == '\0')
+ text = g_strdup(_("Timeout checking the signature. Click the icon to try again."));
+ else
+ text = g_strdup_printf(_("Timeout checking the signature. Click the icon or hit '%s' to try again."), shortcut);
+ g_free(shortcut);
}
noticeview_set_text(mimeview->siginfoview, text);
(gpointer) mimeview);
noticeview_set_icon(mimeview->siginfoview, icon);
noticeview_set_tooltip(mimeview->siginfoview, button_text);
+
+ icon_list_clear(mimeview);
+ icon_list_create(mimeview, mimeview->mimeinfo);
}
#ifdef USE_PTHREAD
pthread_cancel(mimeview->check_data->cancel_th);
}
- g_free(mimeview->check_data);
- mimeview->check_data = NULL;
-
if (must_free) {
debug_print("freeing deferred mimeinfo\n");
procmime_mimeinfo_free_all(mimeview->check_data->siginfo);
}
+
+ g_free(mimeview->check_data);
+ mimeview->check_data = NULL;
+
if (must_destroy) {
debug_print("freeing deferred mimeview\n");
mimeview_free_mimeinfo(mimeview);
g_free(mimeview);
mimeviews = g_slist_remove(mimeviews, mimeview);
}
-
}
/* GUI update once the checker thread is done or killed */
else
update_signature_noticeview(mimeview, mimeview->siginfo,
FALSE, 0);
- icon_list_clear(mimeview);
- icon_list_create(mimeview, mimeview->mimeinfo);
-
+
end:
mimeview_check_data_reset(mimeview);
return FALSE;
debug_print("checking without thread\n");
privacy_mimeinfo_check_signature(mimeinfo);
update_signature_noticeview(mimeview, mimeview->siginfo, FALSE, 0);
- icon_list_clear(mimeview);
- icon_list_create(mimeview, mimeview->mimeinfo);
}
}
break;
}
}
+
+ if (mimeview->siginfo && privacy_auto_check_signatures(mimeview->siginfo)) {
+ mimeview_check_signature(mimeview);
+ }
}
static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
mimeview_open_part_with(mimeview, partinfo, FALSE);
}
-#ifdef MAEMO
-osso_context_t *get_osso_context(void);
-#endif
static void mimeview_open_part_with(MimeView *mimeview, MimeInfo *partinfo, gboolean automatic)
{
gchar *filename;
gchar *mime_command = NULL;
gchar *content_type = NULL;
gint err;
-#ifdef MAEMO
- DBusConnection *dbusconn;
- gchar *uri;
- int r = 0;
-#endif
+
cm_return_if_fail(partinfo != NULL);
filename = procmime_get_tmp_file_name(partinfo);
partinfo->subtype);
}
-#ifdef MAEMO
- if (content_type != NULL) {
- uri = g_filename_to_uri(filename, NULL, NULL);
- dbusconn = osso_get_dbus_connection (get_osso_context());
-#ifdef CHINOOK
- r = hildon_mime_open_file_with_mime_type (dbusconn, uri, content_type);
-#else
- r = osso_mime_open_file_with_mime_type (dbusconn, uri, content_type);
-#endif
- g_free(uri);
- }
- if (r != 1) {
- alertpanel_error(_("No registered viewer for this file type."));
- }
- goto out;
-#endif
-
if ((partinfo->type == MIMETYPE_TEXT && !strcmp(partinfo->subtype, "html"))
&& prefs_common_get_uri_cmd() && prefs_common.uri_cmd[0]) {
mime_command = g_strdup(prefs_common_get_uri_cmd());
prefs_common.mime_open_cmd_history =
add_history(prefs_common.mime_open_cmd_history, cmd);
}
-#ifdef MAEMO
-out:
-#endif
+
g_free(content_type);
g_free(filename);
}
gtk_widget_show_all(button);
gtk_drag_source_set(button, GDK_BUTTON1_MASK|GDK_BUTTON3_MASK,
mimeview_mime_types, 1, GDK_ACTION_COPY);
-#ifndef MAEMO
+
g_signal_connect(G_OBJECT(button), "popup-menu",
G_CALLBACK(icon_popup_menu), mimeview);
-#else
- gtk_widget_tap_and_hold_setup(GTK_WIDGET(button), NULL, NULL,
- GTK_TAP_AND_HOLD_NONE | GTK_TAP_AND_HOLD_NO_INTERNALS);
- g_signal_connect(G_OBJECT(button), "tap-and-hold",
- G_CALLBACK(icon_popup_menu), mimeview);
-#endif
g_signal_connect(G_OBJECT(button), "button_release_event",
G_CALLBACK(icon_clicked_cb), mimeview);
g_signal_connect(G_OBJECT(button), "key_press_event",