*
* 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
#include "prefs_gpg.h"
#include "manage_window.h"
#include "utils.h"
+#include "mainwindow.h"
+#include "summaryview.h"
static gboolean grab_all = FALSE;
passphrase_mbox(const gchar *uid_hint, const gchar *pass_hint, gint prev_bad)
{
gchar *the_passphrase = NULL;
- GtkWidget *vbox;
+ GtkWidget *vbox, *hbox;
GtkWidget *confirm_box;
GtkWidget *window;
GtkWidget *pass_entry;
GtkWidget *ok_button;
GtkWidget *cancel_button;
+ SummaryView *summaryview = mainwindow_get_mainwindow()->summaryview;
+
+ gtk_menu_popdown(GTK_MENU(summaryview->popupmenu));
+
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), _("Passphrase"));
gtk_widget_set_size_request(window, 450, -1);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
if (uid_hint || pass_hint) {
- GtkWidget *label;
+ GtkWidget *label, *icon;
label = create_description (uid_hint, pass_hint, prev_bad);
- gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 0);
+ icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
+ GTK_ICON_SIZE_DIALOG);
+
+ hbox = gtk_hbox_new (FALSE, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX(hbox), icon, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
}
pass_entry = gtk_entry_new();
int err = 0, cnt = 0;
/* make sure that window is viewable */
gtk_widget_show_now(window);
+ gdk_window_process_updates(window->window, TRUE);
gdk_flush();
- while(gtk_events_pending())
+ while(gtk_events_pending()) {
gtk_main_iteration();
-#ifdef GDK_WINDOWING_X11
- gdk_x11_display_grab(gdk_display_get_default());
-#endif /* GDK_WINDOWING_X11 */
+ }
try_again:
if ((err = gdk_pointer_grab(window->window, TRUE, 0,
window->window, NULL, GDK_CURRENT_TIME))) {
if (err == GDK_GRAB_NOT_VIEWABLE && cnt < 10) {
cnt++;
g_warning("trying to grab mouse again\n");
+ gtk_main_iteration();
goto try_again;
} else {
-#ifdef GDK_WINDOWING_X11
- gdk_x11_display_ungrab(gdk_display_get_default());
-#endif /* GDK_WINDOWING_X11 */
g_warning("OOPS: Could not grab mouse\n");
gtk_widget_destroy(window);
return NULL;
if (gdk_keyboard_grab(window->window, FALSE, GDK_CURRENT_TIME)) {
gdk_display_pointer_ungrab(gdk_display_get_default(),
GDK_CURRENT_TIME);
-#ifdef GDK_WINDOWING_X11
- gdk_x11_display_ungrab(gdk_display_get_default());
-#endif /* GDK_WINDOWING_X11 */
g_warning("OOPS: Could not grab keyboard\n");
gtk_widget_destroy(window);
return NULL;
gdk_display_keyboard_ungrab(gdk_display_get_default(),
GDK_CURRENT_TIME);
gdk_display_pointer_ungrab(gdk_display_get_default(), GDK_CURRENT_TIME);
-#ifdef GDK_WINDOWING_X11
- gdk_x11_display_ungrab(gdk_display_get_default());
-#endif /* GDK_WINDOWING_X11 */
gdk_flush();
}
const gchar *uid = NULL, *info = NULL;
gchar *buf;
GtkWidget *label;
-
+ gchar *my_uid = NULL;
if (!uid_hint)
uid = _("[no user id]");
else
else
info = pass_hint;
- buf = g_strdup_printf (_("%sPlease enter the passphrase for:\n\n"
- " %.*s \n"
- "(%.*s)\n"),
- prev_bad ?
- _("Bad passphrase! Try again...\n\n") : "",
- linelen (uid), uid, linelen (info), info);
+ my_uid = g_strdup(uid);
+ while (strchr(my_uid, '<'))
+ *(strchr(my_uid, '<')) = '(';
+ while (strchr(my_uid, '>'))
+ *(strchr(my_uid, '>')) = ')';
+ buf = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">%sPlease enter the passphrase for:</span>\n\n"
+ "%.*s\n"),
+ prev_bad ?
+ _("Bad passphrase.\n") : "",
+ linelen (my_uid), my_uid);
+ g_free(my_uid);
label = gtk_label_new (buf);
+ gtk_label_set_use_markup(GTK_LABEL (label), TRUE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
g_free (buf);
return GPG_ERR_NO_ERROR;
}
gpgmegtk_set_passphrase_grab (prefs_gpg_get_config()->passphrase_grab);
- debug_print ("%% requesting passphrase for `%s': ", uid_hint);
+ debug_print ("%% requesting passphrase for '%s': ", uid_hint);
pass = passphrase_mbox (uid_hint, passphrase_hint, prev_bad);
gpgmegtk_free_passphrase();
if (!pass) {
void gpgmegtk_free_passphrase()
{
- (void)free_passphrase(NULL); // could be inline
+ (void)free_passphrase(NULL); /* could be inline */
}
#endif /* USE_GPGME */