1
1

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.
Этот коммит содержится в:
Miguel de Icaza 1999-09-21 05:50:22 +00:00
родитель 5309648718
Коммит 0fbbead100
10 изменённых файлов: 135 добавлений и 28 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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
};

Просмотреть файл

@ -332,9 +332,12 @@ x_init_dlg (Dlg_head *h)
}
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);
}
/*
@ -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 ();

Просмотреть файл

@ -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;