xed-app: Handle also application::open

This commit is contained in:
JosephMcc 2017-02-09 03:34:02 -08:00
parent 3b9d03837b
commit 3567a8e4c9
1 changed files with 36 additions and 0 deletions

View File

@ -622,6 +622,41 @@ xed_app_handle_local_options (GApplication *application,
return -1; return -1;
} }
/* Note: when launched from command line we do not reach this method
* since we manually handle the command line parameters in order to
* parse +LINE, stdin, etc.
* However this method is called when open() is called via dbus, for
* instance when double clicking on a file in nautilus
*/
static void
xed_app_open (GApplication *application,
GFile **files,
gint n_files,
const gchar *hint)
{
gint i;
GSList *file_list = NULL;
for (i = 0; i < n_files; i++)
{
file_list = g_slist_prepend (file_list, files[i]);
}
file_list = g_slist_reverse (file_list);
open_files (application,
FALSE,
FALSE,
NULL,
0,
NULL,
NULL,
file_list,
NULL);
g_slist_free (file_list);
}
static gboolean static gboolean
ensure_user_config_dir (void) ensure_user_config_dir (void)
{ {
@ -772,6 +807,7 @@ xed_app_class_init (XedAppClass *klass)
app_class->activate = xed_app_activate; app_class->activate = xed_app_activate;
app_class->command_line = xed_app_command_line; app_class->command_line = xed_app_command_line;
app_class->handle_local_options = xed_app_handle_local_options; app_class->handle_local_options = xed_app_handle_local_options;
app_class->open = xed_app_open;
app_class->shutdown = xed_app_shutdown; app_class->shutdown = xed_app_shutdown;
g_type_class_add_private (object_class, sizeof (XedAppPrivate)); g_type_class_add_private (object_class, sizeof (XedAppPrivate));