Merge lp:~ubuntu-mate-dev/indicator-session/mate-integration into lp:indicator-session

Proposed by Martin Wimpress 
Status: Merged
Approved by: Iain Lane
Approved revision: 507
Merged at revision: 494
Proposed branch: lp:~ubuntu-mate-dev/indicator-session/mate-integration
Merge into: lp:indicator-session
Diff against target: 175 lines (+65/-11)
3 files modified
debian/changelog (+6/-0)
debian/control (+1/-1)
src/backend-dbus/actions.c (+58/-10)
To merge this branch: bzr merge lp:~ubuntu-mate-dev/indicator-session/mate-integration
Reviewer Review Type Date Requested Status
Iain Lane Approve
Ubuntu Sponsors Pending
Review via email: mp+325600@code.launchpad.net

Description of the change

This merge proposal adds the remaining support for MATE Desktop. When MATE is the desktop session:

  * "About This Computer" launches `mate-system-monitor --show-system-tab`
  * "Ubuntu Help..." launches the MATE User Guide.
  * "System Settings..." launches `mate-control-center`
  * "Lock/Switch Account..." invokes `mate-screensaver-command --lock`

`mate-system-monitor` is added to debian/control Suggests: to provide the hint it is required for MATE. It is installed by default in Ubuntu MATE.

`mate-user-guide` is added to debian/control Suggests: to provide the hint it is required for MATE. It is installed by default in Ubuntu MATE.

`have_mate_program()` checks that the active session is MATE and the required program exists, making this a safe mechanism to launch `"yelp help:mate-user-guide` specifically for MATE and fall through the just `yelp` on the other desktop environments.

To post a comment you must log in.
497. By Martin Wimpress 

Fold some code. Turn discrete functions into a single generic function.

498. By Martin Wimpress 

debian/control: Add Suggests (indicator-session) mate-system-monitor.

499. By Martin Wimpress 

Add support for mate-user-guide.

500. By Martin Wimpress 

Split XDG_CURRENT_DESKTOP by : and compare each desktop.

Revision history for this message
Iain Lane (laney) wrote :

Some small refactoring then looks good.

review: Needs Fixing
501. By Martin Wimpress 

Refactor have_mate_program() as per the review comments.

502. By Martin Wimpress 

Add support for mate-session-save to handle prompts for shutdown, reboot, log-out, etc.

Revision history for this message
Martin Wimpress  (flexiondotorg) wrote :

> Some small refactoring then looks good.

I've refactored have_mate_program() as per you comments. I've also add support for mate-session-save to handle the prompts for shutdown, reboot, etc.

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Could you drop the added suggests? That feels like something that MATE should be depending on or recommending rather than indicator-session.

503. By Martin Wimpress 

debian/control: Drop Suggests (indicator-session) mate-system-monitor and mate-user-guide as per the review comments.

504. By Martin Wimpress 

Remove unnecessary declaration. Whitespace cleanup.

505. By Martin Wimpress 

Drop changelog changes.

506. By Martin Wimpress 

Declare desktop_names as (const gchar * const *)

507. By Martin Wimpress 

Declare desktop_name as GStrv and cast desktop_name to (const gchar * const *)

Revision history for this message
Iain Lane (laney) wrote :

ty, looks good to me

review: Approve
508. By Martin Wimpress 

debian/changelog: Add MATE Desktop support. (LP: #1697792)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2017-06-05 14:22:45 +0000
+++ debian/changelog 2017-07-17 19:15:26 +0000
@@ -1,3 +1,9 @@
1indicator-session (17.3.20+17.10.20170717-0ubuntu1) artful; urgency=medium
2
3 * Add MATE Desktop support. (LP: #1697792)
4
5 -- Martin Wimpress <martin.wimpress@ubuntu.com> Mon, 17 Jul 2017 20:13:27 +0100
6
1indicator-session (17.3.20+17.10.20170605-0ubuntu1) artful; urgency=medium7indicator-session (17.3.20+17.10.20170605-0ubuntu1) artful; urgency=medium
28
3 * Don't recommend obsolete Ubuntu Online Accounts settings panel9 * Don't recommend obsolete Ubuntu Online Accounts settings panel
410
=== modified file 'debian/control'
--- debian/control 2017-06-05 13:55:18 +0000
+++ debian/control 2017-07-17 19:15:26 +0000
@@ -38,7 +38,7 @@
38 unity-control-center | gnome-control-center | mate-control-center,38 unity-control-center | gnome-control-center | mate-control-center,
39Suggests: lightdm,39Suggests: lightdm,
40 apport,40 apport,
41 zenity41 zenity,
42Description: indicator showing session management, status and user switching42Description: indicator showing session management, status and user switching
43 This indicator is designed to be placed on the right side of a panel and43 This indicator is designed to be placed on the right side of a panel and
44 give the user easy control for changing their instant message status. 44 give the user easy control for changing their instant message status.
4545
=== modified file 'src/backend-dbus/actions.c'
--- src/backend-dbus/actions.c 2017-06-05 13:54:46 +0000
+++ src/backend-dbus/actions.c 2017-07-17 19:15:26 +0000
@@ -90,10 +90,29 @@
90{90{
91 PROMPT_NONE,91 PROMPT_NONE,
92 PROMPT_WITH_ZENITY,92 PROMPT_WITH_ZENITY,
93 PROMPT_WITH_UNITY93 PROMPT_WITH_UNITY,
94 PROMPT_WITH_MATE
94}95}
95prompt_status_t;96prompt_status_t;
9697
98static gboolean
99have_mate_program (const gchar *program)
100{
101 const gchar *xdg_current_desktop;
102 g_auto(GStrv) desktop_names = NULL;
103
104 xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
105 if (xdg_current_desktop != NULL) {
106 desktop_names = g_strsplit (xdg_current_desktop, ":", 0);
107 if (g_strv_contains ((const gchar * const *) desktop_names, "MATE")) {
108 g_autofree gchar *path = g_find_program_in_path (program);
109 return path != NULL;
110 }
111 }
112
113 return FALSE;
114}
115
97static prompt_status_t116static prompt_status_t
98get_prompt_status (IndicatorSessionActionsDbus * self)117get_prompt_status (IndicatorSessionActionsDbus * self)
99{118{
@@ -102,6 +121,10 @@
102121
103 if (!g_settings_get_boolean (p->indicator_settings, "suppress-logout-restart-shutdown"))122 if (!g_settings_get_boolean (p->indicator_settings, "suppress-logout-restart-shutdown"))
104 {123 {
124 /* can we use the MATE prompt? */
125 if ((prompt == PROMPT_NONE) && have_mate_program ("mate-session-save"))
126 prompt = PROMPT_WITH_MATE;
127
105 /* can we use the Unity prompt? */128 /* can we use the Unity prompt? */
106 if ((prompt == PROMPT_NONE) && p && p->end_session_dialog)129 if ((prompt == PROMPT_NONE) && p && p->end_session_dialog)
107 {130 {
@@ -723,6 +746,15 @@
723}746}
724747
725static void748static void
749run_outside_app (const char * cmd)
750{
751 GError * err = NULL;
752 g_debug ("%s calling \"%s\"", G_STRFUNC, cmd);
753 g_spawn_command_line_async (cmd, &err);
754 log_and_clear_error (&err, G_STRLOC, G_STRFUNC);
755}
756
757static void
726my_logout (IndicatorSessionActions * actions)758my_logout (IndicatorSessionActions * actions)
727{759{
728 IndicatorSessionActionsDbus * self = INDICATOR_SESSION_ACTIONS_DBUS (actions);760 IndicatorSessionActionsDbus * self = INDICATOR_SESSION_ACTIONS_DBUS (actions);
@@ -733,6 +765,11 @@
733 show_unity_end_session_dialog (self, END_SESSION_TYPE_LOGOUT);765 show_unity_end_session_dialog (self, END_SESSION_TYPE_LOGOUT);
734 break;766 break;
735767
768 case PROMPT_WITH_MATE:
769 /* --logout-dialog presents Logout and (if available) Switch User options */
770 run_outside_app ("mate-session-save --logout-dialog");
771 break;
772
736 case PROMPT_NONE:773 case PROMPT_NONE:
737 logout_now (self);774 logout_now (self);
738 break;775 break;
@@ -770,6 +807,11 @@
770 show_unity_end_session_dialog (self, END_SESSION_TYPE_REBOOT);807 show_unity_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
771 break;808 break;
772809
810 case PROMPT_WITH_MATE:
811 /* --shutdown-dialog presents Restart, Shutdown and (if available) Suspend options */
812 run_outside_app ("mate-session-save --shutdown-dialog");
813 break;
814
773 case PROMPT_NONE:815 case PROMPT_NONE:
774 reboot_now (self);816 reboot_now (self);
775 break;817 break;
@@ -799,6 +841,11 @@
799 show_unity_end_session_dialog (self, END_SESSION_TYPE_REBOOT);841 show_unity_end_session_dialog (self, END_SESSION_TYPE_REBOOT);
800 break;842 break;
801843
844 case PROMPT_WITH_MATE:
845 /* --shutdown-dialog presents Restart, Shutdown and (if available) Suspend options */
846 run_outside_app ("mate-session-save --shutdown-dialog");
847 break;
848
802 case PROMPT_WITH_ZENITY:849 case PROMPT_WITH_ZENITY:
803 if (zenity_question (self,850 if (zenity_question (self,
804 "system-shutdown",851 "system-shutdown",
@@ -820,19 +867,12 @@
820***/867***/
821868
822static void869static void
823run_outside_app (const char * cmd)
824{
825 GError * err = NULL;
826 g_debug ("%s calling \"%s\"", G_STRFUNC, cmd);
827 g_spawn_command_line_async (cmd, &err);
828 log_and_clear_error (&err, G_STRLOC, G_STRFUNC);
829}
830
831static void
832my_help (IndicatorSessionActions * self G_GNUC_UNUSED)870my_help (IndicatorSessionActions * self G_GNUC_UNUSED)
833{871{
834 if (g_getenv ("MIR_SOCKET") != NULL)872 if (g_getenv ("MIR_SOCKET") != NULL)
835 url_dispatch_send("http://www.askubuntu.com", NULL, NULL);873 url_dispatch_send("http://www.askubuntu.com", NULL, NULL);
874 else if (have_mate_program ("yelp"))
875 run_outside_app ("yelp help:mate-user-guide");
836 else876 else
837 run_outside_app ("yelp");877 run_outside_app ("yelp");
838}878}
@@ -876,6 +916,8 @@
876 url_dispatch_send("settings:///system", NULL, NULL);916 url_dispatch_send("settings:///system", NULL, NULL);
877 else if (have_unity_control_center ())917 else if (have_unity_control_center ())
878 run_outside_app ("unity-control-center");918 run_outside_app ("unity-control-center");
919 else if (have_mate_program ("mate-control-center"))
920 run_outside_app ("mate-control-center");
879 else921 else
880 run_outside_app ("gnome-control-center");922 run_outside_app ("gnome-control-center");
881}923}
@@ -898,6 +940,8 @@
898 url_dispatch_send("settings:///system/about", NULL, NULL);940 url_dispatch_send("settings:///system/about", NULL, NULL);
899 else if (have_unity_control_center ())941 else if (have_unity_control_center ())
900 run_outside_app ("unity-control-center info");942 run_outside_app ("unity-control-center info");
943 else if (have_mate_program ("mate-system-monitor"))
944 run_outside_app ("mate-system-monitor --show-system-tab");
901 else945 else
902 run_outside_app ("gnome-control-center info");946 run_outside_app ("gnome-control-center info");
903}947}
@@ -922,6 +966,10 @@
922 unity_session_call_lock (p->unity_session, p->cancellable, NULL, NULL);966 unity_session_call_lock (p->unity_session, p->cancellable, NULL, NULL);
923 }967 }
924 }968 }
969 else if (have_mate_program ("mate-screensaver-command"))
970 {
971 run_outside_app ("mate-screensaver-command --lock");
972 }
925 else973 else
926 {974 {
927 g_return_if_fail (p->screen_saver != NULL);975 g_return_if_fail (p->screen_saver != NULL);

Subscribers

People subscribed via source and target branches