widget/gtk/maiRedundantObjectFactory.c

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim:expandtab:shiftwidth=2:tabstop=2:
     3  */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this
     6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 #include <atk/atk.h>
     9 #include "maiRedundantObjectFactory.h"
    11 static void mai_redundant_object_factory_class_init (
    12                               maiRedundantObjectFactoryClass *klass);
    14 static AtkObject* mai_redundant_object_factory_create_accessible (
    15                               GObject *obj);
    16 static GType mai_redundant_object_factory_get_accessible_type (void);
    18 GType
    19 mai_redundant_object_factory_get_type (void)
    20 {
    21   static GType type = 0;
    23   if (!type)
    24   {
    25     static const GTypeInfo tinfo =
    26     {
    27       sizeof (maiRedundantObjectFactoryClass),
    28       (GBaseInitFunc) NULL, /* base init */
    29       (GBaseFinalizeFunc) NULL, /* base finalize */
    30       (GClassInitFunc) mai_redundant_object_factory_class_init, /* class init */
    31       (GClassFinalizeFunc) NULL, /* class finalize */
    32       NULL, /* class data */
    33       sizeof (maiRedundantObjectFactory), /* instance size */
    34       0, /* nb preallocs */
    35       (GInstanceInitFunc) NULL, /* instance init */
    36       NULL /* value table */
    37     };
    38     type = g_type_register_static (
    39                            ATK_TYPE_OBJECT_FACTORY,
    40                            "MaiRedundantObjectFactory" , &tinfo, 0);
    41   }
    43   return type;
    44 }
    46 static void
    47 mai_redundant_object_factory_class_init (maiRedundantObjectFactoryClass *klass)
    48 {
    49   AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
    51   class->create_accessible = mai_redundant_object_factory_create_accessible;
    52   class->get_accessible_type = mai_redundant_object_factory_get_accessible_type;
    53 }
    55 /**
    56  * mai_redundant_object_factory_new:
    57  *
    58  * Creates an instance of an #AtkObjectFactory which generates primitive
    59  * (non-functioning) #AtkObjects.
    60  *
    61  * Returns: an instance of an #AtkObjectFactory
    62  **/
    63 AtkObjectFactory*
    64 mai_redundant_object_factory_new ()
    65 {
    66   GObject *factory;
    68   factory = g_object_new (mai_redundant_object_factory_get_type(), NULL);
    70   g_return_val_if_fail (factory != NULL, NULL);
    71   return ATK_OBJECT_FACTORY (factory);
    72 }
    74 static AtkObject*
    75 mai_redundant_object_factory_create_accessible (GObject   *obj)
    76 {
    77   AtkObject *accessible;
    79   g_return_val_if_fail (obj != NULL, NULL);
    81   accessible = g_object_new (ATK_TYPE_OBJECT, NULL);
    82   g_return_val_if_fail (accessible != NULL, NULL);
    84   accessible->role = ATK_ROLE_REDUNDANT_OBJECT;
    86   return accessible;
    87 }
    89 static GType
    90 mai_redundant_object_factory_get_accessible_type ()
    91 {
    92   return mai_redundant_object_factory_get_type();
    93 }

mercurial