Debug header print (ctrl-alt-p) and fixes new message keyboard shortcut. Closes #4353 and Closes #4247
This commit is contained in:
parent
7a3094696a
commit
1e5f5d1c7e
4 changed files with 35 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ public class GearyApplication : YorbaApplication {
|
|||
public const string ACTION_ABOUT = "GearyAbout";
|
||||
public const string ACTION_QUIT = "GearyQuit";
|
||||
public const string ACTION_NEW_MESSAGE = "GearyNewMessage";
|
||||
public const string ACTION_DEBUG_PRINT = "GearyDebugPrint";
|
||||
|
||||
public const string PREFIX = _PREFIX;
|
||||
|
||||
|
|
@ -90,6 +91,7 @@ along with Geary; if not, write to the Free Software Foundation, Inc.,
|
|||
// Start Geary.
|
||||
actions.add_actions(create_actions(), this);
|
||||
ui_manager.insert_action_group(actions, 0);
|
||||
load_ui_file("accelerators.ui");
|
||||
|
||||
main_window = new MainWindow();
|
||||
|
||||
|
|
@ -213,6 +215,10 @@ along with Geary; if not, write to the Free Software Foundation, Inc.,
|
|||
new_message.label = _("_New Message");
|
||||
entries += new_message;
|
||||
|
||||
Gtk.ActionEntry secret_debug = { ACTION_DEBUG_PRINT, null, null, "<Ctrl><Alt>P",
|
||||
null, on_debug_print };
|
||||
entries += secret_debug;
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +286,10 @@ along with Geary; if not, write to the Free Software Foundation, Inc.,
|
|||
cw.destroy();
|
||||
}
|
||||
|
||||
private void on_debug_print() {
|
||||
main_window.debug_print_selected();
|
||||
}
|
||||
|
||||
public Gtk.Window get_main_window() {
|
||||
return main_window;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,6 +333,24 @@ public class MainWindow : Gtk.Window {
|
|||
on_folders_added_removed(accumulator, null);
|
||||
}
|
||||
|
||||
public void debug_print_selected() {
|
||||
if (message_viewer.messages.size == 0) {
|
||||
debug("Nothing to print");
|
||||
return;
|
||||
}
|
||||
|
||||
debug("---------------------------");
|
||||
foreach (Geary.Email e in message_viewer.messages) {
|
||||
debug("Message: %s", e.id.to_string());
|
||||
if (e.header != null)
|
||||
debug("\n%s", e.header.buffer.to_utf8());
|
||||
else
|
||||
debug("No message data.");
|
||||
|
||||
debug("---------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
private void cancel_folder() {
|
||||
Cancellable old_cancellable = cancellable_folder;
|
||||
cancellable_folder = new Cancellable();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ public class MessageViewer : Gtk.Viewport {
|
|||
private const int MESSAGE_BOX_MARGIN = 10;
|
||||
|
||||
// List of emails corresponding with VBox.
|
||||
private Gee.LinkedList<Geary.Email> messages = new Gee.LinkedList<Geary.Email>();
|
||||
public Gee.LinkedList<Geary.Email> messages { get; private set; default =
|
||||
new Gee.LinkedList<Geary.Email>(); }
|
||||
|
||||
// GUI containing message widgets.
|
||||
private Gtk.VBox message_box = new Gtk.VBox(false, 0);
|
||||
|
|
@ -66,6 +67,7 @@ public class MessageViewer : Gtk.Viewport {
|
|||
|
||||
// Adds a message to the view.
|
||||
public void add_message(Geary.Email email) {
|
||||
messages.add(email);
|
||||
Gtk.Builder builder = GearyApplication.instance.create_builder("message.glade");
|
||||
|
||||
string username;
|
||||
|
|
|
|||
4
ui/accelerators.ui
Normal file
4
ui/accelerators.ui
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<ui>
|
||||
<accelerator action="GearyNewMessage" />
|
||||
<accelerator action="GearyDebugPrint" />
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue