#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"Go to the source code of this file.
Functions | |
| void | on_menuallfs_activate (GtkMenuItem *menuitem, gpointer user_data) |
| void | on_menuscandir_activate (GtkMenuItem *menuitem, gpointer user_data) |
| void | on_esci1_activate (GtkObject *menuitem, gpointer user_data) |
| void | on_about_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_scan_remote_clicked (GtkToolButton *toolbutton, gpointer user_data) |
| void | on_menu_scan_rem_activate (GtkMenuItem *menuitem, gpointer user_data) |
| void | on_tb_search_clicked (GtkToolButton *toolbutton, 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) |
| 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 | volume_changed (GnomeVFSVolumeMonitor *volume_monitor, GnomeVFSVolume *volume) |
| 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 | on_ck_allocated_toggled (GtkToggleButton *togglebutton, 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) |
| void | on_helpcontents_activate (GtkMenuItem *menuitem, gpointer user_data) |
| void | scan_folder_cb (GtkMenuItem *pmenu, gpointer dummy) |
|
||||||||||||||||||||||||
|
Definition at line 372 of file callbacks.c. References baobab, _baobab_application::bbEnableHomeMonitor, and _baobab_application::CONTENTS_CHANGED_DELAYED. Referenced by baobab_init(). 00377 { 00378 gchar *excluding; 00379 00380 if (!baobab.bbEnableHomeMonitor) 00381 return; 00382 00383 if (baobab.CONTENTS_CHANGED_DELAYED) 00384 return; 00385 00386 excluding = g_path_get_basename (info_uri); 00387 if (strcmp (excluding, ".recently-used") == 0 || 00388 strcmp (excluding, ".gnome2_private") == 0 || 00389 strcmp (excluding, ".xsession-errors") == 0 || 00390 strcmp (excluding, ".bash_history") == 0 || 00391 strcmp (excluding, ".gconfd") == 0) { 00392 g_free (excluding); 00393 return; 00394 } 00395 g_free (excluding); 00396 00397 baobab.CONTENTS_CHANGED_DELAYED = TRUE; 00398 }
|
|
||||||||||||
|
Definition at line 313 of file callbacks.c. References baobab, BAOBAB_GLADE_FILE, baobab_graphwin_create(), COL_H_ALLOCSIZE, COL_H_FULLPATH, COL_H_SIZE, _baobab_application::is_local, and _baobab_application::model. Referenced by on_menu_treemap_activate(), and popupmenu_list(). 00314 { 00315 baobab_graphwin_create (GTK_TREE_MODEL (baobab.model), 00316 path_to_string, 00317 BAOBAB_GLADE_FILE, 00318 COL_H_FULLPATH, 00319 baobab.is_local ? COL_H_ALLOCSIZE : COL_H_SIZE, 00320 -1); 00321 g_free (path_to_string); 00322 }
|
|
||||||||||||
|
Definition at line 349 of file callbacks.c. References baobab, bbSearchOpt, BaobabSearchOpt::dont_recurse_dir, BaobabSearchOpt::mod_date, NONE, _baobab_application::selected_path, BaobabSearchOpt::size_limit, and start_search(). Referenced by popupmenu_list(). 00350 { 00351 g_assert (!dummy); 00352 g_assert (baobab.selected_path); 00353 00354 bbSearchOpt.mod_date = NONE; 00355 bbSearchOpt.size_limit = NONE; 00356 bbSearchOpt.dont_recurse_dir = TRUE; 00357 start_search ("*", baobab.selected_path); 00358 }
|
|
||||||||||||
|
Definition at line 63 of file callbacks.c. 00064 { 00065 const gchar * const authors[] = { 00066 "Fabio Marzocca <thesaltydog@gmail.com>", 00067 "Paolo Borelli <pborelli@katamail.com>", 00068 "BenoƮt Dejean <benoit@placenet.org>", 00069 NULL 00070 }; 00071 00072 static const gchar copyright[] = "Fabio Marzocca <thesaltydog@gmail.com> \xc2\xa9 2005-2006"; 00073 00074 gtk_show_about_dialog (NULL, 00075 "name", _("Baobab"), 00076 "comments", _("A graphical tool to analyse " 00077 "disk usage."), 00078 "version", VERSION, 00079 "copyright", copyright, 00080 "logo-icon-name", "baobab", 00081 "license", "GPL", 00082 "authors", authors, "website", 00083 "http://www.gnome.org/projects/baobab", 00084 "translator-credits", 00085 _("translator-credits"), NULL); 00086 }
|
|
||||||||||||
|
Definition at line 206 of file callbacks.c. References dir_select(). Referenced by dialog_search(). 00207 { 00208 GtkWidget *dlg = gtk_widget_get_toplevel ((GtkWidget *) button); 00209 GladeXML *dlg_xml = glade_get_widget_tree ((GtkWidget *) button); 00210 GtkWidget *entry_dir = glade_xml_get_widget (dlg_xml, "entry2"); 00211 gchar *dirname = dir_select (TRUE, dlg); 00212 if (dirname) { 00213 gchar *string_to_display = 00214 gnome_vfs_format_uri_for_display (dirname); 00215 gtk_entry_set_text (GTK_ENTRY (entry_dir), 00216 string_to_display); 00217 g_free (dirname); 00218 g_free (string_to_display); 00219 } 00220 }
|
|
||||||||||||
|
Definition at line 417 of file callbacks.c. References baobab, COL_LASTACCESS, get_NB_page(), _baobab_application::model_search, and VIEW_SEARCH. 00418 { 00419 if (get_NB_page () == VIEW_SEARCH) { 00420 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (baobab.model_search), 00421 COL_LASTACCESS, 00422 GTK_SORT_DESCENDING); 00423 } 00424 }
|
|
||||||||||||
|
Definition at line 112 of file callbacks.c. References baobab, COL_H_SIZE, COL_SIZE, get_NB_page(), _baobab_application::model, _baobab_application::model_search, VIEW_SEARCH, and VIEW_TREE. Referenced by on_tbsortnum_clicked(). 00113 { 00114 if (get_NB_page () == VIEW_TREE) { 00115 gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) 00116 baobab.model, 00117 COL_H_SIZE, 00118 GTK_SORT_DESCENDING); 00119 } 00120 if (get_NB_page () == VIEW_SEARCH) { 00121 gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) 00122 baobab.model_search, 00123 COL_SIZE, 00124 GTK_SORT_DESCENDING); 00125 } 00126 }
|
|
||||||||||||
|
Definition at line 407 of file callbacks.c. References baobab, COL_FILETYPE, get_NB_page(), _baobab_application::model_search, and VIEW_SEARCH. 00408 { 00409 if (get_NB_page () == VIEW_SEARCH) { 00410 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (baobab.model_search), 00411 COL_FILETYPE, 00412 GTK_SORT_ASCENDING); 00413 } 00414 }
|
|
||||||||||||
|
Definition at line 427 of file callbacks.c. References baobab, _baobab_application::is_local, _baobab_application::model, set_busy(), set_statusbar(), _baobab_application::show_allocated, show_bars(), and _baobab_application::window. 00429 { 00430 GdkCursor *cursor = NULL; 00431 00432 if (!baobab.is_local) 00433 return; 00434 00435 baobab.show_allocated = gtk_toggle_button_get_active (togglebutton); 00436 00437 /* change the cursor */ 00438 if (baobab.window->window) { 00439 cursor = gdk_cursor_new (GDK_WATCH); 00440 gdk_window_set_cursor (baobab.window->window, cursor); 00441 } 00442 00443 set_busy (TRUE); 00444 set_statusbar (_("Calculating percentage bars...")); 00445 gtk_tree_model_foreach (GTK_TREE_MODEL (baobab.model), 00446 show_bars, NULL); 00447 set_busy (FALSE); 00448 set_statusbar (_("Ready")); 00449 00450 /* cursor clean up */ 00451 if (baobab.window->window) { 00452 gdk_window_set_cursor (baobab.window->window, NULL); 00453 if (cursor) 00454 gdk_cursor_unref (cursor); 00455 } 00456 }
|
|
||||||||||||||||
|
Definition at line 258 of file callbacks.c. References on_esci1_activate(). 00260 { 00261 on_esci1_activate (NULL, NULL); 00262 return TRUE; 00263 }
|
|
||||||||||||
|
Definition at line 56 of file callbacks.c. References baobab, and _baobab_application::STOP_SCANNING. Referenced by on_delete_activate(). 00057 { 00058 baobab.STOP_SCANNING = TRUE; 00059 gtk_main_quit (); 00060 }
|
|
||||||||||||
|
Definition at line 511 of file callbacks.c. References baobab, baobab_help_display(), and _baobab_application::window. 00512 { 00513 baobab_help_display (GTK_WINDOW (baobab.window), "baobab.xml", NULL); 00514 }
|
|
||||||||||||
|
Definition at line 174 of file callbacks.c. References on_tb_scan_remote_clicked(). 00175 { 00176 on_tb_scan_remote_clicked (NULL, NULL); 00177 }
|
|
||||||||||||
|
Definition at line 489 of file callbacks.c. References baobab, graph_map_cb(), _baobab_application::model, and _baobab_application::tree_view. 00490 { 00491 GtkTreeIter iter; 00492 GtkTreePath *path; 00493 gchar *path_to_string; 00494 00495 if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection 00496 (GTK_TREE_VIEW(baobab.tree_view)), 00497 NULL, 00498 &iter)) 00499 return; 00500 00501 path = gtk_tree_model_get_path(GTK_TREE_MODEL(baobab.model), &iter); 00502 00503 /* path_to_string is freed in graph_map_cb function */ 00504 path_to_string = gtk_tree_path_to_string (path); 00505 00506 gtk_tree_path_free(path); 00507 graph_map_cb(NULL, path_to_string); 00508 }
|
|
||||||||||||
|
Definition at line 44 of file callbacks.c. References start_proc_on_dir(). 00045 { 00046 start_proc_on_dir ("file:///"); 00047 }
|
|
||||||||||||
|
Definition at line 50 of file callbacks.c. References baobab, dir_select(), and _baobab_application::window. 00051 { 00052 dir_select (FALSE, baobab.window); 00053 }
|
|
||||||||||||||||||||
|
Definition at line 229 of file callbacks.c. References baobab, contents_changed(), _baobab_application::CONTENTS_CHANGED_DELAYED, _baobab_application::is_local, set_glade_widget_sens(), show_label(), _baobab_application::STOP_SCANNING, VIEW_SEARCH, and VIEW_TREE. 00232 { 00233 if (page_num == VIEW_SEARCH) { 00234 set_glade_widget_sens("by_type1",TRUE); 00235 set_glade_widget_sens("by_date1",TRUE); 00236 set_glade_widget_sens("ck_allocated",FALSE); 00237 set_glade_widget_sens("menu_treemap",FALSE); 00238 } 00239 00240 if (page_num == VIEW_TREE) { 00241 set_glade_widget_sens("by_type1",FALSE); 00242 set_glade_widget_sens("by_date1",FALSE); 00243 if (baobab.is_local) 00244 set_glade_widget_sens("ck_allocated",TRUE); 00245 if (baobab.CONTENTS_CHANGED_DELAYED) { 00246 baobab.CONTENTS_CHANGED_DELAYED = FALSE; 00247 if (baobab.STOP_SCANNING) { 00248 contents_changed (); 00249 00250 } 00251 } 00252 } 00253 00254 show_label (page_num); 00255 }
|
|
||||||||||||
|
Definition at line 401 of file callbacks.c. References create_props(). 00402 { 00403 create_props (); 00404 }
|
|
||||||||||||
|
Definition at line 186 of file callbacks.c. Referenced by dialog_search(). 00187 { 00188 GladeXML *dlg_xml = glade_get_widget_tree ((GtkWidget *) button); 00189 gtk_widget_set_sensitive (glade_xml_get_widget (dlg_xml, "entry2"), 00190 FALSE); 00191 gtk_widget_set_sensitive (glade_xml_get_widget 00192 (dlg_xml, "btn_select_search"), FALSE); 00193 }
|
|
||||||||||||
|
Definition at line 196 of file callbacks.c. Referenced by dialog_search(). 00197 { 00198 GladeXML *dlg_xml = glade_get_widget_tree ((GtkWidget *) button); 00199 gtk_widget_set_sensitive (glade_xml_get_widget (dlg_xml, "entry2"), 00200 TRUE); 00201 gtk_widget_set_sensitive (glade_xml_get_widget 00202 (dlg_xml, "btn_select_search"), TRUE); 00203 }
|
|
||||||||||||
|
Definition at line 223 of file callbacks.c. References dialog_search(). 00224 { 00225 dialog_search (); 00226 }
|
|
||||||||||||
|
Definition at line 95 of file callbacks.c. References baobab, COL_DIR_NAME, COL_FULLPATH, get_NB_page(), _baobab_application::model, _baobab_application::model_search, VIEW_SEARCH, and VIEW_TREE. Referenced by on_tbsortalfa_clicked(). 00096 { 00097 if (get_NB_page () == VIEW_TREE) { 00098 gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) 00099 baobab.model, 00100 COL_DIR_NAME, 00101 GTK_SORT_ASCENDING); 00102 } 00103 if (get_NB_page () == VIEW_SEARCH) { 00104 gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) 00105 baobab.model_search, 00106 COL_FULLPATH, 00107 GTK_SORT_ASCENDING); 00108 } 00109 }
|
|
||||||||||||
|
Definition at line 154 of file callbacks.c. References baobab, baobab_remote_connect_dialog_new(), _baobab_application::last_scan_command, start_proc_on_dir(), and _baobab_application::window. Referenced by on_menu_scan_rem_activate(). 00155 { 00156 gint response; 00157 GtkWidget *dlg; 00158 00159 dlg = 00160 baobab_remote_connect_dialog_new (GTK_WINDOW (baobab.window), 00161 NULL); 00162 response = gtk_dialog_run (GTK_DIALOG (dlg)); 00163 00164 gtk_widget_destroy (dlg); 00165 00166 while (gtk_events_pending ()) 00167 gtk_main_iteration (); 00168 00169 if (response == GTK_RESPONSE_OK) 00170 start_proc_on_dir (baobab.last_scan_command->str); 00171 }
|
|
||||||||||||
|
Definition at line 180 of file callbacks.c. References dialog_search(). 00181 { 00182 dialog_search (); 00183 }
|
|
||||||||||||
|
Definition at line 148 of file callbacks.c. References start_proc_on_dir(). 00149 { 00150 start_proc_on_dir ("file:///"); 00151 }
|
|
||||||||||||
|
Definition at line 89 of file callbacks.c. References baobab, dir_select(), and _baobab_application::window. 00090 { 00091 dir_select (FALSE, baobab.window); 00092 }
|
|
||||||||||||
|
Definition at line 136 of file callbacks.c. References on_sort_alfa_activate(). 00137 { 00138 on_sort_alfa_activate (NULL, NULL); 00139 }
|
|
||||||||||||
|
Definition at line 142 of file callbacks.c. References on_by_sort_size_activate(). 00143 { 00144 on_by_sort_size_activate (NULL, NULL); 00145 }
|
|
||||||||||||
|
Definition at line 129 of file callbacks.c. References baobab, stop_scan(), and _baobab_application::STOP_SCANNING. 00130 { 00131 baobab.STOP_SCANNING = TRUE; 00132 stop_scan (); 00133 }
|
|
||||||||||||
|
Definition at line 474 of file callbacks.c. References baobab, BAOBAB_STATUSBAR_VISIBLE_KEY, _baobab_application::gconf_client, and set_statusbar_visible(). 00476 { 00477 gboolean visible; 00478 00479 visible = gtk_check_menu_item_get_active (checkmenuitem); 00480 set_statusbar_visible (visible); 00481 00482 gconf_client_set_bool (baobab.gconf_client, 00483 BAOBAB_STATUSBAR_VISIBLE_KEY, 00484 visible, 00485 NULL); 00486 }
|
|
||||||||||||
|
Definition at line 459 of file callbacks.c. References baobab, BAOBAB_TOOLBAR_VISIBLE_KEY, _baobab_application::gconf_client, and set_toolbar_visible(). 00461 { 00462 gboolean visible; 00463 00464 visible = gtk_check_menu_item_get_active (checkmenuitem); 00465 set_toolbar_visible (visible); 00466 00467 gconf_client_set_bool (baobab.gconf_client, 00468 BAOBAB_TOOLBAR_VISIBLE_KEY, 00469 visible, 00470 NULL); 00471 }
|
|
||||||||||||
|
Definition at line 266 of file callbacks.c. Referenced by file_button_release_event_cb(), file_event_after_cb(), file_key_press_event_cb(), gsearchtool_ui_manager(), popupmenu_list(), popupmenu_list_search(), and tm_popupmenu(). 00267 { 00268 GnomeVFSURI *vfs_uri; 00269 00270 g_assert (!dummy); 00271 g_assert (baobab.selected_path); 00272 00273 vfs_uri = gnome_vfs_uri_new (baobab.selected_path); 00274 00275 if (!gnome_vfs_uri_exists (vfs_uri)) { 00276 message (_("The document does not exist."), baobab.window); 00277 gnome_vfs_uri_unref (vfs_uri); 00278 return; 00279 } 00280 00281 gnome_vfs_uri_unref (vfs_uri); 00282 open_file_with_application (baobab.selected_path); 00283 }
|
|
||||||||||||
|
Definition at line 517 of file callbacks.c. References baobab, message(), _baobab_application::selected_path, start_proc_on_dir(), and _baobab_application::window. Referenced by popupmenu_list_search(). 00518 { 00519 GnomeVFSURI *vfs_uri; 00520 00521 g_assert (!dummy); 00522 g_assert (baobab.selected_path); 00523 00524 vfs_uri = gnome_vfs_uri_new (baobab.selected_path); 00525 00526 if (!gnome_vfs_uri_exists (vfs_uri)) { 00527 message (_("The folder does not exist."), baobab.window); 00528 } 00529 00530 gnome_vfs_uri_unref (vfs_uri); 00531 00532 start_proc_on_dir (baobab.selected_path); 00533 }
|
|
||||||||||||
|
Definition at line 325 of file callbacks.c. References baobab, _baobab_application::bbEnableHomeMonitor, contents_changed(), _baobab_application::model, _baobab_application::selected_path, and trash_file(). Referenced by popupmenu_list(). 00326 { 00327 g_assert (!dummy); 00328 g_assert (baobab.selected_path); 00329 00330 if (trash_file (baobab.selected_path)) { 00331 GtkTreeIter iter; 00332 guint64 filesize; 00333 GtkTreeSelection *selection; 00334 00335 selection = 00336 gtk_tree_view_get_selection ((GtkTreeView *) baobab. 00337 tree_view); 00338 gtk_tree_selection_get_selected (selection, NULL, &iter); 00339 gtk_tree_model_get ((GtkTreeModel *) baobab.model, &iter, 00340 5, &filesize, -1); 00341 gtk_tree_store_remove (GTK_TREE_STORE (baobab.model), 00342 &iter); 00343 if (baobab.bbEnableHomeMonitor) 00344 contents_changed (); 00345 } 00346 }
|
|
||||||||||||
|
Definition at line 286 of file callbacks.c. References baobab, _baobab_application::bbEnableHomeMonitor, COL_SIZE, _baobab_application::CONTENTS_CHANGED_DELAYED, _baobab_application::model_search, _baobab_application::number_found_files, _baobab_application::selected_path, set_label_search(), show_label(), _baobab_application::size_found_files, trash_file(), and VIEW_SEARCH. Referenced by popupmenu_list_search(). 00287 { 00288 g_assert (!dummy); 00289 g_assert (baobab.selected_path); 00290 00291 if (trash_file (baobab.selected_path)) { 00292 GtkTreeIter iter; 00293 guint64 filesize; 00294 GtkTreeSelection *selection; 00295 00296 selection = 00297 gtk_tree_view_get_selection ((GtkTreeView *) baobab. 00298 tree_search); 00299 gtk_tree_selection_get_selected (selection, NULL, &iter); 00300 gtk_tree_model_get ((GtkTreeModel *) baobab.model_search, 00301 &iter, COL_SIZE, &filesize, -1); 00302 gtk_list_store_remove (GTK_LIST_STORE 00303 (baobab.model_search), &iter); 00304 set_label_search (baobab.number_found_files - 1, 00305 baobab.size_found_files - filesize); 00306 show_label (VIEW_SEARCH); 00307 if (baobab.bbEnableHomeMonitor) 00308 baobab.CONTENTS_CHANGED_DELAYED = TRUE; 00309 } 00310 }
|
|
||||||||||||
|
Definition at line 361 of file callbacks.c. References baobab_get_filesystem(), g_fs, get_NB_page(), set_label_scan(), show_label(), and VIEW_TREE. Referenced by baobab_init(). 00363 { 00364 /* filesystem has changed (mounted or unmounted device) */ 00365 baobab_get_filesystem (&g_fs); 00366 set_label_scan (&g_fs); 00367 if (get_NB_page () == VIEW_TREE) 00368 show_label (VIEW_TREE); 00369 }
|