ui: Implement "window doesn't respond" dialog on gnome-shell

This does allow us to use ClutterActors instead of lousy legacy tools
meant for shell scripting.

https://bugzilla.gnome.org/show_bug.cgi?id=762083
This commit is contained in:
Carlos Garnacho
2017-01-19 19:52:18 +01:00
parent 593b4318a3
commit d220e353e0
7 changed files with 188 additions and 0 deletions

View File

@ -88,6 +88,8 @@ static void gnome_shell_plugin_confirm_display_change (MetaPlugin *plugin);
static const MetaPluginInfo *gnome_shell_plugin_plugin_info (MetaPlugin *plugin);
static MetaCloseDialog * gnome_shell_plugin_create_close_dialog (MetaPlugin *plugin,
MetaWindow *window);
#define GNOME_TYPE_SHELL_PLUGIN (gnome_shell_plugin_get_type ())
#define GNOME_SHELL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SHELL_PLUGIN, GnomeShellPlugin))
@ -149,6 +151,8 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
plugin_class->confirm_display_change = gnome_shell_plugin_confirm_display_change;
plugin_class->plugin_info = gnome_shell_plugin_plugin_info;
plugin_class->create_close_dialog = gnome_shell_plugin_create_close_dialog;
}
static void
@ -425,3 +429,10 @@ MetaPluginInfo *gnome_shell_plugin_plugin_info (MetaPlugin *plugin)
return &info;
}
static MetaCloseDialog *
gnome_shell_plugin_create_close_dialog (MetaPlugin *plugin,
MetaWindow *window)
{
return _shell_wm_create_close_dialog (get_shell_wm (), window);
}

View File

@ -52,6 +52,9 @@ gboolean _shell_wm_filter_keybinding (ShellWM *wm,
void _shell_wm_confirm_display_change (ShellWM *wm);
MetaCloseDialog * _shell_wm_create_close_dialog (ShellWM *wm,
MetaWindow *window);
G_END_DECLS
#endif /* __SHELL_WM_PRIVATE_H__ */

View File

@ -33,6 +33,7 @@ enum
SHOW_WINDOW_MENU,
FILTER_KEYBINDING,
CONFIRM_DISPLAY_CHANGE,
CREATE_CLOSE_DIALOG,
LAST_SIGNAL
};
@ -168,6 +169,22 @@ shell_wm_class_init (ShellWMClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
* ShellWM::create-close-dialog:
* @wm: The WM
* @window: The window to create the dialog for
*
* Creates a close dialog for the given window.
*
* Returns: (transfer full): The close dialog instance.
*/
shell_wm_signals[CREATE_CLOSE_DIALOG] =
g_signal_new ("create-close-dialog",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
META_TYPE_CLOSE_DIALOG, 1, META_TYPE_WINDOW);
}
void
@ -386,6 +403,17 @@ _shell_wm_confirm_display_change (ShellWM *wm)
g_signal_emit (wm, shell_wm_signals[CONFIRM_DISPLAY_CHANGE], 0);
}
MetaCloseDialog *
_shell_wm_create_close_dialog (ShellWM *wm,
MetaWindow *window)
{
MetaCloseDialog *dialog;
g_signal_emit (wm, shell_wm_signals[CREATE_CLOSE_DIALOG], 0, window, &dialog);
return dialog;
}
/**
* shell_wm_new:
* @plugin: the #MetaPlugin