Commit 57c1bb9e authored by Paolo Bacchilega's avatar Paolo Bacchilega

use the new gth-browser-selection-changed hook

Used when the command sensibility depends only on the number
of selected files.
parent 67372eae
......@@ -196,16 +196,14 @@ catalogs__gth_browser_construct_cb (GthBrowser *browser)
void
catalogs__gth_browser_update_sensitivity_cb (GthBrowser *browser)
catalogs__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
BrowserData *data;
int n_selected;
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
g_return_if_fail (data != NULL);
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
gth_window_enable_action (GTH_WINDOW (browser), "add-to-catalog", n_selected > 0);
gth_window_enable_action (GTH_WINDOW (browser), "remove-from-catalog", (n_selected > 0) && GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source (browser)));
gth_window_enable_action (GTH_WINDOW (browser), "go-to-container-from-catalog", n_selected == 1);
......
......@@ -27,7 +27,8 @@
void catalogs__initialize_cb (void);
void catalogs__gth_browser_construct_cb (GthBrowser *browser);
void catalogs__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void catalogs__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
void catalogs__gth_browser_folder_tree_popup_before_cb (GthBrowser *browser,
GthFileSource *file_source,
GthFileData *folder);
......
......@@ -113,7 +113,7 @@ gthumb_extension_activate (void)
gth_main_register_file_source (GTH_TYPE_FILE_SOURCE_CATALOGS);
gth_hook_add_callback ("initialize", 10, G_CALLBACK (catalogs__initialize_cb), NULL);
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (catalogs__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (catalogs__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (catalogs__gth_browser_selection_changed_cb), NULL);
gth_hook_add_callback ("gth-browser-folder-tree-popup-before", 10, G_CALLBACK (catalogs__gth_browser_folder_tree_popup_before_cb), NULL);
gth_hook_add_callback ("gth-browser-load-location-after", 10, G_CALLBACK (catalogs__gth_browser_load_location_after_cb), NULL);
gth_hook_add_callback ("gth-browser-update-extra-widget", 10, G_CALLBACK (catalogs__gth_browser_update_extra_widget_cb), NULL);
......
......@@ -55,12 +55,8 @@ cd__gth_browser_construct_cb (GthBrowser *browser)
void
cd__gth_browser_update_sensitivity_cb (GthBrowser *browser)
cd__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
gboolean sensitive;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
sensitive = n_selected > 0;
gth_window_enable_action (GTH_WINDOW (browser), "change-date", sensitive);
gth_window_enable_action (GTH_WINDOW (browser), "change-date", n_selected > 0);
}
......@@ -25,6 +25,7 @@
#include <gthumb.h>
void cd__gth_browser_construct_cb (GthBrowser *browser);
void cd__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void cd__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
#endif /* CALLBACKS_H */
......@@ -30,7 +30,7 @@ G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
gth_hook_add_callback ("gth-browser-construct", 50, G_CALLBACK (cd__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (cd__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (cd__gth_browser_selection_changed_cb), NULL);
}
......
......@@ -55,12 +55,8 @@ cf__gth_browser_construct_cb (GthBrowser *browser)
void
cf__gth_browser_update_sensitivity_cb (GthBrowser *browser)
cf__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
gboolean sensitive;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
sensitive = n_selected > 0;
gth_window_enable_action (GTH_WINDOW (browser), "convert-format", sensitive);
gth_window_enable_action (GTH_WINDOW (browser), "convert-format", n_selected > 0);
}
......@@ -25,6 +25,7 @@
#include <gthumb.h>
void cf__gth_browser_construct_cb (GthBrowser *browser);
void cf__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void cf__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
#endif /* CALLBACKS_H */
......@@ -30,7 +30,7 @@ G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
gth_hook_add_callback ("gth-browser-construct", 35, G_CALLBACK (cf__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (cf__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (cf__gth_browser_selection_changed_cb), NULL);
}
......
......@@ -58,10 +58,8 @@ db__gth_browser_construct_cb (GthBrowser *browser)
void
db__gth_browser_update_sensitivity_cb (GthBrowser *browser)
db__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "set-desktop-background"), "enabled", n_selected == 1, NULL);
}
......@@ -25,6 +25,7 @@
#include <gthumb.h>
void db__gth_browser_construct_cb (GthBrowser *browser);
void db__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void db__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
#endif /* CALLBACKS_H */
......@@ -30,7 +30,7 @@ G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
gth_hook_add_callback ("gth-browser-construct", 20, G_CALLBACK (db__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (db__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (db__gth_browser_selection_changed_cb), NULL);
}
......
......@@ -98,14 +98,12 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
void
edit_metadata__gth_browser_update_sensitivity_cb (GthBrowser *browser)
edit_metadata__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
gboolean sensitive;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
sensitive = (n_selected > 0);
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "edit-metadata"), "enabled", sensitive, NULL);
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "edit-tags"), "enabled", sensitive, NULL);
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "delete-metadata"), "enabled", sensitive, NULL);
......
......@@ -25,6 +25,7 @@
#include <gthumb.h>
void edit_metadata__gth_browser_construct_cb (GthBrowser *browser);
void edit_metadata__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void edit_metadata__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
#endif /* CALLBACKS_H */
......@@ -41,7 +41,7 @@ gthumb_extension_activate (void)
gth_main_register_type ("edit-comment-dialog-page", GTH_TYPE_EDIT_GENERAL_PAGE);
gth_hook_add_callback ("gth-browser-construct", 7, G_CALLBACK (edit_metadata__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (edit_metadata__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (edit_metadata__gth_browser_selection_changed_cb), NULL);
}
......
......@@ -67,10 +67,8 @@ ip__gth_browser_construct_cb (GthBrowser *browser)
void
ip__gth_browser_update_sensitivity_cb (GthBrowser *browser)
ip__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "print"), "enabled", n_selected > 0, NULL);
}
......@@ -25,6 +25,7 @@
#include <gthumb.h>
void ip__gth_browser_construct_cb (GthBrowser *browser);
void ip__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void ip__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
#endif /* CALLBACKS_H */
......@@ -31,7 +31,7 @@ G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
gth_hook_add_callback ("gth-browser-construct", 9, G_CALLBACK (ip__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (ip__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (ip__gth_browser_selection_changed_cb), NULL);
gth_hook_add_callback ("dlg-preferences-construct", 40, G_CALLBACK (ip__dlg_preferences_construct_cb), NULL);
gth_hook_add_callback ("dlg-preferences-apply", 10, G_CALLBACK (ip__dlg_preferences_apply_cb), NULL);
}
......
......@@ -105,12 +105,11 @@ ir__gth_browser_construct_cb (GthBrowser *browser)
void
ir__gth_browser_update_sensitivity_cb (GthBrowser *browser)
ir__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
gboolean sensitive;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
sensitive = n_selected > 0;
gth_window_enable_action (GTH_WINDOW (browser), "rotate-right", sensitive);
gth_window_enable_action (GTH_WINDOW (browser), "rotate-left", sensitive);
......
......@@ -25,7 +25,8 @@
#include <gthumb.h>
void ir__gth_browser_construct_cb (GthBrowser *browser);
void ir__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void ir__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
void ir__gth_browser_activate_viewer_page_cb (GthBrowser *browser);
void ir__gth_browser_deactivate_viewer_page_cb (GthBrowser *browser);
......
......@@ -38,7 +38,7 @@ gthumb_extension_activate (void)
gth_hook_register ("jpegtran-after", 1);
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (ir__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (ir__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (ir__gth_browser_selection_changed_cb), NULL);
gth_hook_add_callback ("gth-browser-activate-viewer-page", 10, G_CALLBACK (ir__gth_browser_activate_viewer_page_cb), NULL);
gth_hook_add_callback ("gth-browser-deactivate-viewer-page", 10, G_CALLBACK (ir__gth_browser_deactivate_viewer_page_cb), NULL);
}
......
......@@ -55,12 +55,8 @@ ri__gth_browser_construct_cb (GthBrowser *browser)
void
ri__gth_browser_update_sensitivity_cb (GthBrowser *browser)
ri__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
int n_selected;
gboolean sensitive;
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
sensitive = n_selected > 0;
gth_window_enable_action (GTH_WINDOW (browser), "resize-images", sensitive);
gth_window_enable_action (GTH_WINDOW (browser), "resize-images", n_selected > 0);
}
......@@ -25,6 +25,7 @@
#include <gthumb.h>
void ri__gth_browser_construct_cb (GthBrowser *browser);
void ri__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void ri__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
#endif /* CALLBACKS_H */
......@@ -30,7 +30,7 @@ G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
gth_hook_add_callback ("gth-browser-construct", 40, G_CALLBACK (ri__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (ri__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (ri__gth_browser_selection_changed_cb), NULL);
}
......
......@@ -220,10 +220,10 @@ selections__gth_browser_construct_cb (GthBrowser *browser)
void
selections__gth_browser_update_sensitivity_cb (GthBrowser *browser)
selections__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected)
{
BrowserData *data;
int n_selected;
if (! GTH_IS_FILE_SOURCE_SELECTIONS (gth_browser_get_location_source (browser)))
return;
......@@ -231,7 +231,6 @@ selections__gth_browser_update_sensitivity_cb (GthBrowser *browser)
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
g_return_if_fail (data != NULL);
n_selected = gth_file_selection_get_n_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
gth_window_enable_action (GTH_WINDOW (browser), "go-to-container-from-selection", n_selected == 1);
}
......
......@@ -25,7 +25,8 @@
#include <gthumb.h>
void selections__gth_browser_construct_cb (GthBrowser *browser);
void selections__gth_browser_update_sensitivity_cb (GthBrowser *browser);
void selections__gth_browser_selection_changed_cb (GthBrowser *browser,
int n_selected);
gpointer selections__gth_browser_file_list_key_press_cb (GthBrowser *browser,
GdkEventKey *event);
void selections__gth_browser_load_location_after_cb (GthBrowser *browser,
......
......@@ -41,7 +41,7 @@ gthumb_extension_activate (void)
gth_main_register_metadata_provider (GTH_TYPE_METADATA_PROVIDER_SELECTIONS);
gth_main_register_shortcut_category (shortcut_categories, G_N_ELEMENTS (shortcut_categories));
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (selections__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (selections__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-selection-changed", 10, G_CALLBACK (selections__gth_browser_selection_changed_cb), NULL);
gth_hook_add_callback ("gth-browser-file-list-key-press", 10, G_CALLBACK (selections__gth_browser_file_list_key_press_cb), NULL);
gth_hook_add_callback ("gth-browser-load-location-after", 10, G_CALLBACK (selections__gth_browser_load_location_after_cb), NULL);
gth_hook_add_callback ("gth-browser-update-extra-widget", 20, G_CALLBACK (selections__gth_browser_update_extra_widget_cb), NULL);
......
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