[metacity] theme: remove unused code



commit 76d0a12ace3ed1406b09a9da17da25b5dcf37d7e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jan 23 17:17:33 2016 +0200

    theme: remove unused code

 src/ui/theme-parser.c |  253 -------------------------------------------------
 src/ui/theme.c        |   79 ---------------
 2 files changed, 0 insertions(+), 332 deletions(-)
---
diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c
index b27d676..966312c 100644
--- a/src/ui/theme-parser.c
+++ b/src/ui/theme-parser.c
@@ -1609,61 +1609,6 @@ parse_geometry_element (GMarkupParseContext  *context,
     }
 }
 
-#if 0
-static gboolean
-check_expression (PosToken            *tokens,
-                  int                  n_tokens,
-                  gboolean             has_object,
-                  MetaTheme           *theme,
-                  GMarkupParseContext *context,
-                  GError             **error)
-{
-  MetaPositionExprEnv env;
-  int x, y;
-
-  /* We set it all to 0 to try and catch divide-by-zero screwups.
-   * it's possible we should instead guarantee that widths and heights
-   * are at least 1.
-   */
-
-  env.rect = meta_rect (0, 0, 0, 0);
-  if (has_object)
-    {
-      env.object_width = 0;
-      env.object_height = 0;
-    }
-  else
-    {
-      env.object_width = -1;
-      env.object_height = -1;
-    }
-
-  env.left_width = 0;
-  env.right_width = 0;
-  env.top_height = 0;
-  env.bottom_height = 0;
-  env.title_width = 0;
-  env.title_height = 0;
-
-  env.icon_width = 0;
-  env.icon_height = 0;
-  env.mini_icon_width = 0;
-  env.mini_icon_height = 0;
-  env.theme = theme;
-
-  if (!meta_parse_position_expression (tokens, n_tokens,
-                                       &env,
-                                       &x, &y,
-                                       error))
-    {
-      add_context_to_error (error, context);
-      return FALSE;
-    }
-
-  return TRUE;
-}
-#endif
-
 static void
 parse_draw_op_element (GMarkupParseContext  *context,
                        const gchar          *element_name,
@@ -1701,20 +1646,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x1, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y1, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (x2, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y2, FALSE, info->theme, context, error))
-        return;
-#endif
-
       dash_on_val = 0;
       if (dash_on_length &&
           !parse_positive_integer (dash_on_length, &dash_on_val, context, info->theme, error))
@@ -1788,20 +1719,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
-
       filled_val = FALSE;
       if (filled && !parse_boolean (filled, &filled_val, context, error))
         return;
@@ -1897,20 +1814,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
             }
         }
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
-
       if (start_angle == NULL)
         {
           if (!parse_angle (from, &start_angle_val, context, error))
@@ -1985,19 +1888,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
       op = meta_draw_op_new (META_DRAW_CLIP);
 
       op->data.clip.x = meta_draw_spec_new (info->theme, x, NULL);
@@ -2032,19 +1922,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
       alpha_spec = NULL;
       if (!parse_alpha (alpha, &alpha_spec, context, error))
         return;
@@ -2098,20 +1975,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
-
       type_val = meta_gradient_type_from_string (type);
       if (type_val == META_GRADIENT_LAST)
         {
@@ -2172,19 +2035,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, TRUE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, TRUE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, TRUE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, TRUE, info->theme, context, error))
-        return;
-#endif
       fill_type_val = META_IMAGE_FILL_SCALE;
       if (fill_type)
         {
@@ -2339,19 +2189,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
       filled_val = TRUE;
       if (filled && !parse_boolean (filled, &filled_val, context, error))
         return;
@@ -2426,19 +2263,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
       state_val = meta_gtk_state_from_string (state);
       if (((int) state_val) == -1)
         {
@@ -2491,17 +2315,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y1, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y2, FALSE, info->theme, context, error))
-        return;
-#endif
-
       state_val = meta_gtk_state_from_string (state);
       if (((int) state_val) == -1)
         {
@@ -2547,19 +2360,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
       fill_type_val = META_IMAGE_FILL_SCALE;
       if (fill_type)
         {
@@ -2611,17 +2411,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
                               NULL))
         return;
 
-#if 0
-      if (!check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (ellipsize_width, FALSE, info->theme, context, error))
-        return;
-#endif
-
       if (ellipsize_width && peek_required_version (info) < 3001)
         {
           set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
@@ -2675,20 +2464,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
       /* x/y/width/height default to 0,0,width,height - should
        * probably do this for all the draw ops
        */
-#if 0
-      if (x && !check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (y && !check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (width && !check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (height && !check_expression (height, FALSE, info->theme, context, error))
-        return;
-#endif
-
       op_list = meta_theme_lookup_draw_op_list (info->theme,
                                                 name);
       if (op_list == NULL)
@@ -2757,34 +2532,6 @@ parse_draw_op_element (GMarkupParseContext  *context,
         return;
 
       /* These default to 0 */
-#if 0
-      if (tile_xoffset && !check_expression (tile_xoffset, FALSE, info->theme, context, error))
-        return;
-
-      if (tile_yoffset && !check_expression (tile_yoffset, FALSE, info->theme, context, error))
-        return;
-
-      /* x/y/width/height default to 0,0,width,height - should
-       * probably do this for all the draw ops
-       */
-      if (x && !check_expression (x, FALSE, info->theme, context, error))
-        return;
-
-      if (y && !check_expression (y, FALSE, info->theme, context, error))
-        return;
-
-      if (width && !check_expression (width, FALSE, info->theme, context, error))
-        return;
-
-      if (height && !check_expression (height, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (tile_width, FALSE, info->theme, context, error))
-        return;
-
-      if (!check_expression (tile_height, FALSE, info->theme, context, error))
-        return;
-#endif
       op_list = meta_theme_lookup_draw_op_list (info->theme,
                                                 name);
       if (op_list == NULL)
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 41fc582..aa2f2c1 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -2078,46 +2078,6 @@ parse_number (const char  *p,
  */
 #define IS_VARIABLE_CHAR(c) (g_ascii_isalpha ((c)) || (c) == '_')
 
-#if 0
-static void
-debug_print_tokens (PosToken *tokens,
-                    int       n_tokens)
-{
-  int i;
-
-  for (i = 0; i < n_tokens; i++)
-    {
-      PosToken *t = &tokens[i];
-
-      g_print (" ");
-
-      switch (t->type)
-        {
-        case POS_TOKEN_INT:
-          g_print ("\"%d\"", t->d.i.val);
-          break;
-        case POS_TOKEN_DOUBLE:
-          g_print ("\"%g\"", t->d.d.val);
-          break;
-        case POS_TOKEN_OPEN_PAREN:
-          g_print ("\"(\"");
-          break;
-        case POS_TOKEN_CLOSE_PAREN:
-          g_print ("\")\"");
-          break;
-        case POS_TOKEN_VARIABLE:
-          g_print ("\"%s\"", t->d.v.name);
-          break;
-        case POS_TOKEN_OPERATOR:
-          g_print ("\"%s\"", op_name (t->d.o.op));
-          break;
-        }
-    }
-
-  g_print ("\n");
-}
-#endif
-
 /**
  * Tokenises an expression.
  *
@@ -2287,32 +2247,6 @@ typedef struct
   } d;
 } PosExpr;
 
-#if 0
-static void
-debug_print_exprs (PosExpr *exprs,
-                   int      n_exprs)
-{
-  int i;
-
-  for (i = 0; i < n_exprs; i++)
-    {
-      switch (exprs[i].type)
-        {
-        case POS_EXPR_INT:
-          g_print (" %d", exprs[i].d.int_val);
-          break;
-        case POS_EXPR_DOUBLE:
-          g_print (" %g", exprs[i].d.double_val);
-          break;
-        case POS_EXPR_OPERATOR:
-          g_print (" %s", op_name (exprs[i].d.operator));
-          break;
-        }
-    }
-  g_print ("\n");
-}
-#endif
-
 static gboolean
 do_operation (PosExpr *a,
               PosExpr *b,
@@ -2436,11 +2370,6 @@ do_operations (PosExpr *exprs,
 {
   int i;
 
-#if 0
-  g_print ("Doing prec %d ops on %d exprs\n", precedence, *n_exprs);
-  debug_print_exprs (exprs, *n_exprs);
-#endif
-
   i = 1;
   while (i < *n_exprs)
     {
@@ -6961,10 +6890,6 @@ meta_frame_type_from_string (const char *str)
     return META_FRAME_TYPE_BORDER;
   else if (strcmp ("attached", str) == 0)
     return META_FRAME_TYPE_ATTACHED;
-#if 0
-  else if (strcmp ("toolbar", str) == 0)
-    return META_FRAME_TYPE_TOOLBAR;
-#endif
   else
     return META_FRAME_TYPE_LAST;
 }
@@ -6988,10 +6913,6 @@ meta_frame_type_to_string (MetaFrameType type)
       return "border";
     case META_FRAME_TYPE_ATTACHED:
       return "attached";
-#if 0
-    case META_FRAME_TYPE_TOOLBAR:
-      return "toolbar";
-#endif
     case  META_FRAME_TYPE_LAST:
       break;
     default:


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