Skip to content
Commits on Source (7)
News in 5.6.0, 2022-11-02
-------------------------
* No changes.
News in 5.5.2, 2022-10-24
-------------------------
* Add a function in AmtkApplicationWindow.
* Build: fix a warning.
News in 5.5.1, 2022-06-10
-------------------------
* The project is now hosted here: https://gitlab.gnome.org/World/amtk
......
......@@ -521,6 +521,40 @@ amtk_application_window_connect_recent_chooser_menu_to_statusbar (AmtkApplicatio
amtk_application_window_connect_menu_to_statusbar (amtk_window, GTK_MENU_SHELL (menu));
}
/**
* amtk_application_window_create_open_recent_menu_base:
*
* Creates the base of a simple and generic #GtkRecentChooserMenu.
*
* The #GtkRecentChooser is configured to show files only recently used with the
* current application, as returned by g_get_application_name(). If recent files
* are added to the default #GtkRecentManager with
* gtk_recent_manager_add_item(), the files will normally show up in the
* #GtkRecentChooserMenu.
*
* Returns: (transfer floating): a new #GtkRecentChooserMenu.
* Since: 5.6
*/
GtkRecentChooserMenu *
amtk_application_window_create_open_recent_menu_base (void)
{
GtkRecentChooserMenu *recent_chooser_menu;
GtkRecentChooser *recent_chooser;
GtkRecentFilter *filter;
recent_chooser_menu = GTK_RECENT_CHOOSER_MENU (gtk_recent_chooser_menu_new ());
recent_chooser = GTK_RECENT_CHOOSER (recent_chooser_menu);
gtk_recent_chooser_set_local_only (recent_chooser, FALSE);
gtk_recent_chooser_set_sort_type (recent_chooser, GTK_RECENT_SORT_MRU);
filter = gtk_recent_filter_new ();
gtk_recent_filter_add_application (filter, g_get_application_name ());
gtk_recent_chooser_set_filter (recent_chooser, filter);
return recent_chooser_menu;
}
static void
open_recent_file_cb (GtkRecentChooser *recent_chooser,
gpointer user_data)
......@@ -544,20 +578,16 @@ open_recent_file_cb (GtkRecentChooser *recent_chooser,
* amtk_application_window_create_open_recent_menu:
* @amtk_window: an #AmtkApplicationWindow.
*
* Creates a simple and generic #GtkRecentChooserMenu.
*
* The #GtkRecentChooser is configured to show files only recently used with the
* current application, as returned by g_get_application_name(). If recent files
* are added to the default #GtkRecentManager with
* gtk_recent_manager_add_item(), the files will normally show up in the
* #GtkRecentChooserMenu.
* This function creates a #GtkRecentChooserMenu with
* amtk_application_window_create_open_recent_menu_base(), and setup these
* additional things:
*
* The #GtkRecentChooserMenu is connected to the statusbar with
* amtk_application_window_connect_recent_chooser_menu_to_statusbar().
* - The #GtkRecentChooserMenu is connected to the statusbar with
* amtk_application_window_connect_recent_chooser_menu_to_statusbar().
*
* When the #GtkRecentChooser::item-activated signal is emitted,
* g_application_open() is called (with an empty hint), so the #GApplication
* must have the %G_APPLICATION_HANDLES_OPEN flag set.
* - When the #GtkRecentChooser::item-activated signal is emitted,
* g_application_open() is called (with an empty hint), so the #GApplication
* must have the %G_APPLICATION_HANDLES_OPEN flag set.
*
* Returns: (transfer floating): a new #GtkRecentChooserMenu.
* Since: 3.0
......@@ -566,24 +596,14 @@ GtkWidget *
amtk_application_window_create_open_recent_menu (AmtkApplicationWindow *amtk_window)
{
GtkRecentChooserMenu *recent_chooser_menu;
GtkRecentChooser *recent_chooser;
GtkRecentFilter *filter;
g_return_val_if_fail (AMTK_IS_APPLICATION_WINDOW (amtk_window), NULL);
recent_chooser_menu = GTK_RECENT_CHOOSER_MENU (gtk_recent_chooser_menu_new ());
recent_chooser = GTK_RECENT_CHOOSER (recent_chooser_menu);
gtk_recent_chooser_set_local_only (recent_chooser, FALSE);
gtk_recent_chooser_set_sort_type (recent_chooser, GTK_RECENT_SORT_MRU);
filter = gtk_recent_filter_new ();
gtk_recent_filter_add_application (filter, g_get_application_name ());
gtk_recent_chooser_set_filter (recent_chooser, filter);
recent_chooser_menu = amtk_application_window_create_open_recent_menu_base ();
amtk_application_window_connect_recent_chooser_menu_to_statusbar (amtk_window, recent_chooser_menu);
g_signal_connect_object (recent_chooser,
g_signal_connect_object (recent_chooser_menu,
"item-activated",
G_CALLBACK (open_recent_file_cb),
amtk_window,
......
......@@ -63,6 +63,9 @@ void amtk_application_window_connect_recent_chooser_menu_to_statusbar
(AmtkApplicationWindow *amtk_window,
GtkRecentChooserMenu *menu);
G_MODULE_EXPORT
GtkRecentChooserMenu * amtk_application_window_create_open_recent_menu_base (void);
G_MODULE_EXPORT
GtkWidget * amtk_application_window_create_open_recent_menu (AmtkApplicationWindow *amtk_window);
......
......@@ -73,7 +73,7 @@ amtk_lib = library(
link_args: amtk_lib_link_args,
link_depends: symbol_map,
# link_whole is not supported with MSVC, so we use extract_all_objects().
objects: amtk_static_lib.extract_all_objects(),
objects: amtk_static_lib.extract_all_objects(recursive: false),
version: AMTK_LT_VERSION,
install: true
)
......
......@@ -18,6 +18,7 @@ amtk_application_window_get_statusbar
amtk_application_window_set_statusbar
amtk_application_window_connect_menu_to_statusbar
amtk_application_window_connect_recent_chooser_menu_to_statusbar
amtk_application_window_create_open_recent_menu_base
amtk_application_window_create_open_recent_menu
amtk_application_window_create_open_recent_menu_item
<SUBSECTION Standard>
......
......@@ -6,7 +6,7 @@
project(
'amtk', 'c',
meson_version: '>= 0.53',
version: '5.5.1',
version: '5.6.0',
default_options: ['warning_level=2']
)
......@@ -33,9 +33,9 @@ I18N = import('i18n')
#
# When incrementing the API version (usually for a new major package version),
# set CURRENT, REVISION and AGE to 0 since it's like a new library.
lt_current = 0
lt_revision = 1
lt_age = 0
lt_current = 1
lt_revision = 0
lt_age = 1
AMTK_LT_VERSION = '@0@.@1@.@2@'.format(lt_current, lt_revision, lt_age)
# API version, used for parallel installability.
......