]> git.pld-linux.org Git - packages/synapse.git/blobdiff - synapse-mate.patch
- lock screen support in mate patch
[packages/synapse.git] / synapse-mate.patch
index 86ede9436d90b0ac998dec51bfbe6cb48290c81d..46f4edaaab5dca62f14d98542b5da333aa64ad3d 100644 (file)
@@ -1,37 +1,3 @@
-diff -urN synapse-0.2.10.orig/src/core/desktop-file-service.vala synapse-0.2.10/src/core/desktop-file-service.vala
---- synapse-0.2.10.orig/src/core/desktop-file-service.vala     2013-08-18 18:33:35.710536590 +0200
-+++ synapse-0.2.10/src/core/desktop-file-service.vala  2013-08-18 18:33:55.187202928 +0200
-@@ -39,8 +39,9 @@
-       XFCE  = 1 << 4,
-       OLD   = 1 << 5,
-       UNITY = 1 << 6,
-+      MATE  = 1 << 7,
--      ALL   = 0x7F
-+      ALL   = 0xFF
-     }
-    
-     public string desktop_id { get; construct set; } 
-@@ -92,6 +93,7 @@
-           case "ROX": result |= EnvironmentType.ROX; break;
-           case "OLD": result |= EnvironmentType.OLD; break;
-           case "UNITY": result |= EnvironmentType.UNITY; break;
-+          case "MATE": result |= EnvironmentType.MATE; break;
-           default: warning ("%s is not understood", env); break;
-         }
-       }
-@@ -284,6 +286,11 @@
-         session_type = DesktopFileInfo.EnvironmentType.ROX;
-         session_type_str = "ROX";
-       }
-+      else if (session.has_prefix ("mate"))
-+      {
-+        session_type = DesktopFileInfo.EnvironmentType.MATE;
-+        session_type_str = "MATE";
-+      }
-       else
-       {
-         warning ("Desktop session type is not recognized, assuming GNOME.");
 diff -urN synapse-0.2.10.orig/src/plugins/Makefile.am synapse-0.2.10/src/plugins/Makefile.am
 --- synapse-0.2.10.orig/src/plugins/Makefile.am        2013-08-18 18:33:35.710536590 +0200
 +++ synapse-0.2.10/src/plugins/Makefile.am     2013-08-18 18:33:44.427203171 +0200
@@ -46,7 +12,7 @@ diff -urN synapse-0.2.10.orig/src/plugins/Makefile.am synapse-0.2.10/src/plugins
 diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.10/src/plugins/mate-session-plugin.vala
 --- synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala   1970-01-01 01:00:00.000000000 +0100
 +++ synapse-0.2.10/src/plugins/mate-session-plugin.vala        2013-08-18 18:33:44.427203171 +0200
-@@ -0,0 +1,220 @@
+@@ -0,0 +1,196 @@
 +/*
 + * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
 + *
@@ -96,24 +62,16 @@ diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.1
 +      
 +    }
 +
-+    private class ShutDownAction: Object, Match
++    private class ShutDownAction: ActionMatch
 +    {
-+      // for Match interface
-+      public string title { get; construct set; }
-+      public string description { get; set; default = ""; }
-+      public string icon_name { get; construct set; default = ""; }
-+      public bool has_thumbnail { get; construct set; default = false; }
-+      public string thumbnail_path { get; construct set; }
-+      public MatchType match_type { get; construct set; }
-+
 +      public ShutDownAction ()
 +      {
-+        Object (match_type: MatchType.ACTION, title: _ ("Shut Down"),
-+                description: _ ("Turn your computer off"),
++        Object (title: _("Shut Down"),
++                description: _("Turn your computer off"),
 +                icon_name: "system-shutdown", has_thumbnail: false);
 +      }
 +      
-+      public void execute (Match? match)
++      public override void do_action ()
 +      {
 +        try
 +        {
@@ -130,24 +88,16 @@ diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.1
 +      }
 +    }
 +
-+    private class RebootAction: Object, Match
++    private class RebootAction: ActionMatch
 +    {
-+      // for Match interface
-+      public string title { get; construct set; }
-+      public string description { get; set; default = ""; }
-+      public string icon_name { get; construct set; default = ""; }
-+      public bool has_thumbnail { get; construct set; default = false; }
-+      public string thumbnail_path { get; construct set; }
-+      public MatchType match_type { get; construct set; }
-+
 +      public RebootAction ()
 +      {
-+        Object (match_type: MatchType.ACTION, title: _ ("Restart"),
-+                description: _ ("Restart your computer"),
++        Object (title: _("Restart"),
++                description: _("Restart your computer"),
 +                icon_name: "system-shutdown", has_thumbnail: false);
 +      }
 +      
-+      public void execute (Match? match)
++      public override void do_action ()
 +      {
 +        try
 +        {
@@ -164,24 +114,16 @@ diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.1
 +      }
 +    }
 +
-+    private class LogOutAction: Object, Match
++    private class LogOutAction: ActionMatch
 +    {
-+      // for Match interface
-+      public string title { get; construct set; }
-+      public string description { get; set; default = ""; }
-+      public string icon_name { get; construct set; default = ""; }
-+      public bool has_thumbnail { get; construct set; default = false; }
-+      public string thumbnail_path { get; construct set; }
-+      public MatchType match_type { get; construct set; }
-+
 +      public LogOutAction ()
 +      {
-+        Object (match_type: MatchType.ACTION, title: _ ("Log Out"),
-+                description: _ ("Close your session and return to the login screen"),
-+                icon_name: "system-log-out", has_thumbnail: false);
++        Object (title: _("Log Out"),
++                description: _("Close your session and return to the login screen"),
++                icon_name: "gnome-logout", has_thumbnail: false);
 +      }
 +      
-+      public void execute (Match? match)
++      public override void do_action ()
 +      {
 +        try
 +        {
@@ -205,7 +147,7 @@ diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.1
 +    
 +    static void register_plugin ()
 +    {
-+      DataSink.PluginRegistry.get_default ().register_plugin (
++      PluginRegistry.get_default ().register_plugin (
 +        typeof (MateSessionPlugin),
 +        "MATE Session",
 +        _ ("Log out from your session."),
@@ -228,7 +170,7 @@ diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.1
 +    {
 +      var cache = DBusService.get_default ();
 +      session_manager_available = cache.name_has_owner (MateSessionManager.UNIQUE_NAME);
-+      Utils.Logger.log (this, "%s %s available", MateSessionManager.UNIQUE_NAME,
++      message ("%s %s available", MateSessionManager.UNIQUE_NAME,
 +        session_manager_available ? "is" : "isn't");
 +      
 +      actions = new Gee.LinkedList<Match> ();
@@ -255,7 +197,7 @@ diff -urN synapse-0.2.10.orig/src/plugins/mate-session-plugin.vala synapse-0.2.1
 +        {
 +          if (matcher.key.match (action.title))
 +          {
-+            result.add (action, matcher.value - Match.Score.INCREMENT_SMALL);
++            result.add (action, matcher.value - MatchScore.INCREMENT_SMALL);
 +            break;
 +          }
 +        }
@@ -278,3 +220,157 @@ diff -urN synapse-0.2.10.orig/src/ui/synapse-main.vala synapse-0.2.10/src/ui/syn
          typeof (GnomeScreenSaverPlugin),
          typeof (SystemManagementPlugin),
          typeof (CommandPlugin),
+diff -urN synapse-0.2.99.orig/src/plugins/Makefile.am synapse-0.2.99/src/plugins/Makefile.am
+--- synapse-0.2.99.orig/src/plugins/Makefile.am        2014-12-02 21:09:40.877899345 +0100
++++ synapse-0.2.99/src/plugins/Makefile.am     2014-12-02 21:13:38.577901026 +0100
+@@ -44,6 +44,7 @@
+       gnome-bookmarks-plugin.vala \
+       gnome-session-plugin.vala \
+       gnome-screensaver-plugin.vala \
++      mate-screensaver-plugin.vala \
+       hello-world-plugin.vala \
+       hybrid-search-plugin.vala \
+       launchpad-plugin.vala \
+diff -urN synapse-0.2.99.orig/src/plugins/mate-screensaver-plugin.vala synapse-0.2.99/src/plugins/mate-screensaver-plugin.vala
+--- synapse-0.2.99.orig/src/plugins/mate-screensaver-plugin.vala       1970-01-01 01:00:00.000000000 +0100
++++ synapse-0.2.99/src/plugins/mate-screensaver-plugin.vala    2014-12-02 21:12:56.697900730 +0100
+@@ -0,0 +1,128 @@
++/*
++ * Copyright (C) 2010 Igor S. Mandrigin <i@mandrigin.ru>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
++ *
++ * Based on plugins code by Michal Hruby <michal.mhr@gmail.com>
++ *
++ */
++
++namespace Synapse
++{
++  [DBus (name = "org.mate.ScreenSaver")]
++  public interface MateScreenSaver : Object
++  {
++    public const string UNIQUE_NAME = "org.mate.ScreenSaver";
++    public const string OBJECT_PATH = "/org/mate/ScreenSaver";
++
++    public abstract async void lock () throws IOError;
++  }
++
++  public class MateScreenSaverPlugin : Object, Activatable, ItemProvider
++  {
++    public bool enabled { get; set; default = true; }
++
++    public void activate ()
++    {
++
++    }
++
++    public void deactivate ()
++    {
++
++    }
++
++    private class LockScreenAction : ActionMatch
++    {
++      public LockScreenAction ()
++      {
++        Object (title: _("Lock Screen"),
++                description: _("Locks screen and starts screensaver."),
++                icon_name: "system-lock-screen", has_thumbnail: false);
++      }
++
++      public override void do_action ()
++      {
++        MateScreenSaverPlugin.lock_screen ();
++      }
++    }
++
++    public static void lock_screen ()
++    {
++      try {
++        MateScreenSaver dbus_interface = Bus.get_proxy_sync (BusType.SESSION,
++                                                 MateScreenSaver.UNIQUE_NAME,
++                                                 MateScreenSaver.OBJECT_PATH);
++        // we need the async variant cause Screensaver doesn't send the reply
++        dbus_interface.lock.begin ();
++      } catch (IOError err) {
++        warning ("%s", err.message);
++      }
++    }
++
++    static void register_plugin ()
++    {
++      PluginRegistry.get_default ().register_plugin (
++        typeof (MateScreenSaverPlugin),
++        "Mate screensaver plugin",
++        _("Lock screen of your computer."),
++        "system-lock-screen",
++        register_plugin,
++        DBusService.get_default ().name_is_activatable (MateScreenSaver.UNIQUE_NAME),
++        _("Mate Screen Saver wasn't found")
++      );
++    }
++
++    static construct
++    {
++      register_plugin ();
++    }
++
++    private Gee.List<Match> actions;
++
++    construct
++    {
++      actions = new Gee.LinkedList<Match> ();
++      actions.add (new LockScreenAction ());
++    }
++
++    public async ResultSet? search (Query q) throws SearchError
++    {
++      // we only search for actions
++      if (!(QueryFlags.ACTIONS in q.query_type)) return null;
++
++      var result = new ResultSet ();
++
++      var matchers = Query.get_matchers_for_query (q.query_string, 0,
++        RegexCompileFlags.OPTIMIZE | RegexCompileFlags.CASELESS);
++
++      foreach (var action in actions)
++      {
++        foreach (var matcher in matchers)
++        {
++          if (matcher.key.match (action.title))
++          {
++            result.add (action, matcher.value - MatchScore.INCREMENT_SMALL);
++            break;
++          }
++        }
++      }
++
++      q.check_cancellable ();
++
++      return result;
++    }
++  }
++}
+diff -urN synapse-0.2.99.orig/src/ui/synapse-main.vala synapse-0.2.99/src/ui/synapse-main.vala
+--- synapse-0.2.99.orig/src/ui/synapse-main.vala       2014-12-02 21:09:40.881232678 +0100
++++ synapse-0.2.99/src/ui/synapse-main.vala    2014-12-02 21:13:26.064567604 +0100
+@@ -166,6 +166,7 @@
+         typeof (GnomeSessionPlugin),
+         typeof (MateSessionPlugin),
+         typeof (GnomeScreenSaverPlugin),
++        typeof (MateScreenSaverPlugin),
+         typeof (SystemManagementPlugin),
+         typeof (CommandPlugin),
+         typeof (RhythmboxActions),
This page took 0.083973 seconds and 4 git commands to generate.