From a992cc22a0182fa89d03991385cea24cc4cbad90 Mon Sep 17 00:00:00 2001 From: Jan Palus Date: Sun, 18 Aug 2013 18:50:55 +0200 Subject: [PATCH] - run autotools - add some more BRs - patch for initial integration with mate desktop - rel 1 --- synapse-mate.patch | 280 +++++++++++++++++++++++++++++++++++++++++++++ synapse.spec | 21 +++- 2 files changed, 299 insertions(+), 2 deletions(-) create mode 100644 synapse-mate.patch diff --git a/synapse-mate.patch b/synapse-mate.patch new file mode 100644 index 0000000..86ede94 --- /dev/null +++ b/synapse-mate.patch @@ -0,0 +1,280 @@ +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 +@@ -45,6 +45,7 @@ + hybrid-search-plugin.vala \ + launchpad-plugin.vala \ + locate-plugin.vala \ ++ mate-session-plugin.vala \ + opensearch.vala \ + pastebin-plugin.vala \ + pidgin-plugin.vala \ +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 @@ ++/* ++ * Copyright (C) 2010 Michal Hruby ++ * ++ * 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. ++ * ++ * Authored by Michal Hruby ++ * ++ */ ++ ++namespace Synapse ++{ ++ [DBus (name = "org.mate.SessionManager")] ++ public interface MateSessionManager: Object ++ { ++ public const string UNIQUE_NAME = "org.mate.SessionManager"; ++ public const string OBJECT_PATH = "/org/mate/SessionManager"; ++ ++ public abstract bool can_shutdown () throws IOError; ++ public abstract void shutdown () throws IOError; ++ public abstract void request_reboot () throws IOError; ++ public abstract void logout (uint32 mode = 0) throws IOError; ++ } ++ ++ public class MateSessionPlugin: Object, Activatable, ItemProvider ++ { ++ public bool enabled { get; set; default = true; } ++ ++ public void activate () ++ { ++ ++ } ++ ++ public void deactivate () ++ { ++ ++ } ++ ++ private class ShutDownAction: Object, Match ++ { ++ // 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"), ++ icon_name: "system-shutdown", has_thumbnail: false); ++ } ++ ++ public void execute (Match? match) ++ { ++ try ++ { ++ MateSessionManager dbus_interface = Bus.get_proxy_sync (BusType.SESSION, ++ MateSessionManager.UNIQUE_NAME, ++ MateSessionManager.OBJECT_PATH); ++ ++ dbus_interface.shutdown (); ++ } ++ catch (IOError err) ++ { ++ warning ("%s", err.message); ++ } ++ } ++ } ++ ++ private class RebootAction: Object, Match ++ { ++ // 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"), ++ icon_name: "system-shutdown", has_thumbnail: false); ++ } ++ ++ public void execute (Match? match) ++ { ++ try ++ { ++ MateSessionManager dbus_interface = Bus.get_proxy_sync (BusType.SESSION, ++ MateSessionManager.UNIQUE_NAME, ++ MateSessionManager.OBJECT_PATH); ++ ++ dbus_interface.request_reboot (); ++ } ++ catch (IOError err) ++ { ++ warning ("%s", err.message); ++ } ++ } ++ } ++ ++ private class LogOutAction: Object, Match ++ { ++ // 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); ++ } ++ ++ public void execute (Match? match) ++ { ++ try ++ { ++ MateSessionManager dbus_interface = Bus.get_proxy_sync (BusType.SESSION, ++ MateSessionManager.UNIQUE_NAME, ++ MateSessionManager.OBJECT_PATH); ++ ++ /* ++ * 0: Normal. ++ * 1: No confirmation inferface should be shown. ++ * 2: Forcefully logout. No confirmation will be shown and any inhibitors will be ignored. ++ */ ++ dbus_interface.logout (1); ++ } ++ catch (IOError err) ++ { ++ warning ("%s", err.message); ++ } ++ } ++ } ++ ++ static void register_plugin () ++ { ++ DataSink.PluginRegistry.get_default ().register_plugin ( ++ typeof (MateSessionPlugin), ++ "MATE Session", ++ _ ("Log out from your session."), ++ "mate-session-logout", ++ register_plugin, ++ DBusService.get_default ().name_has_owner (MateSessionManager.UNIQUE_NAME), ++ _ ("MATE Session Manager wasn't found") ++ ); ++ } ++ ++ static construct ++ { ++ register_plugin (); ++ } ++ ++ private bool session_manager_available = false; ++ private Gee.List actions; ++ ++ construct ++ { ++ 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, ++ session_manager_available ? "is" : "isn't"); ++ ++ actions = new Gee.LinkedList (); ++ actions.add (new LogOutAction ()); ++ // TODO: add a config option to enable these actions (for example when ConsoleKit is not available) ++ //actions.add (new RebootAction ()); ++ //actions.add (new ShutDownAction ()); ++ } ++ ++ public async ResultSet? search (Query q) throws SearchError ++ { ++ if (!session_manager_available) return null; ++ // 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 - Match.Score.INCREMENT_SMALL); ++ break; ++ } ++ } ++ } ++ ++ q.check_cancellable (); ++ ++ return result; ++ } ++ } ++} +diff -urN synapse-0.2.10.orig/src/ui/synapse-main.vala synapse-0.2.10/src/ui/synapse-main.vala +--- synapse-0.2.10.orig/src/ui/synapse-main.vala 2013-08-18 18:33:35.710536590 +0200 ++++ synapse-0.2.10/src/ui/synapse-main.vala 2013-08-18 18:33:44.427203171 +0200 +@@ -165,6 +165,7 @@ + typeof (DesktopFilePlugin), + typeof (HybridSearchPlugin), + typeof (GnomeSessionPlugin), ++ typeof (MateSessionPlugin), + typeof (GnomeScreenSaverPlugin), + typeof (SystemManagementPlugin), + typeof (CommandPlugin), diff --git a/synapse.spec b/synapse.spec index b2e789f..4236b26 100644 --- a/synapse.spec +++ b/synapse.spec @@ -1,16 +1,25 @@ Summary: Application launcher Name: synapse Version: 0.2.10 -Release: 0.1 +Release: 1 License: GPL v3+ Group: X11/Applications Source0: https://launchpad.net/synapse-project/0.2/%{version}/+download/%{name}-%{version}.tar.gz # Source0-md5: ac1c075c01f1c179f32fd6651bd184f8 +Patch0: %{name}-mate.patch URL: http://synapse.zeitgeist-project.com/ +BuildRequires: glib2-devel >= 1:2.26.0 +BuildRequires: gtk+2-devel >= 2:2.20.0 BuildRequires: gtkhotkey-devel >= 0.2.1 +BuildRequires: json-glib-devel >= 0.10.0 +BuildRequires: libgee0.6-devel >= 0.5.2 +BuildRequires: libnotify-devel BuildRequires: libunique-devel >= 1.0 +BuildRequires: rest-devel +BuildRequires: vala >= 0.14.0 BuildRequires: vala-libgee >= 0.6.4 BuildRequires: vala-zeitgeist >= 0.3.18 +BuildRequires: zeitgeist-devel >= 0.3.18 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description @@ -20,9 +29,17 @@ files by making use of the Zeitgeist engine. %prep %setup -q +%patch0 -p1 %build -%configure +%{__aclocal} -I m4 +%{__autoconf} +%{__autoheader} +%{__automake} +%configure \ + --disable-silent-rules \ + --enable-librest=yes \ + --enable-zeitgeist=yes %{__make} %install -- 2.44.0