[gnome-flashback] desktop: add gf_get_nautilus_scale



commit aa20e4eeadb106aad363d36e0f34f67bf07c0e4f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Nov 24 18:32:31 2019 +0200

    desktop: add gf_get_nautilus_scale

 gnome-flashback/libdesktop/gf-icon.c  | 41 +----------------------------------
 gnome-flashback/libdesktop/gf-utils.c | 39 +++++++++++++++++++++++++++++++++
 gnome-flashback/libdesktop/gf-utils.h |  2 ++
 3 files changed, 42 insertions(+), 40 deletions(-)
---
diff --git a/gnome-flashback/libdesktop/gf-icon.c b/gnome-flashback/libdesktop/gf-icon.c
index 608aecd..c081307 100644
--- a/gnome-flashback/libdesktop/gf-icon.c
+++ b/gnome-flashback/libdesktop/gf-icon.c
@@ -145,45 +145,6 @@ get_selected_uris (GfIcon *self)
   return uris;
 }
 
-static double
-get_nautilus_scale (void)
-{
-  GSettingsSchemaSource *source;
-  GSettingsSchema *schema;
-  GSettings *settings;
-  int zoom_level;
-  double size;
-
-  source = g_settings_schema_source_get_default ();
-  schema = g_settings_schema_source_lookup (source,
-                                            "org.gnome.nautilus.icon-view",
-                                            FALSE);
-
-  if (schema == NULL)
-    return 1.0;
-
-  g_settings_schema_unref  (schema);
-  settings = g_settings_new ("org.gnome.nautilus.icon-view");
-
-  zoom_level = g_settings_get_enum (settings, "default-zoom-level");
-  g_object_unref (settings);
-
-  if (zoom_level == 0)
-    size = 48.0;
-  else if (zoom_level == 1)
-    size = 64.0;
-  else if (zoom_level == 2)
-    size = 96.0;
-  else if (zoom_level == 3)
-    size = 128.0;
-  else if (zoom_level == 4)
-    size = 256.0;
-  else
-    size = 64.0;
-
-  return size / 64.0;
-}
-
 static GString *
 get_gnome_icon_list (GfIcon *self)
 {
@@ -201,7 +162,7 @@ get_gnome_icon_list (GfIcon *self)
   if (selected_icons == NULL)
     return icon_list;
 
-  scale = 1.0 / get_nautilus_scale ();
+  scale = 1.0 / gf_get_nautilus_scale ();
 
   for (l = selected_icons; l != NULL; l = l->next)
     {
diff --git a/gnome-flashback/libdesktop/gf-utils.c b/gnome-flashback/libdesktop/gf-utils.c
index 85a32f2..c23d3f8 100644
--- a/gnome-flashback/libdesktop/gf-utils.c
+++ b/gnome-flashback/libdesktop/gf-utils.c
@@ -163,3 +163,42 @@ gf_launch_uri (const char  *uri,
 
   return launched;
 }
+
+double
+gf_get_nautilus_scale (void)
+{
+  GSettingsSchemaSource *source;
+  GSettingsSchema *schema;
+  GSettings *settings;
+  int zoom_level;
+  double size;
+
+  source = g_settings_schema_source_get_default ();
+  schema = g_settings_schema_source_lookup (source,
+                                            "org.gnome.nautilus.icon-view",
+                                            FALSE);
+
+  if (schema == NULL)
+    return 1.0;
+
+  g_settings_schema_unref  (schema);
+  settings = g_settings_new ("org.gnome.nautilus.icon-view");
+
+  zoom_level = g_settings_get_enum (settings, "default-zoom-level");
+  g_object_unref (settings);
+
+  if (zoom_level == 0)
+    size = 48.0;
+  else if (zoom_level == 1)
+    size = 64.0;
+  else if (zoom_level == 2)
+    size = 96.0;
+  else if (zoom_level == 3)
+    size = 128.0;
+  else if (zoom_level == 4)
+    size = 256.0;
+  else
+    size = 64.0;
+
+  return size / 64.0;
+}
diff --git a/gnome-flashback/libdesktop/gf-utils.h b/gnome-flashback/libdesktop/gf-utils.h
index 52d370a..f074aa5 100644
--- a/gnome-flashback/libdesktop/gf-utils.h
+++ b/gnome-flashback/libdesktop/gf-utils.h
@@ -32,6 +32,8 @@ gboolean gf_launch_desktop_file (const char       *desktop_file,
 gboolean gf_launch_uri          (const char       *uri,
                                  GError          **error);
 
+double   gf_get_nautilus_scale  (void);
+
 G_END_DECLS
 
 #endif


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