1999-03-15 Federico Mena Quintero <federico@nuclecu.unam.mx>

* cmd.c (edit_symlink_cmd): Generate the title of the dialog after
	we have computed the source filename.
	(edit_symlink_cmd): Use g_strdup_printf() instead of g_strconcat()
	for better internationalization.

	* wtools.c: Removed unused function input_dialog_help_2().
	(real_input_dialog_help): Put this inside an "#ifndef HAVE_GNOME",
	because now the Gnome version implements its own pretty dialog.

1999-03-15  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* gdialogs.c (real_input_dialog_help): Now we use a
	gnome_request_dialog() for generic input dialogs.  They look
	prettier and consistent now.
	(file_progress_show): Update the progress bars.  Thanks to Greg
	for noticing this!

	* Makefile.in: Removed references to gpopup.[co].
This commit is contained in:
Miguel de Icaza 1999-03-16 00:11:32 +00:00
parent dbf6e0f2d3
commit eb864a4949
9 changed files with 82 additions and 79 deletions

View File

@ -1,3 +1,13 @@
1999-03-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdialogs.c (real_input_dialog_help): Now we use a
gnome_request_dialog() for generic input dialogs. They look
prettier and consistent now.
(file_progress_show): Update the progress bars. Thanks to Greg
for noticing this!
* Makefile.in: Removed references to gpopup.[co].
Mon Mar 15 17:09:37 1999 Gregory McLean <gregm@comstar.net>
* gdialogs.c (file_progress_show_bytes): Fixed a GTK Warning when

View File

@ -49,7 +49,6 @@ GNOMESRCS = \
gmenu.c \
gmetadata.c \
gpageprop.c \
gpopup.c \
gpopup2.c \
gprefs.c \
gprint.c \
@ -81,7 +80,6 @@ GNOMEHDRS = \
gmetadata.h \
gpageprop.h \
gpopup.h \
gpopup2.h \
gprefs.h \
gprint.h \
gprop.h \
@ -156,7 +154,6 @@ OBJS = \
gmenu.o \
gmetadata.o \
gpageprop.o \
gpopup.o \
gpopup2.o \
gprefs.o \
gprint.o \

View File

@ -224,8 +224,9 @@ file_progress_show_deleting (FileOpContext *ctx, char *path)
FileProgressStatus
file_progress_show (FileOpContext *ctx, long done, long total)
{
static gchar count[10];
static gchar count[20];
FileOpContextUI *ui;
double perc;
g_return_val_if_fail (ctx != NULL, FILE_CONT);
@ -238,8 +239,14 @@ file_progress_show (FileOpContext *ctx, long done, long total)
if (ui->aborting)
return FILE_ABORT;
snprintf (count, 9, "%d%%", (gint)(100.0 *(gfloat)done/(gfloat)total));
gtk_label_set_text (GTK_LABEL (ui->file_label), count);
if (total > 0) {
perc = (double) done / (double) total;
snprintf (count, 9, "%d%%", (gint) (100.0 * perc));
gtk_label_set_text (GTK_LABEL (ui->file_label), count);
gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), perc);
} else
gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), 0.0);
while (gtk_events_pending ())
gtk_main_iteration ();
return FILE_CONT;
@ -273,7 +280,7 @@ FileProgressStatus
file_progress_show_bytes (FileOpContext *ctx, double done, double total)
{
FileOpContextUI *ui;
gfloat per;
double perc;
g_return_val_if_fail (ctx != NULL, FILE_CONT);
@ -285,12 +292,10 @@ file_progress_show_bytes (FileOpContext *ctx, double done, double total)
if (ui->aborting)
return FILE_ABORT;
per = ( done / total <= 1.0) ? done / total : 1.0;
if (total <= 0.0)
gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), 0.0);
else
gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), per);
perc = done / total;
gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), CLAMP (perc, 0.0, 1.0));
while (gtk_events_pending ())
gtk_main_iteration ();
return FILE_CONT;
@ -929,3 +934,37 @@ fmd_init_i18n (int force)
{
/* unneccessary func */
}
/* Callback for the gnome_request_dialog() in the input dialog */
static void
input_dialog_cb (gchar *string, gpointer data)
{
char **s;
s = data;
*s = string;
gtk_main_quit ();
}
/* Our implementation of the general-purpose input dialog */
char *
real_input_dialog_help (char *header, char *text, char *help, char *def_text)
{
int is_password;
GtkWidget *dialog;
char *string;
if (strncmp (text, _("Password:"), strlen (_("Password"))) == 0)
is_password = TRUE;
else
is_password = FALSE;
dialog = gnome_request_dialog (is_password, text, def_text, 0,
input_dialog_cb, &string,
NULL);
gtk_window_set_title (GTK_WINDOW (dialog), header);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_main ();
return string;
}

View File

@ -16,9 +16,11 @@
int gpopup_do_popup2 (GdkEventButton *event, WPanel *panel, DesktopIconInfo *dii);
#if 0
int gpopup_do_popup (GdkEventButton *event, WPanel *from_panel,
DesktopIconInfo *dii,
int panel_row, char *filename);
#endif
#endif

View File

@ -1,3 +1,14 @@
1999-03-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
* cmd.c (edit_symlink_cmd): Generate the title of the dialog after
we have computed the source filename.
(edit_symlink_cmd): Use g_strdup_printf() instead of g_strconcat()
for better internationalization.
* wtools.c: Removed unused function input_dialog_help_2().
(real_input_dialog_help): Put this inside an "#ifndef HAVE_GNOME",
because now the Gnome version implements its own pretty dialog.
1999-03-14 Miguel de Icaza <miguel@nuclecu.unam.mx>
* dlg.c (dlg_select_nth_widget): Handle the case where h->current

View File

@ -168,13 +168,13 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
return move_dir;
}
if (internal){
char view_entry [BUF_TINY];
#ifdef HAVE_GNOME
if (!gmc_view (filename, start_line)){
view (0, filename, &move_dir, start_line);
}
#else
char view_entry [BUF_TINY];
if (start_line != 0)
g_snprintf (view_entry, sizeof (view_entry), "View:%d", start_line);
else
@ -1114,7 +1114,7 @@ void edit_symlink_cmd (void)
char buffer [MC_MAXPATHLEN];
char *p = NULL;
int i;
char *dest, *q = g_strconcat (_(" Symlink "), name_trunc (p, 32), _(" points to:"), NULL);
char *dest, *q;
if (is_a_desktop_panel (cpanel)) {
gint i;
@ -1126,6 +1126,9 @@ void edit_symlink_cmd (void)
} else {
p = selection (cpanel)->fname;
}
q = g_strdup_printf (_(" Symlink `%s\' points to: "), name_trunc (p, 32));
i = readlink (p, buffer, MC_MAXPATHLEN);
if (i > 0) {
buffer [i] = 0;

View File

@ -500,7 +500,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over
if (file_progress_show_source (ctx, src_path) == FILE_ABORT ||
file_progress_show_target (ctx, dst_path) == FILE_ABORT)
return FILE_ABORT;
/* file_progress_show_count (ctx, *progress_count, ctx->progress_count); */
mc_refresh ();
retry_dst_stat:
@ -673,7 +673,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over
ctx->bps = 0;
return_status = file_progress_show (ctx, 0, file_size);
/* file_progress_show_bytes (ctx, 0, file_size); */
mc_refresh ();
if (return_status != FILE_CONT)
@ -767,7 +767,6 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over
file_progress_set_stalled_label (ctx, stalled_msg);
return_status = file_progress_show (ctx, n_read_total, file_size);
/* file_progress_show_bytes (ctx, n_read_total, file_size); */
mc_refresh ();
if (return_status != FILE_CONT)
goto ret;

View File

@ -551,6 +551,8 @@ int quick_dialog (QuickDialog *qd)
/* }}} */
/* {{{ Input routines */
#ifndef HAVE_GNOME
#define INPUT_INDEX 2
char *real_input_dialog_help (char *header, char *text, char *help, char *def_text)
{
@ -626,72 +628,13 @@ char *real_input_dialog_help (char *header, char *text, char *help, char *def_te
} else
return 0;
}
#endif
char *input_dialog (char *header, char *text, char *def_text)
{
return input_dialog_help (header, text, "[Input Line Keys]", def_text);
}
static int
input_dialog_help_2 (char *header, char *text1, char *text2, char *help, char **r1, char **r2)
{
QuickDialog Quick_input;
QuickWidget quick_widgets [] = {
{ quick_button, 6, 10, 4, 0, N_("&Cancel"), 0, B_CANCEL, 0, 0,
XV_WLAY_DONTCARE, "button-cancel" },
{ quick_button, 3, 10, 4, 0, N_("Ok")
, 0, B_ENTER, 0, 0,
XV_WLAY_DONTCARE, "button-ok" },
{ quick_input, 4, 80, 4, 0, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-pth" },
{ quick_label, 3, 80, 3, 0, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-pth" },
{ quick_input, 4, 80, 3, 0, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-lbl" },
{ quick_label, 3, 80, 2, 0, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-lbl" },
{ 0 } };
int len;
int i;
int lines1, lines2;
char *my_str1, *my_str2;
len = max (strlen (header), msglen (text1, &lines1));
len = max (len, msglen (text2, &lines2)) + 4;
len = max (len, 64);
Quick_input.xlen = len;
Quick_input.xpos = -1;
Quick_input.title = header;
Quick_input.help = help;
Quick_input.class = "quick_input_2";
Quick_input.i18n = 0;
quick_widgets [5].text = text1;
quick_widgets [3].text = text2;
for (i = 0; i < 6; i++)
quick_widgets [i].y_divisions = lines1+lines2+7;
Quick_input.ylen = lines1 + lines2 + 7;
quick_widgets [0].relative_y += (lines1 + lines2);
quick_widgets [1].relative_y += (lines1 + lines2);
quick_widgets [2].relative_y += (lines1);
quick_widgets [3].relative_y += (lines1);
quick_widgets [4].str_result = &my_str1;
quick_widgets [2].str_result = &my_str2;
Quick_input.widgets = quick_widgets;
if (quick_dialog (&Quick_input) != B_CANCEL){
*r1 = *(quick_widgets [4].str_result);
*r2 = *(quick_widgets [2].str_result);
return 1;
} else
return 0;
}
int input_dialog_2 (char *header, char *text1, char *text2, char **r1, char **r2)
{
return input_dialog_help_2 (header, text1, text2, "[Input Line Keys]", r1, r2);
}
char *input_expand_dialog (char *header, char *text, char *def_text)
{
char *result;

View File

@ -79,7 +79,6 @@ void destroy_chooser (Chooser *c);
/* The input dialogs */
char *input_dialog (char *header, char *text, char *def_text);
int input_dialog_2 (char *header, char *text1, char *text2, char **r1, char **r2);
char *input_dialog_help (char *header, char *text, char *help, char *def_text);
char *input_expand_dialog (char *header, char *text, char *def_text);
char *real_input_dialog (char *header, char *text, char *def_text);