From 2658eef1cb4a294b0dc546cd917831685e150d6f Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Fri, 28 Jul 2000 21:11:07 +0000 Subject: [PATCH] r339: The menu key bindings are now only saved if they actually changed. Code tidying: Moved some typedefs to the new `global.h' file and thus removed the dependencies between header files :-) --- ROX-Filer/Help/Changes | 7 ++++++ ROX-Filer/Help/TODO | 2 -- ROX-Filer/src/Makefile.in | 3 +++ ROX-Filer/src/action.c | 11 ++++----- ROX-Filer/src/action.h | 4 +-- ROX-Filer/src/choices.c | 9 ++++--- ROX-Filer/src/choices.h | 4 +-- ROX-Filer/src/collection.c | 2 +- ROX-Filer/src/collection.h | 2 +- ROX-Filer/src/dir.c | 5 +++- ROX-Filer/src/dir.h | 7 +----- ROX-Filer/src/display.c | 5 +++- ROX-Filer/src/display.h | 5 +--- ROX-Filer/src/dnd.c | 10 +++++--- ROX-Filer/src/dnd.h | 3 +-- ROX-Filer/src/filer.c | 17 ++++++++++--- ROX-Filer/src/filer.h | 11 +++------ ROX-Filer/src/find.c | 4 ++- ROX-Filer/src/find.h | 3 +-- ROX-Filer/src/fscache.c | 2 +- ROX-Filer/src/fscache.h | 3 +-- ROX-Filer/src/global.h | 55 +++++++++++++++++++++++++++++++++++++++++ ROX-Filer/src/gui_support.c | 5 ++-- ROX-Filer/src/gui_support.h | 2 +- ROX-Filer/src/i18n.c | 6 ++--- ROX-Filer/src/i18n.h | 2 +- ROX-Filer/src/main.c | 4 ++- ROX-Filer/src/main.h | 3 +-- ROX-Filer/src/menu.c | 60 +++++++++++++++++++++++++++++++++++++++------ ROX-Filer/src/menu.h | 5 +--- ROX-Filer/src/minibuffer.c | 6 ++++- ROX-Filer/src/minibuffer.h | 3 +-- ROX-Filer/src/modechange.c | 2 +- ROX-Filer/src/modechange.h | 2 +- ROX-Filer/src/mount.c | 7 +++--- ROX-Filer/src/mount.h | 2 +- ROX-Filer/src/my_vfs.h | 10 +++++++- ROX-Filer/src/options.c | 5 ++-- ROX-Filer/src/options.h | 2 +- ROX-Filer/src/pinboard.c | 8 ++++-- ROX-Filer/src/pinboard.h | 7 +----- ROX-Filer/src/pixmaps.c | 4 ++- ROX-Filer/src/pixmaps.h | 4 +-- ROX-Filer/src/remote.c | 5 ++-- ROX-Filer/src/remote.h | 2 +- ROX-Filer/src/rox_gettext.c | 4 +-- ROX-Filer/src/rox_gettext.h | 2 +- ROX-Filer/src/run.c | 20 +++++++++------ ROX-Filer/src/run.h | 4 +-- ROX-Filer/src/support.c | 6 ++--- ROX-Filer/src/support.h | 5 +--- ROX-Filer/src/toolbar.c | 12 ++++++--- ROX-Filer/src/toolbar.h | 4 +-- ROX-Filer/src/type.c | 8 +++--- ROX-Filer/src/type.h | 6 +---- 55 files changed, 255 insertions(+), 146 deletions(-) create mode 100644 ROX-Filer/src/global.h diff --git a/ROX-Filer/Help/Changes b/ROX-Filer/Help/Changes index 0d9134b0..8a9e5d05 100644 --- a/ROX-Filer/Help/Changes +++ b/ROX-Filer/Help/Changes @@ -2,6 +2,13 @@ A RISC OS-like filer for X by Thomas Leonard +28-Jul-2000 +~~~~~~~~~~~ +The menu key bindings are now only saved if they actually changed. + +Code tidying: Moved some typedefs to the new `global.h' file and +thus removed the dependencies between header files :-) + 26-Jul-2000 ~~~~~~~~~~~ Tab and Shift-Tab move to next and previous selected item. diff --git a/ROX-Filer/Help/TODO b/ROX-Filer/Help/TODO index 6b19840a..06d9ae02 100644 --- a/ROX-Filer/Help/TODO +++ b/ROX-Filer/Help/TODO @@ -59,8 +59,6 @@ More display styles. Features to (automatically?) set the size of filer windows. -Option to remove text background slab from pinboard icons. - RISC OS COMPATIBILITY diff --git a/ROX-Filer/src/Makefile.in b/ROX-Filer/src/Makefile.in index 6328124a..9edc364f 100644 --- a/ROX-Filer/src/Makefile.in +++ b/ROX-Filer/src/Makefile.in @@ -43,6 +43,9 @@ depend: Makefile: Makefile.in config.status ./config.status +config.h: config.h.in + ./config.status + config.status: configure ./configure --bindir=${PLATFORM_DIR} diff --git a/ROX-Filer/src/action.c b/ROX-Filer/src/action.c index d52bd539..b5fe6460 100644 --- a/ROX-Filer/src/action.c +++ b/ROX-Filer/src/action.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -29,14 +29,12 @@ #include #include #include -#include #include -#include -#include #include -#include #include +#include "global.h" + #include "action.h" #include "string.h" #include "support.h" @@ -46,6 +44,7 @@ #include "options.h" #include "modechange.h" #include "find.h" +#include "dir.h" /* Options bits */ static GtkWidget *create_options(); @@ -296,7 +295,7 @@ static void select_row_callback(GtkWidget *widget, return; } - gui_side->preview = filer_opendir(dir, PANEL_NO); + gui_side->preview = filer_opendir(dir); if (gui_side->preview) { display_set_autoselect(gui_side->preview, leaf); diff --git a/ROX-Filer/src/action.h b/ROX-Filer/src/action.h index e8f6be05..c0cfaed2 100644 --- a/ROX-Filer/src/action.h +++ b/ROX-Filer/src/action.h @@ -2,14 +2,12 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _ACTION_H #define _ACTION_H -#include "filer.h" - void action_init(void); void action_usage(FilerWindow *filer_window); diff --git a/ROX-Filer/src/choices.c b/ROX-Filer/src/choices.c index ddb09ad4..2eb51003 100644 --- a/ROX-Filer/src/choices.c +++ b/ROX-Filer/src/choices.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -20,15 +20,16 @@ */ /* choices.c - code for handling loading and saving of user choices */ +#include "config.h" + #include #include -#include -#include #include #include -#include #include +#include "global.h" + #include "choices.h" static gboolean saving_disabled = TRUE; diff --git a/ROX-Filer/src/choices.h b/ROX-Filer/src/choices.h index fdff2637..df59adc3 100644 --- a/ROX-Filer/src/choices.h +++ b/ROX-Filer/src/choices.h @@ -1,14 +1,12 @@ /* * $Id$ * - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _CHOICES_H #define _CHOICES_H -#include - void choices_init (void); GPtrArray *choices_list_dirs (char *dir); void choices_free_list (GPtrArray *list); diff --git a/ROX-Filer/src/collection.c b/ROX-Filer/src/collection.c index 1c09f382..72a8db58 100644 --- a/ROX-Filer/src/collection.c +++ b/ROX-Filer/src/collection.c @@ -2,7 +2,7 @@ * $Id$ * * Collection - a GTK+ widget - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * The collection widget provides an area for displaying a collection of * objects (such as files). It allows the user to choose a selection of diff --git a/ROX-Filer/src/collection.h b/ROX-Filer/src/collection.h index 62b95e1a..cd08e24c 100644 --- a/ROX-Filer/src/collection.h +++ b/ROX-Filer/src/collection.h @@ -6,7 +6,7 @@ * them and provides signals to allow popping up menus, detecting double-clicks * etc. * - * Thomas Leonard, + * Thomas Leonard, */ diff --git a/ROX-Filer/src/dir.c b/ROX-Filer/src/dir.c index 4f0c8605..4b384a04 100644 --- a/ROX-Filer/src/dir.c +++ b/ROX-Filer/src/dir.c @@ -2,7 +2,7 @@ * $Id$ * * dir.c - Caches and updates directories - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -26,12 +26,15 @@ #include #include +#include "global.h" + #include "support.h" #include "gui_support.h" #include "dir.h" #include "fscache.h" #include "mount.h" #include "pixmaps.h" +#include "type.h" GFSCache *dir_cache = NULL; diff --git a/ROX-Filer/src/dir.h b/ROX-Filer/src/dir.h index cc37dec1..08673c1e 100644 --- a/ROX-Filer/src/dir.h +++ b/ROX-Filer/src/dir.h @@ -1,14 +1,13 @@ /* * $Id$ * - * Thomas Leonard, + * Thomas Leonard, */ #ifndef _DIR_H #define _DIR_H -#include #include #include @@ -20,8 +19,6 @@ typedef enum { DIR_UPDATE, /* Redraw these items */ } DirAction; -typedef struct _Directory Directory; -typedef struct _DirItem DirItem; typedef struct _DirUser DirUser; typedef void (*DirCallback)(Directory *dir, DirAction action, @@ -40,8 +37,6 @@ typedef enum } ItemFlags; #include "fscache.h" -#include "pixmaps.h" -#include "type.h" extern GFSCache *dir_cache; diff --git a/ROX-Filer/src/display.c b/ROX-Filer/src/display.c index a5c1e826..b3ceacbe 100644 --- a/ROX-Filer/src/display.c +++ b/ROX-Filer/src/display.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -38,6 +38,8 @@ #include #include "collection.h" +#include "global.h" + #include "main.h" #include "support.h" #include "gui_support.h" @@ -51,6 +53,7 @@ #include "options.h" #include "action.h" #include "minibuffer.h" +#include "dir.h" #define ROW_HEIGHT_SMALL 20 #define ROW_HEIGHT_FULL_INFO 44 diff --git a/ROX-Filer/src/display.h b/ROX-Filer/src/display.h index aeb1e9fd..4b9a2080 100644 --- a/ROX-Filer/src/display.h +++ b/ROX-Filer/src/display.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _DISPLAY_H @@ -12,7 +12,6 @@ #include #include "collection.h" -#include "pixmaps.h" #include #include @@ -34,8 +33,6 @@ extern guchar *last_layout; extern gboolean last_show_hidden; extern int (*last_sort_fn)(const void *a, const void *b); -#include "filer.h" - /* Prototypes */ void display_init(); char *details(FilerWindow *filer_window, DirItem *item); diff --git a/ROX-Filer/src/dnd.c b/ROX-Filer/src/dnd.c index c38f96e8..fafbfa51 100644 --- a/ROX-Filer/src/dnd.c +++ b/ROX-Filer/src/dnd.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include #include @@ -37,7 +35,10 @@ #include #include "collection.h" +#include "global.h" + #include "dnd.h" +#include "type.h" #include "filer.h" #include "action.h" #include "pixmaps.h" @@ -46,6 +47,7 @@ #include "options.h" #include "run.h" #include "pinboard.h" +#include "dir.h" #define MAXURILEN 4096 /* Longest URI to allow */ @@ -1315,7 +1317,7 @@ static gboolean spring_now(gpointer data) } else { - spring_window = filer_opendir(dest_path, PANEL_NO); + spring_window = filer_opendir(dest_path); gtk_timeout_add(500, spring_check_idle, NULL); gtk_signal_connect(GTK_OBJECT(spring_window->window), "destroy", GTK_SIGNAL_FUNC(spring_win_destroyed), NULL); diff --git a/ROX-Filer/src/dnd.h b/ROX-Filer/src/dnd.h index 5c4bc87b..fd791a91 100644 --- a/ROX-Filer/src/dnd.h +++ b/ROX-Filer/src/dnd.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _DND_H @@ -10,7 +10,6 @@ #include #include "collection.h" -#include "filer.h" extern gboolean o_no_hostnames; extern char *drop_dest_prog; diff --git a/ROX-Filer/src/filer.c b/ROX-Filer/src/filer.c index b0c24032..0a49534c 100644 --- a/ROX-Filer/src/filer.c +++ b/ROX-Filer/src/filer.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -35,6 +35,8 @@ #include #include "collection.h" +#include "global.h" + #include "main.h" #include "support.h" #include "gui_support.h" @@ -42,6 +44,7 @@ #include "pixmaps.h" #include "menu.h" #include "dnd.h" +#include "dir.h" #include "run.h" #include "mount.h" #include "type.h" @@ -742,7 +745,7 @@ void filer_open_parent(FilerWindow *filer_window) if (slash) { *slash = '\0'; - filer_opendir(*copy ? copy : "/", PANEL_NO); + filer_opendir(*copy ? copy : "/"); } else g_warning("No / in directory path!\n"); @@ -850,10 +853,16 @@ static void start_drag_selection(Collection *collection, } } +/* Creates and shows a new filer window */ +FilerWindow *filer_opendir(char *path) +{ + return filer_openpanel(path, PANEL_NO); +} + /* Creates and shows a new filer window. - * panel_type should normally be PANEL_NO (for a normal window). + * panel_type may be PANEL_NO for a normal window. */ -FilerWindow *filer_opendir(char *path, PanelType panel_type) +FilerWindow *filer_openpanel(char *path, PanelType panel_type) { GtkWidget *hbox, *scrollbar, *collection; FilerWindow *filer_window; diff --git a/ROX-Filer/src/filer.h b/ROX-Filer/src/filer.h index dffbc38c..419f6dfd 100644 --- a/ROX-Filer/src/filer.h +++ b/ROX-Filer/src/filer.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _FILER_H @@ -10,11 +10,7 @@ #include #include "collection.h" -#include "pixmaps.h" -#include -#include -typedef struct _FilerWindow FilerWindow; typedef enum {PANEL_NO, PANEL_TOP, PANEL_BOTTOM} PanelType; typedef enum @@ -33,8 +29,6 @@ typedef enum #include "mount.h" #include "minibuffer.h" -#include "dir.h" -#include "type.h" #include "display.h" struct _FilerWindow @@ -78,7 +72,8 @@ extern gboolean o_new_window_on_1; /* Prototypes */ void filer_init(void); -FilerWindow *filer_opendir(char *path, PanelType panel_type); +FilerWindow *filer_opendir(char *path); +FilerWindow *filer_openpanel(char *path, PanelType panel_type); void filer_update_dir(FilerWindow *filer_window, gboolean warning); int selected_item_number(Collection *collection); DirItem *selected_item(Collection *collection); diff --git a/ROX-Filer/src/find.c b/ROX-Filer/src/find.c index d81ed6b7..e8d491d1 100644 --- a/ROX-Filer/src/find.c +++ b/ROX-Filer/src/find.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -35,6 +35,8 @@ #include #include +#include "global.h" + #include "main.h" #include "find.h" diff --git a/ROX-Filer/src/find.h b/ROX-Filer/src/find.h index 2d494485..b19d2c98 100644 --- a/ROX-Filer/src/find.h +++ b/ROX-Filer/src/find.h @@ -2,10 +2,9 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ -#include #include #include diff --git a/ROX-Filer/src/fscache.c b/ROX-Filer/src/fscache.c index 36732396..09d8530c 100644 --- a/ROX-Filer/src/fscache.c +++ b/ROX-Filer/src/fscache.c @@ -2,7 +2,7 @@ * $Id$ * * FSCache - a glib-style object for caching files - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * A cache object holds stat details about files in a hash table, along * with user-specified data. When you want to read in a file try to diff --git a/ROX-Filer/src/fscache.h b/ROX-Filer/src/fscache.h index 2345ad09..1c4ec55a 100644 --- a/ROX-Filer/src/fscache.h +++ b/ROX-Filer/src/fscache.h @@ -1,7 +1,7 @@ /* * $Id$ * - * Thomas Leonard, + * Thomas Leonard, */ @@ -12,7 +12,6 @@ #include #include #include - #include typedef struct _GFSCache GFSCache; diff --git a/ROX-Filer/src/global.h b/ROX-Filer/src/global.h new file mode 100644 index 00000000..06126dc7 --- /dev/null +++ b/ROX-Filer/src/global.h @@ -0,0 +1,55 @@ +/* + * $Id$ + * + * ROX-Filer, filer for the ROX desktop project + * By Thomas Leonard, . + */ + +/* global.h is included by most of the other source files, just after + * including config.h and the system header files, but before any other + * ROX-Filer header files. + */ + +#include + +/* We typedef various pointers here to avoid creating unnecessary + * dependencies on the other header files. + */ + +/* Each filer window has one of these all to itself */ +typedef struct _FilerWindow FilerWindow; + +/* There is one Directory object per cached disk directory inode number. + * Multiple FilerWindows may share a single directory. Directories + * are cached, so a Directories may exist without any filer windows + * referencing it at all. + */ +typedef struct _Directory Directory; + +/* Each item in a directory has a DirItem. The contains information from + * stat()ing the file, plus a few other bits. There may be several of these + * for a single file, if it appears (hard-linked) in several directories. + */ +typedef struct _DirItem DirItem; + +/* This contains pixmaps and masks for an image, and (sometimes) a + * half-sized version. + */ +typedef struct _MaskedPixmap MaskedPixmap; + +/* Each MIME type (eg 'text/plain') has one of these. It contains + * a link to the image and the type's name (used so that the image can + * be refreshed, amoung other things). + */ +typedef struct _MIME_type MIME_type; + +/* There will be one of these if the pinboard is in use. It contains + * the name of the pinboard and links to the pinned items inside. + */ +typedef struct _Pinboard Pinboard; + +/* Each icon on the pinboard has a PinIcon structure. It contains the + * name, path and position of the icon, as well as its DirItem. + */ +typedef struct _PinIcon PinIcon; + diff --git a/ROX-Filer/src/gui_support.c b/ROX-Filer/src/gui_support.c index 7f39245e..d85c8247 100644 --- a/ROX-Filer/src/gui_support.c +++ b/ROX-Filer/src/gui_support.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -30,12 +30,13 @@ #include #include -#include #include #include #include #include +#include "global.h" + #include "main.h" #include "gui_support.h" #include "pixmaps.h" diff --git a/ROX-Filer/src/gui_support.h b/ROX-Filer/src/gui_support.h index c1a80a9d..1bf4d712 100644 --- a/ROX-Filer/src/gui_support.h +++ b/ROX-Filer/src/gui_support.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _GUI_SUPPORT_H diff --git a/ROX-Filer/src/i18n.c b/ROX-Filer/src/i18n.c index c17d605d..afe01d8a 100644 --- a/ROX-Filer/src/i18n.c +++ b/ROX-Filer/src/i18n.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -28,11 +28,11 @@ #ifdef HAVE_LOCALE_H # include #endif -#include -#include #include +#include "global.h" + #include "support.h" #include "choices.h" #include "options.h" diff --git a/ROX-Filer/src/i18n.h b/ROX-Filer/src/i18n.h index 463be223..4708117b 100644 --- a/ROX-Filer/src/i18n.h +++ b/ROX-Filer/src/i18n.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #include diff --git a/ROX-Filer/src/main.c b/ROX-Filer/src/main.c index 24df15d9..97b3693b 100644 --- a/ROX-Filer/src/main.c +++ b/ROX-Filer/src/main.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -38,6 +38,8 @@ #include #include "collection.h" +#include "global.h" + #include "main.h" #include "support.h" #include "gui_support.h" diff --git a/ROX-Filer/src/main.h b/ROX-Filer/src/main.h index ccf4c0db..a238c67a 100644 --- a/ROX-Filer/src/main.h +++ b/ROX-Filer/src/main.h @@ -2,13 +2,12 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _MAIN_H #define _MAIN_H -#include #include typedef struct _Callback Callback; diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c index 36c12b6e..dcf6eaab 100644 --- a/ROX-Filer/src/menu.c +++ b/ROX-Filer/src/menu.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -24,21 +24,21 @@ #include #include #include -#include -#include #include #include #include -#include #include #include #include +#include "global.h" + #include "menu.h" #include "run.h" #include "action.h" #include "filer.h" +#include "pixmaps.h" #include "type.h" #include "support.h" #include "gui_support.h" @@ -49,6 +49,8 @@ #include "minibuffer.h" #include "i18n.h" #include "main.h" +#include "pinboard.h" +#include "dir.h" #define C_ "" @@ -82,6 +84,7 @@ static void savebox_show(guchar *title, guchar *path, MaskedPixmap *image, static gint save_to_file(GtkSavebox *savebox, guchar *pathname); static GList *list_paths(FilerWindow *filer_window); static void free_paths(GList *paths); +static void mark_menus_unmodified(void); /* Note that for most of these callbacks none of the arguments are used. */ static void large(gpointer data, guint action, GtkWidget *widget); @@ -335,7 +338,10 @@ void menu_init() menurc = choices_find_path_load("menus", PROJECT); if (menurc) + { gtk_item_factory_parse_rc(menurc); + mark_menus_unmodified(); + } gtk_accel_group_lock(panel_keys); @@ -1401,7 +1407,7 @@ static void new_window(gpointer data, guint action, GtkWidget *widget) "this directory because the `Unique Windows' option " "is turned on in the Options window.")); else - filer_opendir(window_with_focus->path, PANEL_NO); + filer_opendir(window_with_focus->path); } static void close_window(gpointer data, guint action, GtkWidget *widget) @@ -1441,14 +1447,14 @@ static void select_if(gpointer data, guint action, GtkWidget *widget) void rox_help(gpointer data, guint action, GtkWidget *widget) { - filer_opendir(make_path(app_dir, "Help")->str, PANEL_NO); + filer_opendir(make_path(app_dir, "Help")->str); } static void open_as_dir(gpointer data, guint action, GtkWidget *widget) { g_return_if_fail(window_with_focus != NULL); - filer_opendir(window_with_focus->path, PANEL_NO); + filer_opendir(window_with_focus->path); } static void close_panel(gpointer data, guint action, GtkWidget *widget) @@ -1530,11 +1536,49 @@ static void set_items_shaded(GtkWidget *menu, gboolean shaded, int from, int n) g_list_free(items); } +/* This is called for every modified menu entry. We just use it to + * find out if the menu has changed at all. + */ +static void set_mod(gboolean *mod, guchar *str) +{ + if (str && str[0] == '(') + *mod = TRUE; +} + static void save_menus(void) { char *menurc; menurc = choices_find_path_save("menus", PROJECT, TRUE); if (menurc) - gtk_item_factory_dump_rc(menurc, NULL, TRUE); + { + gboolean mod = FALSE; + + /* Find out if anything changed... */ + gtk_item_factory_dump_items(NULL, TRUE, + (GtkPrintFunc) set_mod, &mod); + + /* Dump out if so... */ + if (mod) + gtk_item_factory_dump_rc(menurc, NULL, TRUE); + } +} + +static void mark_unmodified(gpointer hash_key, + gpointer value, + gpointer user_data) +{ + GtkItemFactoryItem *item = (GtkItemFactoryItem *) value; + + item->modified = FALSE; +} + +/* Clear the 'modified' flag in all menu items. Messy... */ +static void mark_menus_unmodified(void) +{ + GtkItemFactoryClass *class; + + class = gtk_type_class(GTK_TYPE_ITEM_FACTORY); + + g_hash_table_foreach(class->item_ht, mark_unmodified, NULL); } diff --git a/ROX-Filer/src/menu.h b/ROX-Filer/src/menu.h index 86de288d..42095ed9 100644 --- a/ROX-Filer/src/menu.h +++ b/ROX-Filer/src/menu.h @@ -2,15 +2,12 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _MENU_H #define _MENU_H -#include "filer.h" -#include "pinboard.h" - extern GtkAccelGroup *filer_keys; extern GtkWidget *popup_menu; diff --git a/ROX-Filer/src/minibuffer.c b/ROX-Filer/src/minibuffer.c index d300bfb6..53206afe 100644 --- a/ROX-Filer/src/minibuffer.c +++ b/ROX-Filer/src/minibuffer.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -32,6 +32,8 @@ #include #include +#include "global.h" + #include "collection.h" #include "find.h" #include "gui_support.h" @@ -40,6 +42,8 @@ #include "filer.h" #include "main.h" #include "action.h" +#include "dir.h" +#include "type.h" static GList *shell_history = NULL; diff --git a/ROX-Filer/src/minibuffer.h b/ROX-Filer/src/minibuffer.h index 1f7d5545..d2d26150 100644 --- a/ROX-Filer/src/minibuffer.h +++ b/ROX-Filer/src/minibuffer.h @@ -2,7 +2,7 @@ * $Id* * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _MINIBUFFER_H @@ -17,7 +17,6 @@ typedef enum { } MiniType; #include -#include "filer.h" void create_minibuffer(FilerWindow *filer_window); void minibuffer_show(FilerWindow *filer_window, MiniType mini_type); diff --git a/ROX-Filer/src/modechange.c b/ROX-Filer/src/modechange.c index 6d049252..89c282b5 100644 --- a/ROX-Filer/src/modechange.c +++ b/ROX-Filer/src/modechange.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 diff --git a/ROX-Filer/src/modechange.h b/ROX-Filer/src/modechange.h index e6151496..4381c810 100644 --- a/ROX-Filer/src/modechange.h +++ b/ROX-Filer/src/modechange.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . * * This rest of this file was taken from GNU FileUtils, with minor * modifications. diff --git a/ROX-Filer/src/mount.c b/ROX-Filer/src/mount.c index b57f0416..2a0f2cbf 100644 --- a/ROX-Filer/src/mount.c +++ b/ROX-Filer/src/mount.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -41,13 +41,12 @@ # include # include #endif -#include #include -#include -#include #include +#include "global.h" + #include "mount.h" /* Map mount points to mntent structures */ diff --git a/ROX-Filer/src/mount.h b/ROX-Filer/src/mount.h index 00891632..d2cae940 100644 --- a/ROX-Filer/src/mount.h +++ b/ROX-Filer/src/mount.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _MOUNT_H diff --git a/ROX-Filer/src/my_vfs.h b/ROX-Filer/src/my_vfs.h index d8d0a06c..f6f20f84 100644 --- a/ROX-Filer/src/my_vfs.h +++ b/ROX-Filer/src/my_vfs.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _MY_VFS_H @@ -43,6 +43,14 @@ int mc_fstat (int fd, struct stat *buf); /* We don't have VFS installed. Just use the normal functions instead. */ +/* Include these here so that we don't get code that compiles with + * VFS but not without. + */ +# include +# include +# include +# include + # define mc_open open # define mc_close close # define mc_read read diff --git a/ROX-Filer/src/options.c b/ROX-Filer/src/options.c index bbad76b6..af43cc11 100644 --- a/ROX-Filer/src/options.c +++ b/ROX-Filer/src/options.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -26,9 +26,10 @@ #include #include #include -#include #include +#include "global.h" + #include "gui_support.h" #include "choices.h" #include "options.h" diff --git a/ROX-Filer/src/options.h b/ROX-Filer/src/options.h index 70f2532e..d40cefbc 100644 --- a/ROX-Filer/src/options.h +++ b/ROX-Filer/src/options.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _OPTIONS_H diff --git a/ROX-Filer/src/pinboard.c b/ROX-Filer/src/pinboard.c index 16950729..1676ec6a 100644 --- a/ROX-Filer/src/pinboard.c +++ b/ROX-Filer/src/pinboard.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -30,9 +30,12 @@ #include #include +#include "global.h" + +#include "pinboard.h" #include "main.h" #include "dnd.h" -#include "pinboard.h" +#include "pixmaps.h" #include "type.h" #include "choices.h" #include "support.h" @@ -40,6 +43,7 @@ #include "run.h" #include "menu.h" #include "options.h" +#include "dir.h" /* The number of pixels between the bottom of the image and the top * of the text. diff --git a/ROX-Filer/src/pinboard.h b/ROX-Filer/src/pinboard.h index bb97d603..2d62c33e 100644 --- a/ROX-Filer/src/pinboard.h +++ b/ROX-Filer/src/pinboard.h @@ -2,17 +2,12 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _PINBOARD_H #define _PINBOARD_H -#include - -typedef struct _Pinboard Pinboard; -typedef struct _PinIcon PinIcon; - void pinboard_init(void); void pinboard_activate(guchar *name); void pinboard_pin(guchar *path, guchar *name, int x, int y); diff --git a/ROX-Filer/src/pixmaps.c b/ROX-Filer/src/pixmaps.c index 08efb5a0..7ce03c70 100644 --- a/ROX-Filer/src/pixmaps.c +++ b/ROX-Filer/src/pixmaps.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -46,6 +46,8 @@ # include #endif +#include "global.h" + #include "fscache.h" #include "support.h" #include "gui_support.h" diff --git a/ROX-Filer/src/pixmaps.h b/ROX-Filer/src/pixmaps.h index 6e9e9f7a..2e66ead2 100644 --- a/ROX-Filer/src/pixmaps.h +++ b/ROX-Filer/src/pixmaps.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _PIXMAP_H @@ -13,8 +13,6 @@ extern GFSCache *pixmap_cache; -typedef struct _MaskedPixmap MaskedPixmap; - extern MaskedPixmap *im_error; extern MaskedPixmap *im_unknown; extern MaskedPixmap *im_symlink; diff --git a/ROX-Filer/src/remote.c b/ROX-Filer/src/remote.c index ac13f1a3..6f1e6e91 100644 --- a/ROX-Filer/src/remote.c +++ b/ROX-Filer/src/remote.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -33,9 +33,10 @@ #include #include +#include "global.h" + #include "main.h" #include "support.h" -#include "filer.h" #include "gui_support.h" #include "run.h" #include "remote.h" diff --git a/ROX-Filer/src/remote.h b/ROX-Filer/src/remote.h index 756786eb..e780f83f 100644 --- a/ROX-Filer/src/remote.h +++ b/ROX-Filer/src/remote.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _REMOTE_H diff --git a/ROX-Filer/src/rox_gettext.c b/ROX-Filer/src/rox_gettext.c index 16310933..b36bae3e 100644 --- a/ROX-Filer/src/rox_gettext.c +++ b/ROX-Filer/src/rox_gettext.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -25,7 +25,7 @@ #include "config.h" -#include +#include "global.h" #include "gui_support.h" diff --git a/ROX-Filer/src/rox_gettext.h b/ROX-Filer/src/rox_gettext.h index 11c1e7b2..169d775a 100644 --- a/ROX-Filer/src/rox_gettext.h +++ b/ROX-Filer/src/rox_gettext.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ char *rox_gettext(char *from); diff --git a/ROX-Filer/src/run.c b/ROX-Filer/src/run.c index d4dda50c..80d5032f 100644 --- a/ROX-Filer/src/run.c +++ b/ROX-Filer/src/run.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -23,18 +23,22 @@ #include "config.h" -#include #include #include #include +#include "global.h" + #include "stdlib.h" #include "support.h" #include "gui_support.h" #include "filer.h" #include "menu.h" #include "main.h" +#include "type.h" +#include "dir.h" #include "action.h" +#include "pinboard.h" /* Static prototypes */ static void write_data(gpointer data, gint fd, GdkInputCondition cond); @@ -224,7 +228,7 @@ gboolean run_diritem(guchar *full_path, if (filer_window) filer_change_to(filer_window, full_path, NULL); else - filer_opendir(full_path, PANEL_NO); + filer_opendir(full_path); return TRUE; case TYPE_FILE: if ((item->flags & ITEM_FLAG_EXEC_FILE) && !edit) @@ -363,13 +367,13 @@ void run_list(guchar *to_open) pinboard_activate(value); break; case 'd': - filer_opendir(value, PANEL_NO); + filer_opendir(value); break; case 't': - filer_opendir(value, PANEL_TOP); + filer_openpanel(value, PANEL_TOP); break; case 'b': - filer_opendir(value, PANEL_BOTTOM); + filer_openpanel(value, PANEL_BOTTOM); break; default: g_warning("Don't know how to handle '%s'", @@ -473,7 +477,7 @@ static gboolean follow_symlink(char *full_path, FilerWindow *filer_window) { FilerWindow *new; - new = filer_opendir(new_dir, PANEL_NO); + new = filer_opendir(new_dir); display_set_autoselect(new, slash + 1); } @@ -519,6 +523,6 @@ static void app_show_help(char *path) "Shift while you open it). Most applications provide " "their own help here, but this one doesn't.")); else - filer_opendir(help_dir, PANEL_NO); + filer_opendir(help_dir); } diff --git a/ROX-Filer/src/run.h b/ROX-Filer/src/run.h index e874b84b..db11608d 100644 --- a/ROX-Filer/src/run.h +++ b/ROX-Filer/src/run.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _RUN_H @@ -10,8 +10,6 @@ #include -#include - void run_app(char *path); void run_with_files(char *path, GSList *uri_list); void run_with_data(char *path, gpointer data, gulong length); diff --git a/ROX-Filer/src/support.c b/ROX-Filer/src/support.c index 01bb5e71..d6160e72 100644 --- a/ROX-Filer/src/support.c +++ b/ROX-Filer/src/support.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -28,16 +28,14 @@ #include #include #include -#include #include #include #include #include -#include #include #include -#include +#include "global.h" #include "main.h" #include "support.h" diff --git a/ROX-Filer/src/support.h b/ROX-Filer/src/support.h index 207858b0..a5431740 100644 --- a/ROX-Filer/src/support.h +++ b/ROX-Filer/src/support.h @@ -2,15 +2,12 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _SUPPORT_H #define _SUPPORT_H -#include -#include - #define PRETTY_SIZE_LIMIT 4096 #define TIME_FORMAT "%T %d %b %Y" diff --git a/ROX-Filer/src/toolbar.c b/ROX-Filer/src/toolbar.c index 8331423f..62bc8d37 100644 --- a/ROX-Filer/src/toolbar.c +++ b/ROX-Filer/src/toolbar.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -25,11 +25,15 @@ #include +#include "global.h" + #include "toolbar.h" #include "options.h" #include "support.h" #include "main.h" #include "dnd.h" +#include "filer.h" +#include "pixmaps.h" extern int collection_menu_button; @@ -116,7 +120,7 @@ GtkWidget *toolbar_new(FilerWindow *filer_window) static void toolbar_help_clicked(GtkWidget *widget, FilerWindow *filer_window) { - filer_opendir(make_path(app_dir, "Help")->str, PANEL_NO); + filer_opendir(make_path(app_dir, "Help")->str); } static void toolbar_refresh_clicked(GtkWidget *widget, @@ -128,7 +132,7 @@ static void toolbar_refresh_clicked(GtkWidget *widget, if (event->type == GDK_BUTTON_RELEASE && ((GdkEventButton *) event)->button != 1) { - filer_opendir(filer_window->path, PANEL_NO); + filer_opendir(filer_window->path); } else { @@ -144,7 +148,7 @@ static void toolbar_home_clicked(GtkWidget *widget, FilerWindow *filer_window) event = gtk_get_current_event(); if (event->type == GDK_BUTTON_RELEASE && NEW_WIN_BUTTON(event)) { - filer_opendir(home_dir, PANEL_NO); + filer_opendir(home_dir); } else filer_change_to(filer_window, home_dir, NULL); diff --git a/ROX-Filer/src/toolbar.h b/ROX-Filer/src/toolbar.h index 3d88b1bd..d3fbdb22 100644 --- a/ROX-Filer/src/toolbar.h +++ b/ROX-Filer/src/toolbar.h @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _TOOLBAR_H @@ -17,8 +17,6 @@ typedef enum { TOOLBAR_LARGE = 2, } ToolbarType; -#include "filer.h" - extern ToolbarType o_toolbar; /* Prototypes */ diff --git a/ROX-Filer/src/type.c b/ROX-Filer/src/type.c index 9e33fac0..5d4a5a33 100644 --- a/ROX-Filer/src/type.c +++ b/ROX-Filer/src/type.c @@ -2,7 +2,7 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * Copyright (C) 2000, Thomas Leonard, . + * Copyright (C) 2000, Thomas Leonard, . * * 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 @@ -23,25 +23,23 @@ #include "config.h" -#include -#include #include #include #include #include #include -#include +#include "global.h" #include "string.h" #include "main.h" -#include "filer.h" #include "pixmaps.h" #include "run.h" #include "gui_support.h" #include "choices.h" #include "type.h" #include "support.h" +#include "dir.h" /* Static prototypes */ static char *import_extensions(guchar *line); diff --git a/ROX-Filer/src/type.h b/ROX-Filer/src/type.h index d44b8c5c..a5db468d 100644 --- a/ROX-Filer/src/type.h +++ b/ROX-Filer/src/type.h @@ -2,13 +2,12 @@ * $Id$ * * ROX-Filer, filer for the ROX desktop project - * By Thomas Leonard, . + * By Thomas Leonard, . */ #ifndef _TYPE_H #define _TYPE_H -typedef struct _MIME_type MIME_type; extern MIME_type text_plain; /* Often used as a default type */ extern MIME_type special_directory; extern MIME_type special_pipe; @@ -17,9 +16,6 @@ extern MIME_type special_block_dev; extern MIME_type special_char_dev; extern MIME_type special_unknown; -#include "pixmaps.h" -#include "filer.h" - enum { /* Base types - this also determines the sort order */ -- 2.11.4.GIT