1999-04-06 05:00:20 +04:00
|
|
|
/*
|
|
|
|
* Preferences configuration page for the GNU Midnight Commander
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Jonathan Blandford (jrb@redhat.com)
|
|
|
|
*/
|
1999-01-09 03:24:03 +03:00
|
|
|
#include <config.h>
|
|
|
|
#include "x.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include "dir.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "gscreen.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "gmain.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
#include "boxes.h"
|
|
|
|
#include "profile.h"
|
|
|
|
#include "setup.h"
|
|
|
|
#include "panelize.h"
|
|
|
|
#include "dialog.h"
|
|
|
|
#include "layout.h"
|
1999-02-25 22:13:31 +03:00
|
|
|
#include "gcustom-layout.h"
|
1999-08-24 03:13:31 +04:00
|
|
|
#include "gdesktop-prefs.h"
|
1999-01-09 03:24:03 +03:00
|
|
|
#include "../vfs/vfs.h"
|
|
|
|
#include "gprefs.h"
|
|
|
|
|
1999-01-13 00:50:25 +03:00
|
|
|
/* Orphan confirmation options */
|
|
|
|
/* Auto save setup */
|
|
|
|
/* use internal edit */ /* maybe have a mime-type capplet for these */
|
|
|
|
/* use internal view */
|
|
|
|
/* complete: show all */
|
|
|
|
/* Animation??? */
|
|
|
|
/* advanced chown */
|
|
|
|
/* cd follows links */
|
|
|
|
/* safe delete */
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
extern int vfs_timeout;
|
|
|
|
extern int ftpfs_always_use_proxy;
|
|
|
|
extern char* ftpfs_anonymous_passwd;
|
|
|
|
extern int file_op_compute_totals;
|
1999-01-28 08:48:02 +03:00
|
|
|
extern int we_can_afford_the_speed;
|
1999-01-20 01:10:19 +03:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PROPERTY_NONE,
|
|
|
|
PROPERTY_BOOL,
|
|
|
|
PROPERTY_STRING,
|
|
|
|
PROPERTY_INT,
|
|
|
|
PROPERTY_CUSTOM
|
|
|
|
} PropertyType_e;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *label;
|
|
|
|
PropertyType_e type;
|
|
|
|
gpointer property_variable;
|
|
|
|
gpointer extra_data1;
|
|
|
|
gpointer extra_data2;
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
GtkWidget *widget;
|
|
|
|
} Property;
|
|
|
|
|
|
|
|
typedef struct
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
|
|
|
gchar *title;
|
1999-08-24 03:13:31 +04:00
|
|
|
Property *props;
|
1999-01-20 01:10:19 +03:00
|
|
|
} PrefsPage;
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
typedef struct
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
|
|
|
WPanel *panel;
|
|
|
|
GtkWidget *prop_box;
|
|
|
|
PrefsPage *prefs_pages;
|
1999-08-24 03:13:31 +04:00
|
|
|
|
|
|
|
GDesktopPrefs *desktop_prefs;
|
|
|
|
gint desktop_prefs_page;
|
|
|
|
|
1999-02-25 22:13:31 +03:00
|
|
|
GCustomLayout *custom_layout;
|
|
|
|
gint custom_layout_page;
|
1999-01-20 01:10:19 +03:00
|
|
|
} PrefsDlg;
|
|
|
|
|
|
|
|
|
|
|
|
#define PROPERTIES_DONE { NULL, PROPERTY_NONE, NULL, NULL, NULL, NULL }
|
|
|
|
#define PREFSPAGES_DONE { NULL, NULL }
|
|
|
|
|
|
|
|
typedef GtkWidget* (*CustomCreateFunc) (PrefsDlg *dlg, Property *prop);
|
|
|
|
typedef void (*CustomApplyFunc) (PrefsDlg *dlg, Property *prop);
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
static Property file_display_props [] =
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
N_("Show backup files"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&show_backups, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
N_("Show hidden files"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&show_dot_files, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
1999-01-20 10:15:34 +03:00
|
|
|
N_("Mix files and directories"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&mix_all_files, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
N_("Use shell patterns instead of regular expressions"), PROPERTY_BOOL,
|
|
|
|
&easy_patterns, NULL, NULL, NULL
|
|
|
|
},
|
2000-01-03 Aaron Lehmann <aaronl@vitelus.com>
* gdesktop.c, gdnd.c, gaction.c, gicon.c,
gnome-file-property-dialog.c, gpopup.c, gpopup2.c, gprefs.cgmain.h,
setup.c: Add option of using GNOME "magic" routines to determine file
types. This makes MC intelligently look at the data in the file to see
what type of file it is, rather than looking at the filename extension.
This slows down MC quite a bit, so it has been made an optional
preference item. Type detection is expected to improve as mime-magic
matures.
2000-01-24 01:25:26 +03:00
|
|
|
{
|
|
|
|
N_("Determine file types from file content instead of extensions"), PROPERTY_BOOL,
|
|
|
|
&use_magic, NULL, NULL, NULL
|
|
|
|
},
|
1999-01-20 01:10:19 +03:00
|
|
|
PROPERTIES_DONE
|
|
|
|
};
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
static Property confirmation_props [] =
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
N_("Confirm when deleting file"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&confirm_delete, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
N_("Confirm when overwriting files"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&confirm_overwrite, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
N_("Confirm when executing files"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&confirm_execute, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
N_("Show progress while operations are being performed"), PROPERTY_BOOL,
|
1999-01-20 01:10:19 +03:00
|
|
|
&verbose, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
PROPERTIES_DONE
|
|
|
|
};
|
|
|
|
|
|
|
|
static Property vfs_props [] =
|
|
|
|
{
|
|
|
|
{
|
1999-02-15 23:14:11 +03:00
|
|
|
N_("VFS Timeout:"), PROPERTY_INT,
|
1999-01-20 01:10:19 +03:00
|
|
|
&vfs_timeout, N_("Seconds"), NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
1999-02-15 23:14:11 +03:00
|
|
|
N_("Anonymous FTP password:"), PROPERTY_STRING,
|
1999-01-20 01:10:19 +03:00
|
|
|
&ftpfs_anonymous_passwd, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
N_("Always use FTP proxy"), PROPERTY_BOOL,
|
|
|
|
&ftpfs_always_use_proxy, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
PROPERTIES_DONE
|
|
|
|
};
|
1999-08-24 03:13:31 +04:00
|
|
|
|
|
|
|
static Property caching_and_optimization_props [] =
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
|
|
|
{
|
|
|
|
N_("Fast directory reload"), PROPERTY_BOOL,
|
|
|
|
&fast_reload, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
N_("Compute totals before copying files"), PROPERTY_BOOL,
|
|
|
|
&file_op_compute_totals, NULL, NULL, NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
N_("FTP directory cache timeout :"), PROPERTY_INT,
|
|
|
|
&ftpfs_directory_timeout, N_("Seconds"), NULL, NULL
|
|
|
|
},
|
1999-01-28 08:48:02 +03:00
|
|
|
{
|
1999-02-05 01:20:26 +03:00
|
|
|
N_("Allow customization of icons in icon view"), PROPERTY_BOOL,
|
1999-01-28 08:48:02 +03:00
|
|
|
&we_can_afford_the_speed, NULL, NULL, NULL
|
|
|
|
},
|
1999-01-20 01:10:19 +03:00
|
|
|
PROPERTIES_DONE
|
|
|
|
};
|
|
|
|
|
|
|
|
static PrefsPage prefs_pages [] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
N_("File display"),
|
|
|
|
file_display_props
|
1999-08-24 03:13:31 +04:00
|
|
|
},
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
|
|
|
N_("Confirmation"),
|
|
|
|
confirmation_props
|
|
|
|
},
|
|
|
|
{
|
|
|
|
N_("VFS"),
|
|
|
|
vfs_props
|
|
|
|
},
|
|
|
|
{
|
|
|
|
N_("Caching"),
|
|
|
|
caching_and_optimization_props
|
|
|
|
},
|
|
|
|
PREFSPAGES_DONE
|
|
|
|
};
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
static void
|
1999-01-20 01:10:19 +03:00
|
|
|
apply_changes_bool (PrefsDlg *dlg, Property *cur_prop)
|
|
|
|
{
|
|
|
|
GtkWidget *checkbox;
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
checkbox = cur_prop->widget;
|
1999-08-24 03:13:31 +04:00
|
|
|
|
|
|
|
if (GTK_TOGGLE_BUTTON (checkbox)->active)
|
1999-01-20 01:10:19 +03:00
|
|
|
*( (int*) cur_prop->property_variable) = TRUE;
|
1999-08-24 03:13:31 +04:00
|
|
|
else
|
1999-01-20 01:10:19 +03:00
|
|
|
*( (int*) cur_prop->property_variable) = FALSE;
|
1999-01-09 03:24:03 +03:00
|
|
|
}
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
static void
|
|
|
|
apply_changes_string (PrefsDlg *dlg, Property *cur_prop)
|
|
|
|
{
|
|
|
|
GtkWidget *entry;
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
entry = cur_prop->widget;
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
text = gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))));
|
|
|
|
|
|
|
|
*( (char**) cur_prop->property_variable) = g_strdup (text);
|
1999-01-09 03:24:03 +03:00
|
|
|
}
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
static void
|
|
|
|
apply_changes_int (PrefsDlg *dlg, Property *cur_prop)
|
|
|
|
{
|
|
|
|
GtkWidget *entry;
|
|
|
|
gdouble val;
|
|
|
|
gchar *num;
|
|
|
|
|
|
|
|
entry = cur_prop->widget;
|
|
|
|
num = gtk_entry_get_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))));
|
|
|
|
sscanf(num,"%lg",&val);
|
|
|
|
|
|
|
|
*( (int*) cur_prop->property_variable) = (gint) val;
|
|
|
|
}
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
static void
|
1999-01-20 01:10:19 +03:00
|
|
|
apply_changes_custom (PrefsDlg *dlg, Property *cur_prop)
|
|
|
|
{
|
|
|
|
CustomApplyFunc apply = (CustomApplyFunc) cur_prop->extra_data2;
|
|
|
|
|
|
|
|
apply (dlg, cur_prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
apply_page_changes (PrefsDlg *dlg, gint pagenum)
|
|
|
|
{
|
|
|
|
Property *props;
|
|
|
|
Property cur_prop;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
props = dlg->prefs_pages [pagenum].props;
|
|
|
|
i = 0;
|
|
|
|
cur_prop = props [i];
|
|
|
|
while (cur_prop.label != NULL) {
|
|
|
|
switch (cur_prop.type) {
|
|
|
|
case PROPERTY_NONE :
|
1999-02-15 23:14:11 +03:00
|
|
|
g_warning ("Invalid case in gprefs.c: apply_page_changes");
|
1999-01-20 01:10:19 +03:00
|
|
|
break;
|
1999-08-24 03:13:31 +04:00
|
|
|
case PROPERTY_BOOL :
|
1999-01-20 01:10:19 +03:00
|
|
|
apply_changes_bool (dlg, &cur_prop);
|
|
|
|
break;
|
|
|
|
case PROPERTY_STRING :
|
|
|
|
apply_changes_string (dlg, &cur_prop);
|
|
|
|
break;
|
|
|
|
case PROPERTY_INT :
|
|
|
|
apply_changes_int (dlg, &cur_prop);
|
|
|
|
break;
|
|
|
|
case PROPERTY_CUSTOM :
|
|
|
|
apply_changes_custom (dlg, &cur_prop);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
cur_prop = props[++i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-08-24 03:13:31 +04:00
|
|
|
apply_callback (GtkWidget *prop_box, gint pagenum, PrefsDlg *dlg)
|
1999-01-20 01:10:19 +03:00
|
|
|
{
|
1999-08-24 03:13:31 +04:00
|
|
|
if (pagenum == dlg->desktop_prefs_page)
|
|
|
|
desktop_prefs_apply (dlg->desktop_prefs);
|
|
|
|
else if (pagenum == dlg->custom_layout_page)
|
1999-02-25 22:13:31 +03:00
|
|
|
custom_layout_apply (dlg->custom_layout);
|
1999-08-24 03:13:31 +04:00
|
|
|
else if (pagenum != -1)
|
1999-01-20 01:10:19 +03:00
|
|
|
apply_page_changes (dlg, pagenum);
|
1999-08-24 03:13:31 +04:00
|
|
|
else {
|
1999-01-20 10:15:34 +03:00
|
|
|
update_panels (UP_RELOAD, UP_KEEPSEL);
|
1999-01-20 01:10:19 +03:00
|
|
|
save_setup ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
static void
|
1999-01-20 01:10:19 +03:00
|
|
|
changed_callback (GtkWidget *widget, PrefsDlg *dlg)
|
|
|
|
{
|
|
|
|
if (dlg->prop_box)
|
|
|
|
gnome_property_box_changed (GNOME_PROPERTY_BOX (dlg->prop_box));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget*
|
|
|
|
create_prop_bool (PrefsDlg *dlg, Property *prop)
|
|
|
|
{
|
|
|
|
GtkWidget *checkbox;
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-03-08 08:18:50 +03:00
|
|
|
checkbox = gtk_check_button_new_with_label (_(prop->label));
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
if (*((int*) prop->property_variable)) {
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox),
|
|
|
|
TRUE);
|
|
|
|
} else {
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox),
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
gtk_signal_connect (GTK_OBJECT (checkbox), "clicked",
|
1999-01-20 01:10:19 +03:00
|
|
|
changed_callback, (gpointer) dlg);
|
|
|
|
|
|
|
|
prop->widget = checkbox;
|
|
|
|
gtk_widget_show_all (checkbox);
|
|
|
|
return checkbox;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget*
|
|
|
|
create_prop_string (PrefsDlg *dlg, Property *prop)
|
|
|
|
{
|
|
|
|
GtkWidget *entry;
|
|
|
|
GtkWidget *gtk_entry;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
gint max_length;
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-03-08 08:18:50 +03:00
|
|
|
label = gtk_label_new (_(prop->label));
|
1999-08-24 03:13:31 +04:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label,
|
1999-01-20 01:10:19 +03:00
|
|
|
FALSE, FALSE, 0);
|
|
|
|
|
1999-03-08 08:18:50 +03:00
|
|
|
entry = gnome_entry_new (_(prop->label));
|
1999-01-20 01:10:19 +03:00
|
|
|
gtk_entry = gnome_entry_gtk_entry (GNOME_ENTRY (entry));
|
|
|
|
|
|
|
|
max_length = (int)prop->extra_data1;
|
|
|
|
if (max_length != 0) {
|
|
|
|
gtk_entry_set_max_length (GTK_ENTRY (gtk_entry),
|
|
|
|
max_length);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (gtk_entry),
|
|
|
|
(gchar*) *( (gchar**) prop->property_variable));
|
1999-08-24 03:13:31 +04:00
|
|
|
gtk_signal_connect_while_alive (GTK_OBJECT (gtk_entry),
|
|
|
|
"changed",
|
1999-01-20 01:10:19 +03:00
|
|
|
GTK_SIGNAL_FUNC (changed_callback),
|
|
|
|
(gpointer) dlg,
|
|
|
|
GTK_OBJECT (dlg->prop_box));
|
1999-08-24 03:13:31 +04:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), entry,
|
1999-01-20 01:10:19 +03:00
|
|
|
FALSE, FALSE, 0);
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
prop->widget = entry;
|
|
|
|
gtk_widget_show_all (hbox);
|
|
|
|
return hbox;
|
1999-01-09 03:24:03 +03:00
|
|
|
}
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
static GtkWidget*
|
|
|
|
create_prop_int (PrefsDlg *dlg, Property *prop)
|
1999-01-09 03:24:03 +03:00
|
|
|
{
|
1999-01-20 01:10:19 +03:00
|
|
|
GtkWidget *entry;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
gchar buffer [10];
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-03-08 08:18:50 +03:00
|
|
|
label = gtk_label_new (_(prop->label));
|
1999-08-24 03:13:31 +04:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label,
|
1999-01-20 01:10:19 +03:00
|
|
|
FALSE, FALSE, 0);
|
|
|
|
|
1999-03-08 08:18:50 +03:00
|
|
|
entry = gnome_entry_new (_(prop->label));
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
snprintf (buffer, 9, "%d", *( (int*) prop->property_variable));
|
|
|
|
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (entry))),
|
|
|
|
buffer);
|
1999-08-24 03:13:31 +04:00
|
|
|
|
|
|
|
gtk_signal_connect_while_alive (GTK_OBJECT (gnome_entry_gtk_entry (GNOME_ENTRY (entry))),
|
|
|
|
"changed",
|
1999-01-20 01:10:19 +03:00
|
|
|
GTK_SIGNAL_FUNC (changed_callback),
|
|
|
|
(gpointer) dlg,
|
|
|
|
GTK_OBJECT (dlg->prop_box));
|
1999-08-24 03:13:31 +04:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), entry,
|
1999-01-20 01:10:19 +03:00
|
|
|
FALSE, FALSE, 0);
|
|
|
|
if (prop->extra_data1) {
|
1999-05-29 23:22:51 +04:00
|
|
|
label = gtk_label_new (_((gchar *)prop->extra_data1));
|
1999-08-24 03:13:31 +04:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label,
|
1999-01-20 01:10:19 +03:00
|
|
|
FALSE, FALSE, 0);
|
|
|
|
}
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
prop->widget = entry;
|
|
|
|
gtk_widget_show_all (hbox);
|
|
|
|
return hbox;
|
1999-08-24 03:13:31 +04:00
|
|
|
}
|
1999-01-20 01:10:19 +03:00
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
static GtkWidget*
|
1999-01-20 01:10:19 +03:00
|
|
|
create_prop_custom (PrefsDlg *dlg, Property *prop)
|
|
|
|
{
|
|
|
|
CustomCreateFunc create = (CustomCreateFunc) prop->extra_data1;
|
1999-01-20 10:15:34 +03:00
|
|
|
|
|
|
|
if (!create)
|
|
|
|
return create_prop_bool (dlg, prop);
|
1999-08-24 03:13:31 +04:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
return create (dlg, prop);
|
1999-01-09 03:24:03 +03:00
|
|
|
}
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
static GtkWidget*
|
|
|
|
create_prop_widget (PrefsDlg *dlg, Property *prop)
|
1999-01-09 03:24:03 +03:00
|
|
|
{
|
1999-01-20 01:10:19 +03:00
|
|
|
switch (prop->type) {
|
|
|
|
case PROPERTY_NONE :
|
1999-02-15 23:14:11 +03:00
|
|
|
g_warning ("Invalid case in gprefs.c: create_prop_widget");
|
1999-01-20 01:10:19 +03:00
|
|
|
break;
|
|
|
|
case PROPERTY_BOOL :
|
|
|
|
return create_prop_bool (dlg, prop);
|
|
|
|
case PROPERTY_STRING :
|
|
|
|
return create_prop_string (dlg, prop);
|
|
|
|
case PROPERTY_INT :
|
|
|
|
return create_prop_int (dlg, prop);
|
|
|
|
case PROPERTY_CUSTOM :
|
|
|
|
return create_prop_custom (dlg, prop);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return NULL;
|
1999-01-09 03:24:03 +03:00
|
|
|
}
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
static void
|
|
|
|
create_page (PrefsDlg *dlg, PrefsPage *page)
|
1999-08-24 03:13:31 +04:00
|
|
|
{
|
1999-01-20 01:10:19 +03:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *prop_widget;
|
|
|
|
Property *cur_prop;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
i = 0;
|
|
|
|
cur_prop = &(page->props [i]);
|
|
|
|
while (cur_prop->label != NULL) {
|
|
|
|
cur_prop = &(page->props [i]);
|
|
|
|
prop_widget = create_prop_widget (dlg, cur_prop);
|
1999-08-24 03:13:31 +04:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), prop_widget,
|
1999-01-20 01:10:19 +03:00
|
|
|
FALSE, FALSE, 0);
|
|
|
|
i++;
|
|
|
|
cur_prop = &(page->props [i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
gnome_property_box_append_page (GNOME_PROPERTY_BOX (dlg->prop_box),
|
|
|
|
vbox,
|
1999-03-08 08:18:50 +03:00
|
|
|
gtk_label_new (_(page->title)));
|
1999-01-20 01:10:19 +03:00
|
|
|
}
|
|
|
|
|
1999-08-06 00:58:36 +04:00
|
|
|
/* Help callback for the preferences dialog */
|
|
|
|
static void
|
|
|
|
help_callback (GnomePropertyBox *pb, gint page_num, gpointer data)
|
|
|
|
{
|
|
|
|
static GnomeHelpMenuEntry entry = {
|
|
|
|
"gmc",
|
|
|
|
"gmcprefs.html"
|
|
|
|
};
|
|
|
|
|
|
|
|
gnome_help_display (NULL, &entry);
|
|
|
|
}
|
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
static void
|
|
|
|
create_prop_box (PrefsDlg *dlg)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
PrefsPage *cur_page;
|
1999-02-15 23:14:11 +03:00
|
|
|
|
|
|
|
dlg->prop_box = gnome_property_box_new ();
|
2000-06-20 23:42:15 +04:00
|
|
|
if (dlg->panel)
|
|
|
|
gnome_dialog_set_parent (GNOME_DIALOG (dlg->prop_box),
|
|
|
|
GTK_WINDOW (dlg->panel->xwindow));
|
1999-02-15 23:14:11 +03:00
|
|
|
gtk_window_set_modal (GTK_WINDOW (dlg->prop_box), TRUE);
|
|
|
|
gtk_window_set_title (GTK_WINDOW (dlg->prop_box), _("Preferences"));
|
1999-01-20 01:10:19 +03:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
cur_page = &(dlg->prefs_pages [i]);
|
|
|
|
while (cur_page->title != NULL) {
|
|
|
|
create_page (dlg, cur_page);
|
|
|
|
i++;
|
|
|
|
cur_page = &(dlg->prefs_pages [i]);
|
|
|
|
}
|
1999-02-15 23:14:11 +03:00
|
|
|
|
1999-08-24 03:13:31 +04:00
|
|
|
dlg->desktop_prefs = desktop_prefs_new (GNOME_PROPERTY_BOX (dlg->prop_box));
|
|
|
|
dlg->desktop_prefs_page = i++;
|
|
|
|
|
2000-06-20 23:42:15 +04:00
|
|
|
if (dlg->panel)
|
|
|
|
dlg->custom_layout = custom_layout_create_page (
|
|
|
|
GNOME_PROPERTY_BOX (dlg->prop_box), dlg->panel);
|
|
|
|
|
1999-02-25 22:13:31 +03:00
|
|
|
dlg->custom_layout_page = i;
|
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
gtk_signal_connect (GTK_OBJECT (dlg->prop_box), "apply",
|
|
|
|
GTK_SIGNAL_FUNC (apply_callback), dlg);
|
1999-08-06 00:58:36 +04:00
|
|
|
gtk_signal_connect (GTK_OBJECT (dlg->prop_box), "help",
|
|
|
|
GTK_SIGNAL_FUNC (help_callback), dlg);
|
1999-01-20 01:10:19 +03:00
|
|
|
}
|
1999-02-15 23:14:11 +03:00
|
|
|
|
1999-01-09 03:24:03 +03:00
|
|
|
void
|
2000-06-20 23:42:15 +04:00
|
|
|
gnome_configure_box_with_desktop (GtkWidget *widget, WPanel *panel,
|
|
|
|
gboolean desktop)
|
1999-01-09 03:24:03 +03:00
|
|
|
{
|
1999-02-15 23:14:11 +03:00
|
|
|
static PrefsDlg dlg;
|
1999-01-09 03:24:03 +03:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
dlg.panel = panel;
|
|
|
|
dlg.prefs_pages = prefs_pages;
|
1999-01-20 05:16:09 +03:00
|
|
|
|
1999-01-20 01:10:19 +03:00
|
|
|
create_prop_box (&dlg);
|
2000-06-20 23:42:15 +04:00
|
|
|
|
|
|
|
if (desktop)
|
|
|
|
gtk_notebook_set_page (
|
|
|
|
GTK_NOTEBOOK (GNOME_PROPERTY_BOX (
|
|
|
|
dlg.prop_box)->notebook),
|
|
|
|
dlg.desktop_prefs_page);
|
1999-01-20 01:10:19 +03:00
|
|
|
gtk_widget_show (dlg.prop_box);
|
|
|
|
}
|
2000-06-20 23:42:15 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
gnome_configure_box (GtkWidget *widget, WPanel *panel)
|
|
|
|
{
|
|
|
|
gnome_configure_box_with_desktop (widget, panel, FALSE);
|
|
|
|
}
|