I do not think gtk_recent_manager_add_item() can handle an AUDIO (such as
.mp3) files automatically.
You may need to use gtk_recent_manager_add_full() and fill the GtkRecentData
structure with values.
Here are 2 tests; test a and b.
// Test a) Does this work?
// Put a valid audio1.mp3 file in the current directory.
const gchar *file_uri = "audio1.mp3";
GtkRecentManager *manager = gtk_recent_manager_get_default();
gboolean ret = gtk_recent_manager_add_item(manager, file_uri);
if (!ret) {
g_print("Error, cannot add to recent files: %s\n", file_uri);
}
// Check the $HOME/.local/share/recently-used.xbel file.
$ cat $HOME/.local/share/recently-used.xbel
-------------------------------
// Test b) Is this better?
GtkRecentData *recent_data;
recent_data = g_slice_new0 (GtkRecentData);
recent_data->mime_type = "video/mpeg";
recent_data->app_name = "Audio recorder";
recent_data->is_private = FALSE;
recent_data->app_exec = "xxxxxx %u"; // This could be totem or rhythmbox
gboolean ret = gtk_recent_manager_add_full (manager, file_uri,
recent_data);
g_slice_free (GtkRecentData, recent_data);
if (!ret) {
g_print("Error, cannot add to recent files: %s\n", file_uri);
}
-----------------------------------
Notice.
You may need to clear the $HOME/.local/share/recently-used.xbel file
between tests. Truncate it with.
$ echo "" > $HOME/.local/share/recently-used.xbel
I can add & bake your code to audio-recorder when it is tested.
Muito bem Robert,
Até logo,
Osmo (Moma) Antero
Portugal
Re-hi,
I do not think gtk_recent_ manager_ add_item( ) can handle an AUDIO (such as manager_ add_full( ) and fill the GtkRecentData
.mp3) files automatically.
You may need to use gtk_recent_
structure with values.
Here are 2 tests; test a and b.
// Test a) Does this work?
// Put a valid audio1.mp3 file in the current directory. manager_ get_default( ); manager_ add_item( manager, file_uri);
const gchar *file_uri = "audio1.mp3";
GtkRecentManager *manager = gtk_recent_
gboolean ret = gtk_recent_
if (!ret) {
g_print("Error, cannot add to recent files: %s\n", file_uri);
}
// Check the $HOME/. local/share/ recently- used.xbel file. local/share/ recently- used.xbel ------- ------- ------- ---
$ cat $HOME/.
-------
// Test b) Is this better?
GtkRecentData *recent_data; data->mime_ type = "video/mpeg"; data->app_ name = "Audio recorder"; data->is_ private = FALSE; data->app_ exec = "xxxxxx %u"; // This could be totem or rhythmbox manager_ add_full (manager, file_uri,
recent_data = g_slice_new0 (GtkRecentData);
recent_
recent_
recent_
recent_
gboolean ret = gtk_recent_
recent_data);
g_slice_free (GtkRecentData, recent_data);
if (!ret) { ------- ------- ------- -------
g_print("Error, cannot add to recent files: %s\n", file_uri);
}
-------
Notice. local/share/ recently- used.xbel file local/share/ recently- used.xbel
You may need to clear the $HOME/.
between tests. Truncate it with.
$ echo "" > $HOME/.
I can add & bake your code to audio-recorder when it is tested.
Muito bem Robert,
Até logo,
Osmo (Moma) Antero
Portugal