Allow opening Geany projects remotely.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4455 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-11-29 19:59:13 +00:00
parent 4f32cbbc0e
commit d9e7c95531
4 changed files with 31 additions and 10 deletions

View File

@ -5,6 +5,8 @@
Add main_is_realized() to the plugin API.
* tagmanager/include/tm_tagmanager.h:
Update partly outdated and wrong doc comment.
* src/main.c, src/main.h, src/socket.c:
Allow opening Geany projects remotely.
2009-11-26 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>

View File

@ -830,6 +830,26 @@ static void load_settings(void)
}
void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session)
{
gchar *pfile = NULL;
if (utils_is_uri(locale_filename))
pfile = utils_get_path_from_uri(locale_filename);
else
pfile = g_strdup(locale_filename);
if (pfile != NULL)
{
if (use_session)
project_load_file_with_session(pfile);
else
project_load_file(pfile);
}
g_free(pfile);
}
static void load_startup_files(gint argc, gchar **argv)
{
gboolean load_project_from_cl = FALSE;
@ -845,15 +865,7 @@ static void load_startup_files(gint argc, gchar **argv)
{
if (load_project_from_cl)
{
gchar *pfile = argv[1];
if (utils_is_uri(argv[1]))
pfile = utils_get_path_from_uri(argv[1]);
if (pfile != NULL)
{
project_load_file(pfile);
if (pfile != argv[1])
g_free(pfile);
}
main_load_project_from_command_line(argv[1], FALSE);
}
else if (cl_options.load_session && !cl_options.new_instance)
load_session_project_file();

View File

@ -66,4 +66,6 @@ void main_locale_init(const gchar *locale_dir, const gchar *gettext_package);
gboolean main_is_realized(void);
void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session);
#endif

View File

@ -504,7 +504,12 @@ static void handle_input_filename(const gchar *buf)
locale_filename = utils_get_locale_from_utf8(utf8_filename);
if (locale_filename)
main_handle_filename(locale_filename);
{
if (g_str_has_suffix(locale_filename, ".geany"))
main_load_project_from_command_line(locale_filename, TRUE);
else
main_handle_filename(locale_filename);
}
g_free(utf8_filename);
g_free(locale_filename);
}