Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2:Test
beagle
beagle-propose-autostart.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File beagle-propose-autostart.patch of Package beagle
Index: beagle-0.3.9/search/Beagle.Search.Pages/StartDaemon.cs =================================================================== --- beagle-0.3.9.orig/search/Beagle.Search.Pages/StartDaemon.cs +++ beagle-0.3.9/search/Beagle.Search.Pages/StartDaemon.cs @@ -1,6 +1,11 @@ using System; using System.Diagnostics; +using System.IO; +using System.Reflection; + using Mono.Unix; +using Mono.Unix.Native; + using Gtk; namespace Beagle.Search.Pages { @@ -10,6 +15,7 @@ namespace Beagle.Search.Pages { public class StartDaemon : Base { public event DaemonStarted DaemonStarted; + private Gtk.ToggleButton autostart_toggle; public StartDaemon () { @@ -24,13 +30,45 @@ namespace Beagle.Search.Pages { button.Show (); Append (button); + + autostart_toggle = new Gtk.CheckButton (Catalog.GetString ("Automatically start service on login")); + autostart_toggle.Active = true; + autostart_toggle.Show (); + + Append (autostart_toggle); } private void OnStartDaemon (object o, EventArgs args) { + if (autostart_toggle.Active) + EnableAutostart (); + DoStartDaemon (DaemonStarted); } + private void EnableAutostart () + { + string local_autostart_dir = System.IO.Path.Combine (System.IO.Path.Combine (Environment.GetEnvironmentVariable ("HOME"), ".config"), "autostart"); + + if (! Directory.Exists (local_autostart_dir)) { + Directory.CreateDirectory (local_autostart_dir); + Syscall.chmod (local_autostart_dir, (FilePermissions) 448); // 448 == 0700 + } + + string beagled_file = System.IO.Path.Combine (local_autostart_dir, "beagled-autostart.desktop"); + + Assembly assembly = Assembly.GetExecutingAssembly (); + + StreamReader reader = new StreamReader (assembly.GetManifestResourceStream ("beagled-autostart.desktop")); + StreamWriter writer = new StreamWriter (beagled_file); + + string l; + while ((l = reader.ReadLine ()) != null) + writer.WriteLine (l); + reader.Close (); + writer.Close (); + } + internal static void DoStartDaemon (DaemonStarted DaemonStarted) { string beagled_filename = "beagled"; Index: beagle-0.3.9/search/Makefile.am =================================================================== --- beagle-0.3.9.orig/search/Makefile.am +++ beagle-0.3.9/search/Makefile.am @@ -91,6 +91,9 @@ SOURCES = \ $(srcdir)/Beagle.Search/UIManager.cs \ $(srcdir)/Beagle.Search/WidgetFu.cs +SEARCH_RESOURCES = $(top_srcdir)/beagled/beagled-autostart.desktop +SEARCH_RESOURCES_BUILD = $(foreach res,$(SEARCH_RESOURCES), $(addprefix -resource:,$(srcdir)/$(res)),$(notdir $(res))) + LOCAL_ASSEMBLIES = \ ../Util/Util.dll \ ../Util/UiUtil.dll \ @@ -108,8 +111,8 @@ pkglib_DATA = $(ASSEMBLY) $(ASSEMBLY).md BIN_WRAPPERS = beagle-search -$(ASSEMBLY): $(SOURCES) $(LOCAL_ASSEMBLIES) - $(CSC) -out:$@ $(CSFLAGS) $(SOURCES) $(ASSEMBLIES) +$(ASSEMBLY): $(SOURCES) $(SEARCH_RESOURCES) $(LOCAL_ASSEMBLIES) + $(CSC) -out:$@ $(SEARCH_RESOURCES_BUILD) $(CSFLAGS) $(SOURCES) $(ASSEMBLIES) $(ASSEMBLY).mdb: $(ASSEMBLY) @@ -148,6 +151,7 @@ uninstall-local: EXTRA_DIST = \ $(SOURCES) \ + $(SEARCH_RESOURCES) \ $(man_MANS) \ $(desktop_DATA).in \ $(autostart_DATA) \
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor