LCOV - code coverage report
Current view: top level - src/plugins/clipboard - valent-clipboard-preferences.c (source / functions) Coverage Total Hit
Test: Code Coverage Lines: 100.0 % 29 29
Test Date: 2024-04-23 06:02:46 Functions: 100.0 % 7 7
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 75.0 % 4 3

             Branch data     Line data    Source code
       1                 :             : // SPDX-License-Identifier: GPL-3.0-or-later
       2                 :             : // SPDX-FileCopyrightText: Andy Holmes <andrew.g.r.holmes@gmail.com>
       3                 :             : 
       4                 :             : #define G_LOG_DOMAIN "valent-clipboard-preferences"
       5                 :             : 
       6                 :             : #include "config.h"
       7                 :             : 
       8                 :             : #include <glib/gi18n.h>
       9                 :             : #include <adwaita.h>
      10                 :             : #include <gtk/gtk.h>
      11                 :             : #include <valent.h>
      12                 :             : 
      13                 :             : #include "valent-clipboard-preferences.h"
      14                 :             : 
      15                 :             : 
      16                 :             : struct _ValentClipboardPreferences
      17                 :             : {
      18                 :             :   ValentDevicePreferencesGroup  parent_instance;
      19                 :             : 
      20                 :             :   /* template */
      21                 :             :   GtkSwitch                    *sync_pull;
      22                 :             :   GtkSwitch                    *sync_push;
      23                 :             : };
      24                 :             : 
      25   [ +  +  +  - ]:           7 : G_DEFINE_FINAL_TYPE (ValentClipboardPreferences, valent_clipboard_preferences, VALENT_TYPE_DEVICE_PREFERENCES_GROUP)
      26                 :             : 
      27                 :             : 
      28                 :             : /*
      29                 :             :  * GObject
      30                 :             :  */
      31                 :             : static void
      32                 :           1 : valent_clipboard_preferences_constructed (GObject *object)
      33                 :             : {
      34                 :           1 :   ValentClipboardPreferences *self = VALENT_CLIPBOARD_PREFERENCES (object);
      35                 :           1 :   ValentDevicePreferencesGroup *group = VALENT_DEVICE_PREFERENCES_GROUP (self);
      36                 :           1 :   GSettings *settings;
      37                 :             : 
      38                 :           1 :   settings = valent_device_preferences_group_get_settings (group);
      39                 :           1 :   g_settings_bind (settings,        "auto-pull",
      40                 :           1 :                    self->sync_pull, "active",
      41                 :             :                    G_SETTINGS_BIND_DEFAULT);
      42                 :           1 :   g_settings_bind (settings,        "auto-push",
      43                 :           1 :                    self->sync_push, "active",
      44                 :             :                    G_SETTINGS_BIND_DEFAULT);
      45                 :             : 
      46                 :           1 :   G_OBJECT_CLASS (valent_clipboard_preferences_parent_class)->constructed (object);
      47                 :           1 : }
      48                 :             : 
      49                 :             : static void
      50                 :           1 : valent_clipboard_preferences_dispose (GObject *object)
      51                 :             : {
      52                 :           1 :   GtkWidget *widget = GTK_WIDGET (object);
      53                 :             : 
      54                 :           1 :   gtk_widget_dispose_template (widget, VALENT_TYPE_CLIPBOARD_PREFERENCES);
      55                 :             : 
      56                 :           1 :   G_OBJECT_CLASS (valent_clipboard_preferences_parent_class)->dispose (object);
      57                 :           1 : }
      58                 :             : 
      59                 :             : static void
      60                 :           2 : valent_clipboard_preferences_class_init (ValentClipboardPreferencesClass *klass)
      61                 :             : {
      62                 :           2 :   GObjectClass *object_class = G_OBJECT_CLASS (klass);
      63                 :           2 :   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
      64                 :             : 
      65                 :           2 :   object_class->constructed = valent_clipboard_preferences_constructed;
      66                 :           2 :   object_class->dispose = valent_clipboard_preferences_dispose;
      67                 :             : 
      68                 :           2 :   gtk_widget_class_set_template_from_resource (widget_class, "/plugins/clipboard/valent-clipboard-preferences.ui");
      69                 :           2 :   gtk_widget_class_bind_template_child (widget_class, ValentClipboardPreferences, sync_pull);
      70                 :           2 :   gtk_widget_class_bind_template_child (widget_class, ValentClipboardPreferences, sync_push);
      71                 :           2 : }
      72                 :             : 
      73                 :             : static void
      74                 :           1 : valent_clipboard_preferences_init (ValentClipboardPreferences *self)
      75                 :             : {
      76                 :           1 :   gtk_widget_init_template (GTK_WIDGET (self));
      77                 :           1 : }
      78                 :             : 
        

Generated by: LCOV version 2.0-1