25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

217 lines
8.9 KiB

  1. /* GTK - The GIMP Toolkit
  2. * gtkrecentmanager.h: a manager for the recently used resources
  3. *
  4. * Copyright (C) 2006 Emmanuele Bassi
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. */
  20. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  21. #error "Only <gtk/gtk.h> can be included directly."
  22. #endif
  23. #ifndef __GTK_RECENT_MANAGER_H__
  24. #define __GTK_RECENT_MANAGER_H__
  25. #include <gdk-pixbuf/gdk-pixbuf.h>
  26. #include <gdk/gdk.h>
  27. #include <time.h>
  28. G_BEGIN_DECLS
  29. #define GTK_TYPE_RECENT_INFO (gtk_recent_info_get_type ())
  30. #define GTK_TYPE_RECENT_MANAGER (gtk_recent_manager_get_type ())
  31. #define GTK_RECENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_MANAGER, GtkRecentManager))
  32. #define GTK_IS_RECENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_MANAGER))
  33. #define GTK_RECENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RECENT_MANAGER, GtkRecentManagerClass))
  34. #define GTK_IS_RECENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RECENT_MANAGER))
  35. #define GTK_RECENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RECENT_MANAGER, GtkRecentManagerClass))
  36. typedef struct _GtkRecentInfo GtkRecentInfo;
  37. typedef struct _GtkRecentData GtkRecentData;
  38. typedef struct _GtkRecentManager GtkRecentManager;
  39. typedef struct _GtkRecentManagerClass GtkRecentManagerClass;
  40. typedef struct _GtkRecentManagerPrivate GtkRecentManagerPrivate;
  41. /**
  42. * GtkRecentData:
  43. * @display_name: a UTF-8 encoded string, containing the name of the recently
  44. * used resource to be displayed, or %NULL;
  45. * @description: a UTF-8 encoded string, containing a short description of
  46. * the resource, or %NULL;
  47. * @mime_type: the MIME type of the resource;
  48. * @app_name: the name of the application that is registering this recently
  49. * used resource;
  50. * @app_exec: command line used to launch this resource; may contain the
  51. * "&percnt;f" and "&percnt;u" escape characters which will be expanded
  52. * to the resource file path and URI respectively when the command line
  53. * is retrieved;
  54. * @groups: a vector of strings containing groups names;
  55. * @is_private: whether this resource should be displayed only by the
  56. * applications that have registered it or not.
  57. *
  58. * Meta-data to be passed to gtk_recent_manager_add_full() when
  59. * registering a recently used resource.
  60. **/
  61. struct _GtkRecentData
  62. {
  63. gchar *display_name;
  64. gchar *description;
  65. gchar *mime_type;
  66. gchar *app_name;
  67. gchar *app_exec;
  68. gchar **groups;
  69. gboolean is_private;
  70. };
  71. struct _GtkRecentManager
  72. {
  73. /*< private >*/
  74. GObject parent_instance;
  75. GtkRecentManagerPrivate *GSEAL (priv);
  76. };
  77. struct _GtkRecentManagerClass
  78. {
  79. /*< private >*/
  80. GObjectClass parent_class;
  81. void (*changed) (GtkRecentManager *manager);
  82. /* padding for future expansion */
  83. void (*_gtk_recent1) (void);
  84. void (*_gtk_recent2) (void);
  85. void (*_gtk_recent3) (void);
  86. void (*_gtk_recent4) (void);
  87. };
  88. /**
  89. * GtkRecentManagerError:
  90. * @GTK_RECENT_MANAGER_ERROR_NOT_FOUND: the URI specified does not exists in
  91. * the recently used resources list.
  92. * @GTK_RECENT_MANAGER_ERROR_INVALID_URI: the URI specified is not valid.
  93. * @GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING: the supplied string is not
  94. * UTF-8 encoded.
  95. * @GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED: no application has registered
  96. * the specified item.
  97. * @GTK_RECENT_MANAGER_ERROR_READ: failure while reading the recently used
  98. * resources file.
  99. * @GTK_RECENT_MANAGER_ERROR_WRITE: failure while writing the recently used
  100. * resources file.
  101. * @GTK_RECENT_MANAGER_ERROR_UNKNOWN: unspecified error.
  102. *
  103. * Error codes for GtkRecentManager operations
  104. **/
  105. typedef enum
  106. {
  107. GTK_RECENT_MANAGER_ERROR_NOT_FOUND,
  108. GTK_RECENT_MANAGER_ERROR_INVALID_URI,
  109. GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING,
  110. GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED,
  111. GTK_RECENT_MANAGER_ERROR_READ,
  112. GTK_RECENT_MANAGER_ERROR_WRITE,
  113. GTK_RECENT_MANAGER_ERROR_UNKNOWN
  114. } GtkRecentManagerError;
  115. #define GTK_RECENT_MANAGER_ERROR (gtk_recent_manager_error_quark ())
  116. GQuark gtk_recent_manager_error_quark (void);
  117. GType gtk_recent_manager_get_type (void) G_GNUC_CONST;
  118. GtkRecentManager *gtk_recent_manager_new (void);
  119. GtkRecentManager *gtk_recent_manager_get_default (void);
  120. #ifndef GTK_DISABLE_DEPRECATED
  121. GtkRecentManager *gtk_recent_manager_get_for_screen (GdkScreen *screen);
  122. void gtk_recent_manager_set_screen (GtkRecentManager *manager,
  123. GdkScreen *screen);
  124. #endif
  125. gboolean gtk_recent_manager_add_item (GtkRecentManager *manager,
  126. const gchar *uri);
  127. gboolean gtk_recent_manager_add_full (GtkRecentManager *manager,
  128. const gchar *uri,
  129. const GtkRecentData *recent_data);
  130. gboolean gtk_recent_manager_remove_item (GtkRecentManager *manager,
  131. const gchar *uri,
  132. GError **error);
  133. GtkRecentInfo * gtk_recent_manager_lookup_item (GtkRecentManager *manager,
  134. const gchar *uri,
  135. GError **error);
  136. gboolean gtk_recent_manager_has_item (GtkRecentManager *manager,
  137. const gchar *uri);
  138. gboolean gtk_recent_manager_move_item (GtkRecentManager *manager,
  139. const gchar *uri,
  140. const gchar *new_uri,
  141. GError **error);
  142. void gtk_recent_manager_set_limit (GtkRecentManager *manager,
  143. gint limit);
  144. gint gtk_recent_manager_get_limit (GtkRecentManager *manager);
  145. GList * gtk_recent_manager_get_items (GtkRecentManager *manager);
  146. gint gtk_recent_manager_purge_items (GtkRecentManager *manager,
  147. GError **error);
  148. GType gtk_recent_info_get_type (void) G_GNUC_CONST;
  149. GtkRecentInfo * gtk_recent_info_ref (GtkRecentInfo *info);
  150. void gtk_recent_info_unref (GtkRecentInfo *info);
  151. G_CONST_RETURN gchar *gtk_recent_info_get_uri (GtkRecentInfo *info);
  152. G_CONST_RETURN gchar *gtk_recent_info_get_display_name (GtkRecentInfo *info);
  153. G_CONST_RETURN gchar *gtk_recent_info_get_description (GtkRecentInfo *info);
  154. G_CONST_RETURN gchar *gtk_recent_info_get_mime_type (GtkRecentInfo *info);
  155. time_t gtk_recent_info_get_added (GtkRecentInfo *info);
  156. time_t gtk_recent_info_get_modified (GtkRecentInfo *info);
  157. time_t gtk_recent_info_get_visited (GtkRecentInfo *info);
  158. gboolean gtk_recent_info_get_private_hint (GtkRecentInfo *info);
  159. gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info,
  160. const gchar *app_name,
  161. const gchar **app_exec,
  162. guint *count,
  163. time_t *time_);
  164. gchar ** gtk_recent_info_get_applications (GtkRecentInfo *info,
  165. gsize *length) G_GNUC_MALLOC;
  166. gchar * gtk_recent_info_last_application (GtkRecentInfo *info) G_GNUC_MALLOC;
  167. gboolean gtk_recent_info_has_application (GtkRecentInfo *info,
  168. const gchar *app_name);
  169. gchar ** gtk_recent_info_get_groups (GtkRecentInfo *info,
  170. gsize *length) G_GNUC_MALLOC;
  171. gboolean gtk_recent_info_has_group (GtkRecentInfo *info,
  172. const gchar *group_name);
  173. GdkPixbuf * gtk_recent_info_get_icon (GtkRecentInfo *info,
  174. gint size);
  175. gchar * gtk_recent_info_get_short_name (GtkRecentInfo *info) G_GNUC_MALLOC;
  176. gchar * gtk_recent_info_get_uri_display (GtkRecentInfo *info) G_GNUC_MALLOC;
  177. gint gtk_recent_info_get_age (GtkRecentInfo *info);
  178. gboolean gtk_recent_info_is_local (GtkRecentInfo *info);
  179. gboolean gtk_recent_info_exists (GtkRecentInfo *info);
  180. gboolean gtk_recent_info_match (GtkRecentInfo *info_a,
  181. GtkRecentInfo *info_b);
  182. /* private */
  183. void _gtk_recent_manager_sync (void);
  184. G_END_DECLS
  185. #endif /* __GTK_RECENT_MANAGER_H__ */