[metacity] theme: make meta_theme_validate static



commit c9b1bf774d955719a3f4541e394e08e20607ae27
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Jan 24 11:39:41 2016 +0200

    theme: make meta_theme_validate static

 src/ui/theme-parser.c  |   94 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/ui/theme-private.h |    3 --
 src/ui/theme.c         |   94 ------------------------------------------------
 3 files changed, 94 insertions(+), 97 deletions(-)
---
diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c
index 879a2ae..0d36b4e 100644
--- a/src/ui/theme-parser.c
+++ b/src/ui/theme-parser.c
@@ -3677,6 +3677,100 @@ start_element_handler (GMarkupParseContext *context,
     }
 }
 
+static const char*
+meta_frame_type_to_string (MetaFrameType type)
+{
+  switch (type)
+    {
+    case META_FRAME_TYPE_NORMAL:
+      return "normal";
+    case META_FRAME_TYPE_DIALOG:
+      return "dialog";
+    case META_FRAME_TYPE_MODAL_DIALOG:
+      return "modal_dialog";
+    case META_FRAME_TYPE_UTILITY:
+      return "utility";
+    case META_FRAME_TYPE_MENU:
+      return "menu";
+    case META_FRAME_TYPE_BORDER:
+      return "border";
+    case META_FRAME_TYPE_ATTACHED:
+      return "attached";
+    case  META_FRAME_TYPE_LAST:
+      break;
+    default:
+      break;
+    }
+
+  return "<unknown>";
+}
+
+static gboolean
+meta_theme_validate (MetaTheme *theme,
+                     GError   **error)
+{
+  int i;
+
+  g_return_val_if_fail (theme != NULL, FALSE);
+
+  /* FIXME what else should be checked? */
+
+  g_assert (theme->name);
+
+  if (theme->readable_name == NULL)
+    {
+      /* Translators: This error means that a necessary XML tag (whose name
+       * is given in angle brackets) was not found in a given theme (whose
+       * name is given second, in quotation marks).
+       */
+      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+                   _("No <%s> set for theme \"%s\""), "name", theme->name);
+      return FALSE;
+    }
+
+  if (theme->author == NULL)
+    {
+      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+                   _("No <%s> set for theme \"%s\""), "author", theme->name);
+      return FALSE;
+    }
+
+  if (theme->date == NULL)
+    {
+      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+                   _("No <%s> set for theme \"%s\""), "date", theme->name);
+      return FALSE;
+    }
+
+  if (theme->description == NULL)
+    {
+      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+                   _("No <%s> set for theme \"%s\""), "description", theme->name);
+      return FALSE;
+    }
+
+  if (theme->copyright == NULL)
+    {
+      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+                   _("No <%s> set for theme \"%s\""), "copyright", theme->name);
+      return FALSE;
+    }
+
+  for (i = 0; i < (int)META_FRAME_TYPE_LAST; i++)
+    if (i != (int)META_FRAME_TYPE_ATTACHED && theme->style_sets_by_type[i] == NULL)
+      {
+        g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+                     _("No frame style set for window type \"%s\" in theme \"%s\", add a <window type=\"%s\" 
style_set=\"whatever\"/> element"),
+                     meta_frame_type_to_string (i),
+                     theme->name,
+                     meta_frame_type_to_string (i));
+
+        return FALSE;
+      }
+
+  return TRUE;
+}
+
 static void
 end_element_handler (GMarkupParseContext *context,
                      const gchar         *element_name,
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index a349777..96c5b6f 100644
--- a/src/ui/theme-private.h
+++ b/src/ui/theme-private.h
@@ -819,9 +819,6 @@ MetaFrameStyle        *meta_theme_get_frame_style              (MetaTheme
                                                                 MetaFrameType                type,
                                                                 MetaFrameFlags               flags);
 
-gboolean               meta_theme_validate                     (MetaTheme                   *theme,
-                                                                GError                     **error);
-
 PangoFontDescription  *meta_style_info_create_font_desc        (MetaTheme                   *theme,
                                                                 MetaStyleInfo               *style_info);
 
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 3baa14e..ac2d1be 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -5777,100 +5777,6 @@ meta_theme_free (MetaTheme *theme)
   g_free (theme);
 }
 
-static const char*
-meta_frame_type_to_string (MetaFrameType type)
-{
-  switch (type)
-    {
-    case META_FRAME_TYPE_NORMAL:
-      return "normal";
-    case META_FRAME_TYPE_DIALOG:
-      return "dialog";
-    case META_FRAME_TYPE_MODAL_DIALOG:
-      return "modal_dialog";
-    case META_FRAME_TYPE_UTILITY:
-      return "utility";
-    case META_FRAME_TYPE_MENU:
-      return "menu";
-    case META_FRAME_TYPE_BORDER:
-      return "border";
-    case META_FRAME_TYPE_ATTACHED:
-      return "attached";
-    case  META_FRAME_TYPE_LAST:
-      break;
-    default:
-      break;
-    }
-
-  return "<unknown>";
-}
-
-gboolean
-meta_theme_validate (MetaTheme *theme,
-                     GError   **error)
-{
-  int i;
-
-  g_return_val_if_fail (theme != NULL, FALSE);
-
-  /* FIXME what else should be checked? */
-
-  g_assert (theme->name);
-
-  if (theme->readable_name == NULL)
-    {
-      /* Translators: This error means that a necessary XML tag (whose name
-       * is given in angle brackets) was not found in a given theme (whose
-       * name is given second, in quotation marks).
-       */
-      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
-                   _("No <%s> set for theme \"%s\""), "name", theme->name);
-      return FALSE;
-    }
-
-  if (theme->author == NULL)
-    {
-      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
-                   _("No <%s> set for theme \"%s\""), "author", theme->name);
-      return FALSE;
-    }
-
-  if (theme->date == NULL)
-    {
-      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
-                   _("No <%s> set for theme \"%s\""), "date", theme->name);
-      return FALSE;
-    }
-
-  if (theme->description == NULL)
-    {
-      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
-                   _("No <%s> set for theme \"%s\""), "description", theme->name);
-      return FALSE;
-    }
-
-  if (theme->copyright == NULL)
-    {
-      g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
-                   _("No <%s> set for theme \"%s\""), "copyright", theme->name);
-      return FALSE;
-    }
-
-  for (i = 0; i < (int)META_FRAME_TYPE_LAST; i++)
-    if (i != (int)META_FRAME_TYPE_ATTACHED && theme->style_sets_by_type[i] == NULL)
-      {
-        g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
-                     _("No frame style set for window type \"%s\" in theme \"%s\", add a <window type=\"%s\" 
style_set=\"whatever\"/> element"),
-                     meta_frame_type_to_string (i),
-                     theme->name,
-                     meta_frame_type_to_string (i));
-
-        return FALSE;
-      }
-
-  return TRUE;
-}
-
 void
 meta_theme_set_composited (MetaTheme *theme,
                            gboolean   composited)


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