aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-11-05 21:33:53 +0800
committerChristian Persch <chpe@src.gnome.org>2003-11-05 21:33:53 +0800
commitcf267d03537f9e647a9ee60fc7916de89ad6721f (patch)
tree05701f67c58c8c902d1d04d064e71b1d047469bc
parentc36c58b6c786360ff45ff8f907d6142b1bfc94c5 (diff)
downloadgsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.tar
gsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.tar.gz
gsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.tar.bz2
gsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.tar.lz
gsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.tar.xz
gsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.tar.zst
gsoc2013-epiphany-cf267d03537f9e647a9ee60fc7916de89ad6721f.zip
Set "Print Selection" insensitive when there is no selection. Ported from
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): * lib/ephy-dialog.c: (impl_run): Set "Print Selection" insensitive when there is no selection. Ported from galeon.
-rw-r--r--ChangeLog18
-rw-r--r--data/glade/print.glade2
-rwxr-xr-xembed/print-dialog.c100
-rw-r--r--lib/ephy-dialog.c12
4 files changed, 86 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 70bee0324..a404e37a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+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):
+ * lib/ephy-dialog.c: (impl_run):
+
+ Set "Print Selection" insensitive when there is no selection.
+ Ported from galeon.
+
+2003-11-05 Christian Persch <chpe@cvs.gnome.org>
+
+ * configure.in:
+
+ Bump version to 1.0.5.
+
2003-11-02 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/mozilla-embed.cpp:
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 c1558999c..f02f49e49 100755
--- a/embed/print-dialog.c
+++ b/embed/print-dialog.c
@@ -19,7 +19,10 @@
*/
#include "print-dialog.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 +86,8 @@ enum
FROM_PROP,
COLOR_PROP,
ORIENTATION_PROP,
- PREVIEW_PROP
+ PREVIEW_PROP,
+ SELECTION_PROP
};
enum
@@ -114,6 +118,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,14 +162,55 @@ print_dialog_get_type (void)
}
static void
+impl_show (EphyDialog *dialog)
+{
+ PrintDialog *print_dialog = 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_embed_selection_can_copy (embed) != G_OK)
+ {
+ 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);
object_class->finalize = print_dialog_finalize;
+ dialog_class->show = impl_show;
+
print_dialog_signals[PREVIEW] =
g_signal_new ("preview",
G_OBJECT_CLASS_TYPE (object_class),
@@ -232,15 +278,8 @@ print_dialog_new (EphyEmbed *embed,
if (ret_info != NULL)
{
- GtkWidget *button;
-
dialog->only_collect_info = TRUE;
dialog->ret_info = ret_info;
-
- /* disappear preview button */
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog),
- PREVIEW_PROP);
- gtk_widget_hide (button);
}
return EPHY_DIALOG(dialog);
@@ -260,15 +299,8 @@ print_dialog_new_with_parent (GtkWidget *window,
if (ret_info != NULL)
{
- GtkWidget *button;
-
dialog->only_collect_info = TRUE;
dialog->ret_info = ret_info;
-
- /* disappear preview button */
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog),
- PREVIEW_PROP);
- gtk_widget_hide (button);
}
return EPHY_DIALOG(dialog);
@@ -414,18 +446,17 @@ print_dialog_print (EphyDialog *dialog)
{
*(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));
}
@@ -440,18 +471,17 @@ print_dialog_preview (EphyDialog *dialog)
if(PRINT_DIALOG(dialog)->only_collect_info && PRINT_DIALOG(dialog)->ret_info)
{
- *(PRINT_DIALOG(dialog)->ret_info) = info;
+ return;
}
- else
- {
- embed = ephy_embed_dialog_get_embed
+
+ embed = ephy_embed_dialog_get_embed
(EPHY_EMBED_DIALOG(dialog));
- g_return_if_fail (embed != NULL);
+ g_return_if_fail (embed != NULL);
+
+ info->preview = TRUE;
+ ephy_embed_print (embed, info);
+ print_free_info (info);
- 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));
@@ -463,6 +493,7 @@ print_cancel_button_cb (GtkWidget *widget,
{
if (PRINT_DIALOG (dialog)->only_collect_info)
{
+ /* When in collect_info mode the caller owns the reference */
return;
}
@@ -480,6 +511,5 @@ void
print_preview_button_cb (GtkWidget *widget,
EphyDialog *dialog)
{
- if(!(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 06ef88f06..ed929d3b4 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
@@ -1180,15 +1180,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));
}