comparison src/layout.c @ 1167:e812b1a7adda

Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
author zas_
date Sat, 22 Nov 2008 16:24:23 +0000
parents 1646720364cf
children 0bea79d87065
comparison
equal deleted inserted replaced
1166:26b9fca795f8 1167:e812b1a7adda
181 LayoutWindow *lw = data; 181 LayoutWindow *lw = data;
182 182
183 layout_set_path(lw, path); 183 layout_set_path(lw, path);
184 } 184 }
185 185
186 static void layout_path_entry_tab_append_cb(const gchar *path, gpointer data, gint n)
187 {
188 LayoutWindow *lw = data;
189
190 if (!lw || !lw->back_button) return;
191 if (!layout_valid(&lw)) return;
192
193 if (n >= 2)
194 {
195 /* Enable back button */
196 gtk_widget_set_sensitive(lw->back_button, TRUE);
197 }
198 else
199 {
200 /* Disable back button */
201 gtk_widget_set_sensitive(lw->back_button, FALSE);
202 }
203 }
204
186 static GtkWidget *layout_tool_setup(LayoutWindow *lw) 205 static GtkWidget *layout_tool_setup(LayoutWindow *lw)
187 { 206 {
188 GtkWidget *box; 207 GtkWidget *box;
189 GtkWidget *menu_bar; 208 GtkWidget *menu_bar;
190 GtkWidget *tabcomp; 209 GtkWidget *tabcomp;
200 if (!lw->toolbar_hidden) gtk_widget_show(lw->toolbar); 219 if (!lw->toolbar_hidden) gtk_widget_show(lw->toolbar);
201 220
202 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1, 221 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1,
203 layout_path_entry_cb, lw); 222 layout_path_entry_cb, lw);
204 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw); 223 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw);
224 tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw);
205 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); 225 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0);
206 gtk_widget_show(tabcomp); 226 gtk_widget_show(tabcomp);
207 227
208 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed", 228 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed",
209 G_CALLBACK(layout_path_entry_changed_cb), lw); 229 G_CALLBACK(layout_path_entry_changed_cb), lw);