-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add desktop action #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
2450aef
d6474ad
6091996
855f4f1
23ede5f
ee2e5ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,12 +10,12 @@ public class Application : Gtk.Application { | |
|
|
||
| public static uint created_documents = 1; | ||
| public static string data_dir_path = Environment.get_user_data_dir () + "/slate"; | ||
|
|
||
| public bool newdocument = false; | ||
|
|
||
| public Application () { | ||
| Object ( | ||
| application_id: APP_ID, | ||
| flags: ApplicationFlags.DEFAULT_FLAGS | ApplicationFlags.HANDLES_OPEN | ||
| flags: ApplicationFlags.DEFAULT_FLAGS | ApplicationFlags.HANDLES_OPEN | ApplicationFlags.HANDLES_COMMAND_LINE | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -178,4 +178,26 @@ public class Application : Gtk.Application { | |
| } | ||
| }); | ||
| } | ||
|
|
||
| protected override int command_line (ApplicationCommandLine command_line) { | ||
| string[] args = command_line.get_arguments (); | ||
|
|
||
| switch (args[1]) { | ||
| case "--new-document": | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are your thoughts on adding a check to look for unsaved new documents so we can skip over them and always create a new blank one? Currently, we just open the first unsaved document — which might already contain something
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would need to count the number of unsaved documents in the folder, add 1, and start from there. Another hurdle would be that, what if while im editing my cool new document i want to open another unsaved document ? |
||
| on_new_document (); | ||
| break; | ||
|
|
||
| case (null): | ||
| activate (); | ||
| break; | ||
|
|
||
| default: | ||
| foreach (var arg in args[1:args.length]) { | ||
| open_window_with_file (File.new_for_commandline_arg (arg)); | ||
| } | ||
| break; | ||
| } | ||
| return 0; | ||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I probably did try another approach but forgor to remove it