LCOV - code coverage report
Current view: top level - shumate - shumate-point.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 16 16 100.0 %
Date: 2024-05-11 21:41:31 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 8 75.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2011-2013 Jiri Techet <techet@gmail.com>
       3                 :            :  * Copyright (C) 2019 Marcus Lundblad <ml@update.uu.se>
       4                 :            :  *
       5                 :            :  * This library is free software; you can redistribute it and/or
       6                 :            :  * modify it under the terms of the GNU Lesser General Public
       7                 :            :  * License as published by the Free Software Foundation; either
       8                 :            :  * version 2.1 of the License, or (at your option) any later version.
       9                 :            :  *
      10                 :            :  * This library is distributed in the hope that it will be useful,
      11                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13                 :            :  * Lesser General Public License for more details.
      14                 :            :  *
      15                 :            :  * You should have received a copy of the GNU Lesser General Public
      16                 :            :  * License along with this library; if not, write to the Free Software
      17                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      18                 :            :  */
      19                 :            : 
      20                 :            : /**
      21                 :            :  * ShumatePoint:
      22                 :            :  *
      23                 :            :  * A simple variant of [class@Marker] showing the location of the point as a
      24                 :            :  * circle on the map.
      25                 :            :  */
      26                 :            : 
      27                 :            : #include "shumate-point.h"
      28                 :            : 
      29                 :            : struct _ShumatePoint
      30                 :            : {
      31                 :            :   ShumateMarker parent_instance;
      32                 :            : };
      33                 :            : 
      34   [ +  +  +  - ]:        215 : G_DEFINE_TYPE (ShumatePoint, shumate_point, SHUMATE_TYPE_MARKER);
      35                 :            : 
      36                 :            : static void
      37                 :          3 : shumate_point_class_init (ShumatePointClass *klass)
      38                 :            : {
      39                 :          3 :   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
      40                 :          3 :   GdkDisplay *display;
      41                 :            : 
      42                 :          3 :   gtk_widget_class_set_css_name (widget_class, "map-point");
      43                 :            : 
      44                 :          3 :   display = gdk_display_get_default ();
      45         [ +  + ]:          3 :   if (display)
      46                 :            :     {
      47                 :          2 :       g_autoptr(GtkCssProvider) provider = gtk_css_provider_new ();
      48                 :          2 :       gtk_css_provider_load_from_resource (provider, "/org/gnome/shumate/point.css");
      49         [ +  - ]:          2 :       gtk_style_context_add_provider_for_display (display,
      50                 :            :                                                   GTK_STYLE_PROVIDER (provider),
      51                 :            :                                                   GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
      52                 :            :     }
      53                 :          3 : }
      54                 :            : 
      55                 :            : static void
      56                 :        208 : shumate_point_init (ShumatePoint *point)
      57                 :            : {
      58                 :        208 :   g_object_set (point,
      59                 :            :                 "halign", GTK_ALIGN_CENTER,
      60                 :            :                 "valign", GTK_ALIGN_CENTER,
      61                 :            :                 NULL);
      62                 :        208 : }
      63                 :            : 
      64                 :            : /**
      65                 :            :  * shumate_point_new:
      66                 :            :  *
      67                 :            :  * Creates an instance of #ShumatePoint.
      68                 :            :  *
      69                 :            :  * Returns: (type ShumatePoint): a new #ShumatePoint.
      70                 :            :  */
      71                 :            : ShumateMarker *
      72                 :        208 : shumate_point_new (void)
      73                 :            : {
      74                 :        208 :   return SHUMATE_MARKER (g_object_new (SHUMATE_TYPE_POINT, NULL));
      75                 :            : }

Generated by: LCOV version 1.14