gtk+3: fix dependencies for new gnome/accessibility/at-spi2-core
[oi-userland.git] / components / desktop / mate / caja / patches / 04-timeslider-caja-navigation-window.patch
blob784f1244d2aaf9337f9c5d471eb65ee685c44d2c
1 --- caja-1.28.0/src/caja-navigation-window-ui.xml.orig 2024-02-20 01:30:36.000000000 +0100
2 +++ caja-1.28.0/src/caja-navigation-window-ui.xml 2024-02-26 08:42:41.080238291 +0100
3 @@ -63,6 +63,7 @@
4 <toolitem name="Up" action="Up"/>
5 <toolitem name="Stop" action="Stop"/>
6 <toolitem name="Reload" action="Reload"/>
7 + <toolitem name="Restore" action="Restore"/>
8 <separator/>
9 <toolitem name="Home" action="Home"/>
10 <toolitem name="Computer" action="Go to Computer"/>
11 --- caja-1.28.0/src/caja-navigation-window.h.orig 2024-02-20 01:30:36.000000000 +0100
12 +++ caja-1.28.0/src/caja-navigation-window.h 2024-02-26 09:27:56.105335195 +0100
13 @@ -67,10 +67,18 @@
14 /** UI stuff **/
15 CajaSidePane *sidebar;
17 + GtkWidget *zfs_bar;
19 /* Current views stuff */
20 GList *sidebar_panels;
23 +typedef enum {
24 + RESTORE_NORMAL,
25 + RESTORE_SEARCH,
26 + RESTORE_NO
27 +} CajaNavigationRestoreIconType;
29 struct _CajaNavigationWindowClass
31 CajaWindowClass parent_spot;
32 @@ -91,6 +99,9 @@
33 void caja_navigation_window_hide_sidebar (CajaNavigationWindow *window);
34 void caja_navigation_window_show_sidebar (CajaNavigationWindow *window);
35 gboolean caja_navigation_window_sidebar_showing (CajaNavigationWindow *window);
36 +gboolean Caja_navigation_window_zfs_bar_showing (CajaNavigationWindow *window);
37 +void Caja_navigation_window_set_restore_icon (CajaNavigationWindow* window,
38 + CajaNavigationRestoreIconType type);
39 void caja_navigation_window_add_sidebar_panel (CajaNavigationWindow *window,
40 CajaSidebar *sidebar_panel);
41 void caja_navigation_window_remove_sidebar_panel (CajaNavigationWindow *window,
42 --- caja-1.28.0/src/caja-navigation-window.c.orig 2024-02-20 01:30:36.000000000 +0100
43 +++ caja-1.28.0/src/caja-navigation-window.c 2024-02-26 08:42:41.080677444 +0100
44 @@ -71,6 +71,7 @@
45 #include "caja-notebook.h"
46 #include "caja-window-manage-views.h"
47 #include "caja-navigation-window-pane.h"
48 +#include "caja-zfs-bar.h"
50 #define MAX_TITLE_LENGTH 180
52 @@ -107,6 +108,13 @@
55 static void
56 +restore_pref_changed (CajaWindow *window)
58 + g_assert (CAJA_IS_WINDOW (window));
59 + caja_window_reload (window, FALSE);
62 +static void
63 caja_navigation_window_init (CajaNavigationWindow *window)
65 GtkUIManager *ui_manager;
66 @@ -167,6 +175,16 @@
68 ui_manager = caja_window_get_ui_manager (CAJA_WINDOW (window));
69 toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
71 + /* add custom icon */
72 + caja_navigation_window_set_restore_icon (window, RESTORE_SEARCH);
74 + /* add preference callback */
75 + g_signal_connect_swapped (caja_desktop_preferences,
76 + g_strconcat ("changed::", CAJA_PREFERENCES_ENABLE_TIME_SLIDER, NULL),
77 + G_CALLBACK (restore_pref_changed),
78 + (gpointer) window);
80 gtk_style_context_add_class (gtk_widget_get_style_context (toolbar), GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
81 window->details->toolbar = toolbar;
82 gtk_widget_set_hexpand (toolbar, TRUE);
83 @@ -183,6 +201,12 @@
84 caja_navigation_window_allow_back (window, FALSE);
85 caja_navigation_window_allow_forward (window, FALSE);
87 + window->zfs_bar = caja_zfs_bar_new ();
89 + gtk_grid_attach(GTK_GRID (CAJA_WINDOW (window)->details->grid),
90 + window->zfs_bar,
91 + 0, 2, 1, 1);
93 g_signal_connect_swapped (caja_preferences,
94 "changed::" CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY,
95 G_CALLBACK(always_use_location_entry_changed),
96 @@ -348,6 +372,59 @@
100 +void
101 +caja_navigation_window_set_restore_icon (CajaNavigationWindow* window,
102 + CajaNavigationRestoreIconType type)
104 + static gboolean init = 0;
105 + static GdkPixbuf *normal = NULL;
106 + static GdkPixbuf *search = NULL;
107 + static GdkPixbuf *no = NULL;
108 + GdkPixbuf *pb = NULL;
109 + GtkWidget *image = NULL;
110 + GtkAction* action = gtk_ui_manager_get_action (caja_window_get_ui_manager (CAJA_WINDOW (window)), "/Toolbar/Restore");
112 + if (!init)
114 + char *path = caja_pixmap_file ("restore.png");
115 + normal = gdk_pixbuf_new_from_file (path, NULL);
116 + g_free (path);
117 + path = caja_pixmap_file ("restore-search.png");
118 + search = gdk_pixbuf_new_from_file (path, NULL);
119 + g_free (path);
120 + path = caja_pixmap_file ("restore-no.png");
121 + no = gdk_pixbuf_new_from_file (path, NULL);
122 + g_free (path);
123 + init = TRUE;
126 + switch (type)
128 + case RESTORE_NORMAL :
129 + pb = normal;
130 + break;
131 + case RESTORE_SEARCH:
132 + pb = search;
133 + break;
134 + case RESTORE_NO:
135 + pb = no;
136 + break;
139 + image = gtk_image_new_from_pixbuf (pb);
140 + g_object_ref (image);
141 + gtk_widget_show (image);
142 + GSList *tmp = gtk_action_get_proxies (action);
143 + for (tmp; tmp ; tmp = tmp->next)
145 + GtkWidget *proxy = (GtkWidget *)tmp->data;
146 + if (GTK_IS_TOOL_BUTTON (proxy))
148 + gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (proxy), image);
153 static void
154 side_pane_close_requested_callback (GtkWidget *widget,
155 gpointer user_data)
156 @@ -1207,6 +1284,7 @@
157 static void
158 real_window_close (CajaWindow *window)
160 + caja_zfs_bar_cancel_tasks (window);
161 caja_navigation_window_save_geometry (CAJA_NAVIGATION_WINDOW (window));
164 @@ -1428,6 +1506,19 @@
165 caja_navigation_window_update_split_view_actions_sensitivity (window);
169 +gboolean
170 +caja_navigation_window_zfs_bar_showing (CajaNavigationWindow *window)
172 + g_return_val_if_fail (CAJA_IS_NAVIGATION_WINDOW (window), FALSE);
174 + if (window->zfs_bar != NULL)
176 + return gtk_widget_get_visible(GTK_WIDGET (window->zfs_bar));
178 + return FALSE;
181 gboolean
182 caja_navigation_window_split_view_showing (CajaNavigationWindow *window)