diff options
author | Emmanuele Bassi <ebassi@src.gnome.org> | 2006-04-23 14:28:58 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@src.gnome.org> | 2006-04-23 14:28:58 +0000 |
commit | 253a387c66a5c666adb115980580e4aaf54e6f66 (patch) | |
tree | 117baa83923303f1594751b33c301609338d69be | |
download | baobab-253a387c66a5c666adb115980580e4aaf54e6f66.tar.gz |
Initial import of baobab
59 files changed, 9334 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in @@ -0,0 +1,13 @@ +Fabio Marzocca <thesaltydog@gmail.com> + +Benoît Dejean <benoit@placenet.org> + +Paolo Borelli <pborelli@katamail.com> + +Thanks: +======= +Beniamino Caputo +Andrea Abelli +Sean Montel +Piotr Szotkowski +Francesco Accattapà diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..3873dba --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1300 @@ +2006-04-23 Emmanuele Bassi <ebassi@cvs.gnome.org> + + * *: Initial import inside gnome-utils. + +2006-04-22 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab-utils.c: fixed bug on deleting files + +2006-04-21 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.ac: + + Bumped post-release version + +2006-04-21 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + * NEWS: + * configure.ac: + + Released v.2.4.1 + +2006-04-21 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * po/it.po: + * src/baobab-treeview.c: + * src/baobab-utils.c: + * src/baobab-utils.h: + * src/baobab.c: + * src/callbacks.c: + * src/callbacks.h: + + Added treemap item in View Menu + +2006-04-21 Fabio Marzocca <thesaltydog@gmail.com> + + * src/Makefile.am: + * src/baobab-scan.c: moved hardlinks.c here + * src/baobab-scan.h: move hardlinks.h here + +2006-04-21 Fabio Marzocca <thesaltydog@gmail.com> + + * po/POTFILES.in: + * po/POTFILES.skip: + * src/Makefile.am: + * src/baobab-prefs.c: renamed from props.c + * src/baobab-prefs.h: renamed from props.h + * src/baobab.c: + * src/callbacks.c: + +2006-04-21 Paolo Borelli <pborelli@katamail.com> + + * src/baobab.c: + * src/callbacks.c: + * src/baobab-utils.c: + + factor out a set_busy method and cache the animation pixbufs. + +2006-04-21 Paolo Borelli <pborelli@katamail.com> + + * pixmaps/Makefile.am: + * baobab.glade: + * src/baobab.c: + * src/callbacks.c: + * src/baobab-utils.c: + + Make app icon themable + +2006-04-20 Paolo Borelli <pborelli@katamail.com> + + * src/callbacks.c: + * src/tv.c: move tv callbacks here. + * src/baobab_globals.[ch]: remove + * src/baobab-utils.[ch]: renamed from bb_util + * src/baobab-scan.[ch]: renamed from bbthread + * src/baobab-treeview.[ch]: renamed from tv + * src/baobab-graphwin.[ch]: renamed from bb_graphwin + +2006-04-20 Fabio Marzocca <thesaltydog@gmail.com> + + * MAINTAINERS: + * src/callbacks.c: (on_about1_activate): + + Updated maintainers + +2006-04-20 Paolo Borelli <pborelli@katamail.com> + + * src/baobab.c: plug some more leaks and simplify string + handling. + +2006-04-20 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_util.c: (dialog_search): fixed bug on logic + +2006-04-20 Paolo Borelli <pborelli@katamail.com> + + * src/bb_util.c: rework find dialog logic + +2006-04-20 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/baobab.c: (baobab_toolbar_style), (baobab_init): + * src/baobab.h: + * src/bb_util.c: (check_menu_sens): + + Set toolbar style to system global + +2006-04-20 Paolo Borelli <pborelli@katamail.com> + + * src/baobab.c: do not leak pixbuf. + +2006-04-19 Paolo Borelli <pborelli@katamail.com> + + * src/baobab.[ch]: + * src/callbacks.c: + * src/props.c: + + store toolbar and statusbar visibility in gconf. + +2006-04-19 Paolo Borelli <pborelli@katamail.com> + + * configure.ac: + * data/Makefile.am: + + Fix gconf schemas install. + +2006-04-19 Fabio Marzocca <thesaltydog@gmail.com> + + * INSTALL: + * data/.cvsignore: + * data/Makefile.am: + * data/baobab.schemas.in: + * po/POTFILES.in: + * po/it.po: + * src/props.c: (create_props_model): + + Introducing schemas file + +2006-04-19 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/props.c: (create_tree_props), (check_toggled), + (fill_props_model): + * src/props.h: + +2006-04-19 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/bb_util.c: (check_menu_sens): + * src/callbacks.c: (on_pref_menu), (on_view_tb_activate), + (on_view_sb_activate): + * src/callbacks.h: + + Relocated toolbar buttons + Introduced a View menu + +2006-04-12 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab-tree-map.c: + * src/baobab-tree-map.h: + Added GPL boilerplate + +2006-04-12 Paolo Borelli <pborelli@katamail.com> + + * src/bb_util.[ch]: pass a const string to set_statusbar + * src/callbacks.c: escape the string caller side. + +2006-04-12 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.desktop.in.in: + * po/it.po: + * src/callbacks.c: (on_about1_activate): + +2006-04-12 Paolo Borelli <pborelli@katamail.com> + + * src/bb_util.c: fix ICC warnings. + * src/baobab-remote-connect-dialog.c: ditto. + +2006-04-12 Fabio Marzocca <thesaltydog@gmail.com> + + * po/it.po: updated italian translation + +2006-04-12 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/bb_util.c (dir_select), (baobab_check_dir): + Terminology changes: folder vs directory + +2006-04-12 Paolo Borelli <pborelli@katamail.com> + + * src/bb_util.c: do not leak the animation and check a + GnomeVfsResult. + +2006-04-12 Paolo Borelli <pborelli@katamail.com> + + * src/*.[ch]: run the code through indent and add GPL + boilerplate. + +2006-04-11 Paolo Borelli <pborelli@katamail.com> + + * src/baobab.[ch]: move scan_is_local here. Factor out an + is_excluded_dir() function. + * src/bb_util.[ch]: use is_excluded_dir() and other cleanups. + * src/bb_thread.[ch]: use is_excluded_dir() and other cleanups. + Fix leaks on error paths. + * src/props.c: fix sign comparison warning. + +2006-04-11 Paolo Borelli <pborelli@katamail.com> + + * configure.ac: rename from configure.in, bump version. + +2006-04-11 Paolo Borelli <pborelli@katamail.com> + + * Makefile.am + * src/Makefile.am + * src/baobab.[ch]: + + define the glade file location and pixmap dir at compile time + instead of constructing the path. Also misc indentation + cleanups. + + * src/bb_utils.c: + * src/callbacks.c: + * src/props.c: + + adapt to above changes. + + * .cvsignore: updates + +2006-02-28 Fabio Marzocca <thesaltydog@gmail.com> + + * .cvsignore: + * po/.cvsignore: + +2006-02-23 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + + Removed bug on distclean + +2006-02-23 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * configure.in: + + Released v.2.3.2 + +2006-02-23 Fabio Marzocca <thesaltydog@gmail.com> + + * autogen.sh: + * config.h.in: + * configure.in: + * install-sh: + * intltool-extract.in: + * intltool-merge.in: + * intltool-update.in: + * missing: + * mkinstalldirs: + * src/callbacks.c: (on_about1_activate): + * src/props.c: (set_gconf_list): + + Moved to automake1.8 + +2006-02-01 Ilkka Tuohela <hile@iki.fi> + + * configure.in: Added "fi" to ALL_LINGUAS + +2006-01-11 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped post-release version + +2006-01-10 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * configure.in: + + Released v. 2.3.1 + +2006-01-10 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (baobab_init): + * src/bb_util.c: (baobab_get_filesystem): + * src/callbacks.c: (volume_changed), (on_propstb_clicked): + * src/props.c: (fill_props_model): + * src/tv.c: (create_directorytreeview): + + Do not popup preference window upon (un)mounting partitions + +2006-01-03 Stanislav Brabec <sbrabec@suse.cz> + + * configure.in: Added vi to ALL_LINGUAS. + +2005-12-31 Fabio Marzocca <thesaltydog@gmail.com> + + * src/callbacks.c: (on_sort_alfa_activate), + (on_by_sort_size_activate): + * src/tv.c: (create_model), (create_search_model): + + Trees sorted by size by default + +2005-12-26 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped post-release version + +2005-12-26 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * configure.in: + + Released v.2.3.0 + +2005-12-20 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.desktop.in.in: + + Moved menu in Applications->Accessories + +2005-12-18 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_util.c: (baobab_check_dir): + * src/bbthread.c: (getDir): + + Scanning can now start from a sym-link too. + +2005-12-14 Stanislav Brabec <utx@penguin.cz> + + * configure.in: Added cs to ALL_LINGUAS. + +2005-12-13 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + +2005-12-07 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped post-release version + +2005-12-07 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * configure.in: + * src/bbthread.c: (loopsearch): + + Release v.2.2.2 + +2005-12-07 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + * src/bbthread.c: (loopdir): + + Fixed buf on allocated size + +2005-12-06 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + +2005-12-06 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Release v.2.2.1 + +2005-12-06 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + +2005-12-06 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bbthread.c: (bb_scan_is_local): + * src/props.c: (check_toggled): + + Fixes bug #323331 + +2005-11-28 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped new cvs version + +2005-11-28 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * configure.in: + * data/baobab.1: + + Released v.2.2.0 + +2005-11-28 Fabio Marzocca <thesaltydog@gmail.com> + + * po/fr.po: + +2005-11-28 Fabio Marzocca <thesaltydog@gmail.com> + + * po/fr.po: + +2005-11-20 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (start_proc_on_dir): + * src/bbthread.c: (bb_scan_is_local): + * src/callbacks.c: (on_notebook1_switch_page): + +2005-11-19 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab-remote-connect-dialog.c: (remote_connect): + * src/baobab.c: (start_proc_on_dir): + * src/bb_util.c: (baobab_check_dir), (open_file_with_application): + * src/bbthread.c: (loopdir), (getDir), (bb_scan_is_local): + * src/callbacks.c: (on_tb_scan_remote_clicked): + + Removed bug on GnomeVFSFileInfo use. + +2005-11-18 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * data/baobab.1: + * po/POTFILES.in: + * po/it.po: + * src/Makefile.am: + * src/baobab-remote-connect-dialog.c: + (baobab_remote_connect_dialog_finalize), (remote_connect), + (response_callback), (baobab_remote_connect_dialog_class_init), + (setup_for_type), (combo_changed_callback), (port_insert_text), + (baobab_remote_connect_dialog_init), + (baobab_remote_connect_dialog_new): + * src/baobab-remote-connect-dialog.h: + * src/baobab.c: (start_proc_on_dir), (start_search), + (prefill_model), (fill_model), (baobab_init): + * src/baobab.h: + * src/bb_util.c: (check_menu_sens): + * src/bbthread.c: (loopdir), (getDir), (bb_scan_is_local): + * src/bbthread.h: + * src/callbacks.c: (on_tbscanall_clicked), + (on_tb_scan_remote_clicked), (on_menu_scan_rem_activate), + (graph_map_cb), (on_ck_allocated_toggled): + * src/callbacks.h: + + Now baobab can also scan remote folders, with SSH-FTP-WEBDAV-SMB + protocols. + +2005-11-17 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (fill_model), (main): + * src/bbthread.c: (loopsearch), (loopdir): + +2005-11-17 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: + * src/bb_graphwin.c: (quit_canvas), (tm_popupmenu): + * src/bb_util.c: (get_trash_path), (trash_file): + * src/bb_util.h: + + Fixed bug in trash file + +2005-11-17 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/baobab.c: (start_search), (fill_search_model), + (prepare_firstcol), (get_file_filter): + * src/baobab.h: + * src/bb_util.c: (open_file_with_application): + * src/bbthread.c: (loopsearch), (searchDir): + * src/callbacks.c: (on_tv_cur_changed), + (on_btn_select_search_clicked), (open_file_cb): + + Using GnomeVFSURI in file-search functions + +2005-11-17 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (start_proc_on_dir), (main): + * src/baobab.h: + * src/bb_util.c: (dir_select), (on_toggled), (show_bars), + (message), (messageyesno), (baobab_check_dir), (contents_changed): + * src/bbthread.c: (loopdir), (getDir): + * src/bbthread.h: + * src/callbacks.c: (on_menuallfs_activate), (on_tbscanall_clicked): + + Introducing GnomeVFSURI + +2005-11-16 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (start_proc_on_dir), (main): + * src/baobab.h: + * src/bb_util.c: (dir_select), (contents_changed): + * src/bbthread.c: (getDir): + * src/bbthread.h: + * src/callbacks.c: (on_menuallfs_activate), (on_tbscanall_clicked): + +2005-11-16 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bbthread.c: (loopdir): + + Escaped folder names starting with '#' + +2005-11-16 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + * src/baobab.c: (list_find), (baobab_init): + * src/bbthread.c: (loopdir), (getDir): + * src/hardlinks.c: (baobab_hardlinks_array_create), + (baobab_hardlinks_array_has), (baobab_hardlinks_array_add): + * src/hardlinks.h: + * src/props.c: + + Switched to GnomeVFS in loopdir() and hardlinks.ch + +2005-11-14 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/baobab.c: (fill_model): + +2005-11-14 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped post-release version + +2005-11-14 Guilherme de S. Pastore <gpastore@gnome.org> + + * baobab.glade: replace "KB" with "kB" (K is Kelvin, + k is kilo), fixes bug #321402 + +2005-11-14 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * src/bb_graphwin.c: (graph_save_cb): + + Released v.2.0.1 + +2005-11-14 Guilherme de S. Pastore <gpastore@gnome.org> + + * configure.in: added pt_BR to ALL_LINGUAS. + +2005-11-13 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped post-release version + +2005-11-13 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + + Released v. 2.0.0 + +2005-11-13 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * po/POTFILES.in: + * src/Makefile.am: + * src/baobab-tree-map.c: + * src/baobab-tree-map.h: + * src/baobab-treemap.c: + * src/baobab-treemap.h: + * src/bb_graphwin.c: (create_bb_treemap), (zoom_in_cb), + (zoom_out_cb), (zoom_100_cb), (tm_popupmenu), (graph_save_cb), + (tm_spin_changed), (tm_refresh): + * src/callbacks.c: (graph_map_cb): + + Changed treemap namespace in baobab-tree-map + +2005-11-11 Fabio Marzocca <thesaltydog@gmail.com> + + * AUTHORS: + * po/POTFILES.in: + * po/it.po: + * src/Makefile.am: + * src/baobab-treemap.c: + * src/baobab-treemap.h: + * src/bb_graphwin.c: (create_bb_treemap), (quit_canvas), + (zoom_in_cb), (zoom_out_cb), (zoom_100_cb), (tm_popupmenu), + (graph_save_cb), (open_folder_cb), (open_file_with_application), + (tm_spin_changed), (tm_refresh): + * src/bb_graphwin.h: + * src/bb_treemap.c: + * src/bb_treemap.h: + * src/callbacks.c: (on_about1_activate), (graph_map_cb): + + GObjectified treemap into a general purpose treemap view + +2005-11-10 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (prefill_model): + + Fixed main memory leak in baobab.c + +2005-11-10 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap), (bb_draw_treemap), + (quit_canvas), (graph_save_cb), (tm_refresh): + + Fixed memory leaks + +2005-11-10 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * po/it.po: + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), + (bb_draw_treemap), (tm_refresh), (bb_clear_canvas), + (bb_treemap_get_total_elements): + + Added function to display total folders number in tremap + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + * po/ChangeLog: + * po/ru.po: + + Added russian translation + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap): + * src/bb_treemap.h: + * src/bb_util.c: (popupmenu_list): + * src/callbacks.c: (graph_map_cb): + * src/callbacks.h: + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap): + * src/bb_treemap.h: + * src/callbacks.c: (graph_map_cb): + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), + (loop_treemap), (open_file_with_application): + * src/bb_treemap.h: + * src/callbacks.c: (on_menuallfs_activate), + (on_menuscandir_activate), (on_esci1_activate), (graph_map_cb): + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * po/it.po: + * src/bb_treemap.c: (create_bb_treemap), (bb_draw_treemap), + (loop_treemap), (tm_spin_changed), (tm_refresh), (bb_clear_canvas): + + Added bb_clear_canvas. Replaced ALL with Unlimited in depth level + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/bb_treemap.c: (create_bb_treemap), (zoom_in_cb), + (zoom_out_cb), (zoom_100_cb), (bb_draw_treemap), (loop_treemap), + (item_event), (quit_canvas), (graph_save_cb), + (open_file_with_application), (tm_spin_changed), (tm_refresh): + * src/bb_treemap.h: + * src/callbacks.c: (graph_map_cb): + + Added spin button to change treemap's depth + +2005-11-09 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap): + + Closes:#321014 + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/baobab.c: (first_row): + * src/bb_util.c: (popupmenu_list), (popupmenu_list_search), + (dialog_search): + * src/callbacks.c: (on_tv_button_press): + * src/tv.c: (create_search_model): + + Fixed program crash on search dialog + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * src/Makefile.am: + + exporting functions for libglade + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * data/baobab.1: + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * .cvsignore: + * Makefile.am: + * baobab.prj: + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * .cvsignore: + * baobab.gladep: + + Removed gladep file + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + * baobab.glade: + * baobab.gladep: + * configure.in: + * data/Makefile.am: + * pixmaps/Makefile.am: + * pixmaps/shot.png: + * po/POTFILES.in: + * po/de.po: + * po/en_CA.po: + * po/es.po: + * po/eu.po: + * po/fr.po: + * po/it.po: + * po/ja.po: + * po/pl.po: + * po/sv.po: + * po/zh_CN.po: + * src/Makefile.am: + * src/baobab.c: (baobab_init), (baobab_close), (main): + * src/baobab.h: + * src/bb_support.c: + * src/bb_support.h: + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), (zoom_in_cb), + (zoom_out_cb), (zoom_100_cb), (baobab_get_pixels_per_unit), + (bb_draw_treemap), (loop_treemap), (setup_widget_item), + (item_event), (popupmenu_canvas), (quit_canvas), (graph_save_cb), + (open_folder_cb), (open_file_with_application): + * src/bb_treemap.h: + * src/bb_util.c: (find_pixmap_file), (set_statusbar), + (change_icon), (set_bar), (check_menu_sens), (popupmenu_list), + (dialog_search), (save_search_opt), (set_search_opt), + (switch_view), (get_NB_page), (show_label), (contents_changed), + (baobab_load_pixbuf), (baobab_get_icon): + * src/bb_util.h: + * src/bbthread.c: + * src/callbacks.c: (on_radio_allfs_clicked), + (on_radio_dir_clicked), (on_btn_select_search_clicked), + (on_notebook1_switch_page), (graph_map_cb), (contents_changed_cb), + (on_pref_menu): + * src/callbacks.h: + * src/interface.c: + * src/interface.h: + * src/props.c: (create_props), (create_tree_props): + * src/tv.c: (create_directorytreeview), (create_tree_filesearch), + (create_search_model): + + Merged treemap branch + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (setup_widget_item), (popupmenu_canvas), + (quit_canvas), (open_folder_cb): + + More cleaning and removing memory leaks + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap): + + Code cleanup + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * po/POTFILES.in: + * po/it.po: + * src/Makefile.am: + * src/baobab.c: (main): + * src/bb_support.c: + * src/bb_support.h: + * src/bb_treemap.c: + * src/bb_util.c: (find_pixmap_file), (set_bar), (popupmenu_list), + (contents_changed), (baobab_load_pixbuf), (baobab_get_icon): + * src/bb_util.h: + * src/bbthread.c: + * src/callbacks.c: + * src/props.c: + * src/tv.c: + + Dropped bb_support.c/h + +2005-11-08 Fabio Marzocca <thesaltydog@gmail.com> + + * src/baobab.c: (main): + * src/bb_treemap.c: (create_bb_treemap): + + set default icon + +2005-11-07 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (baobab_close): + * src/baobab.h: + * src/bb_util.c: (popupmenu_list), (popupmenu_list_search): + * src/callbacks.c: (open_file_cb), (trash_file_cb), (trash_dir_cb), + (list_all_cb): + * src/callbacks.h: + * src/tv.c: (create_search_model): + + Reworked these callbacks. + Store the selected_path in baobab_application. + + +2005-11-07 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (popupmenu_canvas), (graph_save_cb), + (open_folder_cb), (open_file_with_application): + +2005-11-07 Fabio Marzocca <thesaltydog@gmail.com> + + * po/it.po: + * src/bb_treemap.c: (create_bb_treemap), (bb_draw_treemap), + (loop_treemap), (graph_save_cb): + * src/bb_treemap.h: + * src/callbacks.c: (graph_map_cb): + +2005-11-07 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), (zoom_in_cb), + (zoom_out_cb), (zoom_100_cb), (baobab_get_pixels_per_unit), + (bb_draw_treemap), (loop_treemap), (setup_widget_item), + (item_event), (popupmenu_canvas), (quit_canvas), (graph_save_cb): + * src/bb_treemap.h: + + Multi-window treemap mode. Removed s-handlers from glade + +2005-11-07 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_util.c: (dialog_search): + * src/props.c: (create_props): + + Unreferenced glade objects + +2005-11-07 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * pixmaps/Makefile.am: + * pixmaps/shot.png: + * src/baobab.h: + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), (zoom_in_cb), + (zoom_out_cb), (zoom_100_cb), (baobab_get_pixels_per_unit), + (bb_draw_treemap), (loop_treemap), (popupmenu_canvas), + (quit_canvas), (graph_save_cb): + * src/bb_treemap.h: + * src/callbacks.c: (contents_changed_cb), + (on_ck_allocated_toggled): + +2005-11-06 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), + (bb_draw_treemap), (loop_treemap), (setup_widget_item), + (item_event), (popupmenu_canvas): + + Treemap starts working + +2005-11-06 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), (zoom_in_cb), + (zoom_out_cb), (zoom_100_cb), (loop_treemap): + * src/bb_treemap.h: + * src/callbacks.c: (on_graph_close_btn_clicked): + + Using rendering RGB buffer for treemap + +2005-11-05 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap), (bb_draw_treemap), + (loop_treemap): + +2005-11-05 Fabio Marzocca <thesaltydog@gmail.com> + + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), + (bb_draw_treemap), (loop_treemap): + +2005-11-04 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * configure.in: + * po/POTFILES.in: + * po/it.po: + * src/Makefile.am: + * src/baobab.h: + * src/bb_treemap.c: (create_bb_treemap), (draw_rect), (zoom_in), + (zoom_out), (zoom_100), (baobab_get_pixels_per_unit), + (bb_draw_treemap): + * src/bb_treemap.h: + * src/bb_util.c: (popupmenu_list): + * src/callbacks.c: (graph_map_cb), (on_ck_allocated_toggled), + (on_graph_close_btn_clicked), (on_graph_zoom_in_clicked), + (on_graph_zoom_out_clicked), (on_graph_zoom_100_clicked): + * src/callbacks.h: + + Started coding treemap + +2005-11-04 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + * baobab.glade: + * po/POTFILES.in: + * po/de.po: + * po/en_CA.po: + * po/es.po: + * po/eu.po: + * po/fr.po: + * po/it.po: + * po/ja.po: + * po/pl.po: + * po/sv.po: + * po/zh_CN.po: + * src/Makefile.am: + * src/baobab.c: (baobab_init), (baobab_close), (main): + * src/baobab.h: + * src/bb_support.c: + * src/bb_support.h: + * src/bb_util.c: (set_statusbar), (change_icon), (check_menu_sens), + (dialog_search), (save_search_opt), (set_search_opt), + (switch_view), (get_NB_page), (show_label): + * src/bbthread.c: + * src/callbacks.c: (on_radio_allfs_clicked), + (on_radio_dir_clicked), (on_btn_select_search_clicked), + (on_notebook1_switch_page), (on_pref_menu): + * src/callbacks.h: + * src/interface.c: + * src/interface.h: + * src/props.c: (create_props), (create_tree_props): + * src/tv.c: (create_directorytreeview), (create_tree_filesearch): + + Dropped interface.ch - Using dynamic GladeXML + +2005-11-03 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + * baobab.glade: + * baobab.gladep: + * configure.in: + * data/Makefile.am: + * data/baobab.glade: + * data/baobab.gladep: + * pixmaps/Makefile.am: + * src/baobab.c: (baobab_init), (main): + * src/baobab.h: + +2005-11-03 Fabio Marzocca,,, <thesaltydog@gmail.com> + + * Makefile.am: + * baobab.glade: + * baobab.gladep: + * data/Makefile.am: + * data/baobab.glade: + * data/baobab.gladep: + + Moved glade files in data dir + +2005-11-03 Fabio Marzocca <thesaltydog@gmail.com> + + * src/interface.c: (create_graph_win): + +2005-11-03 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.glade: + * src/interface.c: (create__about), (create_dialog_scan_props), + (create_graph_win): + * src/interface.h: + + Updated glade with new window for graphic map + +2005-11-03 Fabio Marzocca <thesaltydog@gmail.com> + + * configure.in: + + Bumped new version 2.0.0 + +>>>>>>> 1.38.2.20 +2005-11-01 Fabio Marzocca,,, <thesaltydog@gmail.com> + + * Makefile.am: + * baobab.png: + * configure.in: + * pixmaps/.cvsignore: + * pixmaps/Makefile.am: + * pixmaps/baobab.png: + + Fixed pixmap dir + +2005-11-01 Fabio Marzocca <thesaltydog@gmail.com> + + * Makefile.am: + * src/baobab.h: + + Relocated pixmap dir + +2005-11-01 Benoît Dejean <benoit@placenet.org> + + * configure.in: + * src/baobab.c: (main): + * src/bb_support.c: (find_pixmap_file), + (glade_set_atk_action_description), (baobab_get_icon): + * src/bb_support.h: + * src/callbacks.c: (on_about1_activate): + + Fixed icon and pictures lookup. + Added baobab_get_icon() to get application icon. + Bumped version. + +2005-11-01 Benoît Dejean <benoit@placenet.org> + + * Makefile.am: + * pixmaps/baobab.png: + * baobab.png: + + Moved the icon and fixed install rule. + + * data/Makefile.am: + * data/baobab.desktop: + + Dropped that desktop file. + +2005-10-31 Benoît Dejean <benoit@placenet.org> + + * .cvsignore: + * Makefile.am: + * intltool-extract.in: + * intltool-merge.in: + * intltool-update.in: + * po/POTFILES.in: + * po/POTFILES.skip: + + Fixed distcheck. + + * src/interface.c: + * src/support.c: + * src/support.h: + + Dropped support.[ch]. + +2005-10-31 Fabio Marzocca <thesaltydog@gmail.com> + + * NEWS: + * configure.in: + + Released 1.3.0 + +2005-10-25 Fabio Marzocca <thesaltydog@gmail.com> + + * src/hardlinks.c: (baobab_hardlinks_array_free): + + Removed debugging code + +2005-10-25 Fabio Marzocca <thesaltydog@gmail.com> + + * baobab.pws: + * po/it.po: + +>>>>>>> 1.60 +2005-10-19 Fabio Marzocca,,, <thesaltydog@gmail.com> + + * README: + * baobab.prj: + * src/callbacks.c: (on_about1_activate): + + Changed website url address. + +2005-10-19 Adam Weinberger <adamw@gnome.org> + + * configure.in: Added en_CA to ALL_LINGUAS. + +2005-10-19 Benoît Dejean <benoit@placenet.org> + + * src/Makefile.am: + * src/baobab.h: + * src/baobab_globals.c: + * src/baobab_globals.h: + * src/bb_util.c: (baobab_get_filesystem), (set_label_scan): + * src/bb_util.h: + + Move globals definition outside of baobab.h. + Also fixes baobab.h include guard. + +2005-10-16 Benoît Dejean <benoit@placenet.org> + + * Makefile.am: + * configure.in: + * scripts/.cvsignore: + * scripts/Makefile.am: + * scripts/naut-script.sh: + * src/baobab.c: (main): + * src/bb_util.c: (baobab_check_dir): + * src/bb_util.h: + + Dropped the nautilus script. It's useless as nautilus can do + it with "Open with". + +2005-10-16 Takeshi AIHANA <aihana@gnome.gr.jp> + + * configure.in: Added 'ja' (Japanese) to ALL_LINGUAS. + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/bb_util.c: (show_label): + + Cleaned and fixed logic. + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (fill_model): ngettext love. + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/Makefile.am: + * src/baobab.c: (main): + + Fixed program init. Marked static baobab_{init,close}(). + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/*.[ch]: Made gcc-2.95 happy. + GNOME C is C89. + + +2005-10-14 Fabio Marzocca,,, <thesaltydog@gmail.com> + + * src/bb_util.c: (baobab_check_dir): + + dropped deadcode functions. + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * TODO: + + New item. + + * src/Makefile.am: + * src/bbthread.c: (loopdir), (getDir), (searchDir): + * src/hardlinks.c: (baobab_hardlinks_array_create), + (baobab_hardlinks_array_has), (baobab_hardlinks_array_add), + (baobab_hardlinks_array_free): + * src/hardlinks.h: + + Moved the hardlink detection code to hardlinks.[ch]. + No more global. + Fixed lookup (inode number is unique per filesystem, + not globally). + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (fill_model): + + Yet another leak. + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (prefill_model): + + Fixed one more leak. + +2005-10-14 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (check_UTF): + + Fixed logic to plug 2 leaks. + + * src/bb_util.c: (set_statusbar): + + Fixed 1 leak. + +2005-10-12 Funda Wang <fundawang@linux.net.cn> + + * configure.in: Added Simplified Chinese translation. + +2005-10-11 Fabio Marzocca <thesaltydog@gmail.com> + + * MAINTAINERS: file added + + +2005-10-11 Benoît Dejean <benoit@placenet.org> + + * scripts/naut-script.sh: + + Added exec statement. + +2005-10-11 Benoît Dejean <benoit@placenet.org> + + * Makefile.am: + * baobab.desktop.in.in: + * configure.in: + + Added desktop file. + +2005-10-11 Benoît Dejean <benoit@placenet.org> + + * src/bbthread.c: + * src/props.c: + + Added missing <config.h>. + +2005-10-11 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (start_proc_on_dir): + * src/bb_util.c: (baobab_check_dir): + * src/bb_util.h: + + check_dir -> baobab_check_dir. + Fixed prototype. Cleaned. Fixed string surgery. + +2005-10-11 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (main): + * src/baobab.h: + * src/bb_util.c: (baobab_get_filesystem), (contents_changed): + * src/bb_util.h: + * src/props.c: (props_notify), (fill_props_model): + + Changed getFileSystem prototype and renamed to + baobab_get_filesystem. Cleaned it. + Fixed glibtop usage (free -> g_free). + +2005-10-11 Benoît Dejean <benoit@placenet.org> + + * src/baobab.c: (baobab_close), (main): + + Added missing libgtop init/shutdown. + +2005-10-10 Benoît Dejean <benoit@placenet.org> + + * AUTHORS: + * src/callbacks.c: (on_about1_activate): + * src/interface.c: + * src/interface.h (create__about): Removed that function. + + Reworked and simplified the about dialog. Moved some people to AUTHORS. + +2005-10-10 Fabio Marzocca <thesaltydog@gmail.com> + + * .cvsignore: + * AUTHORS: + * baobab.pws: + + removed baobab.pws and added to cvsignore + added Benoit Dejean to AUTHORS + +2005-10-10 Fabio Marzocca <thesaltydog@gmail.com> + + * AUTHORS: + * baobab.pws: + +2005-10-10 Fabio Marzocca <thesaltydog@gmail.com> + + * .cvsignore: added .tm_project.cache baobab.prj.bak + +2005-10-10 Benoît Dejean <benoit@placenet.org> + + * .tm_project.cache: Dropped. + +2005-10-10 Benoît Dejean <benoit@placenet.org> + + * configure.in: + * src/Makefile.am: + + Cleaned a bit. Stricter CFLAGS. + + * src/baobab.h: + * src/bb_util.c: + + Remove duplicate _DIR_*. + Fixed some warnings. + +2005-10-10 Benoît Dejean <benoit@placenet.org> + + * .cvsignore: + * Makefile.in: + * aclocal.m4: + * autom4te.cache/output.0: + * autom4te.cache/requests: + * autom4te.cache/traces.0: + * configure: + * data/.cvsignore: + * data/Makefile.in: + * po/.cvsignore: + * po/Makefile.in.in: + * scripts/.cvsignore: + * scripts/Makefile.in: + * src/.cvsignore: + * src/Makefile.in: + + Removed autogenerated files and added .cvsignore files. + +2005-10-10 Fabio Marzocca <thesaltydog@gmail.com> + + * po/.cvsignore: + * po/*.gmo: + * src/.cvsignore: + * src/baobab + + Added missing files to .cvsignore diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d9279ee --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = src data pixmaps help @@ -0,0 +1,56 @@ +Copyright +========= + + Baobab - a graphical directory tree analyzer + Copyright (C) 2005 Fabio Marzocca + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more details see the file COPYING. + + +What is Baobab +============== + + Baobab is able to scan either specific directories or the whole + filesystem, in order to give the user a graphical tree representation + including each directory size or percentage in the branch. + It also includes a complete file-search functionality and auto-detects + in real-time any changes made to your home directory as far as any + mounted/unmounted device. + + A detailed documentation of the program could be read at: + http://www.gnome.org/projects/baobab. + + +System Requirements +=================== + +Baobab should build on most unices. It needs the X11R6 (or xorg) +libraries, glib, gtk 2.x, gnome-vfs2, gconf2 libraries. + + +Author +====== + +Baobab is being maintained by Fabio Marzocca <thesaltydog@gmail.com>. If +you are having trouble installing and/or running Baobab, feel free to +e-mail me. + +You can check on the current status of Baobab via www at: + http://www.gnome.org/projects/baobab + +Comments, ideas and (most of all) bug reports (and especially patches) are +very welcome. @@ -0,0 +1,6 @@ +- gconf schema +- clean baobab.h (move data definiton in .c) +- rework loopdir / loopsearch. Make them non-recursive and use + gnome-vfs for recursing. +- make a customizable list of ignored mountpoints to ignore + /proc, /sys, /dev, etc.
\ No newline at end of file diff --git a/data/.cvsignore b/data/.cvsignore new file mode 100644 index 0000000..798e51b --- /dev/null +++ b/data/.cvsignore @@ -0,0 +1,5 @@ +Makefile +Makefile.in +baobab.schemas +baobab.desktop +baobab.desktop.in diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..4825c3a --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,38 @@ +gladedir = $(datadir)/baobab +glade_DATA = baobab.glade + +baobabappdir = $(datadir)/applications +baobabapp_in_files = baobab.desktop.in +baobabapp_DATA = $(baobabapp_in_files:.desktop.in=.desktop) + +$(baobabapp_in_files): $(baobabapp_in_files:.desktop.in=.desktop.in.in) + sed -e "s|\@VERSION\@|@VERSION@|" $< > $@ + +@INTLTOOL_DESKTOP_RULE@ + +schemasdir = $(GCONF_SCHEMA_FILE_DIR) +schemas_in_files = baobab.schemas.in +schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) +@INTLTOOL_SCHEMAS_RULE@ + +man_MANS = baobab.1 + +if GCONF_SCHEMAS_INSTALL +install-data-local: + if test -z "$(DESTDIR)" ; then \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schema_DATA) ; \ + fi +else +install-data-local: +endif + +EXTRA_DIST = \ + $(glade_DATA) \ + baobab.desktop.in.in \ + $(schemas_in_files) \ + $(man_MANS) + +CLEANFILES = \ + $(baobabapp_in_files) \ + $(baobabapp_DATA) \ + $(schemas_DATA) diff --git a/data/baobab.1 b/data/baobab.1 new file mode 100644 index 0000000..85fe32c --- /dev/null +++ b/data/baobab.1 @@ -0,0 +1,151 @@ +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "BAOBAB 1" +.TH BAOBAB 1 +.SH "NAME" +\&\fBBaobab\fR \- Graphical directory\-tree analysis tool +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBbaobab\fR [directory] +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBbaobab\fR is able to scan either specific directories or the whole +filesystem (local and remote), in order to give the user a graphical tree +representation including each directory size or percentage in the branch. +It also includes a complete file-search functionality and auto-detects +in real-time any changes made to your home directory as far as any +mounted/unmounted device. A graphical treemap window is also provided +for any selected folder. +.PP +A detailed documentation on the program could be read at: +http://www.gnome.org/projects/baobab +.SH "AUTHOR" +.IX Header "AUTHOR" +Fabio \s-1MARZOCCA\s0 <thesaltydog@gmail.org> diff --git a/data/baobab.desktop.in.in b/data/baobab.desktop.in.in new file mode 100644 index 0000000..3729181 --- /dev/null +++ b/data/baobab.desktop.in.in @@ -0,0 +1,15 @@ +[Desktop Entry] +Encoding=UTF-8 +_Name=Baobab - Disk Usage Analyser +_Comment=A graphical tool to analyse disk usage +TryExec=baobab +Exec=baobab +Icon=baobab +Terminal=false +Type=Application +StartupNotify=true +Categories=GTK;GNOME;Application;System; +X-GNOME-Bugzilla-Bugzilla=GNOME +X-GNOME-Bugzilla-Product=gnome-utils +X-GNOME-Bugzilla-Component=baobab +X-GNOME-Bugzilla-Version=@VERSION@ diff --git a/data/baobab.glade b/data/baobab.glade new file mode 100644 index 0000000..3dda7e3 --- /dev/null +++ b/data/baobab.glade @@ -0,0 +1,1860 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="baobab_window"> + <property name="border_width">2</property> + <property name="visible">True</property> + <property name="title" translatable="yes">Baobab</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER</property> + <property name="modal">False</property> + <property name="default_height">500</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <signal name="destroy" handler="on_esci1_activate" last_modification_time="Sun, 31 Jul 2005 16:47:41 GMT"/> + <signal name="delete_event" handler="on_delete_activate" last_modification_time="Sun, 31 Jul 2005 16:53:49 GMT"/> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkMenuBar" id="menubar1"> + <property name="visible">True</property> + <property name="pack_direction">GTK_PACK_DIRECTION_LTR</property> + <property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property> + + <child> + <widget class="GtkMenuItem" id="menuitem1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_File</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="menuitem1_menu"> + + <child> + <widget class="GtkImageMenuItem" id="preferenze1"> + <property name="visible">True</property> + <property name="label">gtk-preferences</property> + <property name="use_stock">True</property> + <signal name="activate" handler="on_pref_menu" last_modification_time="Fri, 04 Nov 2005 11:19:35 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separatore2"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="esci1"> + <property name="visible">True</property> + <property name="label">gtk-quit</property> + <property name="use_stock">True</property> + <signal name="activate" handler="on_esci1_activate" last_modification_time="Tue, 05 Jul 2005 08:47:26 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="view1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_View</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="view1_menu"> + + <child> + <widget class="GtkCheckMenuItem" id="view_tb"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Toolbar</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <signal name="activate" handler="on_view_tb_activate" last_modification_time="Wed, 19 Apr 2006 12:10:25 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkCheckMenuItem" id="view_sb"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Statusbar</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <signal name="activate" handler="on_view_sb_activate" last_modification_time="Wed, 19 Apr 2006 12:45:08 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separatore3"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="menu_treemap"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Folder graphical map</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menu_treemap_activate" last_modification_time="Fri, 21 Apr 2006 16:44:40 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="menuactions"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Actions</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="menuactions_menu"> + + <child> + <widget class="GtkImageMenuItem" id="menuallfs"> + <property name="visible">True</property> + <property name="label" translatable="yes">Scan the whole _filesystem</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menuallfs_activate" last_modification_time="Tue, 05 Jul 2005 08:47:26 GMT"/> + + <child internal-child="image"> + <widget class="GtkImage" id="image216"> + <property name="visible">True</property> + <property name="pixbuf">scan_harddisk.png</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="menuscandir"> + <property name="visible">True</property> + <property name="label" translatable="yes">Scan a selected f_older</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menuscandir_activate" last_modification_time="Tue, 05 Jul 2005 08:47:26 GMT"/> + + <child internal-child="image"> + <widget class="GtkImage" id="image217"> + <property name="visible">True</property> + <property name="pixbuf">scan_directory.png</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="menu_scan_rem"> + <property name="visible">True</property> + <property name="label" translatable="yes">Scan a _remote folder</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_menu_scan_rem_activate" last_modification_time="Fri, 18 Nov 2005 18:20:25 GMT"/> + + <child internal-child="image"> + <widget class="GtkImage" id="image218"> + <property name="visible">True</property> + <property name="stock">gtk-network</property> + <property name="icon_size">1</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="search_for_a_file"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Search for a file</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_search_for_a_file_activate" last_modification_time="Tue, 19 Jul 2005 17:17:57 GMT"/> + + <child internal-child="image"> + <widget class="GtkImage" id="image219"> + <property name="visible">True</property> + <property name="pixbuf">search.png</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="menusort"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Sort</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="menusort_menu"> + + <child> + <widget class="GtkImageMenuItem" id="menu_sort_alfa"> + <property name="visible">True</property> + <property name="label" translatable="yes">By _name</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_sort_alfa_activate" last_modification_time="Fri, 08 Jul 2005 20:16:01 GMT"/> + + <child internal-child="image"> + <widget class="GtkImage" id="image220"> + <property name="visible">True</property> + <property name="pixbuf">alfa_sort.png</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="menu_sort_size"> + <property name="visible">True</property> + <property name="label" translatable="yes">By _size</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_by_sort_size_activate" last_modification_time="Fri, 08 Jul 2005 20:16:01 GMT"/> + + <child internal-child="image"> + <widget class="GtkImage" id="image221"> + <property name="visible">True</property> + <property name="pixbuf">num_sort.png</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="by_type1"> + <property name="visible">True</property> + <property name="label" translatable="yes">By _type</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_by_type1_activate" last_modification_time="Thu, 04 Aug 2005 13:23:50 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="by_date1"> + <property name="visible">True</property> + <property name="label" translatable="yes">By _date</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_by_date1_activate" last_modification_time="Thu, 04 Aug 2005 13:39:38 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="help1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Help</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="help1_menu"> + + <child> + <widget class="GtkImageMenuItem" id="about"> + <property name="visible">True</property> + <property name="label">gtk-about</property> + <property name="use_stock">True</property> + <signal name="activate" handler="on_about_activate" last_modification_time="Tue, 05 Jul 2005 08:58:33 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolbar" id="toolbar1"> + <property name="visible">True</property> + <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> + <property name="toolbar_style">GTK_TOOLBAR_ICONS</property> + <property name="tooltips">True</property> + <property name="show_arrow">False</property> + + <child> + <widget class="GtkToolButton" id="tbscanall"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Scan the whole filesystem</property> + <property name="label" translatable="yes">Filesystem</property> + <property name="use_underline">True</property> + <property name="icon">scan_harddisk.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tbscanall_clicked" last_modification_time="Sat, 09 Jul 2005 20:16:36 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="tbscandir"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Scan a selected folder</property> + <property name="label" translatable="yes">Folder</property> + <property name="use_underline">True</property> + <property name="icon">scan_directory.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tbscandir_clicked" last_modification_time="Wed, 06 Jul 2005 13:15:40 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="tb_scan_remote"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Scan a remote folder</property> + <property name="stock_id">gtk-network</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tb_scan_remote_clicked" last_modification_time="Fri, 18 Nov 2005 15:56:32 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkSeparatorToolItem" id="separatortoolitem1"> + <property name="visible">True</property> + <property name="draw">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="tbsortalfa"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Sort by name</property> + <property name="label" translatable="yes">Sort</property> + <property name="use_underline">True</property> + <property name="icon">alfa_sort.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tbsortalfa_clicked" last_modification_time="Sat, 09 Jul 2005 20:16:18 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="tbsortnum"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Sort by size</property> + <property name="label" translatable="yes">Sort</property> + <property name="use_underline">True</property> + <property name="icon">num_sort.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tbsortnum_clicked" last_modification_time="Sat, 09 Jul 2005 20:16:27 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkSeparatorToolItem" id="separatortoolitem2"> + <property name="visible">True</property> + <property name="draw">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolItem" id="toolitem2"> + <property name="visible">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + + <child> + <widget class="GtkCheckButton" id="ck_allocated"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Show allocated disk usage instead of apparent size</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Allocated space</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_ck_allocated_toggled" after="yes" last_modification_time="Wed, 07 Sep 2005 11:10:27 GMT"/> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkSeparatorToolItem" id="separatortoolitem4"> + <property name="visible">True</property> + <property name="draw">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="tb_search"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Search for a file</property> + <property name="label" translatable="yes">Search</property> + <property name="use_underline">True</property> + <property name="icon">search.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tb_search_clicked" last_modification_time="Tue, 19 Jul 2005 11:00:42 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="tbstop"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="tooltip" translatable="yes">Stop scanning</property> + <property name="label" translatable="yes">Stop</property> + <property name="use_underline">True</property> + <property name="icon">stop.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + <signal name="clicked" handler="on_tbstop_clicked" last_modification_time="Sat, 09 Jul 2005 16:03:18 GMT"/> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkHBox" id="hbox1"> + <property name="border_width">2</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.300000011921</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkImage" id="busyimage"> + <property name="visible">True</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkNotebook" id="notebook1"> + <property name="border_width">2</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="show_tabs">True</property> + <property name="show_border">True</property> + <property name="tab_pos">GTK_POS_TOP</property> + <property name="scrollable">False</property> + <property name="enable_popup">False</property> + <signal name="switch_page" handler="on_notebook1_switch_page" last_modification_time="Tue, 26 Jul 2005 17:19:00 GMT"/> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTreeView" id="treeview1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">False</property> + <property name="rules_hint">True</property> + <property name="reorderable">False</property> + <property name="enable_search">True</property> + <property name="fixed_height_mode">False</property> + <property name="hover_selection">False</property> + <property name="hover_expand">False</property> + </widget> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes">Directory tree</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolled_search"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTreeView" id="tree_search"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">False</property> + <property name="rules_hint">True</property> + <property name="reorderable">False</property> + <property name="enable_search">True</property> + <property name="fixed_height_mode">False</property> + <property name="hover_selection">False</property> + <property name="hover_expand">False</property> + </widget> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="label" translatable="yes">File search</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkStatusbar" id="statusbar1"> + <property name="visible">True</property> + <property name="has_resize_grip">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> +</widget> + +<widget class="GtkDialog" id="dlg_search"> + <property name="visible">True</property> + <property name="title" translatable="yes">Search for a file</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER</property> + <property name="modal">True</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <property name="has_separator">False</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="cancelbutton1"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-6</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="btn_oksearch"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-find</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame1"> + <property name="border_width">10</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkVBox" id="vbox4"> + <property name="border_width">10</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkRadioButton" id="radio_allfs"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Search the whole filesystem</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_dir"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Search in selected folder</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radio_allfs</property> + <signal name="clicked" handler="on_radio_dir_clicked" last_modification_time="Tue, 19 Jul 2005 14:17:38 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="entry2"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="padding">2</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkExpander" id="expander1"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="expanded">False</property> + <property name="spacing">3</property> + + <child> + <widget class="GtkTable" id="table1"> + <property name="visible">True</property> + <property name="n_rows">4</property> + <property name="n_columns">2</property> + <property name="homogeneous">True</property> + <property name="row_spacing">0</property> + <property name="column_spacing">10</property> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Modification date:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes">Size:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_mod_unk"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Any</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_mod_week"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Last week</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radio_mod_unk</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_mod_month"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Last month</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radio_mod_unk</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_size_unk"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Any</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_size_small"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Small (< 100 kB)</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radio_size_unk</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_size_medium"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Medium (< 1 MB)</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radio_size_unk</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="label" translatable="yes">Advanced</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + + <child> + <widget class="GtkButton" id="btn_select_search"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Select</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Search options:</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Enter a file name to search:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="entry1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox4"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="homogeneous">True</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkRadioButton" id="radio_exact"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Exact matching search</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radio_extended"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Extended search</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radio_exact</property> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">5</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +<widget class="GtkDialog" id="dialog_scan_props"> + <property name="height_request">330</property> + <property name="visible">True</property> + <property name="title" translatable="yes">Scan preferences</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">True</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <property name="has_separator">False</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area2"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="okbutton1"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-close</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-7</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">5</property> + <property name="bottom_padding">5</property> + <property name="left_padding">10</property> + <property name="right_padding">10</property> + + <child> + <widget class="GtkLabel" id="label100"> + <property name="visible">True</property> + <property name="label" translatable="yes">Select devices to be included during system scan</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">19</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property> + + <child> + <widget class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">5</property> + <property name="left_padding">12</property> + <property name="right_padding">12</property> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTreeView" id="tree_view_props"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">True</property> + <property name="rules_hint">True</property> + <property name="reorderable">False</property> + <property name="enable_search">False</property> + <property name="fixed_height_mode">False</property> + <property name="hover_selection">False</property> + <property name="hover_expand">False</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">8</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="check_enable_home"> + <property name="border_width">4</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Enable auto-detect monitoring of home directory</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">8</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +<widget class="GtkWindow" id="graph_win"> + <property name="visible">True</property> + <property name="title" translatable="yes"></property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="default_width">600</property> + <property name="default_height">400</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkVBox" id="vbox6"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkToolbar" id="toolbar2"> + <property name="visible">True</property> + <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> + <property name="toolbar_style">GTK_TOOLBAR_ICONS</property> + <property name="tooltips">True</property> + <property name="show_arrow">True</property> + + <child> + <widget class="GtkToolButton" id="graph_zoom_in"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Zoom in</property> + <property name="stock_id">gtk-zoom-in</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="graph_zoom_100"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Zoom 100%</property> + <property name="stock_id">gtk-zoom-100</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="graph_zoom_out"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Zoom out</property> + <property name="stock_id">gtk-zoom-out</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkSeparatorToolItem" id="separatortoolitem6"> + <property name="visible">True</property> + <property name="draw">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="graph_save"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Take a snapshot</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">True</property> + <property name="icon">shot.png</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkSeparatorToolItem" id="separatortoolitem7"> + <property name="visible">True</property> + <property name="draw">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolItem" id="toolitem4"> + <property name="visible">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + + <child> + <widget class="GtkLabel" id="label101"> + <property name="visible">True</property> + <property name="label" translatable="yes">Depth level:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">11</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolItem" id="toolitem3"> + <property name="visible">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + + <child> + <widget class="GtkSpinButton" id="graph_spin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">False</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">-1 -1 50 1 5 5</property> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="graph_refresh"> + <property name="visible">True</property> + <property name="stock_id">gtk-refresh</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkSeparatorToolItem" id="separatortoolitem8"> + <property name="visible">True</property> + <property name="draw">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolItem" id="toolitem5"> + <property name="visible">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + + <child> + <widget class="GtkLabel" id="label102"> + <property name="visible">True</property> + <property name="label" translatable="yes">Total folders:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">8</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + + <child> + <widget class="GtkToolItem" id="toolitem6"> + <property name="visible">True</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + + <child> + <widget class="GtkEntry" id="graph_total"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + <property name="width_chars">8</property> + </widget> + </child> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="graph_scroll"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + + <child> + <placeholder/> + </child> + + <child> + <widget class="GtkButton" id="graph_close_btn"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-close</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> diff --git a/data/baobab.schemas.in b/data/baobab.schemas.in new file mode 100644 index 0000000..469e164 --- /dev/null +++ b/data/baobab.schemas.in @@ -0,0 +1,56 @@ +<gconfschemafile> + <schemalist> + <schema> + <key>/schemas/apps/baobab/ui/toolbar_visible</key> + <applyto>/apps/baobab/ui/toolbar_visible</applyto> + <owner>baobab</owner> + <type>bool</type> + <default>TRUE</default> + <locale name="C"> + <short>Toolbar is Visible</short> + <long>Whether the toolbar should be visible in main window.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/baobab/ui/statusbar_visible</key> + <applyto>/apps/baobab/ui/statusbar_visible</applyto> + <owner>baobab</owner> + <type>bool</type> + <default>TRUE</default> + <locale name="C"> + <short>Status Bar is Visible</short> + <long>Whether the status bar at the bottom of main window + should be visible.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/baobab/properties/enable_home_monitor</key> + <applyto>/apps/baobab/properties/enable_home_monitor</applyto> + <owner>baobab</owner> + <type>bool</type> + <default>FALSE</default> + <locale name="C"> + <short>Enable monitoring of home directory</short> + <long>Whether any change to the home directory should + be monitored.</long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/baobab/properties/noscan</key> + <applyto>/apps/baobab/properties/noscan</applyto> + <owner>baobab</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Exluded partitions</short> + <long>A list of partitions to be excluded from scanning.</long> + </locale> + </schema> + + </schemalist> +</gconfschemafile> + diff --git a/help/.cvsignore b/help/.cvsignore new file mode 100644 index 0000000..da2d75c --- /dev/null +++ b/help/.cvsignore @@ -0,0 +1,3 @@ +baobab.omf +Makefile +Makefile.in diff --git a/help/C/baobab.xml b/help/C/baobab.xml new file mode 100644 index 0000000..9874bbf --- /dev/null +++ b/help/C/baobab.xml @@ -0,0 +1,128 @@ +<?xml version="1.0"?> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" +"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ + <!ENTITY legal SYSTEM "legal.xml"> + <!ENTITY appversion "2.15"> + <!ENTITY manrevision "1.0"> + <!ENTITY date "April 2006"> + <!ENTITY app "Disk Usage Analyzer"> +]> +<!-- + (Do not remove this comment block.) + Maintained by the GNOME Documentation Project + http://developer.gnome.org/projects/gdp + Template version: 2.0 beta + Template last modified Apr 11, 2002 + +--> +<!-- =============Document Header ============================= --> +<article id="index" lang="en"> +<!-- please do not change the id; for translations, change lang to --> +<!-- appropriate code --> + <articleinfo> + <title>&app; Manual</title> + + <abstract role="description"> + <para>&app; is a graphical, menu-driven viewer that you can + use to view and monitor your disk usage and folder structure.</para> + </abstract> + + <copyright> + <year>2006</year> + <holder>Fabio Marzocca</holder> + </copyright> +<!-- translators: uncomment this: + + <copyright> + <year>2002</year> + <holder>ME-THE-TRANSLATOR (Latin translation)</holder> + </copyright> + + --> + <publisher> + <publishername> GNOME Documentation Project </publishername> + </publisher> + + &legal; + + <authorgroup> + <author> + <firstname>Fabio</firstname> + <surname>Marzocca</surname> + <affiliation> + <orgname>GNOME Documentation Project</orgname> + <address> <email>thesaltydog@gmail.com</email> </address> + </affiliation> + </author> + + <author role="maintainer"> + <firstname>Fabio</firstname> + <surname>Marzocca</surname> + <affiliation> + <address><email>thesaltydog@gmail.com</email></address> + </affiliation> + </author> + +<!-- This is appropriate place for other contributors: translators, + maintainers, etc. Commented out by default. + <othercredit role="translator"> + <firstname>Latin</firstname> + <surname>Translator 1</surname> + <affiliation> + <orgname>Latin Translation Team</orgname> + <address> <email>translator@gnome.org</email> </address> + </affiliation> + <contrib>Latin translation</contrib> + </othercredit> +--> + </authorgroup> + + <revhistory> + <revision> + <revnumber>&app; Manual 1.0</revnumber> + <date>April 2006</date> + <revdescription> + <para role="author">Emmanuele Bassi + <email>ebassi@gmail.com</email> + </para> + <para role="publisher">GNOME Documentation Project</para> + </revdescription> + </revision> + </revhistory> + + <releaseinfo>This manual describes version &appversion; of &app;.</releaseinfo> + + <legalnotice> + <title>Feedback</title> + <para>To report a bug or make a suggestion regarding the &app; application or + this manual, follow the directions in the + <ulink url="ghelp:gnome-feedback" type="help">GNOME Feedback Page</ulink>. + </para> +<!-- Translators may also add here feedback address for translations --> + </legalnotice> + </articleinfo> + + <indexterm> + <primary>Disk Usage Analyser</primary> + </indexterm> + +<!-- ============= Document Body ============================= --> +<!-- ============= Introduction ============================== --> + + <sect1 id="baobab-introduction"> + <title>Introduction</title> + + <para>FIXME</para> + + </sect1> + +<!-- ================ Usage ================================ --> + + <sect1 id="baobab-usage"> + <title>Usage</title> + + <para>FIXME</para> + + </sect1> + +</article> diff --git a/help/C/legal.xml b/help/C/legal.xml new file mode 100644 index 0000000..ac97e1d --- /dev/null +++ b/help/C/legal.xml @@ -0,0 +1,76 @@ + <legalnotice id="legalnotice"> + <para> + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation + License (GFDL), Version 1.1 or any later version published + by the Free Software Foundation with no Invariant Sections, + no Front-Cover Texts, and no Back-Cover Texts. You can find + a copy of the GFDL at this <ulink type="help" + url="ghelp:fdl">link</ulink> or in the file COPYING-DOCS + distributed with this manual. + </para> + <para> This manual is part of a collection of GNOME manuals + distributed under the GFDL. If you want to distribute this + manual separately from the collection, you can do so by + adding a copy of the license to the manual, as described in + section 6 of the license. + </para> + + <para> + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any GNOME documentation, and the members of + the GNOME Documentation Project are made aware of those + trademarks, then the names are in capital letters or initial + capital letters. + </para> + + <para> + DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT ARE PROVIDED + UNDER THE TERMS OF THE GNU FREE DOCUMENTATION LICENSE + WITH THE FURTHER UNDERSTANDING THAT: + + <orderedlist> + <listitem> + <para>DOCUMENT IS PROVIDED ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR + IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES + THAT THE DOCUMENT OR MODIFIED VERSION OF THE + DOCUMENT IS FREE OF DEFECTS MERCHANTABLE, FIT FOR + A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE + RISK AS TO THE QUALITY, ACCURACY, AND PERFORMANCE + OF THE DOCUMENT OR MODIFIED VERSION OF THE + DOCUMENT IS WITH YOU. SHOULD ANY DOCUMENT OR + MODIFIED VERSION PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL WRITER, AUTHOR OR ANY + CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY + SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS + LICENSE. NO USE OF ANY DOCUMENT OR MODIFIED + VERSION OF THE DOCUMENT IS AUTHORIZED HEREUNDER + EXCEPT UNDER THIS DISCLAIMER; AND + </para> + </listitem> + <listitem> + <para>UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL + THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), + CONTRACT, OR OTHERWISE, SHALL THE AUTHOR, + INITIAL WRITER, ANY CONTRIBUTOR, OR ANY + DISTRIBUTOR OF THE DOCUMENT OR MODIFIED VERSION + OF THE DOCUMENT, OR ANY SUPPLIER OF ANY OF SUCH + PARTIES, BE LIABLE TO ANY PERSON FOR ANY + DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER + INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS + OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR + MALFUNCTION, OR ANY AND ALL OTHER DAMAGES OR + LOSSES ARISING OUT OF OR RELATING TO USE OF THE + DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT, + EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF + THE POSSIBILITY OF SUCH DAMAGES. + </para> + </listitem> + </orderedlist> + </para> + </legalnotice> + diff --git a/help/ChangeLog b/help/ChangeLog new file mode 100644 index 0000000..9649f00 --- /dev/null +++ b/help/ChangeLog @@ -0,0 +1,7 @@ +2006-04-23 Emmanuele Bassi <ebassi@cvs.gnome.org> + + * ChangeLog: + * Makefile.am: + * baobab.omf.in: + * C/baobab.xml: + * C/legal.xml: Intial stub for baobab's documentation. diff --git a/help/Makefile.am b/help/Makefile.am new file mode 100644 index 0000000..85b9171 --- /dev/null +++ b/help/Makefile.am @@ -0,0 +1,8 @@ +include $(top_srcdir)/gnome-doc-utils.make +dist-hook: doc-dist-hook + +DOC_MODULE = baobab +DOC_ENTITIES = legal.xml +DOC_INCLUDES = + +DOC_LINGUAS = diff --git a/help/baobab.omf.in b/help/baobab.omf.in new file mode 100644 index 0000000..00b3394 --- /dev/null +++ b/help/baobab.omf.in @@ -0,0 +1,9 @@ +<?xml version="1.0" standalone="no"?> +<omf> + <resource> + <subject category="GNOME|Applications|System Tools"/> + <type>user's guide</type> + <relation seriesid="196f8340-d2c8-11da-9519-df1aa4a99e74"/> + <rights type="GNU FDL" license.version="1.0" holder="Sun Microsystems"/> + </resource> +</omf> diff --git a/pixmaps/.cvsignore b/pixmaps/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/pixmaps/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am new file mode 100644 index 0000000..c4715dc --- /dev/null +++ b/pixmaps/Makefile.am @@ -0,0 +1,38 @@ +icondir = ${datadir}/icons/hicolor/48x48/apps +icon_DATA = baobab.png + +gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor + +install-data-hook: + @-if test -z "$(DESTDIR)"; then \ + echo "Updating Gtk icon cache."; \ + $(gtk_update_icon_cache); \ + else \ + echo "*** Icon cache not updated. After install, run this:"; \ + echo "*** $(gtk_update_icon_cache)"; \ + fi + +imagesdir = $(pkgdatadir)/pixmaps +images_DATA = \ + alfa_sort.png \ + green.png \ + red.png \ + search.png \ + done.png \ + scan_directory.png \ + stop.png \ + baobab.xpm \ + format_numeric.png \ + nautilus.png \ + scan_harddisk.png \ + white.png \ + busy.gif \ + format_percent.png \ + num_sort.png \ + searchall.png \ + shot.png \ + yellow.png + +EXTRA_DIST = \ + $(images_DATA) \ + $(icon_DATA) diff --git a/pixmaps/alfa_sort.png b/pixmaps/alfa_sort.png Binary files differnew file mode 100644 index 0000000..c6403dd --- /dev/null +++ b/pixmaps/alfa_sort.png diff --git a/pixmaps/baobab.png b/pixmaps/baobab.png Binary files differnew file mode 100644 index 0000000..7106b93 --- /dev/null +++ b/pixmaps/baobab.png diff --git a/pixmaps/baobab.xpm b/pixmaps/baobab.xpm new file mode 100644 index 0000000..e848f6d --- /dev/null +++ b/pixmaps/baobab.xpm @@ -0,0 +1,90 @@ +/* XPM */ +static char * gts_xpm[] = { +"32 28 59 1", +" c None", +". c #004500", +"+ c #004300", +"@ c #004400", +"# c #004200", +"$ c #004000", +"% c #004100", +"& c #014000", +"* c #024100", +"= c #034200", +"- c #133A00", +"; c #173800", +"> c #1B3600", +", c #402000", +"' c #093E00", +") c #0F3C00", +"! c #084100", +"~ c #044100", +"{ c #024000", +"] c #123A00", +"^ c #073F00", +"/ c #054000", +"( c #442300", +"_ c #133B00", +": c #014100", +"< c #043F00", +"[ c #053F00", +"} c #452300", +"| c #492500", +"1 c #213800", +"2 c #343000", +"3 c #3C2B00", +"4 c #4A2500", +"5 c #462300", +"6 c #4B2600", +"7 c #4C2600", +"8 c #4E2700", +"9 c #4D2600", +"0 c #492400", +"a c #482400", +"b c #4F2800", +"c c #512900", +"d c #4F2700", +"e c #472400", +"f c #4D2700", +"g c #482800", +"h c #1A3700", +"i c #4C2800", +"j c #492900", +"k c #313100", +"l c #073D00", +"m c #143900", +"n c #293200", +"o c #293300", +"p c #203500", +"q c #263200", +"r c #113900", +"s c #043E00", +"t c #023F00", +" .+@ ", +" @@@#$$$%# ", +" @$$$$$$$$$$$$$$$# ", +" +$$$$$$$$$$$$$$$% ", +" #$$$$$$$$$$$$$$$$+ ", +" #$$$$$$$$$$$$$$$$$%%%# ", +" %$$$$$$$$$$$$$$$$$$$$$$%+ ", +" %$$$$$$$$$$$$$$$$$$$$$$$$%+ ", +" $$$$$$$$$$$$$$$$$$$$$$$$#@. ", +" #$$$$$$$$$$$$$$$$$$$$$$$+ + ", +" +$$$$$$$$%%$&*$$$$$$$$$$$%+$+ ", +" +%$$$$$$#@ =- %$$$$$$$$$$$$$ ", +" %$$$$$#; @+> #$$$$$$$$$$$$# ", +" %$$$$$. , %$' @%$$$$$$$$$$$$%@", +" %$$$$%)!~{$$+ #++#]^#%$$$$$$$+", +" $$$$$+ /$$$$%%@ ( _:$$$$$@", +" %$$$% +$$$<[+ } | %$$% ", +" .%$# @$%123 45 56 %$$# ", +" 4788996 0| %% ", +" abb84cd| ", +" d99776 ", +" e64f7 ", +" 474|6 ", +" 97f90 ", +" 7879g ", +" hi879jk ", +" $lm;nopqrl$ ", +" sst "}; diff --git a/pixmaps/busy.gif b/pixmaps/busy.gif Binary files differnew file mode 100644 index 0000000..d1dc0cf --- /dev/null +++ b/pixmaps/busy.gif diff --git a/pixmaps/done.png b/pixmaps/done.png Binary files differnew file mode 100644 index 0000000..6f3ed30 --- /dev/null +++ b/pixmaps/done.png diff --git a/pixmaps/format_numeric.png b/pixmaps/format_numeric.png Binary files differnew file mode 100644 index 0000000..737db49 --- /dev/null +++ b/pixmaps/format_numeric.png diff --git a/pixmaps/format_percent.png b/pixmaps/format_percent.png Binary files differnew file mode 100644 index 0000000..b1121e3 --- /dev/null +++ b/pixmaps/format_percent.png diff --git a/pixmaps/green.png b/pixmaps/green.png Binary files differnew file mode 100644 index 0000000..6161caf --- /dev/null +++ b/pixmaps/green.png diff --git a/pixmaps/nautilus.png b/pixmaps/nautilus.png Binary files differnew file mode 100644 index 0000000..fe12731 --- /dev/null +++ b/pixmaps/nautilus.png diff --git a/pixmaps/num_sort.png b/pixmaps/num_sort.png Binary files differnew file mode 100644 index 0000000..e348a5a --- /dev/null +++ b/pixmaps/num_sort.png diff --git a/pixmaps/red.png b/pixmaps/red.png Binary files differnew file mode 100644 index 0000000..c4937b4 --- /dev/null +++ b/pixmaps/red.png diff --git a/pixmaps/scan_directory.png b/pixmaps/scan_directory.png Binary files differnew file mode 100644 index 0000000..100b3bb --- /dev/null +++ b/pixmaps/scan_directory.png diff --git a/pixmaps/scan_harddisk.png b/pixmaps/scan_harddisk.png Binary files differnew file mode 100644 index 0000000..6bb2ec6 --- /dev/null +++ b/pixmaps/scan_harddisk.png diff --git a/pixmaps/search.png b/pixmaps/search.png Binary files differnew file mode 100644 index 0000000..904b1a8 --- /dev/null +++ b/pixmaps/search.png diff --git a/pixmaps/searchall.png b/pixmaps/searchall.png Binary files differnew file mode 100644 index 0000000..19efe56 --- /dev/null +++ b/pixmaps/searchall.png diff --git a/pixmaps/shot.png b/pixmaps/shot.png Binary files differnew file mode 100644 index 0000000..271ad11 --- /dev/null +++ b/pixmaps/shot.png diff --git a/pixmaps/stop.png b/pixmaps/stop.png Binary files differnew file mode 100644 index 0000000..89c2124 --- /dev/null +++ b/pixmaps/stop.png diff --git a/pixmaps/white.png b/pixmaps/white.png Binary files differnew file mode 100644 index 0000000..4b59db6 --- /dev/null +++ b/pixmaps/white.png diff --git a/pixmaps/yellow.png b/pixmaps/yellow.png Binary files differnew file mode 100644 index 0000000..c8032b9 --- /dev/null +++ b/pixmaps/yellow.png diff --git a/src/.cvsignore b/src/.cvsignore new file mode 100644 index 0000000..b3a6fd7 --- /dev/null +++ b/src/.cvsignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +baobab diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..965c286 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,54 @@ +## Process this file with automake to produce Makefile.in + +NULL = + +INCLUDES = \ + -DPREFIX=\""$(prefix)"\" \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DPKGDATADIR=\""$(datadir)/baobab"\" \ + -DUIDATADIR=\""$(datadir)/gnome-2.0/ui"\" \ + -DBAOBAB_DATA_DIR=\""$(datadir)"\" \ + -DBAOBAB_PIX_DIR=\""$(datadir)/baobab/pixmaps/"\" \ + -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ + $(NULL) + +bin_PROGRAMS = baobab + +baobab_SOURCES = \ + baobab.c \ + baobab.h \ + baobab-graphwin.c \ + baobab-graphwin.h \ + baobab-scan.c \ + baobab-scan.h \ + baobab-treeview.c \ + baobab-treeview.h \ + baobab-utils.c \ + baobab-utils.h \ + callbacks.c \ + callbacks.h \ + baobab-prefs.c \ + baobab-prefs.h \ + baobab-tree-map.c \ + baobab-tree-map.h \ + baobab-remote-connect-dialog.c \ + baobab-remote-connect-dialog.h + +baobab_CFLAGS = \ + $(GNOME_UTILS_CFLAGS) \ + $(GNOMEVFS_CFLAGS) \ + $(LIBGLADE_CFLAGS) \ + $(GNOMECANVAS_CFLAGS) \ + $(LIBGTOP_CFLAGS) \ + $(NULL) + +baobab_LDFLAGS = -export-dynamic +baobab_LDADD = \ + $(GNOME_UTILS_LIBS) \ + $(GNOMEVFS_LIBS) \ + $(LIBGLADE_LIBS) \ + $(GNOMECANVAS_LIBS) \ + $(LIBGTOP_LIBS) \ + $(NULL) diff --git a/src/baobab-graphwin.c b/src/baobab-graphwin.c new file mode 100644 index 0000000..681e864 --- /dev/null +++ b/src/baobab-graphwin.c @@ -0,0 +1,368 @@ +/* + * baobab-graphwin.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include <config.h> + +#include <glib.h> +#include <gtk/gtk.h> +#include <glib/gi18n.h> +#include <glade/glade-xml.h> +#include <libgnomevfs/gnome-vfs.h> +#include <libgnomevfs/gnome-vfs-mime.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> + +#include "baobab.h" +#include "baobab-graphwin.h" +#include "baobab-utils.h" +#include "callbacks.h" +#include "baobab-tree-map.h" + +struct _BaobabTreemapWindow { + /* GUI elements */ + GtkWidget *win_graph; + BaobabTreeMap *treemap; + GtkWidget *sw; + GtkWidget *quit_btn; + GtkWidget *shot_btn; + GtkWidget *zoom_in_btn; + GtkWidget *zoom_out_btn; + GtkWidget *zoom_100_btn; + GtkWidget *refresh_btn; + GtkWidget *depth_spin; + GtkWidget *entry_total; + GtkTreePath *path; +}; + +typedef struct _BaobabTreemapWindow BaobabTreemapWindow; + +static void +quit_canvas (GtkWidget *widget, BaobabTreemapWindow *tm) +{ + gtk_widget_destroy (tm->win_graph); + gtk_tree_path_free (tm->path); + g_free (tm); +} + +static void +zoom_in_cb (GtkWidget *widget, BaobabTreemapWindow *tm) +{ + gdouble d = baobab_tree_map_get_zoom (tm->treemap); + baobab_tree_map_set_zoom (tm->treemap, d + 0.5); +} + +static void +zoom_out_cb (GtkWidget *widget, BaobabTreemapWindow *tm) +{ + gdouble d = baobab_tree_map_get_zoom (tm->treemap); + if (d <= 0.5) + return; + baobab_tree_map_set_zoom (tm->treemap, d - 0.5); +} + +static void +zoom_100_cb (GtkWidget *widget, BaobabTreemapWindow *tm) +{ + baobab_tree_map_set_zoom (tm->treemap, 1.0); +} + +static gint +tm_popupmenu (GtkWidget *widget, GdkEventButton *event, + BaobabTreemapWindow *tm) +{ + GtkWidget *pmenu, *open, *zoom_in, *zoom_100, *zoom_out; + const gchar *selected_item; + + if (event->button != 3) + return FALSE; + + if (baobab.selected_path) { + g_free (baobab.selected_path); + baobab.selected_path = NULL; + } + + pmenu = gtk_menu_new (); + open = gtk_image_menu_item_new_from_stock ("gtk-open", NULL); + zoom_in = gtk_image_menu_item_new_from_stock ("gtk-zoom-in", NULL); + zoom_100 = gtk_image_menu_item_new_from_stock ("gtk-zoom-100", NULL); + zoom_out = gtk_image_menu_item_new_from_stock ("gtk-zoom-out", NULL); + + /* get folder name */ + selected_item = baobab_tree_map_get_selected_item_name (tm->treemap); + baobab.selected_path = g_strdup (selected_item); + + g_signal_connect (open, "activate", + G_CALLBACK (open_file_cb), NULL); + g_signal_connect (zoom_in, "activate", + G_CALLBACK (zoom_in_cb), tm); + g_signal_connect (zoom_100, "activate", + G_CALLBACK (zoom_100_cb), tm); + g_signal_connect (zoom_out, "activate", + G_CALLBACK (zoom_out_cb), tm); + + if (baobab.selected_path) { + gtk_container_add (GTK_CONTAINER (pmenu), open); + gtk_widget_show (open); + gtk_container_add (GTK_CONTAINER (pmenu), zoom_in); + gtk_widget_show (zoom_in); + gtk_container_add (GTK_CONTAINER (pmenu), zoom_100); + gtk_widget_show (zoom_100); + gtk_container_add (GTK_CONTAINER (pmenu), zoom_out); + gtk_widget_show (zoom_out); + + gtk_menu_popup (GTK_MENU (pmenu), + NULL, NULL, NULL, NULL, + event->button, event->time); + } + + return FALSE; +} + +static void +graph_save_cb (GtkWidget *widget, BaobabTreemapWindow *tm) +{ + GdkPixbuf *map_pixbuf; + GtkWidget *fs_dlg; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *opt_menu; + gchar *sel_type; + + map_pixbuf = baobab_tree_map_get_pixbuf (tm->treemap); + + if (!map_pixbuf) { + GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (tm->win_graph), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Cannot create pixbuf image!")); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + return; + } + + fs_dlg = gtk_file_chooser_dialog_new (_("Save the screenshot"), + GTK_WINDOW (tm->win_graph), + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE_AS, + GTK_RESPONSE_ACCEPT, NULL); + + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fs_dlg), + g_get_home_dir ()); + +#if GTK_CHECK_VERSION(2,8,0) + gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fs_dlg), TRUE); +#endif + + /* extra widget */ + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 0); + gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (fs_dlg), vbox); + + hbox = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 6); + + gtk_box_pack_start (GTK_BOX (hbox), + gtk_label_new (_("Image type:")), + FALSE, FALSE, 0); + + opt_menu = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (opt_menu), "jpeg"); + gtk_combo_box_append_text (GTK_COMBO_BOX (opt_menu), "png"); + gtk_combo_box_append_text (GTK_COMBO_BOX (opt_menu), "bmp"); + gtk_combo_box_set_active (GTK_COMBO_BOX (opt_menu), 0); + gtk_box_pack_start (GTK_BOX (hbox), opt_menu, FALSE, FALSE, 12); + + gtk_widget_show_all (vbox); + + if (gtk_dialog_run (GTK_DIALOG (fs_dlg)) == GTK_RESPONSE_ACCEPT) { + gchar *filename; + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fs_dlg)); + sel_type = gtk_combo_box_get_active_text (GTK_COMBO_BOX (opt_menu)); + gdk_pixbuf_save (map_pixbuf, filename, sel_type, NULL, NULL); + + g_free (filename); + g_free (sel_type); + } + + gtk_widget_destroy (fs_dlg); + g_object_unref (map_pixbuf); +} + +static void +tm_spin_changed (GtkSpinButton *spinbutton, BaobabTreemapWindow *tm) +{ + gint value; + + value = gtk_spin_button_get_value_as_int (spinbutton); + if (value == -1) + gtk_entry_set_text (GTK_ENTRY (spinbutton), + _("Unlimited")); +} + +static void +tm_refresh (GtkWidget *widget, BaobabTreemapWindow *tm) +{ + gint value; + gint tot; + gchar *total; + GdkCursor *cursor = NULL; + + /* change the cursor */ + if (tm->win_graph->window) { + cursor = gdk_cursor_new (GDK_WATCH); + gdk_window_set_cursor (tm->win_graph->window, cursor); + } + + value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (tm->depth_spin)); + baobab_tree_map_refresh (tm->treemap, value); + + tot = baobab_tree_map_get_total_elements (tm-> treemap); + total = g_strdup_printf ("%d", tot); + gtk_entry_set_text (GTK_ENTRY (tm->entry_total), total); + g_free (total); + + /* cursor clean up */ + if (tm->win_graph->window) { + gdk_window_set_cursor (tm->win_graph->window, NULL); + if (cursor) + gdk_cursor_unref (cursor); + } +} + +void +baobab_graphwin_create (GtkTreeModel *mdl, + const gchar *path_to_string, + gchar *gladepath, + gint nFolderNameCol, + gint nAllocSizeCol, + gint required_depth) +{ + GladeXML *graph_xml; + gint tot; + gchar *total, *dir; + GtkTreeIter iter; + gchar *title; + GdkCursor *cursor = NULL; + BaobabTreemapWindow *bb_tm = NULL; + + bb_tm = g_new0 (BaobabTreemapWindow, 1); + if (!bb_tm) { + GtkWidget *dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Cannot allocate memory for graphical window!")); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + return; + } + + /* Get the path & folder name */ + bb_tm->path = gtk_tree_path_new_from_string (path_to_string); + gtk_tree_model_get_iter (mdl, &iter, bb_tm->path); + gtk_tree_model_get (mdl, &iter, nFolderNameCol, &dir, -1); + + /* Glade stuff */ + graph_xml = glade_xml_new (gladepath, "graph_win", NULL); + glade_xml_signal_autoconnect (graph_xml); + bb_tm->win_graph = glade_xml_get_widget (graph_xml, "graph_win"); + bb_tm->sw = glade_xml_get_widget (graph_xml, "graph_scroll"); + bb_tm->quit_btn = glade_xml_get_widget (graph_xml, "graph_close_btn"); + bb_tm->shot_btn = glade_xml_get_widget (graph_xml, "graph_save"); + bb_tm->zoom_in_btn = glade_xml_get_widget (graph_xml, "graph_zoom_in"); + bb_tm->zoom_100_btn = glade_xml_get_widget (graph_xml, "graph_zoom_100"); + bb_tm->zoom_out_btn = glade_xml_get_widget (graph_xml, "graph_zoom_out"); + bb_tm->refresh_btn = glade_xml_get_widget (graph_xml, "graph_refresh"); + bb_tm->depth_spin = glade_xml_get_widget (graph_xml, "graph_spin"); + bb_tm->entry_total = glade_xml_get_widget (graph_xml, "graph_total"); + + g_object_unref (graph_xml); + + /* Main treemap window */ + title = g_strdup_printf ("%s %s", _("Graphical map for folder:"), dir); + gtk_window_set_title (GTK_WINDOW (bb_tm->win_graph), title); + g_free (title); + + gtk_window_maximize (GTK_WINDOW (bb_tm->win_graph)); + + gtk_editable_set_editable (GTK_EDITABLE (bb_tm->depth_spin), FALSE); + gtk_entry_set_width_chars (GTK_ENTRY (bb_tm->depth_spin), 11); + if (required_depth == -1) + gtk_entry_set_text (GTK_ENTRY (bb_tm->depth_spin), + _("Unlimited")); + + /* The treemap */ + bb_tm->treemap = baobab_tree_map_new (); + gtk_container_add (GTK_CONTAINER (bb_tm->sw), + GTK_WIDGET (bb_tm->treemap)); + gtk_widget_show_all (bb_tm->win_graph); + + /* connect signals */ + g_signal_connect (bb_tm->quit_btn, "clicked", + G_CALLBACK (quit_canvas), bb_tm); + g_signal_connect (bb_tm->shot_btn, "clicked", + G_CALLBACK (graph_save_cb), bb_tm); + g_signal_connect (bb_tm->zoom_in_btn, "clicked", + G_CALLBACK (zoom_in_cb), bb_tm); + g_signal_connect (bb_tm->zoom_100_btn, "clicked", + G_CALLBACK (zoom_100_cb), bb_tm); + g_signal_connect (bb_tm->zoom_out_btn, "clicked", + G_CALLBACK (zoom_out_cb), bb_tm); + g_signal_connect (bb_tm->depth_spin, "value-changed", + G_CALLBACK (tm_spin_changed), bb_tm); + g_signal_connect (bb_tm->refresh_btn, "clicked", + G_CALLBACK (tm_refresh), bb_tm); + g_signal_connect (bb_tm->treemap, "button-press-event", + G_CALLBACK (tm_popupmenu), bb_tm); + + /* change the cursor */ + if (bb_tm->win_graph->window) { + cursor = gdk_cursor_new (GDK_WATCH); + gdk_window_set_cursor (bb_tm->win_graph->window, cursor); + } + + /* Draw the treemap */ + baobab_tree_map_draw (bb_tm->treemap, + mdl, + bb_tm->path, + nFolderNameCol, + nAllocSizeCol, required_depth); + + /* set the total folders entry */ + tot = baobab_tree_map_get_total_elements (bb_tm->treemap); + total = g_strdup_printf ("%d", tot); + gtk_entry_set_text (GTK_ENTRY (bb_tm->entry_total), total); + g_free (total); + + /* cursor clean up */ + if (bb_tm->win_graph->window) { + gdk_window_set_cursor (bb_tm->win_graph->window, NULL); + if (cursor) + gdk_cursor_unref (cursor); + } + + g_free (dir); +} + diff --git a/src/baobab-graphwin.h b/src/baobab-graphwin.h new file mode 100644 index 0000000..99f7d42 --- /dev/null +++ b/src/baobab-graphwin.h @@ -0,0 +1,33 @@ +/* + * baobab-graphwin.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __BAOBAB_GRAPHWIN_H__ +#define __BAOBAB_GRAPHWIN_H__ + +void baobab_graphwin_create (GtkTreeModel *mdl, + const gchar *path_to_string, + gchar *gladepath, + gint nFolderNameCol, + gint nAllocSizeCol, + gint required_depth); + +#endif /* __BAOBAB_GRAPHWIN_H__ */ diff --git a/src/baobab-prefs.c b/src/baobab-prefs.c new file mode 100644 index 0000000..efd04e9 --- /dev/null +++ b/src/baobab-prefs.c @@ -0,0 +1,314 @@ +/* + * baobab-prefs.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + + +#include <config.h> + +#include <string.h> +#include <gtk/gtk.h> +#include <glib/gi18n.h> +#include <gconf/gconf-client.h> +#include <glibtop/mountlist.h> + +#include "baobab.h" +#include "baobab-utils.h" +#include "baobab-prefs.h" + + +static gboolean props_changed; + +static GtkTreeView *tree_props; +static GtkListStore *model_props; +static GtkListStore *create_props_model (void); +static GtkWidget *create_tree_props (GladeXML *); +static void fill_props_model (GtkWidget *); +static void check_toggled (GtkCellRendererToggle * cell, + gchar * path_str, gpointer data); + +static void read_gconf (void); +static void save_gconf (void); +static gboolean set_gconf_list (GtkTreeModel * model, GtkTreePath * path, + GtkTreeIter * iter, gpointer data); + +static gboolean set_model_checks (GtkTreeModel * model, GtkTreePath * path, + GtkTreeIter * iter, gpointer data); + +static void enable_home_cb (GtkToggleButton * togglebutton, + gpointer user_data); + + +void +props_notify (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) +{ + g_slist_foreach (baobab.bbExcludedDirs, (GFunc) g_free, NULL); + g_slist_free (baobab.bbExcludedDirs); + + baobab.bbExcludedDirs = + gconf_client_get_list (client, PROPS_SCAN_KEY, + GCONF_VALUE_STRING, NULL); + + baobab_get_filesystem (&g_fs); + set_label_scan (&g_fs); + if (get_NB_page () == VIEW_TREE) + show_label (VIEW_TREE); + gtk_tree_store_clear (baobab.model); + first_row (); +} + +void +create_props (void) +{ + GtkWidget *dlg, *check_enablehome; + GladeXML *dlg_xml; + + props_changed = FALSE; + + /* Glade stuff */ + dlg_xml = glade_xml_new (BAOBAB_GLADE_FILE, + "dialog_scan_props", NULL); + glade_xml_signal_autoconnect (dlg_xml); + dlg = glade_xml_get_widget (dlg_xml, "dialog_scan_props"); + + gtk_window_set_transient_for (GTK_WINDOW (dlg), + GTK_WINDOW (baobab.window)); + + tree_props = (GtkTreeView *) create_tree_props (dlg_xml); + fill_props_model (dlg); + read_gconf (); + + check_enablehome = glade_xml_get_widget (dlg_xml, "check_enable_home"); + gtk_toggle_button_set_active ((GtkToggleButton *) check_enablehome, + baobab.bbEnableHomeMonitor); + + g_signal_connect_after ((GtkToggleButton *) check_enablehome, + "toggled", G_CALLBACK (enable_home_cb), + NULL); + + if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_CLOSE) { + if (props_changed) + save_gconf (); + } + + g_object_unref (dlg_xml); + gtk_widget_destroy (dlg); +} + +GtkListStore * +create_props_model (void) +{ + GtkListStore *mdl; + + mdl = gtk_list_store_new (TOT_COLUMNS, + G_TYPE_BOOLEAN, /* checkbox */ + G_TYPE_STRING, /* device */ + G_TYPE_STRING /* mount point */ + ); + + return mdl; +} + +GtkWidget * +create_tree_props (GladeXML *dlg_xml) +{ + GtkCellRenderer *cell; + GtkTreeViewColumn *col; + GtkWidget *tvw; + + tvw = glade_xml_get_widget (dlg_xml, "tree_view_props"); + + /* checkbox column */ + cell = gtk_cell_renderer_toggle_new (); + g_signal_connect (cell, "toggled", + G_CALLBACK (check_toggled), NULL); + + col = gtk_tree_view_column_new_with_attributes (_("Scan"), cell, + "active", COL_CHECK, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* First text column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (_("Device"), cell, + "markup", COL_DEVICE, + "text", COL_DEVICE, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* second text column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (_("Mount point"), + cell, "markup", + COL_MOUNT, "text", + COL_MOUNT, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + model_props = create_props_model (); + gtk_tree_view_set_model (GTK_TREE_VIEW (tvw), + GTK_TREE_MODEL (model_props)); + g_object_unref (model_props); + + return tvw; +} + +void +check_toggled (GtkCellRendererToggle *cell, + gchar *path_str, + gpointer data) +{ + GtkTreeIter iter; + GtkTreePath *path = gtk_tree_path_new_from_string (path_str); + gboolean toggle; + gchar *mountpoint; + + /* get toggled iter */ + gtk_tree_model_get_iter ((GtkTreeModel *) model_props, &iter, + path); + gtk_tree_model_get ((GtkTreeModel *) model_props, &iter, COL_CHECK, + &toggle, COL_MOUNT, &mountpoint, -1); + + /* check if root dir */ + if (strcmp ("/", mountpoint) == 0) + goto clean_up; + + /* set new value */ + props_changed = TRUE; + toggle ^= 1; + gtk_list_store_set (GTK_LIST_STORE (model_props), &iter, COL_CHECK, + toggle, -1); + + clean_up: + g_free (mountpoint); + gtk_tree_path_free (path); +} + +void +fill_props_model (GtkWidget *dlg) +{ + GtkTreeIter iter; + guint lo; + glibtop_mountlist mountlist; + glibtop_mountentry *mountentry, *mountentry_tofree; + + mountentry_tofree = glibtop_get_mountlist (&mountlist, 0); + + for (lo = 0, mountentry = mountentry_tofree; lo < mountlist.number; + lo++, mountentry++) { + gtk_list_store_append (model_props, &iter); + gtk_list_store_set (model_props, &iter, + COL_CHECK, TRUE, + COL_DEVICE, + mountentry->devname, COL_MOUNT, + mountentry->mountdir, + -1); + } + + g_free (mountentry_tofree); +} + +void +read_gconf (void) +{ + GSList *l; + + l = gconf_client_get_list (baobab.gconf_client, PROPS_SCAN_KEY, + GCONF_VALUE_STRING, NULL); + + if (!l) + return; + + gtk_tree_model_foreach (GTK_TREE_MODEL (model_props), + set_model_checks, l); + + g_slist_foreach (l, (GFunc) g_free, NULL); + g_slist_free (l); +} + +void +save_gconf (void) +{ + GSList *l = NULL; + + l = g_slist_append (l, "START"); + gtk_tree_model_foreach (GTK_TREE_MODEL (model_props), + set_gconf_list, l); + l = g_slist_remove (l, "START"); + gconf_client_set_list (baobab.gconf_client, + PROPS_SCAN_KEY, GCONF_VALUE_STRING, + l, NULL); + + g_slist_foreach (l, (GFunc) g_free, NULL); + g_slist_free (l); +} + +gboolean +set_gconf_list (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer list) +{ + gchar *mount; + gboolean check; + + gtk_tree_model_get (model, iter, COL_MOUNT, &mount, COL_CHECK, + &check, -1); + + /* add only un-checked mount points */ + if (!check) { + list = g_slist_last (list); + list = g_slist_append (list, mount); + } + + /* g_free(mount); //freed in save_gconf() */ + return FALSE; +} + +gboolean +set_model_checks (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer list) +{ + gchar *mount; + + gtk_tree_model_get (model, iter, COL_MOUNT, &mount, -1); + + if (g_slist_find_custom (list, mount, list_find) != NULL) + gtk_list_store_set ((GtkListStore *) model, iter, + COL_CHECK, FALSE, -1); + + g_free (mount); + + return FALSE; +} + +void +enable_home_cb (GtkToggleButton *togglebutton, gpointer user_data) +{ + baobab.bbEnableHomeMonitor = gtk_toggle_button_get_active (togglebutton); + + gconf_client_set_bool (baobab.gconf_client, PROPS_ENABLE_HOME_MONITOR, + baobab.bbEnableHomeMonitor, NULL); + +} diff --git a/src/baobab-prefs.h b/src/baobab-prefs.h new file mode 100644 index 0000000..16efcff --- /dev/null +++ b/src/baobab-prefs.h @@ -0,0 +1,42 @@ +/* + * baobab-prefs.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __BAOBAB_PROPS_H__ +#define __BAOBAB_PROPS_H__ + +/* props model columns */ +enum +{ + COL_CHECK, + COL_DEVICE, + COL_MOUNT, + TOT_COLUMNS +}; + +void props_notify (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data); + +void create_props (void); + +#endif /* __BAOBAB_PROPS_H__ */ diff --git a/src/baobab-remote-connect-dialog.c b/src/baobab-remote-connect-dialog.c new file mode 100644 index 0000000..7b2d137 --- /dev/null +++ b/src/baobab-remote-connect-dialog.c @@ -0,0 +1,758 @@ +/* Baobab - (C) 2005 Fabio Marzocca + + baobab-remote-connect-dialog.c + + Modified module from nautilus-connect-server-dialog.c + Released under same licence + */ +/* + * Nautilus + * + * Copyright (C) 2003 Red Hat, Inc. + * + * Nautilus is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * Nautilus is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; see the file COPYING. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include <config.h> +#include "baobab-remote-connect-dialog.h" + +#include <string.h> + +#include <libgnomevfs/gnome-vfs-utils.h> +#include <libgnomevfs/gnome-vfs-volume.h> +#include <glib/gi18n.h> +#include <gtk/gtk.h> + +#include "baobab.h" + +struct _BaobabRemoteConnectDialogDetails { + + GtkWidget *table; + + GtkWidget *type_combo; + GtkWidget *uri_entry; + GtkWidget *server_entry; + GtkWidget *share_entry; + GtkWidget *port_entry; + GtkWidget *folder_entry; + GtkWidget *domain_entry; + GtkWidget *user_entry; + + GtkWidget *name_entry; +}; + +static void baobab_remote_connect_dialog_class_init (BaobabRemoteConnectDialogClass *class); +static void baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog); + +#define RESPONSE_CONNECT GTK_RESPONSE_OK +/* +enum { + + RESPONSE_CONNECT +}; +*/ + +/* Keep this order in sync with strings below */ +enum { + TYPE_SSH, + TYPE_ANON_FTP, + TYPE_FTP, + TYPE_SMB, + TYPE_DAV, + TYPE_DAVS, + TYPE_URI +}; + +G_DEFINE_TYPE(BaobabRemoteConnectDialog, baobab_remote_connect_dialog, GTK_TYPE_DIALOG) + +static void +baobab_remote_connect_dialog_finalize (GObject *object) +{ + BaobabRemoteConnectDialog *dialog; + + dialog = BAOBAB_REMOTE_CONNECT_DIALOG(object); + + g_object_unref (dialog->details->uri_entry); + g_object_unref (dialog->details->server_entry); + g_object_unref (dialog->details->share_entry); + g_object_unref (dialog->details->port_entry); + g_object_unref (dialog->details->folder_entry); + g_object_unref (dialog->details->domain_entry); + g_object_unref (dialog->details->user_entry); + g_object_unref (dialog->details->name_entry); + + g_free (dialog->details); + + G_OBJECT_CLASS (baobab_remote_connect_dialog_parent_class)->finalize (object); +} + + +static gboolean +remote_connect (BaobabRemoteConnectDialog *dialog) +{ + char *uri; + char *user_uri; + GnomeVFSURI *vfs_uri; + char *error_message; + char *name; + int type; + + type = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->details->type_combo)); + + if (type == TYPE_URI) { + user_uri = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->uri_entry), 0, -1); + uri = gnome_vfs_make_uri_from_input (user_uri); + g_free (user_uri); + + vfs_uri = gnome_vfs_uri_new (uri); + + if (vfs_uri == NULL) { + GtkWidget *dlg; + + error_message = g_strdup_printf (_("\"%s\" is not a valid location."), uri); + + dlg = gtk_message_dialog_new (GTK_WINDOW (dialog), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + error_message); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), + _("Please check the spelling and try again.")); + + g_free(error_message); + + gtk_dialog_run (GTK_DIALOG (dlg)); + gtk_widget_destroy (dlg); + + return FALSE; + } + else { + gnome_vfs_uri_unref (vfs_uri); + } + } + else { + char *method, *user, *port, *initial_path, *server, *folder, *domain; + char *t, *join; + gboolean free_initial_path, free_user, free_domain, free_port; + + server = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->server_entry), 0, -1); + if (strlen (server) == 0) { + GtkWidget *dlg; + + dlg = gtk_message_dialog_new (GTK_WINDOW (dialog), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("You must enter a name for the server.")); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), + _("Please enter a name and try again.")); + + g_free(server); + + gtk_dialog_run (GTK_DIALOG (dlg)); + gtk_widget_destroy (dlg); + + return FALSE; + } + + method = ""; + user = ""; + port = ""; + initial_path = ""; + domain = ""; + free_initial_path = FALSE; + free_user = FALSE; + free_domain = FALSE; + free_port = FALSE; + switch (type) { + case TYPE_SSH: + method = "sftp"; + break; + case TYPE_ANON_FTP: + method = "ftp"; + user = "anonymous"; + break; + case TYPE_FTP: + method = "ftp"; + break; + case TYPE_SMB: + method = "smb"; + t = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->share_entry), 0, -1); + initial_path = g_strconcat ("/", t, NULL); + free_initial_path = TRUE; + g_free (t); + break; + case TYPE_DAV: + method = "dav"; + break; + case TYPE_DAVS: + method = "davs"; + break; + } + + if (dialog->details->port_entry->parent != NULL) { + free_port = TRUE; + port = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->port_entry), 0, -1); + } + folder = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->folder_entry), 0, -1); + if (dialog->details->user_entry->parent != NULL) { + free_user = TRUE; + + t = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->user_entry), 0, -1); + + user = gnome_vfs_escape_string (t); + + g_free (t); + } + if (dialog->details->domain_entry->parent != NULL) { + free_domain = TRUE; + + domain = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->domain_entry), 0, -1); + + if (strlen (domain) != 0) { + t = user; + + user = g_strconcat (domain , ";" , t, NULL); + + if (free_user) { + g_free (t); + } + + free_user = TRUE; + } + } + + if (folder[0] != 0 && + folder[0] != '/') { + join = "/"; + } else { + join = ""; + } + + t = folder; + folder = g_strconcat (initial_path, join, t, NULL); + g_free (t); + + t = folder; + folder = gnome_vfs_escape_path_string (t); + g_free (t); + + uri = g_strdup_printf ("%s://%s%s%s%s%s%s", + method, + user, (user[0] != 0) ? "@" : "", + server, + (port[0] != 0) ? ":" : "", port, + folder); + + if (free_initial_path) { + g_free (initial_path); + } + g_free (server); + if (free_port) { + g_free (port); + } + g_free (folder); + if (free_user) { + g_free (user); + } + if (free_domain) { + g_free (domain); + } + } + + name = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->name_entry), 0, -1); + if (strlen (name) == 0) { + const char *host, *path; + char *path_utf8, *basename; + + g_free (name); + + vfs_uri = gnome_vfs_uri_new (uri); + + if (vfs_uri == NULL) { + g_warning ("Illegal uri in connect to server!\n"); + g_free (uri); + g_free (name); + return FALSE; + } + + host = gnome_vfs_uri_get_host_name (vfs_uri); + path = gnome_vfs_uri_get_path (vfs_uri); + if (path != NULL && + strlen (path) > 0 && + strcmp (path, "/") != 0) { + path_utf8 = gnome_vfs_format_uri_for_display (uri); + basename = g_path_get_basename (path_utf8); + name = g_strdup_printf (_("%s on %s"), basename, host); + g_free (path_utf8); + g_free (basename); + } else { + name = g_strdup (host); + } + gnome_vfs_uri_unref (vfs_uri); + } + + g_string_assign(baobab.last_scan_command,uri); + + g_free (uri); + g_free (name); + + return TRUE; +} + +static void +response_callback (BaobabRemoteConnectDialog *dialog, + int response_id, + gpointer data) +{ + switch (response_id) { + case RESPONSE_CONNECT: + if (!remote_connect (dialog)) + g_signal_stop_emission_by_name (dialog, "response"); + break; + case GTK_RESPONSE_NONE: + case GTK_RESPONSE_DELETE_EVENT: + case GTK_RESPONSE_CANCEL: + + break; + default : + g_assert_not_reached (); + } +} + +static void +baobab_remote_connect_dialog_class_init (BaobabRemoteConnectDialogClass *class) +{ + GObjectClass *gobject_class; + + + gobject_class = G_OBJECT_CLASS (class); + gobject_class->finalize = baobab_remote_connect_dialog_finalize; + + +} + +static void +setup_for_type (BaobabRemoteConnectDialog *dialog) +{ + int type, i; + gboolean show_share, show_port, show_user, show_domain; + GtkWidget *label, *table; + + type = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->details->type_combo)); + + if (dialog->details->uri_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->uri_entry); + } + if (dialog->details->server_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->server_entry); + } + if (dialog->details->share_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->share_entry); + } + if (dialog->details->port_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->port_entry); + } + if (dialog->details->folder_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->folder_entry); + } + if (dialog->details->user_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->user_entry); + } + if (dialog->details->domain_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->domain_entry); + } + if (dialog->details->name_entry->parent != NULL) { + gtk_container_remove (GTK_CONTAINER (dialog->details->table), + dialog->details->name_entry); + } + /* Destroy all labels */ + gtk_container_foreach (GTK_CONTAINER (dialog->details->table), + (GtkCallback) gtk_widget_destroy, NULL); + + + i = 1; + table = dialog->details->table; + + if (type == TYPE_URI) { + label = gtk_label_new_with_mnemonic (_("_Location (URI):")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->uri_entry); + gtk_widget_show (dialog->details->uri_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->uri_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + + return; + } + + switch (type) { + default: + case TYPE_SSH: + case TYPE_FTP: + case TYPE_DAV: + case TYPE_DAVS: + show_share = FALSE; + show_port = TRUE; + show_user = TRUE; + show_domain = FALSE; + break; + case TYPE_ANON_FTP: + show_share = FALSE; + show_port = TRUE; + show_user = FALSE; + show_domain = FALSE; + break; + case TYPE_SMB: + show_share = TRUE; + show_port = FALSE; + show_user = TRUE; + show_domain =TRUE; + break; + } + + label = gtk_label_new_with_mnemonic (_("_Server:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->server_entry); + gtk_widget_show (dialog->details->server_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->server_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + + label = gtk_label_new (_("Optional information:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 2, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + i++; + + if (show_share) { + label = gtk_label_new_with_mnemonic (_("_Share:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->share_entry); + gtk_widget_show (dialog->details->share_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->share_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + } + + if (show_port) { + label = gtk_label_new_with_mnemonic (_("_Port:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->port_entry); + gtk_widget_show (dialog->details->port_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->port_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + } + + label = gtk_label_new_with_mnemonic (_("_Folder:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->folder_entry); + gtk_widget_show (dialog->details->folder_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->folder_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + + if (show_user) { + label = gtk_label_new_with_mnemonic (_("_User Name:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->user_entry); + gtk_widget_show (dialog->details->user_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->user_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + } + + if (show_domain) { + label = gtk_label_new_with_mnemonic (_("_Domain Name:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, + i, i+1, + GTK_FILL, GTK_FILL, + 0, 0); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->domain_entry); + gtk_widget_show (dialog->details->domain_entry); + gtk_table_attach (GTK_TABLE (table), dialog->details->domain_entry, + 1, 2, + i, i+1, + GTK_FILL | GTK_EXPAND, GTK_FILL, + 0, 0); + + i++; + } + + +} + +static void +combo_changed_callback (GtkComboBox *combo_box, + BaobabRemoteConnectDialog *dialog) +{ + setup_for_type (dialog); +} + + +static void +port_insert_text (GtkEditable *editable, + const gchar *new_text, + gint new_text_length, + gint *position) +{ + if (new_text_length < 0) { + new_text_length = strlen (new_text); + } + + if (new_text_length != 1 || + !g_ascii_isdigit (new_text[0])) { + gdk_display_beep (gtk_widget_get_display (GTK_WIDGET (editable))); + g_signal_stop_emission_by_name (editable, "insert_text"); + } +} + + +static void +baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) +{ + GtkWidget *label; + GtkWidget *table; + GtkWidget *combo; + GtkWidget *hbox; + GtkWidget *vbox; + + dialog->details = g_new0 (BaobabRemoteConnectDialogDetails, 1); + + gtk_window_set_title (GTK_WINDOW (dialog), _("Connect to a remote folder")); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); + gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); + + vbox = gtk_vbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + vbox, FALSE, TRUE, 0); + gtk_widget_show (vbox); + + hbox = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (vbox), + hbox, FALSE, TRUE, 0); + gtk_widget_show (hbox); + + label = gtk_label_new_with_mnemonic (_("Service _type:")); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), + label, FALSE, FALSE, 0); + + dialog->details->type_combo = combo = gtk_combo_box_new_text (); + /* Keep this in sync with enum */ + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("SSH")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("Public FTP")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("FTP (with login)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("Windows share")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("WebDAV (HTTP)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("Secure WebDAV (HTTPS)")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + _("Custom Location")); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), TYPE_ANON_FTP); + gtk_widget_show (combo); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo); + gtk_box_pack_start (GTK_BOX (hbox), + combo, TRUE, TRUE, 0); + g_signal_connect (combo, "changed", + G_CALLBACK (combo_changed_callback), + dialog); + + + hbox = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (vbox), + hbox, FALSE, TRUE, 0); + gtk_widget_show (hbox); + + label = gtk_label_new_with_mnemonic (" "); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), + label, FALSE, FALSE, 0); + + + dialog->details->table = table = gtk_table_new (5, 2, FALSE); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_table_set_col_spacings (GTK_TABLE (table), 12); + gtk_widget_show (table); + gtk_box_pack_start (GTK_BOX (hbox), + table, TRUE, TRUE, 0); + + //dialog->details->uri_entry = nautilus_location_entry_new (); + dialog->details->uri_entry = gtk_entry_new(); + dialog->details->server_entry = gtk_entry_new (); + dialog->details->share_entry = gtk_entry_new (); + dialog->details->port_entry = gtk_entry_new (); + g_signal_connect (dialog->details->port_entry, "insert_text", G_CALLBACK (port_insert_text), + NULL); + dialog->details->folder_entry = gtk_entry_new (); + dialog->details->domain_entry = gtk_entry_new (); + dialog->details->user_entry = gtk_entry_new (); + dialog->details->name_entry = gtk_entry_new (); + /* We need an extra ref so we can remove them from the table */ + g_object_ref (dialog->details->uri_entry); + g_object_ref (dialog->details->server_entry); + g_object_ref (dialog->details->share_entry); + g_object_ref (dialog->details->port_entry); + g_object_ref (dialog->details->folder_entry); + g_object_ref (dialog->details->domain_entry); + g_object_ref (dialog->details->user_entry); + g_object_ref (dialog->details->name_entry); + + setup_for_type (dialog); + + gtk_dialog_add_button (GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL); + gtk_dialog_add_button (GTK_DIALOG (dialog), + _("C_onnect"), + RESPONSE_CONNECT); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), + RESPONSE_CONNECT); + + g_signal_connect (dialog, "response", + G_CALLBACK (response_callback), + dialog); + + +} + +GtkWidget * +baobab_remote_connect_dialog_new (GtkWindow *window, const gchar *location) +{ + BaobabRemoteConnectDialog *conndlg; + GtkWidget *dialog; + GnomeVFSURI *uri; + + dialog = gtk_widget_new (BAOBAB_TYPE_REMOTE_CONNECT_DIALOG, NULL); + + if (window) { + conndlg = BAOBAB_REMOTE_CONNECT_DIALOG(dialog); + + gtk_window_set_screen (GTK_WINDOW (dialog), + gtk_window_get_screen (GTK_WINDOW (window))); + + if (location) { + uri = gnome_vfs_uri_new (location); + g_return_val_if_fail (uri != NULL, dialog); + + /* ... and if it's a remote URI, then load as the default */ + if (!g_str_equal (gnome_vfs_uri_get_scheme (uri), "file") && + !gnome_vfs_uri_is_local (uri)) { + + gtk_combo_box_set_active (GTK_COMBO_BOX (conndlg->details->type_combo), TYPE_URI); + gtk_entry_set_text (GTK_ENTRY (conndlg->details->uri_entry), location); + } +; + gnome_vfs_uri_unref (uri); + } + } + + return dialog; +} diff --git a/src/baobab-remote-connect-dialog.h b/src/baobab-remote-connect-dialog.h new file mode 100644 index 0000000..8f9246b --- /dev/null +++ b/src/baobab-remote-connect-dialog.h @@ -0,0 +1,62 @@ +/* Baobab - (C) 2005 Fabio Marzocca + + baobab-remote-connect-dialog.h + + Modified module from BaobabRemoteConnectDialog.h + Released under same licence + */ + +/* + * Nautilus + * + * Copyright (C) 2003 Red Hat, Inc. + * + * Nautilus is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * Nautilus is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; see the file COPYING. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef BAOBAB_REMOTE_CONNECT_DIALOG_H +#define BAOBAB_REMOTE_CONNECT_DIALOG_H + +#include <gtk/gtkdialog.h> + + +#define BAOBAB_TYPE_REMOTE_CONNECT_DIALOG (baobab_remote_connect_dialog_get_type()) +#define BAOBAB_REMOTE_CONNECT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAOBAB_TYPE_REMOTE_CONNECT_DIALOG, BaobabRemoteConnectDialog)) +#define BAOBAB_REMOTE_CONNECT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAOBAB_TYPE_REMOTE_CONNECT_DIALOG, BaobabRemoteConnectDialogClass)) +#define BAOBAB_IS_REMOTE_CONNECT_DIALOG(obj) (G_TYPE_INSTANCE_CHECK_TYPE ((obj), BAOBAB_TYPE_REMOTE_CONNECT_DIALOG) + +typedef struct _BaobabRemoteConnectDialog BaobabRemoteConnectDialog; +typedef struct _BaobabRemoteConnectDialogClass BaobabRemoteConnectDialogClass; +typedef struct _BaobabRemoteConnectDialogDetails BaobabRemoteConnectDialogDetails; + +struct _BaobabRemoteConnectDialog { + GtkDialog parent; + BaobabRemoteConnectDialogDetails *details; +}; + +struct _BaobabRemoteConnectDialogClass { + GtkDialogClass parent_class; +}; + +GType baobab_remote_connect_dialog_get_type (void); +GtkWidget* baobab_remote_connect_dialog_new (GtkWindow *window, + const gchar *uri); + +/* Private internal calls */ + + + +#endif /* BAOBAB_REMOTE_CONNECT_DIALOG_H */ diff --git a/src/baobab-scan.c b/src/baobab-scan.c new file mode 100644 index 0000000..9f1190e --- /dev/null +++ b/src/baobab-scan.c @@ -0,0 +1,363 @@ +/* + * baobab-scan.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + + +#include <config.h> + +#include <glib.h> + +#include <string.h> +#include <time.h> +#include <pwd.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <gtk/gtk.h> +#include <libgnomevfs/gnome-vfs.h> +#include <glib/gstdio.h> +#include <fnmatch.h> + +#include "baobab.h" +#include "baobab-scan.h" + + +struct allsizes { + GnomeVFSFileSize size; + GnomeVFSFileSize alloc_size; +}; + +struct _baobab_hardlinks_array { + /* Array of GnomeFileInfo * + as long as we're optimistic about hardlinks count + over the whole system (250 files with st_nlink > 1 here), + we keep linear search. + + TODO: get real timings about this code. find out the average + number of files with st_nlink > 1 on average computer. + + MAYBE: store only { inode, dev } instead of full struct stat. + I don't know if dev_t and ino_t are standard enough so i guess + i would be safier to store both as guint64. + On my ppc : + - dev_t is 8 bytes + - ino_t is 4 bytes + - struct stat is 88 bytes + + MAYBE: turn into a hashtable or tree for faster lookups. + Would use st_ino or (st_ino and st_dev) for hash + and use st_ino and st_dev for equality. + Again, as we don't know the sizeof of these st_*, i don't + think using g_direct_hash / g_direct_equal / boxing st_something + into a void* would be safe. + + EDIT: /me stupid. I realize that this code was not called that often + 1 call per file with st_nlink > 1. BUT, i'm using pdumpfs to backup + my /etc. pdumpfs massively uses hard links. So there are more than + 5000 files with st_nlink > 1. I believe this is the worst case. + */ + + GArray *inodes; +}; + +baobab_hardlinks_array * +baobab_hardlinks_array_create (void) +{ + baobab_hardlinks_array *array; + + array = g_new (baobab_hardlinks_array, 1); + array->inodes = g_array_new (FALSE, FALSE, sizeof (GnomeVFSFileInfo)); + + return array; +} + +gboolean +baobab_hardlinks_array_has (baobab_hardlinks_array *a, + GnomeVFSFileInfo *s) +{ + guint i; + + for (i = 0; i < a->inodes->len; ++i) { + GnomeVFSFileInfo *cur = &g_array_index (a->inodes, GnomeVFSFileInfo, i); + + /* + * cur->st_dev == s->st_dev is the common case and may be more + * expansive than cur->st_ino == s->st_ino + * so keep this order */ + if (cur->inode == s->inode && cur->device == s->device) + return TRUE; + } + + return FALSE; +} + +void +baobab_hardlinks_array_add (baobab_hardlinks_array *a, + GnomeVFSFileInfo *s) +{ + /* FIXME: maybe slow check */ + g_assert (!baobab_hardlinks_array_has (a, s)); + g_array_append_val (a->inodes, *s); +} + +void +baobab_hardlinks_array_free (baobab_hardlinks_array *a) +{ + /* + g_print("HL len was %u (size %u)\n", + a->inodes->len, + (unsigned) a->inodes->len * sizeof(struct stat)); + */ + g_array_free (a->inodes, TRUE); + g_free (a); +} + +static void +loopsearch (GnomeVFSURI *vfs_uri_dir, const gchar *search) +{ + GList *file_list, *l; + gchar *dir; + struct BaobabSearchRet bbret; + GnomeVFSResult result; + GnomeVFSURI *new_uri; + + dir = gnome_vfs_uri_to_string (vfs_uri_dir, GNOME_VFS_URI_HIDE_NONE); + + if (is_excluded_dir (dir)) + return; + + /* get the GnomeVFSFileInfo stuct for every directory entry */ + result = gnome_vfs_directory_list_load (&file_list, dir, GNOME_VFS_FILE_INFO_GET_MIME_TYPE); + g_free (dir); + + while (gtk_events_pending ()) + gtk_main_iteration (); + + if (result == GNOME_VFS_OK) { + for (l = file_list; l != NULL; l = l->next) { + GnomeVFSFileInfo *info = l->data; + + if (baobab.STOP_SCANNING) { + gnome_vfs_file_info_list_free (file_list); + return; + } + + if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) == 0) + continue; + + if (strcmp (info->name, ".") == 0 || + strcmp (info->name, "..") == 0) + continue; + + new_uri = gnome_vfs_uri_append_file_name (vfs_uri_dir, info->name); + dir = gnome_vfs_uri_to_string (new_uri, GNOME_VFS_URI_HIDE_NONE); + + if (fnmatch (search, info->name, FNM_PATHNAME | FNM_PERIOD) == 0) { + gchar *string_to_display; + + string_to_display = gnome_vfs_format_uri_for_display (dir); + bbret.fullpath = string_to_display; + bbret.size = info->size; + bbret.lastacc = info->mtime; + bbret.owner = info->uid; + bbret.alloc_size = info->block_count * 512; + bbret.mime_type = info->mime_type; + fill_search_model (&bbret); + g_free (string_to_display); + } + + /* is a directory? */ + if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY && + !bbSearchOpt.dont_recurse_dir) { + if (strcmp (gnome_vfs_uri_get_path (vfs_uri_dir), "/proc") != 0) + loopsearch (new_uri, search); + } + + gnome_vfs_uri_unref (new_uri); + g_free (dir); + } + + gnome_vfs_file_info_list_free (file_list); + } +} + +static struct allsizes +loopdir (GnomeVFSURI *vfs_uri_dir, + guint count, + baobab_hardlinks_array *hla) +{ + GList *file_list, *l; + guint64 tempHLsize; + gint elements; + struct chan_data data; + struct allsizes retloop; + struct allsizes temp; + GnomeVFSResult result; + gchar *dir, *string_to_display; + GnomeVFSURI *new_uri; + GnomeVFSFileInfo *dir_info; + + count++; + elements = 0; + tempHLsize = 0; + retloop.size = 0; + retloop.alloc_size = 0; + + dir = gnome_vfs_uri_to_string (vfs_uri_dir, GNOME_VFS_URI_HIDE_NONE); + + if (!baobab.is_local) + string_to_display = gnome_vfs_unescape_string_for_display (dir); + else + string_to_display = gnome_vfs_format_uri_for_display (dir); + + if (is_excluded_dir (dir)) + goto exit; + + if (strcmp (gnome_vfs_uri_get_path (vfs_uri_dir), "/proc") == 0) + goto exit; + + /* prefill the model */ + data.size = 1; + data.alloc_size = 1; + data.depth = count - 1; + data.elements = -1; + data.dir = string_to_display; + data.tempHLsize = tempHLsize; + fill_model (&data); + + /* get the directory-entry sizes */ + dir_info = gnome_vfs_file_info_new (); + gnome_vfs_get_file_info (dir, dir_info, + GNOME_VFS_FILE_INFO_DEFAULT); + if ((dir_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) + retloop.size = dir_info->size; + if ((dir_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT) != 0) + retloop.alloc_size = dir_info->block_count * dir_info->io_block_size; + gnome_vfs_file_info_unref (dir_info); + + /* get the GnomeVFSFileInfo stuct for every directory entry */ + result = gnome_vfs_directory_list_load (&file_list, + dir, + GNOME_VFS_FILE_INFO_DEFAULT); + + if (result == GNOME_VFS_OK) { + for (l = file_list; l != NULL; l = l->next) { + GnomeVFSFileInfo *info = l->data; + + if (baobab.STOP_SCANNING) { + gnome_vfs_file_info_list_free (file_list); + goto exit; + } + + if (strcmp (info->name, ".") == 0 || + strcmp (info->name, "..") == 0) + continue; + + if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) == 0) { + gnome_vfs_file_info_list_free (file_list); + goto exit; + } + + /* is a symlink? */ + if (info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) + continue; + + /* is a directory? */ + if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) { + new_uri = gnome_vfs_uri_append_file_name (vfs_uri_dir, info->name); + temp = loopdir (new_uri, count, hla); + retloop.size += temp.size; + retloop.alloc_size += temp.alloc_size; + elements++; + gnome_vfs_uri_unref (new_uri); + } + + else if (info->type == GNOME_VFS_FILE_TYPE_REGULAR) { + + /* check for hard links only on local files */ + if (GNOME_VFS_FILE_INFO_LOCAL (info)) { + if (info->link_count > 1) { + + if (baobab_hardlinks_array_has (hla, info)) { + tempHLsize += (info->block_count * + info->io_block_size); + continue; + } + else { + baobab_hardlinks_array_add (hla, info); + } + } + } + + if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT) != 0) + retloop.alloc_size += (info->block_count * 512); + + retloop.size += info->size; + elements++; + } + } + + gnome_vfs_file_info_list_free (file_list); + } + + data.dir = string_to_display; + data.size = retloop.size; + data.alloc_size = retloop.alloc_size; + data.depth = count - 1; + data.elements = elements; + data.tempHLsize = tempHLsize; + fill_model (&data); + + exit: + g_free (dir); + g_free (string_to_display); + + return retloop; +} + +void +getDir (const gchar *uri_dir) +{ + baobab_hardlinks_array *hla; + GnomeVFSURI *vfs_uri; + + if (is_excluded_dir (uri_dir)) + return; + + hla = baobab_hardlinks_array_create (); + + vfs_uri = gnome_vfs_uri_new (uri_dir); + + loopdir (vfs_uri, 0, hla); + + baobab_hardlinks_array_free (hla); + gnome_vfs_uri_unref (vfs_uri); +} + +void +searchDir (const gchar *uri_dir, const gchar *search) +{ + GnomeVFSURI *vfs_uri; + + vfs_uri = gnome_vfs_uri_new (uri_dir); + loopsearch (vfs_uri, search); + + gnome_vfs_uri_unref (vfs_uri); +} diff --git a/src/baobab-scan.h b/src/baobab-scan.h new file mode 100644 index 0000000..45a4ef3 --- /dev/null +++ b/src/baobab-scan.h @@ -0,0 +1,43 @@ +/* + * baobab-scan.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __BBTHREAD_H__ +#define __BBTHREAD_H__ + +#include <glib/gtypes.h> +#include <libgnomevfs/gnome-vfs.h> +#include <sys/types.h> + +void getDir (const gchar *); +void searchDir (const gchar *, const gchar *); + +/* hardlinks handling */ + +typedef struct _baobab_hardlinks_array baobab_hardlinks_array; + +baobab_hardlinks_array * baobab_hardlinks_array_create (void); +gboolean baobab_hardlinks_array_has (baobab_hardlinks_array *, GnomeVFSFileInfo *); +void baobab_hardlinks_array_add (baobab_hardlinks_array *, GnomeVFSFileInfo *); +void baobab_hardlinks_array_free (baobab_hardlinks_array *); + + +#endif /* __BBTHREAD_H__ */ diff --git a/src/baobab-tree-map.c b/src/baobab-tree-map.c new file mode 100644 index 0000000..eeae66d --- /dev/null +++ b/src/baobab-tree-map.c @@ -0,0 +1,364 @@ +/* + **************************************************************************
+ * baobab-tree-map.c
+ *
+ * Copyright 2005-2006 Fabio Marzocca <thesaltydog@gmail.com>
+ *
+ *
+ * Draw a graphical treemap from a hierarchical data structure
+ * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA
+ *************************************************************************** + */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "baobab-tree-map.h"
+ +struct _rect_coords { + gdouble x1; + gdouble y1; + gdouble x2; + gdouble y2; +}; + +typedef struct _rect_coords rect_coords;
+
+#define BAOBAB_TREE_MAP_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ BAOBAB_TYPE_TREE_MAP, BaobabTreeMapPrivate))
+
+
+struct _BaobabTreeMapPrivate
+{
+ GtkTooltips *tooltips;
+ GnomeCanvasGroup *group;
+ GtkTreeModel *model;
+ gint COL_FOLDERNAME;
+ gint COL_SIZE;
+ gint req_depth;
+ gint total_elements;
+ GtkTreePath *first_path; + gchar *item_name;
+};
+
+G_DEFINE_TYPE(BaobabTreeMap, baobab_tree_map, GNOME_TYPE_CANVAS)
+
+static void
+baobab_tree_map_finalize (GObject *object)
+{
+ BaobabTreeMap *treemap = BAOBAB_TREE_MAP(object);
+
+ g_object_unref (treemap->priv->tooltips);
+
+ G_OBJECT_CLASS (baobab_tree_map_parent_class)->finalize (object);
+}
+
+static void
+baobab_tree_map_class_init (BaobabTreeMapClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = baobab_tree_map_finalize;
+
+ g_type_class_add_private (object_class, sizeof (BaobabTreeMapPrivate));
+}
+
+static gint
+item_event (GtkWidget *item,
+ GdkEventButton *event,
+ BaobabTreeMap *tm)
+{
+ switch (event->button) {
+ case 1:
+ case 3:
+ {
+ /* get item name */ + GtkTooltipsData * t_data = gtk_tooltips_data_get(item); + if (t_data) tm->priv->item_name = t_data->tip_text;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+static void
+setup_widget_item (BaobabTreeMap *tm,
+ GnomeCanvasItem *item)
+{
+ GtkWidget *widget = ((GnomeCanvasWidget *)item)->widget;
+
+ g_signal_connect (widget,
+ "button-press-event",
+ G_CALLBACK (item_event),
+ tm);
+}
+
+static void
+draw_rect (BaobabTreeMap *tm,
+ const rect_coords *R,
+ guint color,
+ gchar *tip)
+{
+ gnome_canvas_item_new (tm->priv->group,
+ gnome_canvas_rect_get_type(),
+ "x1", R->x1,
+ "y1", R->y1,
+ "x2", R->x2,
+ "y2", R->y2,
+ "fill_color_rgba", color,
+ "outline_color_rgba", 200,
+ "width_pixels", 0,
+ NULL);
+
+ tm->priv->total_elements++;
+
+ /* setup the event box for tooltips */
+ if ((R->x2-R->x1)< 1.5 || (R->y2-R->y1)< 1.5)
+ return;
+
+ GtkWidget * widget = gtk_event_box_new ();
+ gtk_event_box_set_visible_window ((GtkEventBox*)widget, FALSE);
+ gtk_tooltips_set_tip (tm->priv->tooltips, widget, tip, NULL);
+
+ setup_widget_item(tm,gnome_canvas_item_new (tm->priv->group,
+ gnome_canvas_widget_get_type(),
+ "x", R->x1,
+ "y", R->y1,
+ "width", R->x2-R->x1,
+ "height", R->y2-R->y1,
+ "widget", widget,
+ NULL));
+
+ gtk_widget_show(widget);
+}
+
+static void
+loop_treemap (BaobabTreeMap *tm,
+ GtkTreeIter anc_iter,
+ guint64 anc_size,
+ rect_coords *R,
+ gboolean b_horiz,
+ gint cur_depth)
+{
+ gchar *name;
+ gdouble ratio;
+ guint64 cur_size;
+ GtkTreeIter cur_iter;
+ rect_coords cur_R;
+
+ if (tm->priv->req_depth > -1)
+ if (cur_depth > tm->priv->req_depth)
+ return;
+
+ cur_R.x1 = R->x1;
+ cur_R.y1 = R->y1;
+ cur_R.x2 = R->x2;
+ cur_R.y2 = R->y2;
+
+ gtk_tree_model_iter_children(tm->priv->model,&cur_iter,&anc_iter);
+ do {
+ gtk_tree_model_get(tm->priv->model,&cur_iter,tm->priv->COL_FOLDERNAME,&name,-1);
+ gtk_tree_model_get(tm->priv->model,&cur_iter,tm->priv->COL_SIZE,&cur_size,-1);
+ if (cur_size == 0 || anc_size ==0) {
+ g_free(name);
+ continue;
+ }
+ ratio = (gdouble)cur_size/(gdouble)anc_size;
+
+ /* check if rect is horiz or vert */
+ if (!b_horiz) {
+ cur_R.x2 = (R->x2-R->x1)*ratio+cur_R.x1;
+ }
+ else {
+ cur_R.y2 = (R->y2-R->y1)*ratio+cur_R.y1;
+ }
+
+ draw_rect(tm,(const rect_coords *)&cur_R,g_random_int(),name);
+
+ /* recurse if iter has child */
+ if (gtk_tree_model_iter_has_child(tm->priv->model,&cur_iter)) {
+ gtk_tree_model_get(tm->priv->model,
+ &cur_iter,
+ tm->priv->COL_SIZE,
+ &cur_size,
+ -1);
+ loop_treemap(tm, cur_iter,cur_size,&cur_R,!b_horiz, cur_depth+1);
+ }
+
+ /* set up new rect for next child (sibling)*/
+ if (!b_horiz) {
+ cur_R.x1 = cur_R.x2;
+ cur_R.x2 = R->x2;
+ }
+ else {
+ cur_R.y1 = cur_R.y2;
+ cur_R.y2 = R->y2;
+ }
+ g_free(name);
+ } while (gtk_tree_model_iter_next(tm->priv->model,&cur_iter));
+}
+
+
+
+static void
+baobab_tree_map_init (BaobabTreeMap *treemap)
+{
+ + treemap->priv = BAOBAB_TREE_MAP_GET_PRIVATE (treemap);
+
+ treemap->priv->tooltips = gtk_tooltips_new ();
+ g_object_ref (treemap->priv->tooltips);
+ gtk_object_sink (GTK_OBJECT(treemap->priv->tooltips));
+
+}
+
+/************** Start of public functions *****************************/
+void
+baobab_tree_map_draw (BaobabTreeMap *tm,
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ gint nNameCol,
+ gint nSizeCol,
+ gint required_depth)
+{
+ GtkTreeIter iter;
+ gchar *name;
+ gboolean b_horiz;
+ guint64 size;
+ rect_coords R;
+ + tm->priv->model = model;
+ tm->priv->first_path = path;
+ tm->priv->COL_FOLDERNAME = nNameCol;
+ tm->priv->COL_SIZE = nSizeCol;
+ tm->priv->req_depth = required_depth;
+ tm->priv->item_name = NULL;
+
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (tm), &R.x1, &R.y1, &R.x2, &R.y2);
+ baobab_tree_map_clear (tm);
+
+ gtk_tree_model_get_iter (tm->priv->model, &iter,tm->priv->first_path);
+ gtk_tree_model_get(tm->priv->model,&iter,tm->priv->COL_FOLDERNAME,&name,-1);
+ + /* how to draw the rectangle */
+ b_horiz = ((R.y2-R.y1) >= (R.x2-R.x1)); +
+ draw_rect (tm, (const rect_coords *)&R, g_random_int(), name);
+
+ if (gtk_tree_model_iter_has_child(tm->priv->model,&iter)) {
+ gtk_tree_model_get(tm->priv->model,&iter,tm->priv->COL_SIZE,&size,-1);
+ loop_treemap(tm,iter,size,&R,b_horiz,1);
+ }
+
+ g_free(name);
+} + +void +baobab_tree_map_refresh(BaobabTreeMap *tm, gint new_depth) +{ + baobab_tree_map_draw (tm, tm->priv->model, + tm->priv->first_path, + tm->priv->COL_FOLDERNAME, + tm->priv->COL_SIZE, + new_depth); +} + +
+gint
+baobab_tree_map_get_total_elements (BaobabTreeMap *tm)
+{
+ return tm->priv->total_elements;
+}
+
+void
+baobab_tree_map_clear (BaobabTreeMap *tm)
+{
+ GList *a, *b;
+
+ a = tm->priv->group->item_list;
+ while (a)
+ {
+ b = a->next;
+ gtk_object_destroy (GTK_OBJECT (a->data));
+ a = b;
+ }
+
+ tm->priv->total_elements = 0;
+}
+
+GdkPixbuf *
+baobab_tree_map_get_pixbuf (BaobabTreeMap *tm)
+{
+ gint w,h;
+ GdkPixbuf *map_pixbuf;
+ + gdk_drawable_get_size ((GTK_WIDGET(tm))->window, &w, &h);
+ map_pixbuf = gdk_pixbuf_get_from_drawable(NULL,
+ GTK_WIDGET (tm)->window,
+ gdk_colormap_get_system(),
+ 0, 0,
+ 0, 0,
+ w, h); + + return map_pixbuf;
+}
+
+gdouble
+baobab_tree_map_get_zoom (BaobabTreeMap *tm)
+{
+ return GNOME_CANVAS (tm)->pixels_per_unit;
+}
+
+void
+baobab_tree_map_set_zoom (BaobabTreeMap *tm,
+ gdouble new_zoom)
+{
+ gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (tm), new_zoom);
+}
+ +const gchar * +baobab_tree_map_get_selected_item_name(BaobabTreeMap *tm) +{ + return (const gchar *)tm->priv->item_name; +} + +
+BaobabTreeMap *
+baobab_tree_map_new (void)
+{ + BaobabTreeMap * tm; + gint screen_w, screen_h;
+ + tm = g_object_new (BAOBAB_TYPE_TREE_MAP, "aa", TRUE, NULL); + + screen_w = gdk_screen_get_width (gdk_screen_get_default());
+ screen_h = gdk_screen_get_height (gdk_screen_get_default()) * 0.83;
+ gnome_canvas_set_scroll_region (GNOME_CANVAS (tm), 0.0, 0.0, screen_w, screen_h);
+ gnome_canvas_set_center_scroll_region (GNOME_CANVAS (tm), TRUE);
+ tm->priv->group = gnome_canvas_root (GNOME_CANVAS (tm)); + + return tm;
+}
+
diff --git a/src/baobab-tree-map.h b/src/baobab-tree-map.h new file mode 100644 index 0000000..424eb16 --- /dev/null +++ b/src/baobab-tree-map.h @@ -0,0 +1,98 @@ +/* + **************************************************************************
+ * baobab-treemap.h
+ *
+ * Copyright 2005 Fabio Marzocca <thesaltydog@gmail.com>
+ *
+ *
+ * Draw a graphical treemap from a hierarchical data structure
+ * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA
+ *************************************************************************** + */ + +#ifndef __BAOBAB_TREE_MAP_H__ +#define __BAOBAB_TREE_MAP_H__ + +#include <libgnomecanvas/gnome-canvas.h>
+#include <libgnomecanvas/libgnomecanvas.h>
+ + +G_BEGIN_DECLS +/* + * Type checking and casting macros + */ +#define BAOBAB_TYPE_TREE_MAP (baobab_tree_map_get_type()) +#define BAOBAB_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), BAOBAB_TYPE_TREE_MAP, BaobabTreeMap)) +#define BAOBAB_TREE_MAP_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), BAOBAB_TREE_MAP, BaobabTreeMap const)) +#define BAOBAB_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), BAOBAB_TREE_MAP, BaobabTreeMapClass)) +#define BAOBAB_IS_TREE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), BAOBAB_TYPE_TREE_MAP)) +#define BAOBAB_IS_TREE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BAOBAB_TYPE_TREE_MAP)) +#define BAOBAB_TREE_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), BAOBAB_TYPE_TREE_MAP, BaobabTreeMapClass)) + + +/* Private structure type */ +typedef struct _BaobabTreeMapPrivate BaobabTreeMapPrivate; + +/* + * Main object structure + */ +typedef struct _BaobabTreeMap BaobabTreeMap; + +struct _BaobabTreeMap +{ + + GnomeCanvas parent; + + /*< private > */ + BaobabTreeMapPrivate *priv; +}; + +/* + * Class definition + */ +typedef struct _BaobabTreeMapClass BaobabTreeMapClass; + +struct _BaobabTreeMapClass +{ + GnomeCanvasClass parent_class; +}; + + +/* + * Public methods + */ +GType baobab_tree_map_get_type (void) G_GNUC_CONST; + +BaobabTreeMap *baobab_tree_map_new (void); +void baobab_tree_map_clear (BaobabTreeMap *tm); +gint baobab_tree_map_get_total_elements (BaobabTreeMap *tm); +void baobab_tree_map_set_zoom (BaobabTreeMap *tm, gdouble new_zoom); +gdouble baobab_tree_map_get_zoom (BaobabTreeMap *tm); +GdkPixbuf *baobab_tree_map_get_pixbuf (BaobabTreeMap *tm); +const gchar *baobab_tree_map_get_selected_item_name (BaobabTreeMap *tm); +void baobab_tree_map_refresh (BaobabTreeMap *tm, gint new_depth); +void baobab_tree_map_draw (BaobabTreeMap *tm,
+ GtkTreeModel *model,
+ GtkTreePath *path,
+ gint nNameCol,
+ gint nSizeCol,
+ gint required_depth); +G_END_DECLS + + + +#endif /* __BAOBAB_TREE_MAP_H__ */ diff --git a/src/baobab-treeview.c b/src/baobab-treeview.c new file mode 100644 index 0000000..6858cb1 --- /dev/null +++ b/src/baobab-treeview.c @@ -0,0 +1,324 @@ +/* + * baobab-treeview.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include <config.h> + +#include <gtk/gtk.h> +#include <glib/gi18n.h> +#include <string.h> + +#include "baobab.h" +#include "baobab-treeview.h" +#include "baobab-utils.h" +#include "callbacks.h" + +static GtkTreeStore * +create_model (void) +{ + GtkTreeStore *mdl = gtk_tree_store_new (NUM_TREE_COLUMNS, + G_TYPE_STRING, /* COL_DIR_NAME */ + G_TYPE_STRING, /* COL_H_FULLPATH */ + GDK_TYPE_PIXBUF,/* COL_BAR */ + G_TYPE_FLOAT, /* COL_H_PERC */ + G_TYPE_STRING, /* COL_DIR_SIZE */ + G_TYPE_UINT64, /* COL_H_SIZE */ + G_TYPE_STRING, /* COL_PERC */ + G_TYPE_UINT64, /* COL_H_ALLOCSIZE */ + G_TYPE_STRING, /* COL_ELEMENTS */ + G_TYPE_INT, /* COL_H_ELEMENTS */ + G_TYPE_STRING, /* COL_HARDLINK */ + G_TYPE_UINT64 /* COL_H_HARDLINK */ + ); + + /* Defaults to sort-by-size */ + gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) mdl, + COL_H_SIZE, + GTK_SORT_DESCENDING); + + return mdl; +} + +static GtkListStore * +create_search_model (void) +{ + GtkListStore *mdl; + GtkTreeIter iter; + + mdl = gtk_list_store_new (NUM_COLUMNS, + GDK_TYPE_PIXBUF, /* icon */ + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, /* fullpath */ + G_TYPE_LONG, /* last access */ + G_TYPE_DOUBLE, /* size */ + G_TYPE_STRING, /* filetype */ + G_TYPE_UINT /* owner id (gushort) */ + ); + + gtk_list_store_append (mdl, &iter); + gtk_list_store_set (mdl, &iter, + COL1_STRING, " ", COL_FULLPATH, "", -1); + gtk_list_store_append (mdl, &iter); + gtk_list_store_set (mdl, &iter, + COL1_STRING, + _("<i>Use Menu->Actions->Search for a file, " + "or the search toolbar button.</i>"), + COL_FULLPATH, "", -1); + + /* Defaults to sort-by-size */ + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (mdl), + COL_SIZE, + GTK_SORT_DESCENDING); + + return mdl; +} + +static void +on_tv_row_expanded (GtkTreeView *treeview, + GtkTreeIter *arg1, + GtkTreePath *arg2, + gpointer data) +{ + gtk_tree_view_columns_autosize (treeview); +} + +static void +on_tv_cur_changed (GtkTreeView *treeview, gpointer data) +{ + + GtkTreeIter iter; + gchar *text = NULL; + + gtk_tree_selection_get_selected (gtk_tree_view_get_selection (treeview), NULL, &iter); + + if (get_NB_page () == VIEW_TREE) { + if (gtk_tree_store_iter_is_valid (baobab.model, &iter)) { + gtk_tree_model_get (GTK_TREE_MODEL (baobab.model), &iter, + COL_H_FULLPATH, &text, -1); + } + } + else if (get_NB_page () == VIEW_SEARCH) { + if (gtk_list_store_iter_is_valid (baobab.model_search, &iter)) { + gtk_tree_model_get (GTK_TREE_MODEL (baobab.model_search), + &iter, COL_FULLPATH, &text, -1); + } + } + + set_glade_widget_sens("menu_treemap",FALSE); + if (text) { + gchar *msg; + + /* make sure it is utf8 */ + msg = g_filename_display_name (text); + + set_statusbar (msg); + if (get_NB_page () == VIEW_TREE && strcmp (text, "") != 0 ) + set_glade_widget_sens("menu_treemap",TRUE); + + g_free (msg); + g_free (text); + } +} + +static gboolean +on_tv_button_press (GtkWidget *widget, + GdkEventButton *event, + gpointer data) +{ + if (get_NB_page () == VIEW_TREE) { + if (baobab.CONTENTS_CHANGED_DELAYED) { + baobab.CONTENTS_CHANGED_DELAYED = FALSE; + if (baobab.STOP_SCANNING) { + contents_changed (); + } + } + } + + GtkTreePath *path; + GtkTreeIter iter; + + gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), + event->x, event->y, + &path, NULL, NULL, NULL); + if (!path) + return TRUE; + + /* check if a valid and scanned folder has been selected */ + if (get_NB_page () == VIEW_TREE) { + if (baobab.selected_path) { + g_free (baobab.selected_path); + baobab.selected_path = NULL; + } + + gtk_tree_model_get_iter (GTK_TREE_MODEL (baobab.model), &iter, + path); + gtk_tree_model_get (GTK_TREE_MODEL (baobab.model), &iter, + COL_H_FULLPATH, &baobab.selected_path, -1); + + if (strcmp (baobab.selected_path, "") == 0) { + set_glade_widget_sens("menu_treemap",FALSE); + gtk_tree_path_free (path); + return FALSE; + } + } + + if (get_NB_page () == VIEW_SEARCH) + set_glade_widget_sens("menu_treemap",FALSE); + else + set_glade_widget_sens("menu_treemap",TRUE); + + + /* right-click */ + if (event->button == 3) { + + if (get_NB_page () == VIEW_TREE) + popupmenu_list (path, event); + if (get_NB_page () == VIEW_SEARCH) + popupmenu_list_search (path, event); + + return FALSE; + } + + gtk_tree_path_free (path); + + return FALSE; +} + +GtkWidget * +create_directory_treeview (void) +{ + GtkCellRenderer *cell; + GtkTreeViewColumn *col; + GtkWidget *scrolled; + + GtkWidget *tvw = glade_xml_get_widget (baobab.main_xml, "treeview1"); + + g_signal_connect (tvw, "row-expanded", + G_CALLBACK (on_tv_row_expanded), NULL); + g_signal_connect (tvw, "cursor-changed", + G_CALLBACK (on_tv_cur_changed), NULL); + g_signal_connect (tvw, "button-press-event", + G_CALLBACK (on_tv_button_press), NULL); + + /* dir name column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL_DIR_NAME, "text", + COL_DIR_NAME, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* percentage bar column */ + cell = gtk_cell_renderer_pixbuf_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "pixbuf", + COL_BAR, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* directory size column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL_DIR_SIZE, "text", + COL_DIR_SIZE, NULL); + g_object_set (G_OBJECT (cell), "xalign", (gfloat) 1.0, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* percentage column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL_PERC, "text", + COL_PERC, NULL); + g_object_set (G_OBJECT (cell), "xalign", (gfloat) 1.0, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* objects column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL_ELEMENTS, "text", + COL_ELEMENTS, NULL); + g_object_set (G_OBJECT (cell), "xalign", (gfloat) 1.0, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* hardlink column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL_HARDLINK, "text", + COL_HARDLINK, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + gtk_tree_view_collapse_all (GTK_TREE_VIEW (tvw)); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tvw), FALSE); + scrolled = glade_xml_get_widget (baobab.main_xml, "scrolledwindow1"); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + + baobab.model = create_model (); + + gtk_tree_view_set_model (GTK_TREE_VIEW (tvw), + GTK_TREE_MODEL (baobab.model)); + g_object_unref (baobab.model); + + return tvw; +} + +GtkWidget * +create_filesearch_treeview (void) +{ + GtkWidget *tvw; + GtkCellRenderer *cell; + GtkTreeViewColumn *col; + + tvw = glade_xml_get_widget (baobab.main_xml, "tree_search"); + + g_signal_connect (tvw, "cursor-changed", + G_CALLBACK (on_tv_cur_changed), NULL); + g_signal_connect (tvw, "button-press-event", + G_CALLBACK (on_tv_button_press), NULL); + + /* icons column */ + cell = gtk_cell_renderer_pixbuf_new (); + g_object_set (cell, "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, + NULL); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "pixbuf", + COL0_ICON, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* First text column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL1_STRING, "text", + COL1_STRING, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + /* second text column */ + cell = gtk_cell_renderer_text_new (); + col = gtk_tree_view_column_new_with_attributes (NULL, cell, "markup", + COL2_STRING, "text", + COL2_STRING, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tvw), col); + + baobab.model_search = create_search_model (); + gtk_tree_view_set_model (GTK_TREE_VIEW (tvw), + GTK_TREE_MODEL (baobab.model_search)); + g_object_unref (baobab.model_search); + + return tvw; +} diff --git a/src/baobab-treeview.h b/src/baobab-treeview.h new file mode 100644 index 0000000..d133027 --- /dev/null +++ b/src/baobab-treeview.h @@ -0,0 +1,63 @@ +/* + * baobab-treeview.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __BAOBAB_TV_H__ +#define __BAOBAB_TV_H__ + +#include <gtk/gtk.h> + +/* tree model columns (_H_ are hidden) */ +enum +{ + COL_DIR_NAME, + COL_H_FULLPATH, + COL_BAR, + COL_H_PERC, + COL_DIR_SIZE, + COL_H_SIZE, + COL_PERC, + COL_H_ALLOCSIZE, + COL_ELEMENTS, + COL_H_ELEMENTS, + COL_HARDLINK, + COL_H_HARDLINK, + NUM_TREE_COLUMNS +}; + +/* search model columns */ +enum +{ + COL0_ICON, + COL1_STRING, + COL2_STRING, + COL_FULLPATH, + COL_LASTACCESS, + COL_SIZE, + COL_FILETYPE, + COL_OWNER, + NUM_COLUMNS +}; + +GtkWidget *create_directory_treeview (void); +GtkWidget *create_filesearch_treeview (void); + +#endif /* __BAOBAB_TV_H__ */ diff --git a/src/baobab-utils.c b/src/baobab-utils.c new file mode 100644 index 0000000..1ad8408 --- /dev/null +++ b/src/baobab-utils.c @@ -0,0 +1,904 @@ +/* + * baobab-utils.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include <config.h> + +#include <glib.h> +#include <glib/gstdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <string.h> +#include <monetary.h> +#include <glib/gi18n.h> +#include <glib/gprintf.h> +#include <gtk/gtk.h> +#include <libgnomevfs/gnome-vfs.h> +#include <libgnomevfs/gnome-vfs-mime.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <glibtop/mountlist.h> +#include <glibtop/fsusage.h> + +#include "baobab.h" +#include "baobab-treeview.h" +#include "baobab-utils.h" +#include "callbacks.h" + +static int radio_group_get_active (GtkRadioButton *); +static void radio_group_set_active (GtkRadioButton *rb, int btn); +static void set_search_opt (GladeXML *dlg_xml); +static void save_search_opt (GladeXML *dlg_xml); + +void +baobab_get_filesystem (baobab_fs *fs) +{ + size_t i; + glibtop_mountlist mountlist; + glibtop_mountentry *mountentries; + + memset (fs, 0, sizeof *fs); + + mountentries = glibtop_get_mountlist (&mountlist, FALSE); + + for (i = 0; i < mountlist.number; ++i) { + glibtop_fsusage fsusage; + + if (is_excluded_dir (mountentries[i].mountdir)) + continue; + + glibtop_get_fsusage (&fsusage, mountentries[i].mountdir); + + /* v.1.1.1 changed bavail with bfree) */ + fs->total += fsusage.blocks * fsusage.block_size; + fs->avail += fsusage.bfree * fsusage.block_size; + fs->used += (fsusage.blocks - fsusage.bfree) * fsusage.block_size; + } + + g_free (mountentries); +} + +void +set_statusbar (const gchar *text) +{ + GtkWidget *sb; + + sb = glade_xml_get_widget (baobab.main_xml, "statusbar1"); + gtk_statusbar_pop (GTK_STATUSBAR (sb), 1); + gtk_statusbar_push (GTK_STATUSBAR (sb), 1, text); + + while (gtk_events_pending ()) + gtk_main_iteration (); +} + +/* + * GtkFileChooser to select a directory to scan + */ +gchar * +dir_select (gboolean SEARCH, GtkWidget *parent) +{ + GtkWidget *dialog; + GtkWidget *toggle; + + dialog = gtk_file_chooser_dialog_new (_("Select a folder"), + GTK_WINDOW (parent), + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT, NULL); + + gtk_file_chooser_set_show_hidden (GTK_FILE_CHOOSER (dialog), TRUE); + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), + g_get_home_dir ()); + /* add extra widget */ + toggle = gtk_check_button_new_with_label (_("Show hidden folders")); + gtk_widget_show (toggle); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE); + g_signal_connect ((gpointer) toggle, "toggled", + G_CALLBACK (on_toggled), dialog); + gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), + toggle); + + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { + char *filename; + + filename = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog)); + gtk_widget_destroy (dialog); + if (!SEARCH) { + start_proc_on_dir (filename); + g_free (filename); + return NULL; + } else { + return (filename); + } + } else { + gtk_widget_destroy (dialog); + return NULL; + } +} + +void +on_toggled (GtkToggleButton *togglebutton, gpointer dialog) +{ + gtk_file_chooser_set_show_hidden (GTK_FILE_CHOOSER (dialog), + !gtk_file_chooser_get_show_hidden + (GTK_FILE_CHOOSER (dialog))); +} + +GdkPixbuf * +set_bar (gfloat perc) +{ + GdkPixbuf *srcpxb = NULL, *destpxb; + gint height, width; + + if (perc <= 33.0f) + srcpxb = baobab.green_bar; + else if (perc > 33.0f && perc <= 60.0f) + srcpxb = baobab.yellow_bar; + else if (perc > 60.0f) + srcpxb = baobab.red_bar; + + destpxb = baobab_load_pixbuf ("white.png"); + height = gdk_pixbuf_get_height (destpxb); + width = gdk_pixbuf_get_width (destpxb) - 1; + width = (gint) (gfloat) ((width * perc) / 100.0f); /* if bar width ==50 --> $width = $perc/2 */ + + gdk_pixbuf_copy_area (srcpxb, + 1, 1, + width - 2, height - 2, + destpxb, + 1, 1); + + return destpxb; +} + +void +set_glade_widget_sens (const gchar *name, gboolean sens) +{ + GtkWidget *w; + + w = glade_xml_get_widget (baobab.main_xml, name); + gtk_widget_set_sensitive (w, sens); +} + +/* menu & toolbar sensitivity */ +void +check_menu_sens (gboolean scanning) +{ + if (scanning) { + + while (gtk_events_pending ()) + gtk_main_iteration (); + + set_statusbar (_("Scanning...")); + set_glade_widget_sens ("menu_treemap", FALSE); + } + + set_glade_widget_sens ("tbstop", scanning); + set_glade_widget_sens ("tbscanall", !scanning); + set_glade_widget_sens ("tbscandir", !scanning); + set_glade_widget_sens ("menuallfs", !scanning); + set_glade_widget_sens ("menuscandir", !scanning); + set_glade_widget_sens ("tb_search", !scanning); + set_glade_widget_sens ("preferenze1", !scanning); + set_glade_widget_sens ("menu_scan_rem", !scanning); + set_glade_widget_sens ("tb_scan_remote", !scanning); + set_glade_widget_sens ("search_for_a_file", !scanning); + set_glade_widget_sens ("ck_allocated", + !scanning && + (get_NB_page () == VIEW_TREE) && + baobab.is_local); + + if (get_NB_page () == VIEW_SEARCH) + set_glade_widget_sens ("label1", !scanning); +} + +void +stop_scan (void) +{ + if (get_NB_page () == VIEW_TREE) { + set_statusbar (_("Calculating percentage bars...")); + gtk_tree_model_foreach (GTK_TREE_MODEL (baobab.model), + show_bars, NULL); + gtk_tree_view_columns_autosize (GTK_TREE_VIEW (baobab.tree_view)); + } + + set_busy (FALSE); + check_menu_sens (FALSE); + set_statusbar (_("Ready")); +} + +gboolean +show_bars (GtkTreeModel *mdl, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) +{ + GtkTreeIter parent; + gfloat perc; + gint readelements, size_col; + guint64 refsize, size; + GdkPixbuf *bar; + gchar textperc[10]; + char *sizecstr = NULL; + + if (baobab.show_allocated) + size_col = (gint) COL_H_ALLOCSIZE; + else + size_col = (gint) COL_H_SIZE; + + if (gtk_tree_model_iter_parent (mdl, &parent, iter)) { + gtk_tree_model_get (mdl, &parent, COL_H_ELEMENTS, + &readelements, -1); + if (readelements == -1) + return TRUE; + + gtk_tree_model_get (mdl, iter, COL_H_ELEMENTS, + &readelements, -1); + if (readelements == -1) + return TRUE; + + gtk_tree_model_get (mdl, &parent, size_col, &refsize, -1); + if (refsize == 0) + return FALSE; + + gtk_tree_model_get (mdl, iter, size_col, &size, -1); + perc = ((gfloat) size * 100) / (gfloat) refsize; + g_sprintf (textperc, " %.1f %%", perc); + sizecstr = gnome_vfs_format_file_size_for_display (size); + bar = set_bar (perc); + + gtk_tree_store_set (GTK_TREE_STORE (mdl), iter, + COL_BAR, bar, + COL_DIR_SIZE, sizecstr, + COL_H_PERC, perc, + COL_PERC, textperc, -1); + + g_object_unref (bar); + g_free (sizecstr); + } else { + gtk_tree_model_get (mdl, iter, COL_H_ELEMENTS, + &readelements, -1); + if (readelements != -1) { + gtk_tree_model_get (mdl, iter, size_col, &size, + -1); + sizecstr = gnome_vfs_format_file_size_for_display (size); + bar = set_bar (100.0); + + gtk_tree_store_set (GTK_TREE_STORE (mdl), iter, + COL_BAR, bar, + COL_H_PERC, 100.0, + COL_PERC, "100 %", + COL_DIR_SIZE, sizecstr, -1); + + g_object_unref (bar); + g_free (sizecstr); + } + } + + return FALSE; +} + +void +message (gchar *messaggio, GtkWidget *parent) +{ + GtkWidget *dialog; + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, "%s", messaggio); + gtk_message_dialog_set_markup ((GtkMessageDialog *) dialog, + messaggio); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); +} + +gint +messageyesno (gchar *message, GtkWidget *parent) +{ + GtkWidget *dialog; + gint response; + + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "%s", message); + gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), + message); + response = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + return response; +} + +gboolean +baobab_check_dir (const gchar *dirname) +{ + char *error_msg = NULL; + GnomeVFSFileInfo *info; + GnomeVFSResult result; + gboolean ret = TRUE; + + info = gnome_vfs_file_info_new (); + result = gnome_vfs_get_file_info (dirname, info, + GNOME_VFS_FILE_INFO_DEFAULT | + GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + + if (result != GNOME_VFS_OK) + error_msg = g_strdup_printf (_("%s is not a valid folder"), + dirname); + + if (info->type != GNOME_VFS_FILE_TYPE_DIRECTORY) + error_msg = g_strdup_printf (_("%s is not a valid folder"), + dirname); + + if (error_msg) { + message (error_msg, baobab.window); + g_free (error_msg); + ret = FALSE; + } + + gnome_vfs_file_info_unref (info); + + return ret; +} + +void +popupmenu_list (GtkTreePath *path, GdkEventButton *event) +{ + GtkWidget *pmenu, *open, *trash, *sep, *allfiles, *graph_map; + gchar *path_to_string; + GtkWidget *image; + + /* path_to_string is freed in callback function */ + path_to_string = gtk_tree_path_to_string (path); + + pmenu = gtk_menu_new (); + open = gtk_image_menu_item_new_from_stock ("gtk-open", NULL); + trash = gtk_image_menu_item_new_from_stock ("gtk-delete", NULL); + graph_map = gtk_image_menu_item_new_with_label (_("Folder graphical map")); + image = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (graph_map), image); + sep = gtk_separator_menu_item_new (); + allfiles = gtk_image_menu_item_new_with_label (_("List all files in folder")); + image = gtk_image_new_from_pixbuf (baobab_load_pixbuf ("searchall.png")); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (allfiles), image); + + g_signal_connect (open, "activate", + G_CALLBACK (open_file_cb), NULL); + g_signal_connect (trash, "activate", + G_CALLBACK (trash_dir_cb), NULL); + g_signal_connect (allfiles, "activate", + G_CALLBACK (list_all_cb), NULL); + g_signal_connect (graph_map, "activate", + G_CALLBACK (graph_map_cb), path_to_string); + + gtk_container_add (GTK_CONTAINER (pmenu), open); + gtk_container_add (GTK_CONTAINER (pmenu), allfiles); + gtk_container_add (GTK_CONTAINER (pmenu), graph_map); + gtk_container_add (GTK_CONTAINER (pmenu), sep); + gtk_container_add (GTK_CONTAINER (pmenu), trash); + gtk_widget_show_all (pmenu); + gtk_menu_popup (GTK_MENU (pmenu), NULL, NULL, NULL, NULL, + event->button, event->time); +} + +void +popupmenu_list_search (GtkTreePath *path, GdkEventButton *event) +{ + GtkWidget *pmenu, *trash, *open, *sep; + GtkTreeIter iter; + + if (baobab.selected_path) { + g_free (baobab.selected_path); + baobab.selected_path = NULL; + } + + gtk_tree_model_get_iter (GTK_TREE_MODEL (baobab.model_search), + &iter, path); + gtk_tree_model_get (GTK_TREE_MODEL (baobab.model_search), &iter, + COL_FULLPATH, &baobab.selected_path, -1); + + if (strcmp (baobab.selected_path, "") == 0) + return; + + pmenu = gtk_menu_new (); + open = gtk_image_menu_item_new_from_stock ("gtk-open", NULL); + trash = gtk_image_menu_item_new_from_stock ("gtk-delete", NULL); + sep = gtk_separator_menu_item_new (); + + g_signal_connect (open, "activate", + G_CALLBACK (open_file_cb), NULL); + g_signal_connect (trash, "activate", + G_CALLBACK (trash_file_cb), NULL); + + gtk_container_add (GTK_CONTAINER (pmenu), open); + gtk_widget_show (open); + gtk_container_add (GTK_CONTAINER (pmenu), sep); + gtk_widget_show (sep); + gtk_container_add (GTK_CONTAINER (pmenu), trash); + gtk_widget_show (trash); + gtk_menu_popup (GTK_MENU (pmenu), NULL, NULL, NULL, NULL, + event->button, event->time); +} + +/* search dialog */ + +static gboolean +begin_search (gpointer data) +{ + GString *search; + + search = g_string_new (bbSearchOpt.filename->str); + + if (!bbSearchOpt.exact) { + g_string_prepend (search, "*"); + g_string_append (search, "*"); + } + if (bbSearchOpt.search_whole) { + start_search (search->str, NULL); + } + else { + start_search (search->str, + bbSearchOpt.dir->str); + } + + g_string_free (search, TRUE); + + return FALSE; +} + +static void +search_dialog_response (GtkDialog *dialog, + gint response_id, + gpointer data) +{ + GladeXML *dlg_xml = data; + + if (response_id == GTK_RESPONSE_OK) + { + save_search_opt (dlg_xml); + + if (strcmp (bbSearchOpt.filename->str, "") == 0) { + message (_("Please provide a file name to search for!"), + GTK_WIDGET (dialog)); + + /* do not destroy */ + return; + } + + /* start the search in an idle after the dialog close */ + g_idle_add (begin_search, NULL); + } + + gtk_widget_destroy (GTK_WIDGET (dialog)); + g_object_unref (dlg_xml); +} + +void +dialog_search (void) +{ + static GtkWidget *search_dialog = NULL; + GladeXML *dlg_xml; + GtkWidget *rb_allfs, *btn_select, *radio_dir; + + if (search_dialog != NULL) { + gtk_window_present (GTK_WINDOW (search_dialog)); + return; + } + + /* Glade stuff */ + dlg_xml = glade_xml_new (BAOBAB_GLADE_FILE, "dlg_search", NULL); + + search_dialog = glade_xml_get_widget (dlg_xml, "dlg_search"); + + rb_allfs = glade_xml_get_widget (dlg_xml, "radio_allfs"); + btn_select = glade_xml_get_widget (dlg_xml, "btn_select_search"); + radio_dir = glade_xml_get_widget (dlg_xml, "radio_dir"); + + + gtk_window_set_transient_for (GTK_WINDOW (search_dialog), + GTK_WINDOW (baobab.window)); + set_search_opt (dlg_xml); + + /* connect signals */ + g_signal_connect (rb_allfs, "clicked", + G_CALLBACK (on_radio_allfs_clicked), NULL); + g_signal_connect (radio_dir, "clicked", + G_CALLBACK (on_radio_dir_clicked), NULL); + g_signal_connect (btn_select, "clicked", + G_CALLBACK (on_btn_select_search_clicked), NULL); + g_signal_connect (search_dialog, "response", + G_CALLBACK (search_dialog_response), dlg_xml); + g_signal_connect (search_dialog, "destroy", + G_CALLBACK (gtk_widget_destroyed), &search_dialog); +} + +void +save_search_opt (GladeXML *dlg_xml) +{ + GtkEntry *entry_searchname; + GtkWidget *rb_exact; + GtkEntry *entry_sel_dir; + GtkWidget *rb_allfs; + + entry_searchname = (GtkEntry *) glade_xml_get_widget (dlg_xml, "entry1"); + g_string_assign (bbSearchOpt.filename, + gtk_entry_get_text (GTK_ENTRY + (entry_searchname))); + rb_exact = glade_xml_get_widget (dlg_xml, "radio_exact"); + bbSearchOpt.exact = gtk_toggle_button_get_active ((GtkToggleButton *) rb_exact); + entry_sel_dir = (GtkEntry *) glade_xml_get_widget (dlg_xml, "entry2"); + g_string_assign (bbSearchOpt.dir, + gtk_entry_get_text (GTK_ENTRY (entry_sel_dir))); + rb_allfs = glade_xml_get_widget (dlg_xml, "radio_allfs"); + bbSearchOpt.search_whole = gtk_toggle_button_get_active ((GtkToggleButton *) rb_allfs); + bbSearchOpt.mod_date = radio_group_get_active ((GtkRadioButton *) glade_xml_get_widget (dlg_xml, "radio_mod_unk")); + bbSearchOpt.size_limit = radio_group_get_active ((GtkRadioButton *) glade_xml_get_widget (dlg_xml, "radio_size_unk")); +} + +void +set_search_opt (GladeXML *dlg_xml) +{ + GtkEntry *entry_searchname; + GtkWidget *rb_exact; + GtkEntry *entry_sel_dir; + GtkWidget *rb_allfs; + GtkWidget *expander; + + entry_searchname = (GtkEntry *) glade_xml_get_widget (dlg_xml, "entry1"); + gtk_entry_set_text (entry_searchname, bbSearchOpt.filename->str); + rb_exact = glade_xml_get_widget (dlg_xml, "radio_exact"); + gtk_toggle_button_set_active ((GtkToggleButton *) rb_exact, + bbSearchOpt.exact); + entry_sel_dir = (GtkEntry *) glade_xml_get_widget (dlg_xml, "entry2"); + gtk_entry_set_text (entry_sel_dir, bbSearchOpt.dir->str); + rb_allfs = glade_xml_get_widget (dlg_xml, "radio_allfs"); + gtk_toggle_button_set_active ((GtkToggleButton *) rb_allfs, + bbSearchOpt.search_whole); + + radio_group_set_active ((GtkRadioButton *) glade_xml_get_widget (dlg_xml, "radio_mod_unk"), bbSearchOpt.mod_date); + radio_group_set_active ((GtkRadioButton *) glade_xml_get_widget (dlg_xml, "radio_size_unk"), bbSearchOpt.size_limit); + expander = glade_xml_get_widget (dlg_xml, "expander1"); + gtk_expander_set_expanded ((GtkExpander *) expander, + (bbSearchOpt.mod_date != NONE || + bbSearchOpt.size_limit != NONE)); +} + +void +switch_view (gint view) +{ + GtkWidget *nb; + nb = glade_xml_get_widget (baobab.main_xml, "notebook1"); + gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), view); +} + +gint +get_NB_page (void) +{ + GtkWidget *nb; + + nb = glade_xml_get_widget (baobab.main_xml, "notebook1"); + return gtk_notebook_get_current_page (GTK_NOTEBOOK (nb)); +} + +int +radio_group_get_active (GtkRadioButton *rb) +{ + GSList *list, *l; + int i; + + list = gtk_radio_button_get_group (rb); + + for (l = list, i = 0; l; l = l->next, i++) { + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (l->data))) + break; + } + + return g_slist_length (list) - i; +} + +void +radio_group_set_active (GtkRadioButton *rb, int btn) +{ + GSList *list, *l; + int i; + + list = gtk_radio_button_get_group (rb); + btn = g_slist_length (list) - btn; + + for (l = list, i = 0; l; l = l->next, i++) { + if (i == btn) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON + (l->data), TRUE); + break; + } + } +} + +void +set_label_scan (baobab_fs *fs) +{ + gchar *markup, *size; + GString *total; + GString *used; + GString *avail; + + if (baobab.label_scan) + g_free (baobab.label_scan); + + size = gnome_vfs_format_file_size_for_display (fs->total); + total = g_string_new (size); + g_free (size); + size = gnome_vfs_format_file_size_for_display (fs->used); + used = g_string_new (size); + g_free (size); + + size = gnome_vfs_format_file_size_for_display (fs->avail); + avail = g_string_new (size); + g_free (size); + + markup = g_markup_printf_escaped ("<small>%s <b>%s</b> (%s %s %s %s )</small>", + _("Total filesystem capacity:"), total->str, _("used:"), + used->str, _("available:"), avail->str); + baobab.label_scan = strdup (markup); + + g_string_free (total, TRUE); + g_string_free (used, TRUE); + g_string_free (avail, TRUE); + g_free (markup); +} + +void +show_label (gint view) +{ + GtkWidget *label; + + label = glade_xml_get_widget (baobab.main_xml, "label1"); + + if (view == VIEW_TREE) { + gtk_label_set_markup (GTK_LABEL (label), + baobab.label_scan); + } + else if (view == VIEW_SEARCH) { + gtk_label_set_markup (GTK_LABEL (label), + baobab.label_search); + } + else { + g_assert_not_reached (); + } +} + +void +set_label_search (gint numfiles, guint64 totalsize) +{ + gchar *markup, *size; + + if (baobab.label_search) + g_free (baobab.label_search); + + size = gnome_vfs_format_file_size_for_display (totalsize); + markup = g_markup_printf_escaped ("<small>%s <b>%d</b> %s %s <b>%s</b></small>", _("Found:"), + numfiles, (numfiles == 1 ? _("file") : _("files")), + _("for total:"), size); + baobab.label_search = strdup (markup); + g_free (markup); + g_free (size); +} + +void +open_file_with_application (gchar *file) +{ + GnomeVFSMimeApplication *application; + gchar *mime; + GnomeVFSFileInfo *info; + GnomeVFSURI *vfs_uri; + + info = gnome_vfs_file_info_new (); + vfs_uri = gnome_vfs_uri_new (file); + + gnome_vfs_get_file_info (file, info, + GNOME_VFS_FILE_INFO_GET_MIME_TYPE); + mime = info->mime_type; + + application = gnome_vfs_mime_get_default_application (mime); + + if (!application) { + if ((g_file_test (file, G_FILE_TEST_IS_EXECUTABLE)) && + (g_ascii_strcasecmp (mime, "application/x-executable") == 0) && + gnome_vfs_uri_is_local (vfs_uri)) { + g_spawn_command_line_async (file, NULL); + } + else { + message (_("There is no installed viewer capable " + "of displaying the document."), + baobab.window); + } + } + else { + GList *uris = NULL; + gchar *uri; + + uri = gnome_vfs_uri_to_string (vfs_uri, GNOME_VFS_URI_HIDE_NONE); + uris = g_list_append (uris, uri); + gnome_vfs_mime_application_launch (application, uris); + + g_list_free (uris); + g_free (uri); + } + + gnome_vfs_uri_unref (vfs_uri); + gnome_vfs_mime_application_free (application); + gnome_vfs_file_info_unref (info); +} + +gchar * +get_trash_path (const gchar *file) +{ + GnomeVFSURI *trash_uri; + GnomeVFSURI *uri; + gchar *filename; + + filename = gnome_vfs_escape_path_string (file); + uri = gnome_vfs_uri_new (file); + g_free (filename); + + gnome_vfs_find_directory (uri, + GNOME_VFS_DIRECTORY_KIND_TRASH, + &trash_uri, TRUE, TRUE, 0777); + gnome_vfs_uri_unref (uri); + + if (trash_uri == NULL) { + return NULL; + } else { + gchar *trash_path; + trash_path = + gnome_vfs_uri_to_string (trash_uri, + GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD); + gnome_vfs_uri_unref (trash_uri); + return trash_path; + } +} + +gboolean +trash_file (const gchar *filename) +{ + gchar *trash_path = NULL; + gchar *basename = NULL; + gchar *destination = NULL; + GnomeVFSResult result; + gboolean ret = FALSE; + + trash_path = get_trash_path (filename); + + if (trash_path == NULL) { + message (_("Cannot find the Trash on this system!"), + baobab.window); + goto out; + } + + if ((!g_file_test (filename, G_FILE_TEST_EXISTS)) && + (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK))) { + message (_("The document does not exist."), baobab.window); + goto out; + } + + basename = g_path_get_basename (filename); + destination = g_build_filename (trash_path, basename, NULL); + + result = gnome_vfs_move (filename, destination, TRUE); + + if (result != GNOME_VFS_OK) { + gchar *mess; + + mess = g_strdup_printf (_("Moving <b>%s</b> to trash failed: %s."), + g_path_get_basename (filename), + gnome_vfs_result_to_string (result)); + message (mess, baobab.window); + g_free (mess); + goto out; + } + else + ret = TRUE; + + if (strcmp (destination, filename) == 0) { + gchar *mess; + gint response; + + mess = g_strdup_printf (_("Do you want to delete <b>%s</b> permanently?"), + g_path_get_basename (filename)); + response = messageyesno (mess, baobab.window); + g_free (mess); + + if (response == GTK_RESPONSE_YES) { + if (!g_file_test (filename, G_FILE_TEST_IS_DIR)) + result = gnome_vfs_unlink (filename); + else + result = gnome_vfs_remove_directory (filename); + + if (result != GNOME_VFS_OK) { + mess = g_strdup_printf (_("Deleting <b>%s</b> failed: %s."), + g_path_get_basename (filename), + gnome_vfs_result_to_string (result)); + message (mess, baobab.window); + g_free (mess); + ret = FALSE; + goto out; + } + + /* success */ + ret = TRUE; + } + } + + out: + g_free (basename); + g_free (trash_path); + g_free (destination); + + return ret; +} + +void +contents_changed (void) +{ + baobab_get_filesystem (&g_fs); + set_label_scan (&g_fs); + show_label (VIEW_TREE); + + if (messageyesno (_("The content of your home directory has changed.\n" + "Do you want to rescan the last tree to update the folder branch details?"), + baobab.window) == GTK_RESPONSE_YES) { + + start_proc_on_dir (baobab.last_scan_command->str); + } +} + +GdkPixbuf * +baobab_load_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = g_build_filename (BAOBAB_PIX_DIR, filename, NULL); + + if (!pathname) { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + + return pixbuf; +} diff --git a/src/baobab-utils.h b/src/baobab-utils.h new file mode 100644 index 0000000..96f714b --- /dev/null +++ b/src/baobab-utils.h @@ -0,0 +1,58 @@ +/* + * baobab-utils.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __BAOBAB_UTILS_H__ +#define __BAOBAB_UTILS_H__ + +#include "baobab.h" + +void baobab_get_filesystem (baobab_fs *fs); +void set_statusbar (const gchar *); +gchar* dir_select (gboolean, GtkWidget *); +void on_toggled (GtkToggleButton *, gpointer); +GdkPixbuf *set_bar (gfloat ); +void check_menu_sens (gboolean); +void stop_scan (void); +gboolean show_bars (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data); +void message (gchar *, GtkWidget *); +gint messageyesno (gchar *messaggio, GtkWidget *parent); +gboolean baobab_check_dir (const gchar *); +void popupmenu_list (GtkTreePath *path, GdkEventButton *event); +void popupmenu_list_search (GtkTreePath *path, GdkEventButton *event); +void open_nautilus (GtkMenuItem *, gpointer ); +void dialog_search (void); +void switch_view (gint); +gint get_NB_page (void); +void set_label_scan (baobab_fs *); +void show_label (gint view); +void set_label_search (gint ,guint64 ); +void open_file_with_application (gchar *file); +gchar * get_trash_path (const gchar *file); +gboolean trash_file (const gchar *filename); +void contents_changed (void); +GdkPixbuf * baobab_load_pixbuf (const gchar *filename); +void set_glade_widget_sens (const gchar *name, gboolean sens); + +#endif /* __BAOBAB_UTILS_H__ */ diff --git a/src/baobab.c b/src/baobab.c new file mode 100644 index 0000000..16d5c59 --- /dev/null +++ b/src/baobab.c @@ -0,0 +1,895 @@ +/* + * baobab.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include <config.h> + +#include <pwd.h> +#include <time.h> +#include <gtk/gtk.h> +#include <glib/gi18n.h> +#include <glib/gprintf.h> +#include <libgnomeui/libgnomeui.h> +#include <libgnomeui/gnome-ui-init.h> +#include <libgnomevfs/gnome-vfs.h> +#include <libgnomevfs/gnome-vfs-mime.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <gconf/gconf-client.h> +#include <glibtop.h> + +#include "baobab.h" +#include "baobab-scan.h" +#include "baobab-treeview.h" +#include "baobab-utils.h" +#include "callbacks.h" +#include "baobab-prefs.h" + +static GnomeVFSMonitorHandle *handle_mtab; +static GnomeVFSMonitorHandle *handle_home; + +static void check_UTF (GString *); + +static void push_iter_in_stack (GtkTreeIter *); +static GtkTreeIter pop_iter_from_stack (void); + +static gint currentdepth = 0; +static GtkTreeIter currentiter; +static GtkTreeIter firstiter; +static GQueue *iterstack = NULL; + +#define BUSY_IMAGE_PATH BAOBAB_PIX_DIR "busy.gif" +#define DONE_IMAGE_PATH BAOBAB_PIX_DIR "done.png" + +static GdkPixbufAnimation *busy_image = NULL; +static GdkPixbuf *done_image = NULL; + +static gboolean filter_adv_search (struct BaobabSearchRet *); +static void initialize_search_variables (void); +static void baobab_toolbar_style (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data); + +static gboolean +scan_is_local (const gchar *uri_dir) +{ + GnomeVFSFileInfo *info; + GnomeVFSResult res; + gboolean ret; + + info = gnome_vfs_file_info_new (); + res = gnome_vfs_get_file_info (uri_dir, + info, GNOME_VFS_FILE_INFO_DEFAULT); + + ret = ((res == GNOME_VFS_OK) && + (info->flags & GNOME_VFS_FILE_FLAGS_LOCAL)); + + gnome_vfs_file_info_unref (info); + + return ret; +} + +void +set_busy (gboolean busy) +{ + GtkWidget *image; + GError *err = NULL; + + image = glade_xml_get_widget (baobab.main_xml, "busyimage"); + + if (busy) { + if (busy_image == NULL) { + busy_image = gdk_pixbuf_animation_new_from_file (BUSY_IMAGE_PATH, &err); + if (err != NULL) { + g_warning ("Could not load \"busy\" animation (%s)\n", err->message); + g_error_free (err); + return; + } + } + + gtk_image_set_from_animation (GTK_IMAGE (image), busy_image); + } + else { + if (done_image == NULL) { + done_image = gdk_pixbuf_new_from_file (DONE_IMAGE_PATH, &err); + if (err != NULL) { + g_warning ("Could not load \"done\" image (%s)\n", err->message); + g_error_free (err); + return; + } + } + + gtk_image_set_from_pixbuf (GTK_IMAGE (image), done_image); + } +} + +/* + * start scanning on a specific directory + */ +void +start_proc_on_dir (const gchar *dir) +{ + GdkCursor *cursor = NULL; + GtkWidget *ck_allocated; + + switch_view (VIEW_TREE); + + if (!baobab_check_dir (dir)) + return; + + g_string_assign (baobab.last_scan_command, dir); + baobab.STOP_SCANNING = FALSE; + set_busy (TRUE); + check_menu_sens (TRUE); + gtk_tree_store_clear (baobab.model); + currentdepth = -1; /* flag */ + iterstack = g_queue_new (); + + /* check if the file system is local or remote */ + baobab.is_local = scan_is_local (dir); + ck_allocated = glade_xml_get_widget (baobab.main_xml, "ck_allocated"); + if (!baobab.is_local) { + gtk_toggle_button_set_active ((GtkToggleButton *) + ck_allocated, FALSE); + gtk_widget_set_sensitive (ck_allocated, FALSE); + baobab.show_allocated = FALSE; + } + else { + gtk_widget_set_sensitive (ck_allocated, TRUE); + } + + getDir (dir); + + /* change the cursor */ + if (baobab.window->window) { + cursor = gdk_cursor_new (GDK_WATCH); + gdk_window_set_cursor (baobab.window->window, cursor); + } + + /* set statusbar, percentage and allocated/normal size */ + set_statusbar (_("Calculating percentage bars...")); + gtk_tree_model_foreach (GTK_TREE_MODEL (baobab.model), + show_bars, + NULL); + set_busy (FALSE); + check_menu_sens (FALSE); + set_statusbar (_("Ready")); + + /* cursor clean up */ + if (baobab.window->window) { + gdk_window_set_cursor (baobab.window->window, NULL); + if (cursor) + gdk_cursor_unref (cursor); + } + + gtk_tree_view_columns_autosize (GTK_TREE_VIEW (baobab.tree_view)); + baobab.STOP_SCANNING = TRUE; + g_queue_free (iterstack); + baobab.CONTENTS_CHANGED_DELAYED = FALSE; +} + +void +start_search (const gchar *searchname, const gchar *dir) +{ + GdkCursor *cursor = NULL; + + switch_view (VIEW_SEARCH); + initialize_search_variables (); + baobab.STOP_SCANNING = FALSE; + set_busy (TRUE); + check_menu_sens (TRUE); + + /* change the cursor */ + if (baobab.window->window) { + cursor = gdk_cursor_new (GDK_WATCH); + gdk_window_set_cursor (baobab.window->window, cursor); + } + + gtk_list_store_clear (baobab.model_search); + + if (dir == NULL) + searchDir ("file:///", searchname); + else + searchDir (dir, searchname); + + /* cursor clean up */ + if (baobab.window->window) { + gdk_window_set_cursor (baobab.window->window, NULL); + if (cursor) + gdk_cursor_unref (cursor); + } + + set_busy (FALSE); + check_menu_sens (FALSE); + set_statusbar (_("Ready")); + + set_label_search (baobab.number_found_files, + baobab.size_found_files); + if (get_NB_page () == VIEW_SEARCH) + show_label (VIEW_SEARCH); + gtk_tree_view_columns_autosize (GTK_TREE_VIEW (baobab.tree_search)); + baobab.STOP_SCANNING = TRUE; + bbSearchOpt.dont_recurse_dir = FALSE; +} + +static gchar * +get_last_mod (time_t timeacc) +{ + gchar snum[21]; + struct tm *lt; + size_t len; + + lt = localtime (&timeacc); + len = strftime (snum, sizeof (snum), "%Y-%m-%d %R:%S", lt); + + return g_strndup (snum, len); +} + +static gchar * +get_owner (uid_t own_id) +{ + struct passwd *pw; + + pw = getpwuid (own_id); + + return g_strdup (pw != NULL ? pw->pw_name : _("Unknown")); +} + +static void +prepare_firstcol (GString *text, struct BaobabSearchRet *bbret) +{ + gchar *basename, *path, *last_mod, *owner, *size, *alloc_size; + + check_UTF (text); + basename = g_path_get_basename (text->str); + path = strdup (text->str); + + last_mod = get_last_mod (bbret->lastacc); + owner = get_owner (bbret->owner); + + size = gnome_vfs_format_file_size_for_display (bbret->size); + alloc_size = gnome_vfs_format_file_size_for_display (bbret->alloc_size); + + g_string_printf (text, + "<big><b>%s</b></big>\n" + "<small>%s %s</small>\n" + "<small>%s %s %s %s</small>\n" + "<small>%s (%s %s) - %s</small>", + basename, + _("Full path:"), path, + _("Last Modification:"), last_mod, + _("Owner:"), owner, + size, _("Allocated bytes:"), alloc_size, + gnome_vfs_mime_get_description (bbret->mime_type)); + + g_free (basename); + g_free (path); + g_free (last_mod); + g_free (owner); + g_free (size); + g_free (alloc_size); +} + +/* + * fill the search model + */ +void +fill_search_model (struct BaobabSearchRet *bbret) +{ + GtkTreeIter iter; + GString *testo1; + GdkPixbuf *picon; + char *gicon; + + if (!filter_adv_search (bbret)) + return; + + gicon = + gnome_icon_lookup_sync (gtk_icon_theme_get_default (), NULL, + bbret->fullpath, NULL, + GNOME_ICON_LOOKUP_FLAGS_NONE, NULL); + picon = + gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), gicon, + 36, GTK_ICON_LOOKUP_USE_BUILTIN, + NULL); + + testo1 = g_string_new (bbret->fullpath); + prepare_firstcol (testo1, bbret); + + gtk_list_store_append (baobab.model_search, &iter); + gtk_list_store_set (baobab.model_search, &iter, + COL0_ICON, picon, COL1_STRING, testo1->str, + /* COL2_STRING,testo2->str, */ + COL_FULLPATH, bbret->fullpath, + COL_FILETYPE, bbret->mime_type, + COL_SIZE, bbret->size, + COL_LASTACCESS, bbret->lastacc, + COL_OWNER, bbret->owner, -1); + + baobab.number_found_files++; + baobab.size_found_files += bbret->size; + g_object_unref (picon); + g_string_free (testo1, TRUE); +} + +void +initialize_search_variables (void) +{ + baobab.number_found_files = 0; + baobab.size_found_files = 0; +} + +static gboolean +filter_adv_search (struct BaobabSearchRet *bbret) +{ + gboolean flag = TRUE; + GDate *filedate, *today; + gint days; + gint maxinterval = 100; + + if ((bbSearchOpt.mod_date == NONE) && + bbSearchOpt.size_limit == NONE) { + return TRUE; + } + + switch (bbSearchOpt.mod_date) { + + case LAST_WEEK: + case LAST_MONTH: + filedate = g_date_new (); + today = g_date_new (); + g_date_set_time (filedate, (GTime) bbret->lastacc); + g_date_set_time (today, time (NULL)); + days = g_date_days_between (filedate, today); + if (bbSearchOpt.mod_date == LAST_WEEK) { + maxinterval = 7; + } + if (bbSearchOpt.mod_date == LAST_MONTH) { + maxinterval = 30; + } + if (days > maxinterval) { + flag = FALSE; + } + + g_date_free (today); + g_date_free (filedate); + break; + } + + switch (bbSearchOpt.size_limit) { + + case SIZE_SMALL: + if (bbret->size >= (guint64) 102400) + flag = FALSE; + break; + + case SIZE_MEDIUM: + if (bbret->size >= (guint64) 1048576) + flag = FALSE; + + break; + } + + return flag; +} + +/* + * pre-fills model during scanning + */ +static void +prefill_model (struct chan_data *data) +{ + GString *cdir; + char *basename; + GtkTreeIter iter, iterparent; + GtkTreePath *path; + + cdir = g_string_new (""); + + if (currentdepth == -1) { + gtk_tree_store_append (baobab.model, &iter, NULL); + firstiter = iter; + } + else if (data->depth == 1) { + gtk_tree_store_append (baobab.model, &iter, &firstiter); + path = gtk_tree_model_get_path (GTK_TREE_MODEL (baobab.model), + &firstiter); + gtk_tree_view_expand_row (GTK_TREE_VIEW (baobab.tree_view), + path, FALSE); + gtk_tree_path_free (path); + } + else if (data->depth > currentdepth) { + gtk_tree_store_append (baobab.model, &iter, ¤titer); + } + else if (data->depth == currentdepth) { + gtk_tree_model_iter_parent ((GtkTreeModel *) baobab.model, + &iterparent, ¤titer); + gtk_tree_store_append (baobab.model, &iter, &iterparent); + } + else if (data->depth < currentdepth) { + GtkTreeIter tempiter; + gint i; + iter = currentiter; + for (i = 0; i <= (currentdepth - data->depth); i++) { + gtk_tree_model_iter_parent ((GtkTreeModel *) + baobab.model, + &tempiter, &iter); + iter = tempiter; + } + gtk_tree_store_append (baobab.model, &iter, &tempiter); + } + currentdepth = data->depth; + push_iter_in_stack (&iter); + currentiter = iter; + + basename = g_filename_display_basename (data->dir); + g_string_assign (cdir, basename); + g_free (basename); + + /* check UTF-8 and locale */ + check_UTF (cdir); + + g_string_append (cdir, " <== "); + g_string_append (cdir, _("scanning...")); + gtk_tree_store_set (baobab.model, &iter, COL_DIR_NAME, cdir->str, + COL_H_FULLPATH, "", COL_H_ELEMENTS, -1, -1); + + while (gtk_events_pending ()) { + gtk_main_iteration (); + } + + g_string_free (cdir, TRUE); +} + +/* + * set filesystem first row + */ +void +first_row (void) +{ + char *size; + gfloat perc; + gchar textperc[10]; + GdkPixbuf *bar; + + gtk_tree_store_append (baobab.model, &firstiter, NULL); + size = gnome_vfs_format_file_size_for_display (g_fs.used); + perc = ((gfloat) g_fs.used * 100) / (gfloat) g_fs.total; + g_sprintf (textperc, " %.1f %%", perc); + bar = set_bar ((g_fs.used * 100) / g_fs.total); + + gtk_tree_store_set (baobab.model, &firstiter, + COL_DIR_NAME, + _("<i>Total filesystem usage:</i>"), + COL_H_FULLPATH, "", + COL_BAR, bar, + COL_H_PERC, perc, + COL_DIR_SIZE, size, COL_PERC, textperc, + COL_H_SIZE, g_fs.used, + COL_H_ALLOCSIZE, g_fs.used, + COL_H_ELEMENTS, -1, -1); + + g_object_unref (bar); + g_free (size); +} + +/* fills model during scanning + * model: + * + * 0, $dir, 1, $fullpath, + * 2, set_bar($perc), 3, $perc, + * 4, calc($size), 5, $size, + * 6, sprintf("% 4s",$elements)." "._('elements'), 7, $elements, + * 8, text showing hardlink size, 9, $HLsize + */ +void +fill_model (struct chan_data *data) +{ + GtkTreeIter iter; + GString *hardlinks; + GString *basename; + GString *elementi; + char *size; + char *alloc_size; + char *basename_cstr; + + if (data->elements == -1) { + prefill_model (data); + return; + } + + basename = g_string_new (""); + basename_cstr = g_filename_display_basename (data->dir); + g_string_assign (basename, basename_cstr); + g_free (basename_cstr); + + check_UTF (basename); + g_string_prepend (basename, "<b>"); + g_string_append (basename, "</b>"); + + iter = pop_iter_from_stack (); + + hardlinks = g_string_new (""); + if (data->tempHLsize > 0) { + size = gnome_vfs_format_file_size_for_display (data->tempHLsize); + g_string_assign (hardlinks, "<i>("); + g_string_append (hardlinks, _("contains hardlinks for:")); + g_string_append (hardlinks, " "); + g_string_append (hardlinks, size); + g_string_append (hardlinks, ")</i>"); + g_free (size); + } + + elementi = g_string_new (""); + g_string_printf (elementi, + ngettext ("% 5d object", "% 5d objects", + data->elements), data->elements); + + size = gnome_vfs_format_file_size_for_display (data->size); + alloc_size = gnome_vfs_format_file_size_for_display (data->alloc_size); + + gtk_tree_store_set (baobab.model, &iter, + COL_DIR_NAME, basename->str, COL_H_FULLPATH, + data->dir, COL_H_PERC, 0.0, COL_DIR_SIZE, + baobab.show_allocated ? alloc_size : size, + COL_H_SIZE, data->size, COL_ELEMENTS, + elementi->str, COL_H_ELEMENTS, data->elements, + COL_HARDLINK, hardlinks->str, COL_H_HARDLINK, + data->tempHLsize, COL_H_ALLOCSIZE, + data->alloc_size, -1); + + while (gtk_events_pending ()) { + gtk_main_iteration (); + } + + g_string_free (hardlinks, TRUE); + g_string_free (basename, TRUE); + g_string_free (elementi, TRUE); + g_free (size); + g_free (alloc_size); +} + +void +push_iter_in_stack (GtkTreeIter *iter) +{ + g_queue_push_head (iterstack, iter->user_data3); + g_queue_push_head (iterstack, iter->user_data2); + g_queue_push_head (iterstack, iter->user_data); + g_queue_push_head (iterstack, GINT_TO_POINTER (iter->stamp)); +} + +GtkTreeIter +pop_iter_from_stack (void) +{ + GtkTreeIter iter; + + iter.stamp = GPOINTER_TO_INT (g_queue_pop_head (iterstack)); + iter.user_data = g_queue_pop_head (iterstack); + iter.user_data2 = g_queue_pop_head (iterstack); + iter.user_data3 = g_queue_pop_head (iterstack); + + return iter; +} + +void +check_UTF (GString *name) +{ + char *str; + char *escaped_str; + + str = g_filename_to_utf8 (name->str, -1, NULL, NULL, NULL); + + if (!str) { + str = g_locale_to_utf8 (name->str, -1, NULL, NULL, NULL); + + if (!str) { + str = g_strjoin ("<i>", + _("Invalid UTF-8 characters"), + "</i>", NULL); + } + } + + g_assert (str); + + escaped_str = g_markup_escape_text (str, strlen (str)); + + g_string_assign (name, escaped_str); + + g_free (str); + g_free (escaped_str); +} + +gint +list_find (gconstpointer a, gconstpointer b) +{ + gchar *str_a, *str_b; + gint ret; + + str_a = gnome_vfs_format_uri_for_display (a); + str_b = gnome_vfs_format_uri_for_display (b); + + ret = strcmp (str_a, str_b); + + g_free (str_a); + g_free (str_b); + + return ret; +} + +gboolean +is_excluded_dir (const gchar *dir) +{ + return (baobab.bbExcludedDirs && + (g_slist_find_custom (baobab.bbExcludedDirs, dir, list_find) != NULL)); +} + +void +set_toolbar_visible (gboolean visible) +{ + GtkWidget *toolbar; + GtkWidget *menu; + + toolbar = glade_xml_get_widget (baobab.main_xml, "toolbar1"); + + if (visible) + gtk_widget_show (toolbar); + else + gtk_widget_hide (toolbar); + + /* make sure the check menu item is consistent */ + menu = glade_xml_get_widget (baobab.main_xml, "view_tb"); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu), visible); +} + +void +set_statusbar_visible (gboolean visible) +{ + GtkWidget *statusbar; + GtkWidget *menu; + + statusbar = glade_xml_get_widget (baobab.main_xml, "statusbar1"); + + if (visible) + gtk_widget_show (statusbar); + else + gtk_widget_hide (statusbar); + + /* make sure the check menu item is consistent */ + menu = glade_xml_get_widget (baobab.main_xml, "view_sb"); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu), visible); +} + +static void +baobab_toolbar_style (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer user_data) +{ + GtkWidget *toolbar; + gchar *toolbar_setting; + + toolbar = glade_xml_get_widget(baobab.main_xml, "toolbar1"); + toolbar_setting = gconf_client_get_string (baobab.gconf_client, + SYSTEM_TOOLBAR_STYLE, + NULL); + + if (!strcmp(toolbar_setting, "icons")) { + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); + } + else if (!strcmp(toolbar_setting, "both")) { + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH); + } + else if (!strcmp(toolbar_setting, "both-horiz")) { + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH_HORIZ); + } + else if (!strcmp(toolbar_setting, "text")) { + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_TEXT); + } + + g_free (toolbar_setting); +} + +static void +baobab_init (void) +{ + GnomeVFSResult result; + GnomeVFSVolumeMonitor *volmonitor; + gboolean visible; + + /* Load Glade */ + baobab.main_xml = glade_xml_new (BAOBAB_GLADE_FILE, + "baobab_window", NULL); + glade_xml_signal_autoconnect (baobab.main_xml); + + /* Misc */ + baobab.label_scan = NULL; + baobab.label_search = NULL; + baobab.last_scan_command = g_string_new ("/"); + baobab.CONTENTS_CHANGED_DELAYED = FALSE; + baobab.STOP_SCANNING = TRUE; + baobab.show_allocated = TRUE; + baobab.is_local = TRUE; + + /* GConf */ + baobab.gconf_client = gconf_client_get_default (); + gconf_client_add_dir (baobab.gconf_client, BAOBAB_KEY_DIR, + GCONF_CLIENT_PRELOAD_NONE, NULL); + gconf_client_notify_add (baobab.gconf_client, PROPS_SCAN_KEY, props_notify, + NULL, NULL, NULL); + gconf_client_notify_add (baobab.gconf_client, SYSTEM_TOOLBAR_STYLE, baobab_toolbar_style, + NULL, NULL, NULL); + baobab.bbExcludedDirs = gconf_client_get_list (baobab.gconf_client, PROPS_SCAN_KEY, + GCONF_VALUE_STRING, NULL); + baobab.bbEnableHomeMonitor = gconf_client_get_bool (baobab.gconf_client, + PROPS_ENABLE_HOME_MONITOR, + NULL); + + /* toolbar & statusbar visibility */ + visible = gconf_client_get_bool (baobab.gconf_client, + BAOBAB_TOOLBAR_VISIBLE_KEY, + NULL); + set_toolbar_visible (visible); + visible = gconf_client_get_bool (baobab.gconf_client, + BAOBAB_STATUSBAR_VISIBLE_KEY, + NULL); + set_statusbar_visible (visible); + + /* set the toolbar style */ + baobab_toolbar_style(NULL, 0, NULL, NULL); + + /* initialize bbSearchOpt variables */ + bbSearchOpt.filename = g_string_new (""); + bbSearchOpt.dir = g_string_new (g_get_home_dir ()); + bbSearchOpt.mod_date = NONE; + bbSearchOpt.size_limit = NONE; + bbSearchOpt.exact = TRUE; + bbSearchOpt.search_whole = FALSE; + bbSearchOpt.dont_recurse_dir = FALSE; + + /* start VFS monitoring */ + handle_home = NULL; + + volmonitor = gnome_vfs_get_volume_monitor (); + g_signal_connect (volmonitor, "volume_mounted", + G_CALLBACK (volume_changed), NULL); + g_signal_connect (volmonitor, "volume_unmounted", + G_CALLBACK (volume_changed), NULL); + + result = gnome_vfs_monitor_add (&handle_home, + g_get_home_dir (), + GNOME_VFS_MONITOR_DIRECTORY, + contents_changed_cb, NULL); + + if (result != GNOME_VFS_OK) { + message (_("Cannot initialize GNOME VFS monitoring\n" + "Some real-time auto-detect function will not be available!"), + NULL); + g_print ("homedir:%s\n", + gnome_vfs_result_to_string (result)); + } +} + +static void +baobab_shutdown (void) +{ + g_free (baobab.label_scan); + g_free (baobab.label_search); + g_string_free (baobab.last_scan_command, TRUE); + g_string_free (bbSearchOpt.filename, TRUE); + g_string_free (bbSearchOpt.dir, TRUE); + + if (handle_mtab) + gnome_vfs_monitor_cancel (handle_mtab); + if (handle_home) + gnome_vfs_monitor_cancel (handle_home); + + g_free (baobab.selected_path); + + g_slist_foreach (baobab.bbExcludedDirs, (GFunc) g_free, NULL); + g_slist_free (baobab.bbExcludedDirs); + + if (baobab.gconf_client) + g_object_unref (baobab.gconf_client); + + if (done_image) + g_object_unref (done_image); + if (busy_image) + g_object_unref (busy_image); +} + +int +main (int argc, char *argv[]) +{ + GnomeProgram *program; + + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + program = gnome_program_init ("baobab", VERSION, + LIBGNOMEUI_MODULE, + argc, argv, + GNOME_PARAM_APP_DATADIR, + BAOBAB_DATA_DIR, NULL); + + g_set_application_name ("Baobab"); + + g_assert (gnome_vfs_init ()); + gnome_authentication_manager_init (); + glibtop_init (); + + gtk_window_set_default_icon_name ("baobab"); + + baobab_init (); + + baobab_get_filesystem (&g_fs); + set_label_scan (&g_fs); + + baobab.window = glade_xml_get_widget (baobab.main_xml, "baobab_window"); + gtk_window_set_position (GTK_WINDOW (baobab.window), + GTK_WIN_POS_CENTER); + + /* set global pixbufs */ + baobab.yellow_bar = baobab_load_pixbuf ("yellow.png"); + baobab.red_bar = baobab_load_pixbuf ("red.png"); + baobab.green_bar = baobab_load_pixbuf ("green.png"); + + baobab.tree_view = create_directory_treeview (); + baobab.tree_search = create_filesearch_treeview (); + set_label_search (0, 0); + + switch_view (VIEW_SEARCH); + switch_view (VIEW_TREE); + show_label (VIEW_TREE); + set_busy (FALSE); + + /* set allocated space checkbox */ + gtk_toggle_button_set_active ((GtkToggleButton *) + glade_xml_get_widget (baobab. + main_xml, + "ck_allocated"), + baobab.show_allocated); + + set_glade_widget_sens("menu_treemap",FALSE); + gtk_widget_show (baobab.window); + + first_row (); + set_statusbar (_("Ready")); + + /* commandline */ + if (argc > 1) { + gchar *uri_shell; + uri_shell = gnome_vfs_make_uri_from_shell_arg (argv[1]); + start_proc_on_dir (uri_shell); + g_free (uri_shell); + } + + gtk_main (); + + baobab_shutdown (); + + glibtop_close (); + gnome_vfs_shutdown (); + + g_object_unref (program); + + return 0; +} diff --git a/src/baobab.h b/src/baobab.h new file mode 100644 index 0000000..bf1394a --- /dev/null +++ b/src/baobab.h @@ -0,0 +1,137 @@ +/* + * baobab.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + + +#ifndef __BAOBAB_H__ +#define __BAOBAB_H__ + + +#include <time.h> +#include <sys/types.h> +#include <glib.h> +#include <gtk/gtk.h> +#include <glade/glade-xml.h> +#include <gconf/gconf-client.h> + +typedef struct _baobab_application baobab_application; +typedef struct _baobab_fs baobab_fs; +struct BaobabSearchOpt; + +#define BAOBAB_GLADE_FILE BAOBAB_PIX_DIR "baobab.glade" + +#define VIEW_TREE 0 +#define VIEW_SEARCH 1 + +#define BAOBAB_KEY_DIR "/apps/baobab" +#define BAOBAB_TOOLBAR_VISIBLE_KEY BAOBAB_KEY_DIR "/ui/toolbar_visible" +#define BAOBAB_STATUSBAR_VISIBLE_KEY BAOBAB_KEY_DIR "/ui/statusbar_visible" +#define PROPS_SCAN_KEY BAOBAB_KEY_DIR "/properties/noscan" +#define PROPS_ENABLE_HOME_MONITOR BAOBAB_KEY_DIR "/properties/enable_home_monitor" +#define SYSTEM_TOOLBAR_STYLE "/desktop/gnome/interface/toolbar_style" + + +struct _baobab_application { + GladeXML *main_xml; + GtkWidget *window; + GtkWidget *tree_view; + GtkWidget *tree_search; + GtkTreeStore *model; + GtkListStore *model_search; + GtkTreeStore *search_model; + gboolean STOP_SCANNING; + GdkPixbuf *green_bar,*yellow_bar,*red_bar; + gboolean CONTENTS_CHANGED_DELAYED; + GSList *bbExcludedDirs; + gboolean bbEnableHomeMonitor; + gchar *label_scan; + gchar *label_search; + GString *last_scan_command; + gint number_found_files; + guint64 size_found_files; + gboolean show_allocated; + gboolean is_local; + + char *selected_path; + + GConfClient *gconf_client; +}; + +struct _baobab_fs { + guint64 total; + guint64 used; + guint64 avail; +}; + +struct chan_data { + guint64 size; + guint64 alloc_size; + guint64 tempHLsize; + guint depth; + gint elements; + gchar *dir; +}; + +struct BaobabSearchRet { + guint64 size; + guint64 alloc_size; + gchar *fullpath; + time_t lastacc; + uid_t owner; + gchar *mime_type; +}; + +/* Advanced search options enums */ +enum { + NONE = 1, + LAST_WEEK = 2, + LAST_MONTH = 3, + SIZE_SMALL = 2, + SIZE_MEDIUM = 3 +}; + +struct BaobabSearchOpt { + GString *filename; + GString *dir; + gint mod_date; + gint size_limit; + gboolean dont_recurse_dir; + gboolean exact; + gboolean search_whole; +}; + +/* globals */ +baobab_application baobab; +baobab_fs g_fs; +struct BaobabSearchOpt bbSearchOpt; + +void set_busy (gboolean busy); +void start_proc_on_dir (const gchar *); +void fill_model (struct chan_data *); +void start_search (const gchar *, const gchar *); +void fill_search_model (struct BaobabSearchRet *); +void first_row (void); +gint list_find (gconstpointer a, gconstpointer b); +gboolean is_excluded_dir (const gchar *); +void set_toolbar_visible (gboolean visible); +void set_statusbar_visible (gboolean visible); + +#endif /* __BAOBAB_H_ */ diff --git a/src/callbacks.c b/src/callbacks.c new file mode 100644 index 0000000..9af3c40 --- /dev/null +++ b/src/callbacks.c @@ -0,0 +1,506 @@ +/* + * callbacks.c + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <gtk/gtk.h> +#include <glib/gi18n.h> +#include <libgnomevfs/gnome-vfs.h> +#include <libgnomevfs/gnome-vfs-mime.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <gconf/gconf-client.h> + +#include "baobab.h" +#include "baobab-graphwin.h" +#include "baobab-treeview.h" +#include "baobab-utils.h" +#include "callbacks.h" +#include "baobab-prefs.h" +#include "baobab-remote-connect-dialog.h" + +void +on_menuallfs_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + start_proc_on_dir ("file:///"); +} + +void +on_menuscandir_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + dir_select (FALSE, baobab.window); +} + +void +on_esci1_activate (GtkObject *menuitem, gpointer user_data) +{ + baobab.STOP_SCANNING = TRUE; + gtk_main_quit (); +} + +void +on_about_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + const gchar * const authors[] = { + "Fabio Marzocca <thesaltydog@gmail.com>", + "Paolo Borelli <pborelli@katamail.com>", + "Benoît Dejean <benoit@placenet.org>", + NULL + }; + + static const gchar copyright[] = "Fabio Marzocca <thesaltydog@gmail.com> \xc2\xa9 2005-2006"; + + gtk_show_about_dialog (NULL, + "name", _("Baobab"), + "comments", _("A graphical tool to analyse " + "disk usage."), + "version", VERSION, + "copyright", copyright, + "logo-icon-name", "baobab", + "license", "GPL", + "authors", authors, "website", + "http://www.gnome.org/projects/baobab", + "translator-credits", + _("translator-credits"), NULL); +} + +void +on_tbscandir_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + dir_select (FALSE, baobab.window); +} + +void +on_sort_alfa_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + if (get_NB_page () == VIEW_TREE) { + gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) + baobab.model, + COL_DIR_NAME, + GTK_SORT_ASCENDING); + } + if (get_NB_page () == VIEW_SEARCH) { + gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) + baobab.model_search, + COL_FULLPATH, + GTK_SORT_ASCENDING); + } +} + +void +on_by_sort_size_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + if (get_NB_page () == VIEW_TREE) { + gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) + baobab.model, + COL_H_SIZE, + GTK_SORT_DESCENDING); + } + if (get_NB_page () == VIEW_SEARCH) { + gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) + baobab.model_search, + COL_SIZE, + GTK_SORT_DESCENDING); + } +} + +void +on_tbstop_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + baobab.STOP_SCANNING = TRUE; + stop_scan (); +} + +void +on_tbsortalfa_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + on_sort_alfa_activate (NULL, NULL); +} + +void +on_tbsortnum_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + on_by_sort_size_activate (NULL, NULL); +} + +void +on_tbscanall_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + start_proc_on_dir ("file:///"); +} + +void +on_tb_scan_remote_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + gint response; + GtkWidget *dlg; + + dlg = + baobab_remote_connect_dialog_new (GTK_WINDOW (baobab.window), + NULL); + response = gtk_dialog_run (GTK_DIALOG (dlg)); + + gtk_widget_destroy (dlg); + + while (gtk_events_pending ()) + gtk_main_iteration (); + + if (response == GTK_RESPONSE_OK) + start_proc_on_dir (baobab.last_scan_command->str); +} + +void +on_menu_scan_rem_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + on_tb_scan_remote_clicked (NULL, NULL); +} + +void +on_tb_search_clicked (GtkToolButton *toolbutton, gpointer user_data) +{ + dialog_search (); +} + +void +on_radio_allfs_clicked (GtkButton *button, gpointer user_data) +{ + GladeXML *dlg_xml = glade_get_widget_tree ((GtkWidget *) button); + gtk_widget_set_sensitive (glade_xml_get_widget (dlg_xml, "entry2"), + FALSE); + gtk_widget_set_sensitive (glade_xml_get_widget + (dlg_xml, "btn_select_search"), FALSE); +} + +void +on_radio_dir_clicked (GtkButton *button, gpointer user_data) +{ + GladeXML *dlg_xml = glade_get_widget_tree ((GtkWidget *) button); + gtk_widget_set_sensitive (glade_xml_get_widget (dlg_xml, "entry2"), + TRUE); + gtk_widget_set_sensitive (glade_xml_get_widget + (dlg_xml, "btn_select_search"), TRUE); +} + +void +on_btn_select_search_clicked (GtkButton *button, gpointer user_data) +{ + GtkWidget *dlg = gtk_widget_get_toplevel ((GtkWidget *) button); + GladeXML *dlg_xml = glade_get_widget_tree ((GtkWidget *) button); + GtkWidget *entry_dir = glade_xml_get_widget (dlg_xml, "entry2"); + gchar *dirname = dir_select (TRUE, dlg); + if (dirname) { + gchar *string_to_display = + gnome_vfs_format_uri_for_display (dirname); + gtk_entry_set_text (GTK_ENTRY (entry_dir), + string_to_display); + g_free (dirname); + g_free (string_to_display); + } +} + +void +on_search_for_a_file_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + dialog_search (); +} + +void +on_notebook1_switch_page (GtkNotebook *notebook, + GtkNotebookPage *page, + guint page_num, gpointer user_data) +{ + if (page_num == VIEW_SEARCH) { + set_glade_widget_sens("by_type1",TRUE); + set_glade_widget_sens("by_date1",TRUE); + set_glade_widget_sens("ck_allocated",FALSE); + set_glade_widget_sens("menu_treemap",FALSE); + } + + if (page_num == VIEW_TREE) { + set_glade_widget_sens("by_type1",FALSE); + set_glade_widget_sens("by_date1",FALSE); + if (baobab.is_local) + set_glade_widget_sens("ck_allocated",TRUE); + if (baobab.CONTENTS_CHANGED_DELAYED) { + baobab.CONTENTS_CHANGED_DELAYED = FALSE; + if (baobab.STOP_SCANNING) { + contents_changed (); + + } + } + } + + show_label (page_num); +} + +gboolean +on_delete_activate (GtkWidget *widget, + GdkEvent *event, gpointer user_data) +{ + on_esci1_activate (NULL, NULL); + return TRUE; +} + +void +open_file_cb (GtkMenuItem *pmenu, gpointer dummy) +{ + g_assert (!dummy); + g_assert (baobab.selected_path); + + GnomeVFSURI *vfs_uri; + + vfs_uri = gnome_vfs_uri_new (baobab.selected_path); + + if (!gnome_vfs_uri_exists (vfs_uri)) { + message (_("The document does not exist."), baobab.window); + } + gnome_vfs_uri_unref (vfs_uri); + open_file_with_application (baobab.selected_path); +} + +void +trash_file_cb (GtkMenuItem *pmenu, gpointer dummy) +{ + g_assert (!dummy); + g_assert (baobab.selected_path); + + if (trash_file (baobab.selected_path)) { + GtkTreeIter iter; + guint64 filesize; + GtkTreeSelection *selection; + + selection = + gtk_tree_view_get_selection ((GtkTreeView *) baobab. + tree_search); + gtk_tree_selection_get_selected (selection, NULL, &iter); + gtk_tree_model_get ((GtkTreeModel *) baobab.model_search, + &iter, COL_SIZE, &filesize, -1); + gtk_list_store_remove (GTK_LIST_STORE + (baobab.model_search), &iter); + set_label_search (baobab.number_found_files - 1, + baobab.size_found_files - filesize); + show_label (VIEW_SEARCH); + if (baobab.bbEnableHomeMonitor) + baobab.CONTENTS_CHANGED_DELAYED = TRUE; + } +} + +void +graph_map_cb (GtkMenuItem *pmenu, gchar *path_to_string) +{ + baobab_graphwin_create (GTK_TREE_MODEL (baobab.model), + path_to_string, + BAOBAB_GLADE_FILE, + COL_H_FULLPATH, + baobab.is_local ? COL_H_ALLOCSIZE : COL_H_SIZE, + -1); + g_free (path_to_string); +} + +void +trash_dir_cb (GtkMenuItem *pmenu, gpointer dummy) +{ + g_assert (!dummy); + g_assert (baobab.selected_path); + + if (trash_file (baobab.selected_path)) { + GtkTreeIter iter; + guint64 filesize; + GtkTreeSelection *selection; + + selection = + gtk_tree_view_get_selection ((GtkTreeView *) baobab. + tree_view); + gtk_tree_selection_get_selected (selection, NULL, &iter); + gtk_tree_model_get ((GtkTreeModel *) baobab.model, &iter, + 5, &filesize, -1); + gtk_tree_store_remove (GTK_TREE_STORE (baobab.model), + &iter); + contents_changed (); + } +} + +void +list_all_cb (GtkMenuItem *pmenu, gpointer dummy) +{ + g_assert (!dummy); + g_assert (baobab.selected_path); + + bbSearchOpt.mod_date = NONE; + bbSearchOpt.size_limit = NONE; + bbSearchOpt.dont_recurse_dir = TRUE; + start_search ("*", baobab.selected_path); +} + +void +volume_changed (GnomeVFSVolumeMonitor *volume_monitor, + GnomeVFSVolume *volume) +{ + /* filesystem has changed (mounted or unmounted device) */ + baobab_get_filesystem (&g_fs); + set_label_scan (&g_fs); + if (get_NB_page () == VIEW_TREE) + show_label (VIEW_TREE); +} + +void +contents_changed_cb (GnomeVFSMonitorHandle *handle, + const gchar *monitor_uri, + const gchar *info_uri, + GnomeVFSMonitorEventType event_type, + gpointer user_data) +{ + gchar *excluding; + + if (!baobab.bbEnableHomeMonitor) + return; + + if (baobab.CONTENTS_CHANGED_DELAYED) + return; + + excluding = g_path_get_basename (info_uri); + if (strcmp (excluding, ".recently-used") == 0 || + strcmp (excluding, ".gnome2_private") == 0 || + strcmp (excluding, ".xsession-errors") == 0 || + strcmp (excluding, ".bash_history") == 0 || + strcmp (excluding, ".gconfd") == 0) { + g_free (excluding); + return; + } + g_free (excluding); + + baobab.CONTENTS_CHANGED_DELAYED = TRUE; +} + +void +on_pref_menu (GtkMenuItem *menuitem, gpointer user_data) +{ + create_props (); +} + +void +on_by_type1_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + if (get_NB_page () == VIEW_SEARCH) { + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (baobab.model_search), + COL_FILETYPE, + GTK_SORT_ASCENDING); + } +} + +void +on_by_date1_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + if (get_NB_page () == VIEW_SEARCH) { + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (baobab.model_search), + COL_LASTACCESS, + GTK_SORT_DESCENDING); + } +} + +void +on_ck_allocated_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + GdkCursor *cursor = NULL; + + if (!baobab.is_local) + return; + + baobab.show_allocated = gtk_toggle_button_get_active (togglebutton); + + /* change the cursor */ + if (baobab.window->window) { + cursor = gdk_cursor_new (GDK_WATCH); + gdk_window_set_cursor (baobab.window->window, cursor); + } + + set_busy (TRUE); + set_statusbar (_("Calculating percentage bars...")); + gtk_tree_model_foreach (GTK_TREE_MODEL (baobab.model), + show_bars, NULL); + set_busy (FALSE); + set_statusbar (_("Ready")); + + /* cursor clean up */ + if (baobab.window->window) { + gdk_window_set_cursor (baobab.window->window, NULL); + if (cursor) + gdk_cursor_unref (cursor); + } +} + +void +on_view_tb_activate (GtkCheckMenuItem *checkmenuitem, + gpointer user_data) +{ + gboolean visible; + + visible = gtk_check_menu_item_get_active (checkmenuitem); + set_toolbar_visible (visible); + + gconf_client_set_bool (baobab.gconf_client, + BAOBAB_TOOLBAR_VISIBLE_KEY, + visible, + NULL); +} + +void +on_view_sb_activate (GtkCheckMenuItem *checkmenuitem, + gpointer user_data) +{ + gboolean visible; + + visible = gtk_check_menu_item_get_active (checkmenuitem); + set_statusbar_visible (visible); + + gconf_client_set_bool (baobab.gconf_client, + BAOBAB_STATUSBAR_VISIBLE_KEY, + visible, + NULL); +} + +void +on_menu_treemap_activate (GtkMenuItem *menuitem, gpointer user_data) +{ + + GtkTreeIter iter; + GtkTreePath *path; + gchar *path_to_string; + + if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection + (GTK_TREE_VIEW(baobab.tree_view)), + NULL, + &iter)) + return; + + path = gtk_tree_model_get_path(GTK_TREE_MODEL(baobab.model), &iter); + + /* path_to_string is freed in graph_map_cb function */ + path_to_string = gtk_tree_path_to_string (path); + + gtk_tree_path_free(path); + graph_map_cb(NULL, path_to_string); + +} diff --git a/src/callbacks.h b/src/callbacks.h new file mode 100644 index 0000000..5b5fad2 --- /dev/null +++ b/src/callbacks.h @@ -0,0 +1,79 @@ +/* + * callbacks.h + * This file is part of baobab + * + * Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __BAOBAB_CALLBACKS_H__ +#define __BAOBAB_CALLBACKS_H__ + +#include <gtk/gtk.h> +#include <libgnomevfs/gnome-vfs.h> +#include <libgnomevfs/gnome-vfs-mime.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> + + +void on_about_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_menuallfs_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_menuscandir_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_tbscandir_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_sort_alfa_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_by_sort_size_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_tbstop_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_tbsortalfa_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_tbsortnum_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_tbscanall_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_tb_search_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_btn_oksearch_clicked (GtkButton *button, gpointer user_data); +void on_radio_allfs_clicked (GtkButton *button, gpointer user_data); +void on_radio_dir_clicked (GtkButton *button, gpointer user_data); +void on_btn_select_search_clicked (GtkButton *button, gpointer user_data); +void on_search_for_a_file_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_notebook1_switch_page (GtkNotebook *notebook, + GtkNotebookPage *page, + guint page_num, + gpointer user_data); +void on_esci1_activate (GtkObject *object, gpointer user_data); +gboolean on_delete_activate (GtkWidget *widget, GdkEvent *event, gpointer user_data); +void open_file_cb (GtkMenuItem *pmenu, gpointer dummy); +void trash_file_cb (GtkMenuItem *pmenu, gpointer dummy); +void graph_map_cb (GtkMenuItem *pmenu, gchar * path_to_string); +void trash_dir_cb (GtkMenuItem *pmenu, gpointer dummy); +void list_all_cb (GtkMenuItem *pmenu, gpointer dummy); +void contents_changed_cb (GnomeVFSMonitorHandle *handle, + const gchar *monitor_uri, + const gchar *info_uri, + GnomeVFSMonitorEventType event_type, + gpointer user_data); +void on_pref_menu (GtkMenuItem *menuitem, gpointer user_data); +void on_by_type1_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_by_date1_activate (GtkMenuItem *menuitem, gpointer user_data); +void volume_changed (GnomeVFSVolumeMonitor *volume_monitor, GnomeVFSVolume *volume); +void on_ck_allocated_toggled (GtkToggleButton *togglebutton, gpointer user_data); +void on_graph_close_btn_clicked (GtkButton * button, gpointer user_data); +void on_graph_zoom_in_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_graph_zoom_out_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_graph_zoom_100_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_tb_scan_remote_clicked (GtkToolButton *toolbutton, gpointer user_data); +void on_menu_scan_rem_activate (GtkMenuItem *menuitem, gpointer user_data); +void on_view_tb_activate (GtkCheckMenuItem *checkmenuitem, gpointer user_data); +void on_view_sb_activate (GtkCheckMenuItem *checkmenuitem, gpointer user_data); +void on_menu_treemap_activate (GtkMenuItem *menuitem, gpointer user_data); + +#endif /* __BAOBAB_CALLBACKS_H__ */ |