diff options
author | Gerd Kohlberger <gerdk@src.gnome.org> | 2010-10-16 15:26:35 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2010-11-05 00:42:55 +0000 |
commit | 9b985450f1c29ed59965e394df8a265a882c72f4 (patch) | |
tree | 360f826a95499622f663a2d677b67429a00b8c2e /libgnome-control-center | |
parent | e8b52610496818a214cf8b12d955cc4fca40f085 (diff) |
Add a get_toplevel accessor to CcShell
Can be used to parent dialogs in CcPanel implementations.
https://bugzilla.gnome.org/show_bug.cgi?id=621940
Diffstat (limited to 'libgnome-control-center')
-rw-r--r-- | libgnome-control-center/cc-shell.c | 28 | ||||
-rw-r--r-- | libgnome-control-center/cc-shell.h | 24 |
2 files changed, 41 insertions, 11 deletions
diff --git a/libgnome-control-center/cc-shell.c b/libgnome-control-center/cc-shell.c index cee31773f..323b4d995 100644 --- a/libgnome-control-center/cc-shell.c +++ b/libgnome-control-center/cc-shell.c @@ -204,4 +204,32 @@ cc_shell_set_active_panel_from_id (CcShell *shell, } } +/** + * cc_shell_get_toplevel: + * @shell: A #CcShell + * + * Gets the toplevel window of the shell. + * + * Returns: The #GtkWidget of the shell window, or #NULL on error. + */ +GtkWidget * +cc_shell_get_toplevel (CcShell *shell) +{ + CcShellClass *klass; + + g_return_val_if_fail (CC_IS_SHELL (shell), NULL); + + klass = CC_SHELL_GET_CLASS (shell); + + if (klass->get_toplevel) + { + return klass->get_toplevel (shell); + } + + g_warning ("Object of type \"%s\" does not implement required virtual" + " function \"get_toplevel\",", + G_OBJECT_TYPE_NAME (shell)); + + return NULL; +} diff --git a/libgnome-control-center/cc-shell.h b/libgnome-control-center/cc-shell.h index 55567dc67..1778afc6b 100644 --- a/libgnome-control-center/cc-shell.h +++ b/libgnome-control-center/cc-shell.h @@ -22,7 +22,7 @@ #ifndef _CC_SHELL_H #define _CC_SHELL_H -#include <glib-object.h> +#include <gtk/gtk.h> G_BEGIN_DECLS @@ -84,19 +84,21 @@ struct _CcShellClass /*< public >*/ /* vfuncs */ - gboolean (*set_active_panel_from_id) (CcShell *shell, - const gchar *id, - GError **error); + gboolean (*set_active_panel_from_id) (CcShell *shell, + const gchar *id, + GError **error); + GtkWidget * (*get_toplevel) (CcShell *shell); }; -GType cc_shell_get_type (void) G_GNUC_CONST; +GType cc_shell_get_type (void) G_GNUC_CONST; -CcPanel* cc_shell_get_active_panel (CcShell *shell); -void cc_shell_set_active_panel (CcShell *shell, - CcPanel *panel); -gboolean cc_shell_set_active_panel_from_id (CcShell *shell, - const gchar *id, - GError **error); +CcPanel* cc_shell_get_active_panel (CcShell *shell); +void cc_shell_set_active_panel (CcShell *shell, + CcPanel *panel); +gboolean cc_shell_set_active_panel_from_id (CcShell *shell, + const gchar *id, + GError **error); +GtkWidget * cc_shell_get_toplevel (CcShell *shell); G_END_DECLS |