Commit daed48a4 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

shortcut categories: specify the numeber of categories when registering

parent 251a27ce
...@@ -80,7 +80,7 @@ gth_main_register_default_types (void) ...@@ -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_COMMENT);
gth_main_register_type ("file-properties", GTH_TYPE_FILE_DETAILS); gth_main_register_type ("file-properties", GTH_TYPE_FILE_DETAILS);
gth_main_register_default_file_loader (); 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-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-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); gth_hook_add_callback ("dlg-preferences-construct", 2, G_CALLBACK (browser__dlg_preferences_construct_cb), NULL);
......
...@@ -650,13 +650,13 @@ gth_main_get_shortcut_category (const char *id) ...@@ -650,13 +650,13 @@ gth_main_get_shortcut_category (const char *id)
void void
gth_main_register_shortcut_category (GthShortcutCategory *shortcut_category) gth_main_register_shortcut_category (GthShortcutCategory *shortcut_category,
int n_categories)
{ {
int i; int i;
g_mutex_lock (&register_mutex); g_mutex_lock (&register_mutex);
for (i = 0; i < n_categories; i++) {
for (i = 0; shortcut_category[i].id != NULL; i++) {
if (gth_main_get_shortcut_category (shortcut_category[i].id) == NULL) { if (gth_main_get_shortcut_category (shortcut_category[i].id) == NULL) {
g_ptr_array_add (Main->priv->shortcut_category_v, &shortcut_category[i]); 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]); g_hash_table_insert (Main->priv->shortcut_category_h, shortcut_category[i].id, &shortcut_category[i]);
......
...@@ -86,7 +86,8 @@ GthMetadataProvider * gth_main_get_metadata_writer (const char ...@@ -86,7 +86,8 @@ GthMetadataProvider * gth_main_get_metadata_writer (const char
GthMetadataCategory * gth_main_get_metadata_category (const char *id); GthMetadataCategory * gth_main_get_metadata_category (const char *id);
GthMetadataInfo * gth_main_get_metadata_info (const char *id); GthMetadataInfo * gth_main_get_metadata_info (const char *id);
GList * gth_main_get_all_metadata_info (void); 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); GthShortcutCategory * gth_main_get_shortcut_category (const char *id);
void gth_main_register_sort_type (GthFileDataSort *sort_type); void gth_main_register_sort_type (GthFileDataSort *sort_type);
GthFileDataSort * gth_main_get_sort_type (const char *name); GthFileDataSort * gth_main_get_sort_type (const char *name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment