Verified Commit a6b1cf42 authored by Chigozirim Chukwu's avatar Chigozirim Chukwu
Browse files

attach callbacks to signals

parent 1102df73
Pipeline #8789 passed with stages
in 5 minutes and 51 seconds
......@@ -169,6 +169,15 @@ thunar_abstract_icon_view_init (ThunarAbstractIconView *abstract_icon_view)
g_signal_connect (G_OBJECT (view), "key-press-event", G_CALLBACK (thunar_abstract_icon_view_key_press_event), abstract_icon_view);
g_signal_connect (G_OBJECT (view), "item-activated", G_CALLBACK (thunar_abstract_icon_view_item_activated), abstract_icon_view);
g_signal_connect_swapped (G_OBJECT (view), "selection-changed", G_CALLBACK (thunar_standard_view_selection_changed), abstract_icon_view);
/* TODO: #32 Register icon-view callbacks here */
g_signal_connect_swapped(G_OBJECT (view), "search-in-progress",
G_CALLBACK (thunar_standard_view_search_status_changed),
THUNAR_STANDARD_VIEW (abstract_icon_view));
g_signal_connect_swapped(G_OBJECT (view), "search-concluded",
G_CALLBACK (thunar_standard_view_search_status_changed),
THUNAR_STANDARD_VIEW (abstract_icon_view));
gtk_container_add (GTK_CONTAINER (abstract_icon_view), view);
gtk_widget_show (view);
......
......@@ -231,6 +231,16 @@ thunar_details_view_init (ThunarDetailsView *details_view)
G_CALLBACK (thunar_details_view_row_activated), details_view);
g_signal_connect (G_OBJECT (tree_view), "select-cursor-row",
G_CALLBACK (thunar_details_view_select_cursor_row), details_view);
g_debug("Connecting the search progress callbacks");
/* TODO: #32 Register tree-view callbacks here */
g_signal_connect_swapped (G_OBJECT (tree_view), "search-in-progress",
G_CALLBACK (thunar_standard_view_search_status_changed),
THUNAR_STANDARD_VIEW (details_view));
g_signal_connect_swapped (G_OBJECT (tree_view), "search-concluded",
G_CALLBACK (thunar_standard_view_search_status_changed),
THUNAR_STANDARD_VIEW (details_view));
gtk_container_add (GTK_CONTAINER (details_view), tree_view);
gtk_widget_show (tree_view);
......
......@@ -350,6 +350,9 @@ struct _ThunarStandardViewPrivate
/* current sort_order (GTK_SORT_ASCENDING || GTK_SORT_DESCENDING) */
GtkSortType sort_order;
/* This is an indicator that tells us when search is going on in thunar */
gboolean search_in_progress;
};
static XfceGtkActionEntry thunar_standard_view_action_entries[] =
......@@ -675,6 +678,9 @@ thunar_standard_view_init (ThunarStandardView *standard_view)
standard_view->priv->history = g_object_new (THUNAR_TYPE_HISTORY, NULL);
g_signal_connect_swapped (G_OBJECT (standard_view->priv->history), "change-directory", G_CALLBACK (thunar_navigator_change_directory), standard_view);
/* Assume no search is going on during initialization */
standard_view->priv->search_in_progress = FALSE;
/* setup the list model */
standard_view->model = thunar_list_model_new ();
g_signal_connect_after (G_OBJECT (standard_view->model), "row-deleted", G_CALLBACK (thunar_standard_view_select_after_row_deleted), standard_view);
......@@ -1440,7 +1446,7 @@ thunar_standard_view_set_loading (ThunarStandardView *standard_view,
GFile *first_file;
ThunarFile *current_directory;
loading = !!loading;
loading = loading != 0;
/* check if we're already in that state */
if (G_UNLIKELY (standard_view->loading == loading))
......@@ -3904,6 +3910,25 @@ thunar_standard_view_append_menu_item (ThunarStandardView *standard_view,
}
/* TODO: #32 Create callback here */
/**
* thunar_standard_view_search_status_changed
* @param standard_view : a #ThunarStandardView
* @param searching The search status: in-progress or concluded
*/
void
thunar_standard_view_search_status_changed (ThunarStandardView *standard_view,
gboolean searching)
{
standard_view->priv->search_in_progress = searching;
if (searching) {
g_debug("Search is in progress");
} else {
g_debug("Search has stopped");
}
}
/**
* thunar_standard_view_connect_accelerators:
......
......@@ -56,7 +56,7 @@ typedef enum
THUNAR_STANDARD_VIEW_ACTION_SORT_ASCENDING,
THUNAR_STANDARD_VIEW_ACTION_SORT_DESCENDING,
THUNAR_STANDARD_VIEW_ACTION_SORT_ORDER_TOGGLE,
} ThunarStandardViewAction;
struct _ThunarStandardViewClass
......@@ -174,6 +174,8 @@ void thunar_standard_view_append_menu_items (ThunarStandardView
GtkWidget *thunar_standard_view_append_menu_item (ThunarStandardView *standard_view,
GtkMenu *menu,
ThunarStandardViewAction action);
void thunar_standard_view_search_status_changed (ThunarStandardView *standard_view,
gboolean searching);
void _thunar_standard_view_open_on_middle_click (ThunarStandardView *standard_view,
GtkTreePath *tree_path,
guint event_state);
......
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