From b6c3c38db9d4c0abb201f2f8a109c69b575db6e9 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Tue, 16 Oct 2012 23:53:09 +0200 Subject: add --run-dialog option to open run dialog --- mate-panel/main.c | 19 +++++++++++++++++++ mate-panel/panel-profile.c | 8 +++++++- mate-panel/panel-profile.h | 1 + mate-panel/panel-run-dialog.c | 10 ++++++++++ mate-panel/panel-run-dialog.h | 2 ++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/mate-panel/main.c b/mate-panel/main.c index 52535542..3ba9a126 100644 --- a/mate-panel/main.c +++ b/mate-panel/main.c @@ -30,6 +30,7 @@ #include "panel-lockdown.h" #include "panel-icon-names.h" #include "panel-reset.h" +#include "panel-run-dialog.h" #include "xstuff.h" #include "nothing.cP" @@ -41,6 +42,7 @@ GSList *panel_list = NULL; static char* deprecated_profile; static gboolean replace = FALSE; static gboolean reset = FALSE; +static gboolean run_dialog = FALSE; static const GOptionEntry options[] = { { "replace", 0, 0, G_OPTION_ARG_NONE, &replace, N_("Replace a currently running panel"), NULL }, @@ -48,6 +50,8 @@ static const GOptionEntry options[] = { { "profile", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &deprecated_profile, NULL, NULL }, /* this feature was request in #mate irc channel */ { "reset", 0, 0, G_OPTION_ARG_NONE, &reset, N_("Reset the panel configuration to default"), NULL }, + /* open run dialog */ + { "run-dialog", 0, 0, G_OPTION_ARG_NONE, &run_dialog, N_("Execute the run dialog"), NULL }, { NULL } }; @@ -99,6 +103,21 @@ main (int argc, char **argv) return 0; } + /* open the run dialog and exit */ + if (run_dialog == TRUE) + { + panel_multiscreen_init (); + panel_global_config_load (); + panel_lockdown_init (); + panel_profile_settings_load (); + panel_run_dialog_present (gdk_screen_get_default (), + gtk_get_current_event_time ()); + panel_run_dialog_quit_on_destroy (); + gtk_main (); + panel_lockdown_finalize (); + panel_cleanup_do (); + return 0; + } if (!egg_get_desktop_file ()) { g_set_application_name (_("Panel")); diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index 3f9a594f..60d47465 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -1621,9 +1621,15 @@ panel_profile_ensure_toplevel_per_screen () } void -panel_profile_load (void) +panel_profile_settings_load (void) { profile_settings = g_settings_new ("org.mate.panel"); +} + +void +panel_profile_load (void) +{ + panel_profile_settings_load(); panel_profile_load_list (profile_settings, PANEL_GSETTINGS_TOPLEVELS, diff --git a/mate-panel/panel-profile.h b/mate-panel/panel-profile.h index bd16f615..84b927e8 100644 --- a/mate-panel/panel-profile.h +++ b/mate-panel/panel-profile.h @@ -36,6 +36,7 @@ G_BEGIN_DECLS +void panel_profile_settings_load (void); void panel_profile_load (void); const char *panel_profile_get_toplevel_id (PanelToplevel *toplevel); diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c index 23da2a7b..94ed3e9f 100644 --- a/mate-panel/panel-run-dialog.c +++ b/mate-panel/panel-run-dialog.c @@ -2022,5 +2022,15 @@ panel_run_dialog_present (GdkScreen *screen, G_CALLBACK (panel_run_dialog_static_dialog_destroyed), static_dialog); + gtk_window_present_with_time (GTK_WINDOW (static_dialog->run_dialog), + activate_time); + g_object_unref (gui); } + +void +panel_run_dialog_quit_on_destroy (void) +{ + g_signal_connect(static_dialog->run_dialog, "destroy", + G_CALLBACK(gtk_main_quit), NULL); +} diff --git a/mate-panel/panel-run-dialog.h b/mate-panel/panel-run-dialog.h index fcd3c244..552d35e2 100644 --- a/mate-panel/panel-run-dialog.h +++ b/mate-panel/panel-run-dialog.h @@ -34,6 +34,8 @@ extern "C" { void panel_run_dialog_present (GdkScreen *screen, guint32 activate_time); +void panel_run_dialog_quit_on_destroy (void); + #ifdef __cplusplus } #endif -- cgit v1.2.1