1999-09-21 Federico Mena Quintero <federico@redhat.com>
* dlg.c (init_dlg): Walk the list of widgets only if it exists. 1999-09-21 Federico Mena Quintero <federico@redhat.com> * gmain.c (x_init_dlg): Only call x_focus_widget() if there is a current widget.
Этот коммит содержится в:
родитель
5309648718
Коммит
0fbbead100
@ -5,7 +5,7 @@ AC_INIT(create_vcs)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
PACKAGE=mc
|
||||
VERSION=4.5.39-pre2
|
||||
VERSION=4.5.39-pre6
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
|
||||
AC_SUBST(VERSION)
|
||||
|
@ -1,5 +1,13 @@
|
||||
1999-09-21 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
* gmain.c (x_init_dlg): Only call x_focus_widget() if there is a
|
||||
current widget.
|
||||
|
||||
1999-09-20 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
* gsession.c (save_panel_info): Save the panel's list type.
|
||||
(idle_create_panels): Set the panel's list type.
|
||||
|
||||
* gdesktop.c (handle_recreate_default_icons): New option to
|
||||
re-create the default set of icons.
|
||||
|
||||
|
38
gnome/gcmd.c
38
gnome/gcmd.c
@ -151,7 +151,7 @@ gnome_close_panel (GtkWidget *widget, WPanel *panel)
|
||||
}
|
||||
|
||||
static void
|
||||
set_view_type (GtkWidget *widget, WPanel *panel, enum list_types type)
|
||||
set_list_type (GtkWidget *widget, WPanel *panel, enum list_types type)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -174,7 +174,7 @@ set_view_type (GtkWidget *widget, WPanel *panel, enum list_types type)
|
||||
if (panel->list_type == type)
|
||||
return;
|
||||
|
||||
/* Set the list type */
|
||||
/* Set the list type */
|
||||
|
||||
panel->list_type = type;
|
||||
set_panel_formats (panel);
|
||||
@ -205,28 +205,54 @@ set_view_type (GtkWidget *widget, WPanel *panel, enum list_types type)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* Sets the listing view for a panel */
|
||||
void
|
||||
gnome_set_panel_list_type (WPanel *panel, int list_type)
|
||||
{
|
||||
g_return_if_fail (panel != NULL);
|
||||
g_return_if_fail (list_type >= list_full && list_type <= list_icons);
|
||||
|
||||
/* Set the list type by poking a toolbar item. Yes, this is hackish.
|
||||
* We fall back to icon view if a certain listing type is not supported.
|
||||
* Be sure to keep this in sync with the uiinfo arrays in glayout.c.
|
||||
*/
|
||||
|
||||
if (list_type == list_brief)
|
||||
gtk_toggle_button_set_active (
|
||||
GTK_TOGGLE_BUTTON (panel_view_toolbar_uiinfo[1].widget), TRUE);
|
||||
else if (list_type == list_full)
|
||||
gtk_toggle_button_set_active (
|
||||
GTK_TOGGLE_BUTTON (panel_view_toolbar_uiinfo[2].widget), TRUE);
|
||||
else if (list_type == list_user)
|
||||
gtk_toggle_button_set_active (
|
||||
GTK_TOGGLE_BUTTON (panel_view_toolbar_uiinfo[3].widget), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active (
|
||||
GTK_TOGGLE_BUTTON (panel_view_toolbar_uiinfo[0].widget), TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_icon_view_cmd (GtkWidget *widget, WPanel *panel)
|
||||
{
|
||||
set_view_type (widget, panel, list_icons);
|
||||
set_list_type (widget, panel, list_icons);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_brief_view_cmd (GtkWidget *widget, WPanel *panel)
|
||||
{
|
||||
set_view_type (widget, panel, list_brief);
|
||||
set_list_type (widget, panel, list_brief);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_detailed_view_cmd (GtkWidget *widget, WPanel *panel)
|
||||
{
|
||||
set_view_type (widget, panel, list_full);
|
||||
set_list_type (widget, panel, list_full);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_custom_view_cmd (GtkWidget *widget, WPanel *panel)
|
||||
{
|
||||
set_view_type (widget, panel, list_user);
|
||||
set_list_type (widget, panel, list_user);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -44,4 +44,6 @@ void set_cursor_normal (WPanel *panel);
|
||||
void set_cursor_busy (WPanel *panel);
|
||||
void gnome_new_link (GtkWidget *widget, WPanel *panel);
|
||||
|
||||
void gnome_set_panel_list_type (WPanel *panel, int list_type);
|
||||
|
||||
#endif /* __GCMD_H */
|
||||
|
@ -2639,7 +2639,7 @@ GnomeUIInfo desktop_popup_items[] = {
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop Directory"), NULL, handle_rescan_desktop),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Rescan De_vices"), NULL, handle_rescan_devices),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Re-create Default _Icons"), NULL, handle_recreate_default_icons),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Recreate Default _Icons"), NULL, handle_recreate_default_icons),
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Configure _Background Image"), NULL, set_background_image),
|
||||
GNOMEUIINFO_END
|
||||
|
@ -463,7 +463,7 @@ GnomeUIInfo gnome_panel_desktop_menu [] = {
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Rescan _Desktop Directory"), NULL, do_rescan_desktop),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Rescan De_vices"), NULL, desktop_rescan_devices),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Re-create Default _Icons"), NULL, desktop_recreate_default_icons),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Recreate Default _Icons"), NULL, desktop_recreate_default_icons),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
|
@ -159,7 +159,7 @@ dialog_key_pressed (GtkWidget *win, GdkEventKey *event, Dlg_head *h)
|
||||
w = win;
|
||||
while (w && (GTK_IS_CONTAINER (w) && !GNOME_IS_ICON_LIST (w)))
|
||||
w = GTK_CONTAINER (w)->focus_child;
|
||||
|
||||
|
||||
if (w && GNOME_IS_ICON_LIST (w)){
|
||||
GnomeCanvas *c = GNOME_CANVAS (w);
|
||||
|
||||
@ -168,9 +168,9 @@ dialog_key_pressed (GtkWidget *win, GdkEventKey *event, Dlg_head *h)
|
||||
|
||||
if (i->editing)
|
||||
return FALSE;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
key = translate_gdk_keysym_to_curses (event);
|
||||
if (key == -1)
|
||||
@ -196,7 +196,7 @@ dialog_key_pressed (GtkWidget *win, GdkEventKey *event, Dlg_head *h)
|
||||
}
|
||||
on_escape = 0;
|
||||
}
|
||||
|
||||
|
||||
if (dlg_key_event (h, key)){
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (win), "key_press_event");
|
||||
return TRUE;
|
||||
@ -227,7 +227,7 @@ xtoolkit_create_dialog (Dlg_head *h, int flags)
|
||||
}
|
||||
} else
|
||||
win = 0;
|
||||
|
||||
|
||||
h->grided = flags;
|
||||
h->idle_fn_tag = -1;
|
||||
if (!(flags & DLG_NO_TED)){
|
||||
@ -235,7 +235,7 @@ xtoolkit_create_dialog (Dlg_head *h, int flags)
|
||||
ted = gtk_ted_new_layout (h->name, LIBDIR "/layout");
|
||||
gtk_container_add (GTK_CONTAINER (win), ted);
|
||||
gtk_widget_show (ted);
|
||||
|
||||
|
||||
bind_gtk_keys (GTK_WIDGET (ted), h);
|
||||
}
|
||||
if (win){
|
||||
@ -253,7 +253,7 @@ void
|
||||
x_dlg_set_window (Dlg_head *h, GtkWidget *win)
|
||||
{
|
||||
h->wdata = (widget_data) win;
|
||||
bind_gtk_keys (GTK_WIDGET (win), h);
|
||||
bind_gtk_keys (GTK_WIDGET (win), h);
|
||||
}
|
||||
|
||||
void
|
||||
@ -268,7 +268,7 @@ xtoolkit_get_main_dialog (Dlg_head *h)
|
||||
GtkWidget *win;
|
||||
|
||||
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
return (widget_data) win;
|
||||
return (widget_data) win;
|
||||
}
|
||||
|
||||
/* Creates the containers */
|
||||
@ -315,7 +315,7 @@ x_init_dlg (Dlg_head *h)
|
||||
if (!(h->grided & DLG_NO_TED)){
|
||||
GtkTed *ted = GTK_TED (GTK_BIN (h->wdata)->child);
|
||||
Widget_Item *p, *first;
|
||||
|
||||
|
||||
g_warning ("Should never use GtkTed!!! Write a real dialog!!!");
|
||||
|
||||
first = p = h->current;
|
||||
@ -325,16 +325,19 @@ x_init_dlg (Dlg_head *h)
|
||||
p = p->next;
|
||||
} while (p != first);
|
||||
gtk_ted_prepare (ted);
|
||||
|
||||
|
||||
if (!ted->need_gui){
|
||||
gtk_grab_add (GTK_WIDGET (ted));
|
||||
gtk_window_set_policy (GTK_WINDOW (h->wdata), 0, 0, 0);
|
||||
}
|
||||
gtk_widget_show (GTK_WIDGET (h->wdata));
|
||||
}
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (h->wdata), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gnome_dlg_send_destroy), h);
|
||||
x_focus_widget (h->current);
|
||||
|
||||
if (h->current)
|
||||
x_focus_widget (h->current);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -432,7 +435,7 @@ dialog_panel_callback (struct Dlg_head *h, int id, int msg)
|
||||
{
|
||||
Widget_Item *dh;
|
||||
void *current_widget; /* The current widget */
|
||||
|
||||
|
||||
if (msg == DLG_KEY && id == '\n'){
|
||||
current_widget = (void *) h->current->widget;
|
||||
|
||||
@ -446,11 +449,11 @@ dialog_panel_callback (struct Dlg_head *h, int id, int msg)
|
||||
|
||||
if (current_widget == p->current_dir){
|
||||
WInput *in = p->current_dir;
|
||||
|
||||
|
||||
do_panel_cd (p, in->buffer, cd_parse_command);
|
||||
assign_text (in, p->cwd);
|
||||
update_input (in, 1);
|
||||
|
||||
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
}
|
||||
@ -492,7 +495,7 @@ non_corba_create_panels (char *startup_dir)
|
||||
dialog_panel_callback, "[panel]", "midnight", DLG_NO_TED);
|
||||
|
||||
session_load ();
|
||||
|
||||
#if 0
|
||||
/* The following is a hack. We have to have at least one panel for
|
||||
* run_dlg() to be happy. So we destroy it in the idle loop if we
|
||||
* didn't need it in the first place. This idle function is to be run
|
||||
@ -502,7 +505,7 @@ non_corba_create_panels (char *startup_dir)
|
||||
panel = new_panel_at (startup_dir);
|
||||
gtk_idle_add_priority (GTK_PRIORITY_DEFAULT, idle_destroy_panel, panel);
|
||||
panel->widget.options |= W_PANEL_HIDDEN;
|
||||
|
||||
#endif
|
||||
run_dlg (desktop_dlg);
|
||||
|
||||
desktop_destroy ();
|
||||
@ -546,8 +549,8 @@ gmc_window_setup_from_panel (GnomeDialog *dialog, WPanel *panel)
|
||||
|
||||
/**
|
||||
* gnome_check_super_user:
|
||||
* @void:
|
||||
*
|
||||
* @void:
|
||||
*
|
||||
* Puts out a warning if the user is running gmc as root. If the user selects
|
||||
* Cancel, then gmc will terminate.
|
||||
**/
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <config.h>
|
||||
#include "main.h"
|
||||
#include "../vfs/vfs.h"
|
||||
#include "gcmd.h"
|
||||
#include "gmain.h"
|
||||
#include "gscreen.h"
|
||||
#include "gsession.h"
|
||||
@ -26,6 +27,7 @@ typedef struct {
|
||||
char *cwd;
|
||||
int column_width[GMC_COLUMNS];
|
||||
char *user_format;
|
||||
int list_type;
|
||||
} PanelInfo;
|
||||
|
||||
|
||||
@ -54,6 +56,10 @@ save_panel_info (WPanel *panel)
|
||||
gnome_config_set_int (path, panel->column_width[i]);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
path = g_strconcat (section, "/list_type", NULL);
|
||||
gnome_config_set_int (path, panel->list_type);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
/* Loads a panel from the information in the specified gnome-config file/section */
|
||||
@ -94,6 +100,8 @@ load_panel_info (char *file, char *section)
|
||||
pi->column_width[i] = gnome_config_get_int_with_default (key, NULL);
|
||||
}
|
||||
|
||||
pi->list_type = gnome_config_get_int_with_default ("list_type=0", NULL);
|
||||
|
||||
gnome_config_pop_prefix ();
|
||||
g_free (prefix);
|
||||
|
||||
@ -109,6 +117,42 @@ free_panel_info (PanelInfo *pi)
|
||||
g_free (pi);
|
||||
}
|
||||
|
||||
static void
|
||||
create_panel_from_info (PanelInfo *pi)
|
||||
{
|
||||
WPanel *panel;
|
||||
|
||||
panel = new_panel_at (pi->cwd);
|
||||
|
||||
g_free (panel->user_format);
|
||||
panel->user_format = g_strdup (pi->user_format);
|
||||
memcpy (panel->column_width, pi->column_width, sizeof (pi->column_width));
|
||||
gnome_set_panel_list_type (panel, pi->list_type);
|
||||
}
|
||||
|
||||
static void
|
||||
load_session_info (char *filename)
|
||||
{
|
||||
void *iterator;
|
||||
char *key, *value;
|
||||
PanelInfo *pi;
|
||||
|
||||
iterator = gnome_config_init_iterator_sections (filename);
|
||||
|
||||
while ((iterator = gnome_config_iterator_next (iterator, &key, &value)) != NULL)
|
||||
if (key && strncmp (key, "panel ", 6) == 0) {
|
||||
pi = load_panel_info (filename, key);
|
||||
g_free (key);
|
||||
if (!pi)
|
||||
continue;
|
||||
|
||||
create_panel_from_info (pi);
|
||||
free_panel_info (pi);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* Idle handler to create the list of panels loaded from the session info file */
|
||||
static gint
|
||||
idle_create_panels (gpointer data)
|
||||
@ -126,6 +170,7 @@ idle_create_panels (gpointer data)
|
||||
g_free (panel->user_format);
|
||||
panel->user_format = g_strdup (pi->user_format);
|
||||
memcpy (panel->column_width, pi->column_width, sizeof (pi->column_width));
|
||||
gnome_set_panel_list_type (panel, pi->list_type);
|
||||
|
||||
free_panel_info (pi);
|
||||
}
|
||||
@ -165,6 +210,23 @@ load_session_info (char *filename)
|
||||
gtk_idle_add_priority (GTK_PRIORITY_DEFAULT + 1, idle_create_panels, panels);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
create_default_panel (const char *startup_dir)
|
||||
{
|
||||
char buf[MC_MAXPATHLEN];
|
||||
const char *dir = buf;
|
||||
|
||||
if (startup_dir == NULL)
|
||||
mc_get_current_wd (buf, MC_MAXPATHLEN);
|
||||
else
|
||||
dir = startup_dir;
|
||||
|
||||
new_panel_with_geometry_at (dir, cmdline_geometry);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Idle handler to create the default panel */
|
||||
static gint
|
||||
idle_create_default_panel (gpointer data)
|
||||
@ -193,6 +255,8 @@ create_default_panel (const char *startup_dir)
|
||||
gtk_idle_add_priority (GTK_PRIORITY_DEFAULT + 1, idle_create_default_panel, g_strdup (dir));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Callback from the master client to save the session */
|
||||
static gint
|
||||
session_save (GnomeClient *client, gint phase, GnomeSaveStyle save_style, gint shutdown,
|
||||
|
@ -1,3 +1,7 @@
|
||||
1999-09-21 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
* dlg.c (init_dlg): Walk the list of widgets only if it exists.
|
||||
|
||||
1999-09-20 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
The following is a patch from Volker Braun
|
||||
|
@ -855,7 +855,7 @@ void init_dlg (Dlg_head *h)
|
||||
/* Redraw the screen */
|
||||
dlg_redraw (h);
|
||||
|
||||
while (!dlg_focus (h))
|
||||
while (!dlg_focus (h) && h->current)
|
||||
h->current = h->current->next;
|
||||
|
||||
h->ret_value = 0;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user