[glom] ImageGlom: Avoid copy/paste of code to clear data.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] ImageGlom: Avoid copy/paste of code to clear data.
- Date: Thu, 25 Feb 2016 12:13:08 +0000 (UTC)
commit 4b1eebc8778bdba5fd92b6f82e15700474382f9e
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Feb 25 11:04:23 2016 +0100
ImageGlom: Avoid copy/paste of code to clear data.
glom/utility_widgets/imageglom.cc | 14 +++++++++-----
glom/utility_widgets/imageglom.h | 1 +
2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 608042d..5374ae8 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -236,7 +236,7 @@ void ImageGlom::set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
void ImageGlom::set_value(const Gnome::Gda::Value& value)
{
// Remember original data
- m_original_data = Gnome::Gda::Value();
+ clear_original_data();
m_original_data = value;
show_image_data();
}
@@ -818,7 +818,7 @@ void ImageGlom::on_menupopup_activate_select_file()
bin->data = image_data->data;
bin->binary_length = image_data->binary_length;
- m_original_data = Gnome::Gda::Value();
+ clear_original_data();
g_value_unset(m_original_data.gobj());
g_value_init(m_original_data.gobj(), GDA_TYPE_BINARY);
@@ -832,6 +832,11 @@ void ImageGlom::on_menupopup_activate_select_file()
}
}
+void ImageGlom::clear_original_data()
+{
+ m_original_data = Gnome::Gda::Value();
+}
+
void ImageGlom::on_clipboard_get(Gtk::SelectionData& selection_data, guint /* info */)
{
//info is meant to indicate the target, but it seems to be always 0,
@@ -905,8 +910,7 @@ void ImageGlom::on_clipboard_received_image(const Glib::RefPtr<Gdk::Pixbuf>& pix
if(pixbuf)
{
- // Clear original data of previous image
- m_original_data = Gnome::Gda::Value();
+ clear_original_data();
m_pixbuf_original = pixbuf;
show_image_data();
@@ -933,7 +937,7 @@ void ImageGlom::on_menupopup_activate_clear()
if(m_read_only)
return;
- m_original_data = Gnome::Gda::Value();
+ clear_original_data();
show_image_data();
signal_edited().emit();
}
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index 13f42b8..6fa2b03 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -68,6 +68,7 @@ private:
void init();
void init_widgets(bool use_evince);
void clear_image_from_widgets();
+ void clear_original_data();
void on_size_allocate(Gtk::Allocation& allocation) override;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]