diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | data/glade/print.glade | 2 | ||||
-rwxr-xr-x | embed/print-dialog.c | 108 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 12 |
4 files changed, 88 insertions, 48 deletions
@@ -1,3 +1,17 @@ +2003-11-05 Christian Persch <chpe@cvs.gnome.org> + + * data/glade/print.glade: + * embed/print-dialog.c: (impl_show), (print_dialog_class_init), + (print_dialog_new), (print_dialog_new_with_parent), + (print_dialog_print), (print_dialog_preview), + (print_cancel_button_cb), (print_preview_button_cb): + + Only allow choosing "Selection" if there really is one. + + * lib/ephy-dialog.c: (impl_run): + + Use ephy_dialog_show() when running an EphyDialog. + 2003-11-05 Marco Pesenti Gritti <marco@gnome.org> * lib/ephy-gui.c: (ephy_gui_help): diff --git a/data/glade/print.glade b/data/glade/print.glade index 46574ab51..c28975d01 100644 --- a/data/glade/print.glade +++ b/data/glade/print.glade @@ -474,7 +474,7 @@ </child> <child> - <widget class="GtkRadioButton" id="radiobutton1"> + <widget class="GtkRadioButton" id="selection_radiobutton"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">_Selection</property> diff --git a/embed/print-dialog.c b/embed/print-dialog.c index 841804cc1..0cbe44d59 100755 --- a/embed/print-dialog.c +++ b/embed/print-dialog.c @@ -19,7 +19,11 @@ */ #include "print-dialog.h" + +#include "ephy-command-manager.h" #include "ephy-prefs.h" + +#include <gtk/gtktogglebutton.h> #include <gtk/gtkdialog.h> #include <gtk/gtkstock.h> #include <libgnomevfs/gnome-vfs-utils.h> @@ -83,7 +87,8 @@ enum FROM_PROP, COLOR_PROP, ORIENTATION_PROP, - PREVIEW_PROP + PREVIEW_PROP, + SELECTION_PROP }; enum @@ -114,6 +119,7 @@ EphyDialogProperty properties [] = { COLOR_PROP, "print_color_radiobutton", CONF_PRINT_COLOR, PT_NORMAL, NULL }, { ORIENTATION_PROP, "orient_p_radiobutton", CONF_PRINT_ORIENTATION, PT_NORMAL, NULL }, { PREVIEW_PROP, "preview_button", NULL, PT_NORMAL, NULL }, + { SELECTION_PROP, "selection_radiobutton", NULL, PT_NORMAL, NULL}, { -1, NULL, NULL } }; @@ -157,12 +163,54 @@ print_dialog_get_type (void) } static void +impl_show (EphyDialog *dialog) +{ + PrintDialog *print_dialog = EPHY_PRINT_DIALOG (dialog); + EphyEmbed *embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog)); + + EPHY_DIALOG_CLASS (parent_class)->show (dialog); + + if (print_dialog->only_collect_info) + { + GtkWidget *button; + + /* disappear preview button */ + button = ephy_dialog_get_control (EPHY_DIALOG (dialog), + PREVIEW_PROP); + gtk_widget_hide (button); + } + + if (ephy_command_manager_can_do_command + (EPHY_COMMAND_MANAGER (embed), "cmd_copy") == FALSE) + { + GtkWidget *widget; + + /* Make selection button disabled */ + widget = ephy_dialog_get_control (EPHY_DIALOG (dialog), + SELECTION_PROP); + + gtk_widget_set_sensitive (widget, FALSE); + + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) + { + GtkWidget *all_pages; + all_pages = ephy_dialog_get_control (EPHY_DIALOG (dialog), + ALL_PAGES_PROP); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (all_pages), TRUE); + } + } +} + +static void print_dialog_class_init (PrintDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + EphyDialogClass *dialog_class = EPHY_DIALOG_CLASS (klass); parent_class = g_type_class_peek_parent (klass); + dialog_class->show = impl_show; + print_dialog_signals[PREVIEW] = g_signal_new ("preview", G_OBJECT_CLASS_TYPE (object_class), @@ -214,14 +262,8 @@ print_dialog_new (EphyEmbed *embed, if (ret_info != NULL) { - GtkWidget *button; - dialog->only_collect_info = TRUE; dialog->ret_info = ret_info; - - button = ephy_dialog_get_control (EPHY_DIALOG (dialog), - PREVIEW_PROP); - gtk_widget_hide (button); } return EPHY_DIALOG(dialog); @@ -241,14 +283,8 @@ print_dialog_new_with_parent (GtkWidget *window, if (ret_info != NULL) { - GtkWidget *button; - dialog->only_collect_info = TRUE; dialog->ret_info = ret_info; - - button = ephy_dialog_get_control (EPHY_DIALOG (dialog), - PREVIEW_PROP); - gtk_widget_hide (button); } return EPHY_DIALOG(dialog); @@ -394,18 +430,17 @@ print_dialog_print (EphyDialog *dialog) { *(EPHY_PRINT_DIALOG(dialog)->ret_info) = info; + /* When in collect_info mode the caller owns the reference */ return; } - else - { - embed = ephy_embed_dialog_get_embed - (EPHY_EMBED_DIALOG(dialog)); - g_return_if_fail (embed != NULL); - info->preview = FALSE; - ephy_embed_print (embed, info); - print_free_info (info); - } + embed = ephy_embed_dialog_get_embed + (EPHY_EMBED_DIALOG(dialog)); + g_return_if_fail (embed != NULL); + + info->preview = FALSE; + ephy_embed_print (embed, info); + print_free_info (info); g_object_unref (G_OBJECT(dialog)); } @@ -416,22 +451,22 @@ print_dialog_preview (EphyDialog *dialog) EmbedPrintInfo *info; EphyEmbed *embed; - info = print_get_info (dialog); - + /* Should not be called in collect_info mode */ if(EPHY_PRINT_DIALOG(dialog)->only_collect_info && EPHY_PRINT_DIALOG(dialog)->ret_info) { - *(EPHY_PRINT_DIALOG(dialog)->ret_info) = info; + g_return_if_reached (); } - else - { - embed = ephy_embed_dialog_get_embed - (EPHY_EMBED_DIALOG(dialog)); - g_return_if_fail (embed != NULL); - info->preview = TRUE; - ephy_embed_print (embed, info); - print_free_info (info); - } + info = print_get_info (dialog); + + embed = ephy_embed_dialog_get_embed + (EPHY_EMBED_DIALOG(dialog)); + g_return_if_fail (embed != NULL); + + info->preview = TRUE; + ephy_embed_print (embed, info); + print_free_info (info); + g_signal_emit (G_OBJECT (dialog), print_dialog_signals[PREVIEW], 0); g_object_unref (G_OBJECT(dialog)); @@ -443,6 +478,7 @@ print_cancel_button_cb (GtkWidget *widget, { if (EPHY_PRINT_DIALOG (dialog)->only_collect_info) { + /* When in collect_info mode the caller owns the reference */ return; } @@ -460,7 +496,5 @@ void print_preview_button_cb (GtkWidget *widget, EphyDialog *dialog) { - //FIXME: Don't show preview button at all. - if(!(EPHY_PRINT_DIALOG(dialog)->only_collect_info)) - print_dialog_preview (dialog); + print_dialog_preview (dialog); } diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 5666936c5..bd4ff0cd4 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti + * Copyright (C) 2000-2003 Marco Pesenti Gritti * * 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 @@ -1112,15 +1112,7 @@ setup_default_size (EphyDialog *dialog) static gint impl_run (EphyDialog *dialog) { - if (dialog->priv->props && !dialog->priv->initialized) - { - load_props (dialog->priv->props); - prefs_connect_signals (dialog); - prefs_set_sensitivity (dialog->priv->props); - dialog->priv->initialized = TRUE; - } - - setup_default_size (dialog); + ephy_dialog_show (dialog); return gtk_dialog_run (GTK_DIALOG(dialog->priv->dialog)); } |