[gthumb] settings: added the transparency style



commit c1eb4265caf0e0ce619f08ea31e27db853719aef
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Nov 4 11:09:52 2019 +0100

    settings: added the transparency style

 .../org.gnome.gthumb.image-viewer.gschema.xml      |  3 +++
 extensions/image_viewer/gth-image-viewer-page.c    | 23 +++++++++++++++++++++-
 extensions/image_viewer/preferences.h              |  9 +++++----
 3 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/data/gschemas/org.gnome.gthumb.image-viewer.gschema.xml 
b/data/gschemas/org.gnome.gthumb.image-viewer.gschema.xml
index 71088f51..0765306e 100644
--- a/data/gschemas/org.gnome.gthumb.image-viewer.gschema.xml
+++ b/data/gschemas/org.gnome.gthumb.image-viewer.gschema.xml
@@ -32,6 +32,9 @@
     <key name="histogram-scale" enum="org.gnome.gthumb.GthHistogramScale">
       <default>'linear'</default>
     </key>
+    <key name="transparency-style" enum="org.gnome.gthumb.GthTransparencyStyle">
+      <default>'checkered'</default>
+    </key>
   </schema>
 
 </schemalist>
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index cede0444..47a1f6b4 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -926,6 +926,21 @@ pref_reset_scrollbars_changed (GSettings *settings,
 }
 
 
+static void
+pref_transparency_style_changed (GSettings *settings,
+                                char      *key,
+                                gpointer   user_data)
+{
+       GthImageViewerPage *self = user_data;
+
+       if (! self->priv->active || (self->priv->viewer == NULL))
+               return;
+
+       gth_image_viewer_set_transparency_style (GTH_IMAGE_VIEWER (self->priv->viewer),
+                                                g_settings_get_enum (self->priv->settings, 
PREF_IMAGE_VIEWER_TRANSPARENCY_STYLE));
+}
+
+
 static void
 paint_comment_over_image_func (GthImageViewer *image_viewer,
                               cairo_t        *cr,
@@ -1234,6 +1249,11 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
                          "changed::" PREF_IMAGE_VIEWER_RESET_SCROLLBARS,
                          G_CALLBACK (pref_reset_scrollbars_changed),
                          self);
+       g_signal_connect (self->priv->settings,
+                         "changed::" PREF_IMAGE_VIEWER_TRANSPARENCY_STYLE,
+                         G_CALLBACK (pref_transparency_style_changed),
+                         self);
+
 }
 
 
@@ -2178,7 +2198,8 @@ gth_image_viewer_page_reset_viewer_tool   (GthImageViewerPage *self)
                                          g_settings_get_enum (self->priv->settings, 
PREF_IMAGE_VIEWER_ZOOM_CHANGE));
        gth_image_viewer_set_reset_scrollbars (GTH_IMAGE_VIEWER (self->priv->viewer),
                                               g_settings_get_boolean (self->priv->settings, 
PREF_IMAGE_VIEWER_RESET_SCROLLBARS));
-
+       gth_image_viewer_set_transparency_style (GTH_IMAGE_VIEWER (self->priv->viewer),
+                                                g_settings_get_enum (self->priv->settings, 
PREF_IMAGE_VIEWER_TRANSPARENCY_STYLE));
        _gth_image_viewer_page_enable_drag_source (self, TRUE);
 }
 
diff --git a/extensions/image_viewer/preferences.h b/extensions/image_viewer/preferences.h
index e8cfbe9f..7edd9d5a 100644
--- a/extensions/image_viewer/preferences.h
+++ b/extensions/image_viewer/preferences.h
@@ -30,10 +30,11 @@
 
 /* keys */
 
-#define PREF_IMAGE_VIEWER_ZOOM_QUALITY      "zoom-quality"
-#define PREF_IMAGE_VIEWER_ZOOM_CHANGE       "zoom-change"
-#define PREF_IMAGE_VIEWER_RESET_SCROLLBARS  "reset-scrollbars"
-#define PREF_IMAGE_VIEWER_HISTOGRAM_SCALE   "histogram-scale"
+#define PREF_IMAGE_VIEWER_ZOOM_QUALITY       "zoom-quality"
+#define PREF_IMAGE_VIEWER_ZOOM_CHANGE        "zoom-change"
+#define PREF_IMAGE_VIEWER_RESET_SCROLLBARS   "reset-scrollbars"
+#define PREF_IMAGE_VIEWER_HISTOGRAM_SCALE    "histogram-scale"
+#define PREF_IMAGE_VIEWER_TRANSPARENCY_STYLE "transparency-style"
 
 void image_viewer__dlg_preferences_construct_cb (GtkWidget  *dialog,
                                                 GthBrowser *browser,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]