Top |
struct | GtkRecentManager |
GtkRecentInfo | |
struct | GtkRecentData |
#define | GTK_RECENT_MANAGER_ERROR |
enum | GtkRecentManagerError |
GtkRecentManager *
gtk_recent_manager_new (void
);
Creates a new recent manager object. Recent manager objects are used to handle the list of recently used resources. A GtkRecentManager object monitors the recently used resources list, and emits the "changed" signal each time something inside the list changes.
GtkRecentManager objects are expensive: be sure to create them only when
needed. You should use gtk_recent_manager_get_default()
instead.
Since: 2.10
GtkRecentManager *
gtk_recent_manager_get_default (void
);
Gets a unique instance of GtkRecentManager, that you can share in your application without caring about memory management. The returned instance will be freed when you application terminates.
Since: 2.10
GtkRecentManager *
gtk_recent_manager_get_for_screen (GdkScreen *screen
);
gtk_recent_manager_get_for_screen
has been deprecated since version 2.12 and should not be used in newly-written code.
This function has been deprecated and should
not be used in newly written code. Calling this function is
equivalent to calling gtk_recent_manager_get_default()
.
Gets the recent manager object associated with screen
; if this
function has not previously been called for the given screen,
a new recent manager object will be created and associated with
the screen. Recent manager objects are fairly expensive to create,
so using this function is usually a better choice than calling
gtk_recent_manager_new()
and setting the screen yourself; by using
this function a single recent manager object will be shared between
users.
A unique GtkRecentManager associated with the given screen. This recent manager is associated to the with the screen and can be used as long as the screen is open. Do not ref or unref it.
Since: 2.10
void gtk_recent_manager_set_screen (GtkRecentManager *manager
,GdkScreen *screen
);
gtk_recent_manager_set_screen
has been deprecated since version 2.12 and should not be used in newly-written code.
This function has been deprecated and should not be used in newly written code. Calling this function has no effect.
Sets the screen for a recent manager; the screen is used to track the user's currently configured recently used documents storage.
Since: 2.10
gboolean gtk_recent_manager_add_item (GtkRecentManager *manager
,const gchar *uri
);
Adds a new resource, pointed by uri
, into the recently used
resources list.
This function automatically retrieves some of the needed
metadata and setting other metadata to common default values; it
then feeds the data to gtk_recent_manager_add_full()
.
See gtk_recent_manager_add_full()
if you want to explicitly
define the metadata for the resource pointed by uri
.
Since: 2.10
gboolean gtk_recent_manager_add_full (GtkRecentManager *manager
,const gchar *uri
,const GtkRecentData *recent_data
);
Adds a new resource, pointed by uri
, into the recently used
resources list, using the metadata specified inside the GtkRecentData
structure passed in recent_data
.
The passed URI will be used to identify this resource inside the list.
In order to register the new recently used resource, metadata about the resource must be passed as well as the URI; the metadata is stored in a GtkRecentData structure, which must contain the MIME type of the resource pointed by the URI; the name of the application that is registering the item, and a command line to be used when launching the item.
Optionally, a GtkRecentData structure might contain a UTF-8 string to be used when viewing the item instead of the last component of the URI; a short description of the item; whether the item should be considered private - that is, should be displayed only by the applications that have registered it.
TRUE
if the new item was successfully added to the
recently used resources list, FALSE
otherwise.
Since: 2.10
gboolean gtk_recent_manager_remove_item (GtkRecentManager *manager
,const gchar *uri
,GError **error
);
Removes a resource pointed by uri
from the recently used resources
list handled by a recent manager.
manager |
||
uri |
the URI of the item you wish to remove |
|
error |
return location for a GError, or |
[allow-none] |
TRUE
if the item pointed by uri
has been successfully
removed by the recently used resources list, and FALSE
otherwise.
Since: 2.10
GtkRecentInfo * gtk_recent_manager_lookup_item (GtkRecentManager *manager
,const gchar *uri
,GError **error
);
Searches for a URI inside the recently used resources list, and returns a structure containing informations about the resource like its MIME type, or its display name.
a GtkRecentInfo structure containing information
about the resource pointed by uri
, or NULL
if the URI was
not registered in the recently used resources list. Free with
gtk_recent_info_unref()
.
Since: 2.10
gboolean gtk_recent_manager_has_item (GtkRecentManager *manager
,const gchar *uri
);
Checks whether there is a recently used resource registered
with uri
inside the recent manager.
Since: 2.10
gboolean gtk_recent_manager_move_item (GtkRecentManager *manager
,const gchar *uri
,const gchar *new_uri
,GError **error
);
Changes the location of a recently used resource from uri
to new_uri
.
Please note that this function will not affect the resource pointed by the URIs, but only the URI used in the recently used resources list.
manager |
||
uri |
the URI of a recently used resource |
|
new_uri |
the new URI of the recently used resource, or |
[allow-none] |
error |
a return location for a GError, or |
[allow-none] |
Since: 2.10
gint
gtk_recent_manager_get_limit (GtkRecentManager *manager
);
gtk_recent_manager_get_limit
has been deprecated since version 2.22 and should not be used in newly-written code.
The length of the list should be managed by the view (implementing GtkRecentChooser), and not by the model (the GtkRecentManager). See “limit”.
Gets the maximum number of items that the gtk_recent_manager_get_items()
function should return.
Since: 2.10
void gtk_recent_manager_set_limit (GtkRecentManager *manager
,gint limit
);
gtk_recent_manager_set_limit
has been deprecated since version 2.22 and should not be used in newly-written code.
The length of the list should be managed by the view (implementing GtkRecentChooser), and not by the model (the GtkRecentManager). See “limit”.
Sets the maximum number of item that the gtk_recent_manager_get_items()
function should return. If limit
is set to -1, then return all the
items.
Since: 2.10
GList *
gtk_recent_manager_get_items (GtkRecentManager *manager
);
Gets the list of recently used resources.
a list of
newly allocated GtkRecentInfo objects. Use
gtk_recent_info_unref()
on each item inside the list, and then
free the list itself using g_list_free()
.
[element-type GtkRecentInfo][transfer full]
Since: 2.10
gint gtk_recent_manager_purge_items (GtkRecentManager *manager
,GError **error
);
Purges every item from the recently used resources list.
Since: 2.10
GtkRecentInfo *
gtk_recent_info_ref (GtkRecentInfo *info
);
Increases the reference count of recent_info
by one.
Since: 2.10
void
gtk_recent_info_unref (GtkRecentInfo *info
);
Decreases the reference count of info
by one. If the reference
count reaches zero, info
is deallocated, and the memory freed.
Since: 2.10
const gchar *
gtk_recent_info_get_uri (GtkRecentInfo *info
);
Gets the URI of the resource.
the URI of the resource. The returned string is owned by the recent manager, and should not be freed.
Since: 2.10
const gchar *
gtk_recent_info_get_display_name (GtkRecentInfo *info
);
Gets the name of the resource. If none has been defined, the basename of the resource is obtained.
the display name of the resource. The returned string is owned by the recent manager, and should not be freed.
Since: 2.10
const gchar *
gtk_recent_info_get_description (GtkRecentInfo *info
);
Gets the (short) description of the resource.
the description of the resource. The returned string is owned by the recent manager, and should not be freed.
Since: 2.10
const gchar *
gtk_recent_info_get_mime_type (GtkRecentInfo *info
);
Gets the MIME type of the resource.
the MIME type of the resource. The returned string is owned by the recent manager, and should not be freed.
Since: 2.10
time_t
gtk_recent_info_get_added (GtkRecentInfo *info
);
Gets the timestamp (seconds from system's Epoch) when the resource was added to the recently used resources list.
the number of seconds elapsed from system's Epoch when the resource was added to the list, or -1 on failure.
Since: 2.10
time_t
gtk_recent_info_get_modified (GtkRecentInfo *info
);
Gets the timestamp (seconds from system's Epoch) when the resource was last modified.
the number of seconds elapsed from system's Epoch when the resource was last modified, or -1 on failure.
Since: 2.10
time_t
gtk_recent_info_get_visited (GtkRecentInfo *info
);
Gets the timestamp (seconds from system's Epoch) when the resource was last visited.
the number of seconds elapsed from system's Epoch when the resource was last visited, or -1 on failure.
Since: 2.10
gboolean
gtk_recent_info_get_private_hint (GtkRecentInfo *info
);
Gets the value of the "private" flag. Resources in the recently used
list that have this flag set to TRUE
should only be displayed by the
applications that have registered them.
Since: 2.10
gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info
,const gchar *app_name
,const gchar **app_exec
,guint *count
,time_t *time_
);
Gets the data regarding the application that has registered the resource
pointed by info
.
If the command line contains any escape characters defined inside the storage specification, they will be expanded.
info |
||
app_name |
the name of the application that has registered this item |
|
app_exec |
return location for the string containing the command line. |
[transfer none][out] |
count |
return location for the number of times this item was registered. |
[out] |
time_ |
return location for the timestamp this item was last registered for this application. |
[out] |
TRUE
if an application with app_name
has registered this
resource inside the recently used list, or FALSE
otherwise. The
app_exec
string is owned by the GtkRecentInfo and should not be
modified or freed
Since: 2.10
gchar ** gtk_recent_info_get_applications (GtkRecentInfo *info
,gsize *length
);
Retrieves the list of applications that have registered this resource.
a newly allocated NULL
-terminated array of strings.
Use g_strfreev()
to free it.
[array length=length zero-terminated=1][transfer full]
Since: 2.10
gchar *
gtk_recent_info_last_application (GtkRecentInfo *info
);
Gets the name of the last application that have registered the
recently used resource represented by info
.
Since: 2.10
gchar ** gtk_recent_info_get_groups (GtkRecentInfo *info
,gsize *length
);
Returns all groups registered for the recently used item info
. The
array of returned group names will be NULL
terminated, so length might
optionally be NULL
.
a newly allocated NULL
terminated array of strings.
Use g_strfreev()
to free it.
[array length=length zero-terminated=1][transfer full]
Since: 2.10
gboolean gtk_recent_info_has_group (GtkRecentInfo *info
,const gchar *group_name
);
Checks whether group_name
appears inside the groups registered for the
recently used item info
.
Since: 2.10
gboolean gtk_recent_info_has_application (GtkRecentInfo *info
,const gchar *app_name
);
Checks whether an application registered this resource using app_name
.
Since: 2.10
GdkPixbuf * gtk_recent_info_get_icon (GtkRecentInfo *info
,gint size
);
Retrieves the icon of size size
associated to the resource MIME type.
a GdkPixbuf containing the icon,
or NULL
. Use g_object_unref()
when finished using the icon.
[transfer full]
Since: 2.10
gchar *
gtk_recent_info_get_short_name (GtkRecentInfo *info
);
Computes a valid UTF-8 string that can be used as the name of the item in a menu or list. For example, calling this function on an item that refers to "file:///foo/bar.txt" will yield "bar.txt".
Since: 2.10
gchar *
gtk_recent_info_get_uri_display (GtkRecentInfo *info
);
Gets a displayable version of the resource's URI. If the resource
is local, it returns a local path; if the resource is not local,
it returns the UTF-8 encoded content of gtk_recent_info_get_uri()
.
a newly allocated UTF-8 string containing the
resource's URI or NULL
. Use g_free()
when done using it.
Since: 2.10
gint
gtk_recent_info_get_age (GtkRecentInfo *info
);
Gets the number of days elapsed since the last update of the resource
pointed by info
.
a positive integer containing the number of days elapsed since the time this resource was last modified.
Since: 2.10
gboolean
gtk_recent_info_is_local (GtkRecentInfo *info
);
Checks whether the resource is local or not by looking at the scheme of its URI.
Since: 2.10
gboolean
gtk_recent_info_exists (GtkRecentInfo *info
);
Checks whether the resource pointed by info
still exists. At
the moment this check is done only on resources pointing to local files.
Since: 2.10
gboolean gtk_recent_info_match (GtkRecentInfo *info_a
,GtkRecentInfo *info_b
);
Checks whether two GtkRecentInfo structures point to the same resource.
Since: 2.10
struct GtkRecentData { gchar *display_name; gchar *description; gchar *mime_type; gchar *app_name; gchar *app_exec; gchar **groups; gboolean is_private; };
Meta-data to be passed to gtk_recent_manager_add_full()
when
registering a recently used resource.
a UTF-8 encoded string, containing the name of the recently
used resource to be displayed, or |
||
a UTF-8 encoded string, containing a short description of
the resource, or |
||
the MIME type of the resource; |
||
the name of the application that is registering this recently used resource; |
||
command line used to launch this resource; may contain the "%f" and "%u" escape characters which will be expanded to the resource file path and URI respectively when the command line is retrieved; |
||
a vector of strings containing groups names; |
||
whether this resource should be displayed only by the applications that have registered it or not. |
Error codes for GtkRecentManager operations
the URI specified does not exists in the recently used resources list. |
||
the URI specified is not valid. |
||
the supplied string is not UTF-8 encoded. |
||
no application has registered the specified item. |
||
failure while reading the recently used resources file. |
||
failure while writing the recently used resources file. |
||
unspecified error. |
“filename”
property “filename” char *
The full path to the file to be used to store and read the recently used resources list
Owner: GtkRecentManager
Flags: Read / Write / Construct Only
Default value: NULL
Since: 2.10
“limit”
property “limit” int
The maximum number of items to be returned by the
gtk_recent_manager_get_items()
function.
GtkRecentManager:limit
has been deprecated since version 2.22 and should not be used in newly-written code.
Setting this property does not have any effect. The length of the list should be managed by the view (implementing GtkRecentChooser), and not by the model (the GtkRecentManager). See “limit”.
Owner: GtkRecentManager
Flags: Read / Write
Allowed values: >= -1
Default value: -1
Since: 2.10
“size”
property “size” int
The size of the recently used resources list.
Owner: GtkRecentManager
Flags: Read
Allowed values: >= -1
Default value: 0
Since: 2.10
“changed”
signalvoid user_function (GtkRecentManager *recent_manager, gpointer user_data)
Emitted when the current recently used resources manager changes its contents.
recent_manager |
the recent manager |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
Since: 2.10