From 60ea9cad6fe673ea342c7c23dfb7e844160a4aa4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 31 Mar 2003 18:07:00 +0000 Subject: [PATCH] Add a new property, role, corresponding to gtk_window_[gs]et_role(). 2003-03-31 Matthias Clasen * gtk/gtkwindow.c: Add a new property, role, corresponding to gtk_window_[gs]et_role(). (#93904) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkwindow.c | 23 ++++++++++++++++++++--- 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4d9cb4556..17eb29ec09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-03-31 Matthias Clasen + + * gtk/gtkwindow.c: Add a new property, role, corresponding to + gtk_window_[gs]et_role(). (#93904) + Sun Mar 30 03:57:42 2003 Jonathan Blandford * gtk/gtktreeselection.c (gtk_tree_selection_get_selected_rows): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a4d9cb4556..17eb29ec09 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2003-03-31 Matthias Clasen + + * gtk/gtkwindow.c: Add a new property, role, corresponding to + gtk_window_[gs]et_role(). (#93904) + Sun Mar 30 03:57:42 2003 Jonathan Blandford * gtk/gtktreeselection.c (gtk_tree_selection_get_selected_rows): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a4d9cb4556..17eb29ec09 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2003-03-31 Matthias Clasen + + * gtk/gtkwindow.c: Add a new property, role, corresponding to + gtk_window_[gs]et_role(). (#93904) + Sun Mar 30 03:57:42 2003 Jonathan Blandford * gtk/gtktreeselection.c (gtk_tree_selection_get_selected_rows): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a4d9cb4556..17eb29ec09 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2003-03-31 Matthias Clasen + + * gtk/gtkwindow.c: Add a new property, role, corresponding to + gtk_window_[gs]et_role(). (#93904) + Sun Mar 30 03:57:42 2003 Jonathan Blandford * gtk/gtktreeselection.c (gtk_tree_selection_get_selected_rows): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a4d9cb4556..17eb29ec09 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2003-03-31 Matthias Clasen + + * gtk/gtkwindow.c: Add a new property, role, corresponding to + gtk_window_[gs]et_role(). (#93904) + Sun Mar 30 03:57:42 2003 Jonathan Blandford * gtk/gtktreeselection.c (gtk_tree_selection_get_selected_rows): diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index c98d10b0e1..acd65030a3 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -59,6 +59,7 @@ enum { /* Normal Props */ PROP_TITLE, + PROP_ROLE, PROP_ALLOW_SHRINK, PROP_ALLOW_GROW, PROP_RESIZABLE, @@ -468,6 +469,14 @@ gtk_window_class_init (GtkWindowClass *klass) NULL, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_ROLE, + g_param_spec_string ("role", + _("Window Role"), + _("Unique identifier for the window to be used when restoring a session"), + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, PROP_ALLOW_SHRINK, g_param_spec_boolean ("allow_shrink", @@ -759,6 +768,9 @@ gtk_window_set_property (GObject *object, case PROP_TITLE: gtk_window_set_title (window, g_value_get_string (value)); break; + case PROP_ROLE: + gtk_window_set_role (window, g_value_get_string (value)); + break; case PROP_ALLOW_SHRINK: window->allow_shrink = g_value_get_boolean (value); gtk_widget_queue_resize (GTK_WIDGET (window)); @@ -833,6 +845,9 @@ gtk_window_get_property (GObject *object, case PROP_TYPE: g_value_set_enum (value, window->type); break; + case PROP_ROLE: + g_value_set_string (value, window->wm_role); + break; case PROP_TITLE: g_value_set_string (value, window->title); break; @@ -1044,12 +1059,14 @@ gtk_window_set_role (GtkWindow *window, if (role == window->wm_role) return; - + g_free (window->wm_role); window->wm_role = g_strdup (role); - + if (GTK_WIDGET_REALIZED (window)) - g_warning ("gtk_window_set_role(): shouldn't set role after window is realized!\n"); + gdk_window_set_role (GTK_WIDGET (window)->window, window->wm_role); + + g_object_notify (G_OBJECT (window), "role"); } /**