/core/externals/google-toolbox-for-mac/AppKit/GTMLoginItems.h

http://macfuse.googlecode.com/ · C++ Header · 88 lines · 13 code · 10 blank · 65 comment · 0 complexity · 9ca7c34f45e24c822bbd57f68c1e2267 MD5 · raw file

  1. //
  2. // GTMLoginItems.h
  3. //
  4. // Copyright 2007-2008 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import <Foundation/Foundation.h>
  19. #import "GTMDefines.h"
  20. /// Login items key constants, used as keys in |+loginItems|
  21. //
  22. // Item name
  23. GTM_EXTERN NSString * const kGTMLoginItemsNameKey;
  24. // Item path
  25. GTM_EXTERN NSString * const kGTMLoginItemsPathKey;
  26. // Hidden (NSNumber bool)
  27. GTM_EXTERN NSString * const kGTMLoginItemsHiddenKey;
  28. /// GTMLoginItems
  29. //
  30. /// A helper class to manipulate the user's Login Items.
  31. @interface GTMLoginItems : NSObject
  32. /// Obtain a complete list of all login items.
  33. //
  34. // Returns:
  35. // Autoreleased array of dictionaries keyed with kGTMLoginItemsPathKey, etc.
  36. //
  37. + (NSArray *)loginItems:(NSError **)errorInfo;
  38. /// Check if the given path is in the current user's Login Items
  39. //
  40. // Args:
  41. // path: path to the application
  42. //
  43. // Returns:
  44. // YES if the path is in the Login Items
  45. //
  46. + (BOOL)pathInLoginItems:(NSString *)path;
  47. /// Check if the given name is in the current user's Login Items
  48. //
  49. // Args:
  50. // name: name to the application
  51. //
  52. // Returns:
  53. // YES if the name is in the Login Items
  54. //
  55. + (BOOL)itemWithNameInLoginItems:(NSString *)name;
  56. /// Add the given path to the current user's Login Items. Does nothing if the
  57. /// path is already there.
  58. //
  59. // Args:
  60. // path: path to add
  61. // hide: Set to YES to have the item launch hidden
  62. //
  63. + (void)addPathToLoginItems:(NSString *)path hide:(BOOL)hide;
  64. /// Remove the given path from the current user's Login Items. Does nothing if
  65. /// the path is not there.
  66. //
  67. // Args:
  68. // path: the path to remove
  69. //
  70. + (void)removePathFromLoginItems:(NSString *)path;
  71. /// Remove the given item name from the current user's Login Items. Does nothing
  72. /// if no item with that name is present.
  73. //
  74. // Args:
  75. // name: name of the item to remove
  76. //
  77. + (void)removeItemWithNameFromLoginItems:(NSString *)name;
  78. @end