1 /* Copyright (C) 2005-2006 Fabio Marzocca <thesaltydog@gmail.com> 2 * Copyright (C) 2012-2021 MATE Developers 3 * 4 * This file is part of MATE Utils. 5 * 6 * MATE Utils is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * MATE Utils is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __BAOBAB_H__ 21 #define __BAOBAB_H__ 22 23 #include <time.h> 24 #include <sys/types.h> 25 #include <glib.h> 26 #include <gtk/gtk.h> 27 #include <gio/gio.h> 28 29 struct BaobabSearchOpt; 30 31 /* Settings */ 32 #define BAOBAB_UI_SETTINGS_SCHEMA "org.mate.disk-usage-analyzer.ui" 33 #define BAOBAB_PREFS_SETTINGS_SCHEMA "org.mate.disk-usage-analyzer.preferences" 34 #define BAOBAB_SETTINGS_TOOLBAR_VISIBLE "toolbar-visible" 35 #define BAOBAB_SETTINGS_STATUSBAR_VISIBLE "statusbar-visible" 36 #define BAOBAB_SETTINGS_SUBFLSTIPS_VISIBLE "subfoldertips-visible" 37 #define BAOBAB_SETTINGS_ACTIVE_CHART "active-chart" 38 #define BAOBAB_SETTINGS_MONITOR_HOME "monitor-home" 39 #define BAOBAB_SETTINGS_EXCLUDED_URIS "excluded-uris" 40 41 typedef struct _BaobabChartMenu BaobabChartMenu; 42 43 struct _BaobabChartMenu { 44 GtkWidget *widget; 45 GtkWidget *up_item; 46 GtkWidget *zoom_in_item; 47 GtkWidget *zoom_out_item; 48 GtkWidget *subfolders_item; 49 GtkWidget *snapshot_item; 50 GtkWidget *set_root_item; 51 }; 52 53 typedef struct _BaobabFS BaobabFS; 54 55 struct _BaobabFS { 56 guint64 total; 57 guint64 used; 58 guint64 avail; 59 }; 60 61 typedef struct _BaobabApplication BaobabApplication; 62 63 struct _BaobabApplication { 64 BaobabFS fs; 65 66 GtkBuilder *main_ui; 67 GtkWidget *window; 68 GtkWidget *tree_view; 69 GtkWidget *chart_frame; 70 GtkWidget *rings_chart; 71 GtkWidget *treemap_chart; 72 GtkWidget *current_chart; 73 GtkWidget *chart_type_combo; 74 BaobabChartMenu *chart_menu; 75 GtkWidget *toolbar; 76 GtkWidget *spinner; 77 GtkWidget *statusbar; 78 GtkTreeStore *model; 79 gboolean STOP_SCANNING; 80 gboolean CONTENTS_CHANGED_DELAYED; 81 GSList *excluded_locations; 82 gboolean show_allocated; 83 gboolean is_local; 84 85 char *selected_path; 86 87 GFile *current_location; 88 89 GVolumeMonitor *monitor_vol; 90 GFileMonitor *monitor_home; 91 92 guint model_max_depth; 93 94 GSettings *ui_settings; 95 GSettings *prefs_settings; 96 }; 97 98 /* Application singleton */ 99 extern BaobabApplication baobab; 100 101 struct chan_data { 102 guint64 size; 103 guint64 alloc_size; 104 guint64 tempHLsize; 105 gint depth; 106 gint elements; 107 gchar *display_name; 108 gchar *parse_name; 109 }; 110 111 void baobab_set_busy (gboolean busy); 112 void baobab_update_filesystem (void); 113 void baobab_scan_location (GFile *); 114 void baobab_scan_home (void); 115 void baobab_scan_root (void); 116 void baobab_rescan_current_dir (void); 117 void baobab_stop_scan (void); 118 void baobab_fill_model (struct chan_data *); 119 gboolean baobab_is_excluded_location (GFile *); 120 void baobab_set_toolbar_visible (gboolean visible); 121 void baobab_set_statusbar_visible (gboolean visible); 122 void baobab_set_statusbar (const gchar *); 123 void baobab_quit (void); 124 125 #endif /* __BAOBAB_H_ */ 126