[gthumb] shortcut categories: specify the numeber of categories when registering
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] shortcut categories: specify the numeber of categories when registering
- Date: Sun, 24 Nov 2019 12:31:42 +0000 (UTC)
commit daed48a46c1b3fa99f00b4c1cc2ea0f534aa3a94
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Nov 13 17:09:00 2019 +0100
shortcut categories: specify the numeber of categories when registering
gthumb/gth-main-default-types.c | 2 +-
gthumb/gth-main.c | 6 +++---
gthumb/gth-main.h | 3 ++-
3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gthumb/gth-main-default-types.c b/gthumb/gth-main-default-types.c
index a51122e4..68ecdad5 100644
--- a/gthumb/gth-main-default-types.c
+++ b/gthumb/gth-main-default-types.c
@@ -80,7 +80,7 @@ gth_main_register_default_types (void)
gth_main_register_type ("file-properties", GTH_TYPE_FILE_COMMENT);
gth_main_register_type ("file-properties", GTH_TYPE_FILE_DETAILS);
gth_main_register_default_file_loader ();
- gth_main_register_shortcut_category (shortcut_categories);
+ gth_main_register_shortcut_category (shortcut_categories, G_N_ELEMENTS (shortcut_categories));
gth_hook_add_callback ("dlg-preferences-construct", 1, G_CALLBACK
(general__dlg_preferences_construct_cb), NULL);
gth_hook_add_callback ("dlg-preferences-apply", 1, G_CALLBACK (general__dlg_preferences_apply), NULL);
gth_hook_add_callback ("dlg-preferences-construct", 2, G_CALLBACK
(browser__dlg_preferences_construct_cb), NULL);
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 29f4c707..ecf104cb 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -650,13 +650,13 @@ gth_main_get_shortcut_category (const char *id)
void
-gth_main_register_shortcut_category (GthShortcutCategory *shortcut_category)
+gth_main_register_shortcut_category (GthShortcutCategory *shortcut_category,
+ int n_categories)
{
int i;
g_mutex_lock (®ister_mutex);
-
- for (i = 0; shortcut_category[i].id != NULL; i++) {
+ for (i = 0; i < n_categories; i++) {
if (gth_main_get_shortcut_category (shortcut_category[i].id) == NULL) {
g_ptr_array_add (Main->priv->shortcut_category_v, &shortcut_category[i]);
g_hash_table_insert (Main->priv->shortcut_category_h, shortcut_category[i].id,
&shortcut_category[i]);
diff --git a/gthumb/gth-main.h b/gthumb/gth-main.h
index 91bd7e7d..5475502c 100644
--- a/gthumb/gth-main.h
+++ b/gthumb/gth-main.h
@@ -86,7 +86,8 @@ GthMetadataProvider * gth_main_get_metadata_writer (const char
GthMetadataCategory * gth_main_get_metadata_category (const char *id);
GthMetadataInfo * gth_main_get_metadata_info (const char *id);
GList * gth_main_get_all_metadata_info (void);
-void gth_main_register_shortcut_category (GthShortcutCategory *shortcut_category);
+void gth_main_register_shortcut_category (GthShortcutCategory *shortcut_category,
+ int n_categories);
GthShortcutCategory * gth_main_get_shortcut_category (const char *id);
void gth_main_register_sort_type (GthFileDataSort *sort_type);
GthFileDataSort * gth_main_get_sort_type (const char *name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]