mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-05-11 00:10:04 +00:00
Enhancement: Fixes #379, explorer - toggle buttons for sidebars
This commit is contained in:
@@ -62,6 +62,10 @@ static void on_current_view_items_removed(
|
||||
WinTCShextViewItem** items,
|
||||
gpointer user_data
|
||||
);
|
||||
static void on_current_view_refreshing(
|
||||
WinTCIShextView* view,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
@@ -401,6 +405,12 @@ gboolean wintc_sh_browser_set_location(
|
||||
G_CALLBACK(on_current_view_items_removed),
|
||||
browser
|
||||
);
|
||||
g_signal_connect(
|
||||
browser->current_view,
|
||||
"refreshing",
|
||||
G_CALLBACK(on_current_view_refreshing),
|
||||
browser
|
||||
);
|
||||
|
||||
// Notify that we're loading...
|
||||
//
|
||||
@@ -490,3 +500,13 @@ static void on_current_view_items_removed(
|
||||
p_item++;
|
||||
}
|
||||
}
|
||||
|
||||
static void on_current_view_refreshing(
|
||||
WINTC_UNUSED(WinTCIShextView* view),
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
WinTCShBrowser* browser = WINTC_SH_BROWSER(user_data);
|
||||
|
||||
gtk_list_store_clear(browser->view_model);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,15 @@ static void wintc_sh_tree_view_behaviour_set_property(
|
||||
GParamSpec* pspec
|
||||
);
|
||||
|
||||
static void wintc_sh_tree_view_behaviour_update_view(
|
||||
WinTCShTreeViewBehaviour* behaviour,
|
||||
WinTCShBrowser* browser
|
||||
);
|
||||
|
||||
static void clear_object_safe(
|
||||
GObject* object
|
||||
);
|
||||
|
||||
static void on_browser_load_changed(
|
||||
WinTCShBrowser* self,
|
||||
WinTCShBrowserLoadEvent load_event,
|
||||
@@ -132,12 +141,12 @@ static void wintc_sh_tree_view_behaviour_init(
|
||||
g_str_hash,
|
||||
g_str_equal,
|
||||
g_free,
|
||||
g_object_unref
|
||||
(GDestroyNotify) clear_object_safe
|
||||
);
|
||||
self->map_hash_to_iter = g_hash_table_new_full(
|
||||
g_direct_hash,
|
||||
g_direct_equal,
|
||||
g_free,
|
||||
NULL,
|
||||
g_free
|
||||
);
|
||||
}
|
||||
@@ -225,14 +234,18 @@ static void wintc_sh_tree_view_behaviour_constructed(
|
||||
new_column
|
||||
);
|
||||
|
||||
// TEST: Attachment to browser to monitor for view switches
|
||||
g_signal_connect(
|
||||
// Hook up everything for getting this all started!
|
||||
//
|
||||
g_signal_connect_object(
|
||||
behaviour->browser,
|
||||
"load-changed",
|
||||
G_CALLBACK(on_browser_load_changed),
|
||||
behaviour
|
||||
behaviour,
|
||||
G_CONNECT_DEFAULT
|
||||
);
|
||||
|
||||
wintc_sh_tree_view_behaviour_update_view(behaviour, behaviour->browser);
|
||||
|
||||
(G_OBJECT_CLASS(wintc_sh_tree_view_behaviour_parent_class))
|
||||
->constructed(object);
|
||||
}
|
||||
@@ -245,11 +258,12 @@ static void wintc_sh_tree_view_behaviour_dispose(
|
||||
WINTC_SH_TREE_VIEW_BEHAVIOUR(object);
|
||||
|
||||
g_clear_object(&(behaviour->browser));
|
||||
g_clear_object(&(behaviour->map_iter_to_view));
|
||||
g_clear_object(&(behaviour->map_hash_to_iter));
|
||||
g_clear_object(&(behaviour->shext_host));
|
||||
g_clear_object(&(behaviour->tree_view));
|
||||
|
||||
g_hash_table_unref(g_steal_pointer(&(behaviour->map_iter_to_view)));
|
||||
g_hash_table_unref(g_steal_pointer(&(behaviour->map_hash_to_iter)));
|
||||
|
||||
(G_OBJECT_CLASS(wintc_sh_tree_view_behaviour_parent_class))
|
||||
->dispose(object);
|
||||
}
|
||||
@@ -299,20 +313,17 @@ WinTCShTreeViewBehaviour* wintc_sh_tree_view_behaviour_new(
|
||||
}
|
||||
|
||||
//
|
||||
// CALLBACKS
|
||||
// PRIVATE FUNCTIONS
|
||||
//
|
||||
static void on_browser_load_changed(
|
||||
WinTCShBrowser* self,
|
||||
WinTCShBrowserLoadEvent load_event,
|
||||
gpointer user_data
|
||||
static void wintc_sh_tree_view_behaviour_update_view(
|
||||
WinTCShTreeViewBehaviour* behaviour,
|
||||
WinTCShBrowser* browser
|
||||
)
|
||||
{
|
||||
WinTCShTreeViewBehaviour* behaviour =
|
||||
WINTC_SH_TREE_VIEW_BEHAVIOUR(user_data);
|
||||
WinTCIShextView* current_view =
|
||||
wintc_sh_browser_get_current_view(browser);
|
||||
|
||||
WinTCIShextView* current_view = wintc_sh_browser_get_current_view(self);
|
||||
|
||||
if (!current_view || load_event != WINTC_SH_BROWSER_LOAD_STARTED)
|
||||
if (!current_view)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -566,11 +577,12 @@ static void on_browser_load_changed(
|
||||
//
|
||||
if (new_view)
|
||||
{
|
||||
g_signal_connect(
|
||||
g_signal_connect_object(
|
||||
view,
|
||||
"items-added",
|
||||
G_CALLBACK(on_view_items_added),
|
||||
behaviour
|
||||
behaviour,
|
||||
G_CONNECT_DEFAULT
|
||||
);
|
||||
|
||||
wintc_ishext_view_refresh_items(view);
|
||||
@@ -591,6 +603,36 @@ static void on_browser_load_changed(
|
||||
g_slist_free(list_views);
|
||||
}
|
||||
|
||||
//
|
||||
// CALLBACKS
|
||||
//
|
||||
static void clear_object_safe(
|
||||
GObject* object
|
||||
)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
g_object_unref(object);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_browser_load_changed(
|
||||
WinTCShBrowser* self,
|
||||
WinTCShBrowserLoadEvent load_event,
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
WinTCShTreeViewBehaviour* behaviour =
|
||||
WINTC_SH_TREE_VIEW_BEHAVIOUR(user_data);
|
||||
|
||||
if (load_event != WINTC_SH_BROWSER_LOAD_STARTED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wintc_sh_tree_view_behaviour_update_view(behaviour, self);
|
||||
}
|
||||
|
||||
static void on_view_items_added(
|
||||
WinTCIShextView* view,
|
||||
WinTCShextViewItemsAddedData* items_data,
|
||||
|
||||
@@ -209,6 +209,8 @@ static void wintc_sh_view_cpl_refresh_items(
|
||||
{
|
||||
WinTCShViewCpl* view_cpl = WINTC_SH_VIEW_CPL(view);
|
||||
|
||||
_wintc_ishext_view_refreshing(view);
|
||||
|
||||
// Refresh list
|
||||
//
|
||||
g_clear_slist(
|
||||
|
||||
@@ -248,6 +248,8 @@ static void wintc_sh_view_desktop_refresh_items(
|
||||
{
|
||||
WINTC_LOG_DEBUG("%s", "shell: refresh desktop view");
|
||||
|
||||
_wintc_ishext_view_refreshing(view);
|
||||
|
||||
// Just emit the default items for now
|
||||
// TODO: Should aggregate with user desktop files
|
||||
//
|
||||
|
||||
@@ -199,6 +199,8 @@ static void wintc_sh_view_drives_refresh_items(
|
||||
{
|
||||
WINTC_LOG_DEBUG("%s", "shell: refresh drives view");
|
||||
|
||||
_wintc_ishext_view_refreshing(view);
|
||||
|
||||
// Emit only the root '/' for now
|
||||
// TODO: Basically everything in My Computer!
|
||||
//
|
||||
|
||||
@@ -346,6 +346,8 @@ static void wintc_sh_view_fs_refresh_items(
|
||||
|
||||
WINTC_LOG_DEBUG("%s", "shell: refresh fs view");
|
||||
|
||||
_wintc_ishext_view_refreshing(view);
|
||||
|
||||
// FIXME: Error handling (no way of passing to caller)
|
||||
//
|
||||
GSList* entries =
|
||||
|
||||
@@ -129,6 +129,9 @@ void _wintc_ishext_view_items_removed(
|
||||
WinTCIShextView* view,
|
||||
WinTCShextViewItem** items
|
||||
);
|
||||
void _wintc_ishext_view_refreshing(
|
||||
WinTCIShextView* view
|
||||
);
|
||||
|
||||
void wintc_shext_path_info_copy(
|
||||
WinTCShextPathInfo* dst,
|
||||
|
||||
@@ -11,6 +11,7 @@ enum
|
||||
{
|
||||
SIGNAL_ITEMS_ADDED = 0,
|
||||
SIGNAL_ITEMS_REMOVED,
|
||||
SIGNAL_REFRESHING,
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
@@ -71,6 +72,18 @@ static void wintc_ishext_view_default_init(
|
||||
1,
|
||||
G_TYPE_POINTER
|
||||
);
|
||||
wintc_ishext_view_signals[SIGNAL_REFRESHING] =
|
||||
g_signal_new(
|
||||
"refreshing",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -216,6 +229,17 @@ void _wintc_ishext_view_items_removed(
|
||||
);
|
||||
}
|
||||
|
||||
void _wintc_ishext_view_refreshing(
|
||||
WinTCIShextView* view
|
||||
)
|
||||
{
|
||||
g_signal_emit(
|
||||
view,
|
||||
wintc_ishext_view_signals[SIGNAL_REFRESHING],
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
void wintc_shext_path_info_copy(
|
||||
WinTCShextPathInfo* dst,
|
||||
WinTCShextPathInfo* src
|
||||
|
||||
Reference in New Issue
Block a user