242 GtkWidget *content_area, *action_area;
243 GtkWidget *entry_container;
244 GtkWidget *hbox, *main_vbox, *vbox, *icon;
247 gchar *text, *markup, *file_name;
249 gtk_widget_set_sensitive (GTK_WIDGET (password_view),
FALSE);
251 dialog = GTK_DIALOG (gtk_dialog_new ());
252 content_area = gtk_dialog_get_content_area (dialog);
253 action_area = gtk_dialog_get_action_area (dialog);
256 gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
257 gtk_box_set_spacing (GTK_BOX (content_area), 2);
258 gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
259 gtk_box_set_spacing (GTK_BOX (action_area), 6);
261 gtk_window_set_title (GTK_WINDOW (dialog),
_(
"Enter password"));
262 gtk_window_set_resizable (GTK_WINDOW (dialog),
FALSE);
263 gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_DIALOG_AUTHENTICATION);
264 gtk_window_set_transient_for (GTK_WINDOW (dialog), password_view->
priv->
parent_window);
265 gtk_window_set_modal (GTK_WINDOW (dialog),
TRUE);
267 gtk_dialog_add_buttons (dialog,
268 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
269 _(
"_Unlock Document"), GTK_RESPONSE_OK,
271 gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
272 gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
273 GTK_RESPONSE_OK,
FALSE);
274 gtk_dialog_set_alternative_button_order (dialog,
280 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
281 gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
282 gtk_box_pack_start (GTK_BOX (content_area), hbox,
TRUE,
TRUE, 0);
283 gtk_widget_show (hbox);
285 icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
286 GTK_ICON_SIZE_DIALOG);
288 gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0);
289 gtk_box_pack_start (GTK_BOX (hbox), icon,
FALSE,
FALSE, 0);
290 gtk_widget_show (icon);
292 main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
293 gtk_box_pack_start (GTK_BOX (hbox), main_vbox,
TRUE,
TRUE, 0);
294 gtk_widget_show (main_vbox);
296 label = gtk_label_new (NULL);
297 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
298 gtk_label_set_line_wrap (GTK_LABEL (label),
TRUE);
299 file_name = g_file_get_basename (password_view->
priv->
uri_file);
300 text = g_markup_printf_escaped (
_(
"The document ā%sā is locked and requires a password before it can be opened."),
302 markup = g_strdup_printf (
"<span size=\"larger\" weight=\"bold\">%s</span>\n\n%s",
303 _(
"Password required"),
305 gtk_label_set_markup (GTK_LABEL (label), markup);
309 gtk_box_pack_start (GTK_BOX (main_vbox), label,
311 gtk_widget_show (label);
313 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
314 gtk_box_pack_start (GTK_BOX (main_vbox), vbox,
FALSE,
FALSE, 0);
315 gtk_widget_show (vbox);
318 entry_container = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
320 gtk_alignment_set_padding (GTK_ALIGNMENT (entry_container),
323 gtk_box_pack_start (GTK_BOX (vbox), entry_container,
325 gtk_widget_show (entry_container);
327 grid = gtk_grid_new ();
328 gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
329 gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
330 gtk_container_add (GTK_CONTAINER (entry_container), grid);
331 gtk_widget_show (grid);
333 label = gtk_label_new_with_mnemonic (
_(
"_Password:"));
334 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
344 gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
345 gtk_widget_show (label);
351 gtk_label_set_mnemonic_widget (GTK_LABEL (label),
356 GtkWidget *remember_box;
359 remember_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
360 gtk_box_pack_start (GTK_BOX (vbox), remember_box,
362 gtk_widget_show (remember_box);
364 choice = gtk_radio_button_new_with_mnemonic (NULL,
_(
"Forget password _immediately"));
365 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice),
367 g_object_set_data (G_OBJECT (choice),
"password-save",
368 GINT_TO_POINTER (G_PASSWORD_SAVE_NEVER));
369 g_signal_connect (choice,
"toggled",
372 gtk_box_pack_start (GTK_BOX (remember_box), choice,
FALSE,
FALSE, 0);
373 gtk_widget_show (choice);
375 group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
376 choice = gtk_radio_button_new_with_mnemonic (group,
_(
"Remember password until you _log out"));
377 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice),
379 g_object_set_data (G_OBJECT (choice),
"password-save",
380 GINT_TO_POINTER (G_PASSWORD_SAVE_FOR_SESSION));
381 g_signal_connect (choice,
"toggled",
384 gtk_box_pack_start (GTK_BOX (remember_box), choice,
FALSE,
FALSE, 0);
385 gtk_widget_show (choice);
387 group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (choice));
388 choice = gtk_radio_button_new_with_mnemonic (group,
_(
"Remember _forever"));
389 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (choice),
391 g_object_set_data (G_OBJECT (choice),
"password-save",
392 GINT_TO_POINTER (G_PASSWORD_SAVE_PERMANENTLY));
393 g_signal_connect (choice,
"toggled",
396 gtk_box_pack_start (GTK_BOX (remember_box), choice,
FALSE,
FALSE, 0);
397 gtk_widget_show (choice);
400 g_signal_connect (dialog,
"response",
404 gtk_widget_show (GTK_WIDGET (dialog));