After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702351 - Restart session in app notification issues
Restart session in app notification issues
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Region & Language
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-15 16:05 UTC by Allan Day
Modified: 2017-07-10 13:28 UTC
See Also:
GNOME target: ---
GNOME version: 3.7/3.8


Attachments
region: Embed "Restart session" button below the Language entry (9.88 KB, patch)
2017-06-28 13:10 UTC, Felipe Borges
none Details | Review
region: Drop "restart" in-app notification (6.76 KB, patch)
2017-06-28 13:10 UTC, Felipe Borges
none Details | Review
region: Make the "Restart" notification persistent (2.09 KB, patch)
2017-06-28 13:10 UTC, Felipe Borges
none Details | Review
region: Make the "Restart" notification persistent (2.47 KB, patch)
2017-06-29 08:47 UTC, Felipe Borges
none Details | Review
region: Embed "Restart session" button below the Language entry (9.95 KB, patch)
2017-07-07 12:42 UTC, Felipe Borges
none Details | Review
region: Drop "restart" in-app notification (6.84 KB, patch)
2017-07-07 12:42 UTC, Felipe Borges
committed Details | Review
region: Make the "Restart" notification persistent (4.31 KB, patch)
2017-07-07 12:42 UTC, Felipe Borges
none Details | Review
region: Embed "Restart session" button below the Language entry (10.03 KB, patch)
2017-07-10 10:12 UTC, Felipe Borges
committed Details | Review
region: Make the "Restart" notification persistent (4.67 KB, patch)
2017-07-10 10:12 UTC, Felipe Borges
committed Details | Review

Description Allan Day 2013-06-15 16:05:31 UTC
When you change the language, it is necessary to restart the session for the change to take effect. For this we show an in-app notification. There are a couple of issues with this:

 * The text does not wrap - in some languages this causes the notification to become wider than the window.
 * If you close the window without acting on the restart session notification, there is no way to get back to it.

We should probably use a system notification instead - this can be persistent so that you don't lose the opportunity to restart.
Comment 1 Bastien Nocera 2013-06-17 09:59:21 UTC
(In reply to comment #0)
> When you change the language, it is necessary to restart the session for the
> change to take effect. For this we show an in-app notification. There are a
> couple of issues with this:
> 
>  * The text does not wrap - in some languages this causes the notification to
> become wider than the window.
>  * If you close the window without acting on the restart session notification,
> there is no way to get back to it.

Gah. This is something that was working before the redesign. I guess this is a 3.8.x bug too.

> We should probably use a system notification instead - this can be persistent
> so that you don't lose the opportunity to restart.

No, not really. You'd lose the locality of the notification. It also makes it clearer that the notification happened in response to you changing the language.
Comment 2 Allan Day 2016-04-05 16:02:29 UTC
The latest mockups have some guidance for showing a permanent message in the panel about restarting the session:

https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage#Tentative_Guidelines
Comment 3 Felipe Borges 2017-06-28 13:10:37 UTC
Created attachment 354618 [details] [review]
region: Embed "Restart session" button below the Language entry

This change is based on the mockups available at
https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage
Comment 4 Felipe Borges 2017-06-28 13:10:43 UTC
Created attachment 354619 [details] [review]
region: Drop "restart" in-app notification

This changes are based on the mockups available at
https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage
Comment 5 Felipe Borges 2017-06-28 13:10:49 UTC
Created attachment 354620 [details] [review]
region: Make the "Restart" notification persistent

When the Language is changed in the Region panel, a "Restart"
notification is shown, but if the user closes the window without
acting on the restart session notification, there is no way to
get back to it.

This way we create a temporary file in the g_get_tmp_dir ()
directory flagging whether we should present the "Restart"
notification.
Comment 6 Felipe Borges 2017-06-29 08:47:57 UTC
Created attachment 354674 [details] [review]
region: Make the "Restart" notification persistent

When the Language is changed in the Region panel, a "Restart"
notification is shown, but if the user closes the window without
acting on the restart session notification, there is no way to
get back to it.

This way we create a temporary file in the g_get_tmp_dir ()
directory flagging whether we should present the "Restart"
notification.
Comment 7 Rui Matos 2017-07-06 17:33:37 UTC
Review of attachment 354619 [details] [review]:

::: panels/region/cc-region-panel.c
@@ -87,3 @@
         GCancellable *cancellable;
 
         GtkWidget *overlay;

this variable is no longer needed
Comment 8 Rui Matos 2017-07-06 17:34:54 UTC
Review of attachment 354618 [details] [review]:

::: panels/region/region.ui
@@ +132,3 @@
+                                    <property name="xalign">0</property>
+                                    <property name="wrap">True</property>
+                                    <property name="max-width-chars">31</property>

we probably don't need max-width-chars here

@@ +136,3 @@
+                                    <attributes>
+                                      <attribute name="scale" value="0.9"/>
+                                      <attribute name="foreground" value="#4a90d9"/>

not a fan of the explicit color. if the theme ever changes action buttons to look green this will look out of place. just use dim?

@@ +152,3 @@
+                                    <property name="margin_top">12</property>
+                                    <property name="margin_bottom">12</property>
+                                    <property name="valign">end</property>

you mean xalign? right now, with max-width-chars being used above, the button shows up in the middle of white space
Comment 9 Rui Matos 2017-07-06 17:41:10 UTC
Review of attachment 354674 [details] [review]:

we should probably remove the file and dismiss the button if users change their minds and switch back to the currently used language

::: panels/region/cc-region-panel.c
@@ +89,3 @@
         GtkWidget *overlay;
         GtkWidget *restart_notification;
+        gchar *has_restarted_file_path;

needs_restart_file_path?

@@ +238,3 @@
         }
+
+        if (!g_file_set_contents (priv->has_restarted_file_path, "yes", -1, NULL))

if the contents doesn't matter I'd prefer that we write an empty string instead

@@ +1837,3 @@
 	gtk_container_add (GTK_CONTAINER (self), priv->overlay);
+
+        priv->has_restarted_file_path = g_build_filename (g_get_tmp_dir(),

g_get_user_runtime_dir() is a better fit for this since it's user-wide instead of system-wide
Comment 10 Felipe Borges 2017-07-07 12:42:39 UTC
Created attachment 355089 [details] [review]
region: Embed "Restart session" button below the Language entry

This change is based on the mockups available at
https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage
Comment 11 Felipe Borges 2017-07-07 12:42:47 UTC
Created attachment 355090 [details] [review]
region: Drop "restart" in-app notification

This changes are based on the mockups available at
https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage
Comment 12 Felipe Borges 2017-07-07 12:42:53 UTC
Created attachment 355091 [details] [review]
region: Make the "Restart" notification persistent

When the Language is changed in the Region panel, a "Restart"
notification is shown, but if the user closes the window without
acting on the restart session notification, there is no way to
get back to it.

This way we create a temporary file in the g_get_tmp_dir ()
directory flagging whether we should present the "Restart"
notification.
Comment 13 Rui Matos 2017-07-07 14:11:36 UTC
Review of attachment 355089 [details] [review]:

with max-width-chars added back on the label, looks fine

::: panels/region/region.ui
@@ +131,3 @@
+                                    <property name="margin_bottom">12</property>
+                                    <property name="xalign">0</property>
+                                    <property name="hexpand">True</property>

aha, this makes the button be properly aligned to the end of the row

@@ +133,3 @@
+                                    <property name="hexpand">True</property>
+                                    <property name="wrap">True</property>
+                                    <property name="label" translatable="yes">Restart the session for changes to take effect</property>

Sorry, we do need max-width-chars here (around 30) or this won't wrap on languages that translate to a longer sentence

@@ +154,3 @@
+                                    <property name="margin_top">12</property>
+                                    <property name="margin_bottom">12</property>
+                                    <property name="valign">end</property>

this still seems wrong to me, there's no valign to do here
Comment 14 Rui Matos 2017-07-07 14:12:17 UTC
Review of attachment 355090 [details] [review]:

looks fine
Comment 15 Rui Matos 2017-07-07 14:29:46 UTC
Review of attachment 355091 [details] [review]:

the commit message should be changed to refer to g_get_user_runtime_dir() instead

::: panels/region/cc-region-panel.c
@@ +209,3 @@
 
+        g_file_delete (g_file_new_for_path (priv->needs_restart_file_path),
+                                            NULL, NULL);

if the user cancels the logout dialog we'll still have the button showing and the file will be gone. not easy to detect though and seems like a small enough corner case so let's not bother :-)

@@ +230,1 @@
                 setlocale (LC_MESSAGES, locale);

I don't know when this stopped working but it doesn't work in master right now either so I think we should remove it, perhaps in an extra patch.

It was supposed to show the restart string translated in the target language but I guess that was never really a problem since if a user was able to navigate the UI until this point in the current language, translating the "needs restart" string only is pointless.

@@ +1849,3 @@
+
+        priv->needs_restart_file_path = g_build_filename (g_get_user_runtime_dir (),
+                                                          "gnome-control-center-region-has-restarted",

let's use -needs-restart on the file name here for consistency

also, the string needs to be freed on finalize()
Comment 16 Felipe Borges 2017-07-10 10:12:02 UTC
(In reply to Rui Matos from comment #13)
> Review of attachment 355089 [details] [review] [review]:
> 
> with max-width-chars added back on the label, looks fine
> 
> ::: panels/region/region.ui
> @@ +131,3 @@
> +                                    <property
> name="margin_bottom">12</property>
> +                                    <property name="xalign">0</property>
> +                                    <property name="hexpand">True</property>
> 
> aha, this makes the button be properly aligned to the end of the row
> 
> @@ +133,3 @@
> +                                    <property name="hexpand">True</property>
> +                                    <property name="wrap">True</property>
> +                                    <property name="label"
> translatable="yes">Restart the session for changes to take effect</property>
> 
> Sorry, we do need max-width-chars here (around 30) or this won't wrap on
> languages that translate to a longer sentence
> 
> @@ +154,3 @@
> +                                    <property
> name="margin_top">12</property>
> +                                    <property
> name="margin_bottom">12</property>
> +                                    <property name="valign">end</property>
> 
> this still seems wrong to me, there's no valign to do here

ah, I forgot to mention. If you the translated sentence has multiple lines, it would cause the [Restart] button to fill the whole space vertically. The same in the gnome-control-center-alt, if you resize the window horizontally to the minimum possible -> the restart button fills the container vertically too.
Comment 17 Felipe Borges 2017-07-10 10:12:42 UTC
Created attachment 355249 [details] [review]
region: Embed "Restart session" button below the Language entry

This change is based on the mockups available at
https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage
Comment 18 Felipe Borges 2017-07-10 10:12:56 UTC
Created attachment 355250 [details] [review]
region: Make the "Restart" notification persistent

When the Language is changed in the Region panel, a "Restart"
notification is shown, but if the user closes the window without
acting on the restart session notification, there is no way to
get back to it.

This way we create a temporary file in the g_get_user_runtime_dir ()
directory flagging whether we should present the "Restart"
notification.
Comment 19 Rui Matos 2017-07-10 13:03:50 UTC
Review of attachment 355249 [details] [review]:

ok
Comment 20 Rui Matos 2017-07-10 13:04:45 UTC
Review of attachment 355250 [details] [review]:

lgtm
Comment 21 Felipe Borges 2017-07-10 13:28:45 UTC
Thanks!

Attachment 355090 [details] pushed as 79295b6 - region: Drop "restart" in-app notification
Attachment 355249 [details] pushed as a739ebf - region: Embed "Restart session" button below the Language entry
Attachment 355250 [details] pushed as db551f1 - region: Make the "Restart" notification persistent