Wait for eggsmclient to initialize before running scripts
This commit is contained in:
parent
ebc16f99c9
commit
30cd9878e1
@ -514,7 +514,7 @@ hookup_synaptics_touchpad (void)
|
||||
|
||||
#endif // GDK_WINDOWING_WIN32
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
unit_test_func (void)
|
||||
{
|
||||
MooTestOptions opts = 0;
|
||||
@ -526,16 +526,14 @@ unit_test_func (void)
|
||||
status = unit_tests_main (opts, medit_opts.ut_tests, medit_opts.ut_dir, medit_opts.ut_coverage_file);
|
||||
moo_app_set_exit_status (moo_app_instance (), status);
|
||||
moo_app_quit (moo_app_instance ());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
run_script_func (void)
|
||||
{
|
||||
char **p;
|
||||
for (p = medit_opts.run_script; p && *p; ++p)
|
||||
moo_app_run_script (moo_app_instance(), *p);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -685,9 +683,9 @@ medit_main (int argc, char *argv[])
|
||||
g_option_context_free (ctx);
|
||||
|
||||
if (medit_opts.ut)
|
||||
gdk_threads_add_timeout (10, (GSourceFunc) unit_test_func, NULL);
|
||||
g_signal_connect (app, "started", G_CALLBACK (unit_test_func), NULL);
|
||||
if (medit_opts.run_script)
|
||||
gdk_threads_add_timeout (10, (GSourceFunc) run_script_func, NULL);
|
||||
g_signal_connect (app, "started", G_CALLBACK (run_script_func), NULL);
|
||||
|
||||
retval = moo_app_run (app);
|
||||
gdk_threads_leave ();
|
||||
|
@ -204,6 +204,7 @@ enum {
|
||||
INIT,
|
||||
RUN,
|
||||
QUIT,
|
||||
STARTED,
|
||||
TRY_QUIT,
|
||||
PREFS_DIALOG,
|
||||
LOAD_SESSION,
|
||||
@ -299,6 +300,15 @@ moo_app_class_init (MooAppClass *klass)
|
||||
_moo_marshal_BOOLEAN__VOID,
|
||||
G_TYPE_BOOLEAN, 0);
|
||||
|
||||
signals[STARTED] =
|
||||
g_signal_new ("started",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (MooAppClass, started),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
signals[PREFS_DIALOG] =
|
||||
g_signal_new ("prefs-dialog",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
@ -788,6 +798,13 @@ moo_app_try_quit (MooApp *app)
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
emit_started (MooApp *app)
|
||||
{
|
||||
g_signal_emit_by_name (app, "started");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
sm_quit_requested (MooApp *app)
|
||||
{
|
||||
@ -829,6 +846,8 @@ moo_app_run_real (MooApp *app)
|
||||
if (EGG_SM_CLIENT_GET_CLASS (app->priv->sm_client)->startup)
|
||||
EGG_SM_CLIENT_GET_CLASS (app->priv->sm_client)->startup (app->priv->sm_client, NULL);
|
||||
|
||||
gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 1, (GSourceFunc) emit_started, app, NULL);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return app->priv->exit_status;
|
||||
|
@ -47,6 +47,8 @@ struct _MooAppClass
|
||||
int (*run) (MooApp *app);
|
||||
void (*quit) (MooApp *app);
|
||||
|
||||
void (*started) (MooApp *app);
|
||||
|
||||
gboolean (*try_quit) (MooApp *app);
|
||||
|
||||
GtkWidget* (*prefs_dialog) (MooApp *app);
|
||||
|
Loading…
x
Reference in New Issue
Block a user