[libgnomekbd/next: 9/12] Remove GkbdIndicator




commit 66f82055efeed3e4741e5ee8105ceebeb1f16261
Author: Corentin Noël <tintou noel tf>
Date:   Tue Jul 5 09:51:48 2022 +0200

    Remove GkbdIndicator

 libgnomekbd/gkbd-configuration.c                 | 143 +----
 libgnomekbd/gkbd-configuration.h                 |  21 +-
 libgnomekbd/gkbd-indicator-config.c              | 348 ------------
 libgnomekbd/gkbd-indicator-config.h              | 101 ----
 libgnomekbd/gkbd-indicator-marshal.list          |   1 -
 libgnomekbd/gkbd-indicator.c                     | 591 -------------------
 libgnomekbd/gkbd-indicator.h                     |  56 --
 libgnomekbd/gkbd-status.c                        | 693 -----------------------
 libgnomekbd/gkbd-status.h                        |  60 --
 libgnomekbd/libgnomekbd.convert                  |   8 -
 libgnomekbd/meson.build                          |  16 +-
 libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in |  35 --
 test/gkbd-indicator-test.c                       |  78 ---
 test/gkbd-status-test.c                          |  53 --
 test/meson.build                                 |  24 +-
 15 files changed, 11 insertions(+), 2217 deletions(-)
---
diff --git a/libgnomekbd/gkbd-configuration.c b/libgnomekbd/gkbd-configuration.c
index ff01158..eb6a552 100644
--- a/libgnomekbd/gkbd-configuration.c
+++ b/libgnomekbd/gkbd-configuration.c
@@ -30,7 +30,7 @@
 #include <glib/gi18n-lib.h>
 
 #include <gkbd-configuration.h>
-
+#include <gkbd-keyboard-config.h>
 #include <gkbd-desktop-config.h>
 
 typedef struct {
@@ -38,7 +38,6 @@ typedef struct {
        XklConfigRegistry *registry;
 
        GkbdDesktopConfig cfg;
-       GkbdIndicatorConfig ind_cfg;
        GkbdKeyboardConfig kbd_cfg;
 
        gchar **full_group_names;
@@ -80,25 +79,6 @@ gkbd_configuration_cfg_changed (GSettings * settings, gchar * key,
        g_signal_emit (configuration, signals[SIGNAL_CHANGED], 0);
 }
 
-/* Should be called once for all widgets */
-static void
-gkbd_configuration_ind_cfg_changed (GSettings * settings, gchar * key,
-                                   GkbdConfiguration * configuration)
-{
-       GkbdConfigurationPrivate *priv = gkbd_configuration_get_instance_private (configuration);
-       xkl_debug (100,
-                  "Applet configuration changed in GConf - reiniting...\n");
-       gkbd_indicator_config_load (&priv->ind_cfg);
-
-       gkbd_indicator_config_free_image_filenames (&priv->ind_cfg);
-       gkbd_indicator_config_load_image_filenames (&priv->ind_cfg,
-                                                   &priv->kbd_cfg);
-
-       gkbd_indicator_config_activate (&priv->ind_cfg);
-
-       g_signal_emit (configuration, signals[SIGNAL_CHANGED], 0);
-}
-
 static void
 gkbd_configuration_load_group_names (GkbdConfiguration * configuration,
                                     XklConfigRec * xklrec)
@@ -148,10 +128,6 @@ gkbd_configuration_kbd_cfg_callback (XklEngine * engine,
 
        gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, xklrec);
 
-       gkbd_indicator_config_free_image_filenames (&priv->ind_cfg);
-       gkbd_indicator_config_load_image_filenames (&priv->ind_cfg,
-                                                   &priv->kbd_cfg);
-
        g_clear_pointer (&priv->full_group_names, g_strfreev);
        g_clear_pointer (&priv->short_group_names, g_strfreev);
 
@@ -220,7 +196,6 @@ gkbd_configuration_init (GkbdConfiguration * configuration)
 
        gkbd_desktop_config_init (&priv->cfg, priv->engine);
        gkbd_keyboard_config_init (&priv->kbd_cfg, priv->engine);
-       gkbd_indicator_config_init (&priv->ind_cfg, priv->engine);
 
        gkbd_desktop_config_load (&priv->cfg);
        gkbd_desktop_config_activate (&priv->cfg);
@@ -231,13 +206,6 @@ gkbd_configuration_init (GkbdConfiguration * configuration)
 
        gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg, xklrec);
 
-       gkbd_indicator_config_load (&priv->ind_cfg);
-
-       gkbd_indicator_config_load_image_filenames (&priv->ind_cfg,
-                                                   &priv->kbd_cfg);
-
-       gkbd_indicator_config_activate (&priv->ind_cfg);
-
        gkbd_configuration_load_group_names (configuration, xklrec);
        g_object_unref (G_OBJECT (xklrec));
 
@@ -245,10 +213,6 @@ gkbd_configuration_init (GkbdConfiguration * configuration)
                                          G_CALLBACK
                                          (gkbd_configuration_cfg_changed),
                                          configuration);
-       gkbd_indicator_config_start_listen (&priv->ind_cfg,
-                                           G_CALLBACK
-                                           (gkbd_configuration_ind_cfg_changed),
-                                           configuration);
        xkl_engine_start_listen (priv->engine, XKLL_TRACK_KEYBOARD_STATE);
 
        xkl_debug (100, "The config startup process for %p completed\n",
@@ -268,9 +232,7 @@ gkbd_configuration_finalize (GObject * obj)
        xkl_engine_stop_listen (priv->engine, XKLL_TRACK_KEYBOARD_STATE);
 
        gkbd_desktop_config_stop_listen (&priv->cfg);
-       gkbd_indicator_config_stop_listen (&priv->ind_cfg);
 
-       gkbd_indicator_config_term (&priv->ind_cfg);
        gkbd_keyboard_config_term (&priv->kbd_cfg);
        gkbd_desktop_config_term (&priv->cfg);
 
@@ -373,19 +335,6 @@ gkbd_configuration_get_group_names (GkbdConfiguration * configuration)
        return priv->full_group_names;
 }
 
-gchar *
-gkbd_configuration_get_image_filename (GkbdConfiguration * configuration,
-                                      guint group)
-{
-       GkbdConfigurationPrivate *priv = gkbd_configuration_get_instance_private (configuration);
-
-       g_return_val_if_fail (GKBD_IS_CONFIGURATION (configuration), NULL);
-
-       if (!priv->ind_cfg.show_flags)
-               return NULL;
-       return (gchar *) g_slist_nth_data (priv->ind_cfg.image_filenames, group);
-}
-
 /**
  * gkbd_configuration_get_short_group_names:
  *
@@ -420,16 +369,6 @@ gkbd_configuration_get_current_tooltip (GkbdConfiguration * configuration)
        return g_strdup (priv->full_group_names[state->group]);
 }
 
-gboolean
-gkbd_configuration_if_flags_shown (GkbdConfiguration * configuration)
-{
-       GkbdConfigurationPrivate *priv = gkbd_configuration_get_instance_private (configuration);
-
-       g_return_val_if_fail (GKBD_IS_CONFIGURATION (configuration), FALSE);
-
-       return priv->ind_cfg.show_flags;
-}
-
 gchar *
 gkbd_configuration_extract_layout_name (GkbdConfiguration * configuration,
                                        int group)
@@ -516,21 +455,6 @@ gkbd_configuration_get_current_group (GkbdConfiguration * configuration)
        return state ? state->group : 0u;
 }
 
-/**
- * gkbd_configuration_get_indicator_config:
- *
- * Returns: (transfer none): indicator config
- */
-GkbdIndicatorConfig *
-gkbd_configuration_get_indicator_config (GkbdConfiguration * configuration)
-{
-       GkbdConfigurationPrivate *priv = gkbd_configuration_get_instance_private (configuration);
-
-       g_return_val_if_fail (GKBD_IS_CONFIGURATION (configuration), NULL);
-
-       return &priv->ind_cfg;
-}
-
 /**
  * gkbd_configuration_get_keyboard_config:
  *
@@ -585,71 +509,6 @@ gkbd_configuration_remove_object (GkbdConfiguration * configuration,
            g_slist_remove (priv->widget_instances, obj);
 }
 
-/**
- * gkbd_configuration_load_images:
- *
- * Returns: (transfer full) (element-type GdkPixbuf): list of images
- */
-GSList *
-gkbd_configuration_load_images (GkbdConfiguration * configuration)
-{
-       int i;
-       GSList *image_filename, *images = NULL;
-       GkbdConfigurationPrivate *priv = gkbd_configuration_get_instance_private (configuration);
-
-       g_return_val_if_fail (GKBD_IS_CONFIGURATION (configuration), NULL);
-
-       if (!priv->ind_cfg.show_flags)
-               return NULL;
-
-       image_filename = priv->ind_cfg.image_filenames;
-
-       for (i =
-            xkl_engine_get_max_num_groups (priv->engine);
-            --i >= 0; image_filename = image_filename->next) {
-               GdkPixbuf *image = NULL;
-               char *image_file = (char *) image_filename->data;
-
-               if (image_file != NULL) {
-                       GError *gerror = NULL;
-                       image =
-                           gdk_pixbuf_new_from_file (image_file, &gerror);
-                       xkl_debug (150,
-                                  "Image %d[%s] loaded -> %p[%dx%d]\n",
-                                  i, image_file, image,
-                                  gdk_pixbuf_get_width (image),
-                                  gdk_pixbuf_get_height (image));
-               }
-               /* We append the image anyway - even if it is NULL! */
-               images = g_slist_append (images, image);
-       }
-       return images;
-}
-
-/**
- * gkbd_configuration_free_images:
- * @images: (element-type GdkPixbuf): list of images
- */
-void
-gkbd_configuration_free_images (GkbdConfiguration * configuration,
-                               GSList * images)
-{
-       GdkPixbuf *pi;
-       GSList *img_node;
-
-       g_return_if_fail (GKBD_IS_CONFIGURATION (configuration));
-
-       while ((img_node = images) != NULL) {
-               pi = GDK_PIXBUF (img_node->data);
-               /* It can be NULL - some images may be missing */
-               if (pi != NULL) {
-                       g_object_unref (pi);
-               }
-               images = g_slist_remove_link (images, img_node);
-               g_slist_free_1 (img_node);
-       }
-}
-
 gchar *
 gkbd_configuration_create_label_title (int group, GHashTable ** ln2cnt_map,
                                       gchar * layout_name)
diff --git a/libgnomekbd/gkbd-configuration.h b/libgnomekbd/gkbd-configuration.h
index 1593f27..ffc7506 100644
--- a/libgnomekbd/gkbd-configuration.h
+++ b/libgnomekbd/gkbd-configuration.h
@@ -27,8 +27,7 @@
 #include <glib-object.h>
 
 #include <libxklavier/xklavier.h>
-
-#include <libgnomekbd/gkbd-indicator-config.h>
+#include <libgnomekbd/gkbd-keyboard-config.h>
 
 #define GKBD_TYPE_CONFIGURATION gkbd_configuration_get_type ()
 G_DECLARE_DERIVABLE_TYPE (GkbdConfiguration, gkbd_configuration, GKBD, CONFIGURATION, GObject)
@@ -48,16 +47,9 @@ gchar **gkbd_configuration_get_group_names (GkbdConfiguration *
 gchar **gkbd_configuration_get_short_group_names (GkbdConfiguration
                                                         * configuration);
 
-gchar *gkbd_configuration_get_image_filename (GkbdConfiguration *
-                                                    configuration,
-                                                    guint group);
-
 gchar *gkbd_configuration_get_current_tooltip (GkbdConfiguration *
                                                      configuration);
 
-gboolean gkbd_configuration_if_flags_shown (GkbdConfiguration *
-                                                  configuration);
-
 gchar *gkbd_configuration_extract_layout_name (GkbdConfiguration *
                                                      configuration,
                                                      int group);
@@ -81,10 +73,6 @@ void gkbd_configuration_start_listen (GkbdConfiguration *
 void gkbd_configuration_stop_listen (GkbdConfiguration *
                                            configuration);
 
-GkbdIndicatorConfig
-    * gkbd_configuration_get_indicator_config (GkbdConfiguration *
-                                              configuration);
-
 GkbdKeyboardConfig
     * gkbd_configuration_get_keyboard_config (GkbdConfiguration *
                                              configuration);
@@ -112,13 +100,6 @@ void gkbd_configuration_remove_object (GkbdConfiguration *
                } \
        }
 
-GSList *gkbd_configuration_load_images (GkbdConfiguration *
-                                              configuration);
-
-void gkbd_configuration_free_images (GkbdConfiguration *
-                                           configuration,
-                                           GSList * images);
-
 gchar *gkbd_configuration_create_label_title (int group,
                                                     GHashTable **
                                                     ln2cnt_map,
diff --git a/libgnomekbd/libgnomekbd.convert b/libgnomekbd/libgnomekbd.convert
index 991a8ae..894e712 100644
--- a/libgnomekbd/libgnomekbd.convert
+++ b/libgnomekbd/libgnomekbd.convert
@@ -11,14 +11,6 @@ y = /desktop/gnome/peripherals/keyboard/preview/y
 width = /desktop/gnome/peripherals/keyboard/preview/width
 height = /desktop/gnome/peripherals/keyboard/preview/heigh
 
-[org.gnome.libgnomekbd.indicator]
-secondary = /desktop/gnome/peripherals/keyboard/indicator/secondary
-show-flags = /desktop/gnome/peripherals/keyboard/indicator/showFlags
-font-family = /desktop/gnome/peripherals/keyboard/indicator/fontFamily
-font-size = /desktop/gnome/peripherals/keyboard/indicator/fontSize
-foreground-color = /desktop/gnome/peripherals/keyboard/indicator/foregroundColor
-background-color = /desktop/gnome/peripherals/keyboard/indicator/backgroundColor
-
 [org.gnome.libgnomekbd.keyboard]
 model = /desktop/gnome/peripherals/keyboard/kbd/model
 layouts = /desktop/gnome/peripherals/keyboard/kbd/layouts
diff --git a/libgnomekbd/meson.build b/libgnomekbd/meson.build
index ca65a89..1d14e88 100644
--- a/libgnomekbd/meson.build
+++ b/libgnomekbd/meson.build
@@ -83,26 +83,14 @@ libgnomekbd_dep = declare_dependency(
 
 libgnomekbdui_sources = files(
   'gkbd-configuration.c',
-  'gkbd-indicator-config.c',
-  'gkbd-indicator.c',
-  'gkbd-status.c',
   'gkbd-keyboard-drawing.c',
 )
 
 libgnomekbdui_headers = files(
   'gkbd-configuration.h',
-  'gkbd-indicator.h',
-  'gkbd-status.h',
-  'gkbd-indicator-config.h',
   'gkbd-keyboard-drawing.h',
 )
 
-gkbd_indicator_marshal = gnome.genmarshal(
-  'gkbd-indicator-marshal',
-  prefix: 'gkbd_indicator',
-  sources: 'gkbd-indicator-marshal.list',
-)
-
 gkbd_keyboard_drawing_marshal = gnome.genmarshal(
   'gkbd-keyboard-drawing-marshal',
   prefix: 'gkbd_keyboard_drawing',
@@ -119,7 +107,6 @@ libgnomekbdui_lib = library(
   'gnomekbdui',
   libgnomekbdui_sources,
   config_h,
-  gkbd_indicator_marshal,
   gkbd_keyboard_drawing_marshal,
   dependencies: libgnomekbdui_deps,
   include_directories: root_include,
@@ -143,7 +130,7 @@ libgnomekbdui_dep = declare_dependency(
   link_with: libgnomekbdui_lib,
   include_directories: root_include,
   dependencies: libgnomekbdui_deps,
-  sources: [config_h, gkbd_indicator_marshal, gkbd_keyboard_drawing_marshal],
+  sources: [config_h, gkbd_keyboard_drawing_marshal],
 )
 
 gkbd_keyboard_display_exe = executable(
@@ -197,7 +184,6 @@ if get_option('introspection')
       libgnomekbdui_sources,
       libgnomekbd_headers,
       libgnomekbdui_headers,
-      gkbd_indicator_marshal,
       gkbd_keyboard_drawing_marshal,
     ],
     dependencies: [ libgnomekbd_deps, m_dep ],
diff --git a/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in 
b/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in
index 870db8e..7dbaff5 100644
--- a/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in
+++ b/libgnomekbd/org.gnome.libgnomekbd.gschema.xml.in
@@ -2,7 +2,6 @@
 <schemalist>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.libgnomekbd" path="/org/gnome/libgnomekbd/">
     <child name="preview" schema="org.gnome.libgnomekbd.preview"/>
-    <child name="indicator" schema="org.gnome.libgnomekbd.indicator"/>
   </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.libgnomekbd.preview" 
path="/org/gnome/libgnomekbd/preview/">
     <key name="x" type="i">
@@ -30,38 +29,4 @@
       <description>The Keyboard Preview, height</description>
     </key>
   </schema>
-  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.libgnomekbd.indicator" 
path="/org/gnome/libgnomekbd/indicator/">
-    <key name="secondary" type="i">
-      <range min="0" max="15"/>
-      <default>0</default>
-      <summary>Secondary groups</summary>
-      <description>Secondary groups</description>
-    </key>
-    <key name="show-flags" type="b">
-      <default>false</default>
-      <summary>Show flags in the applet</summary>
-      <description>Show flags in the applet to indicate the current layout</description>
-    </key>
-    <key name="font-family" type="s">
-      <default>''</default>
-      <summary>The font family</summary>
-      <description>The font family for the layout indicator</description>
-    </key>
-    <key name="font-size" type="i">
-      <range min="1" max="65535"/>
-      <default>10</default>
-      <summary>The font size</summary>
-      <description>The font size for the layout indicator</description>
-    </key>
-    <key name="foreground-color" type="s">
-      <default>''</default>
-      <summary>The foreground color</summary>
-      <description>The foreground color for the layout indicator</description>
-    </key>
-    <key name="background-color" type="s">
-      <default>''</default>
-      <summary>The background color</summary>
-      <description>The background color for the layout indicator</description>
-    </key>
-  </schema>
 </schemalist>
diff --git a/test/meson.build b/test/meson.build
index 179c1cf..39bae00 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,17 +1,9 @@
-test_names = [
-  'gkbd-indicator-test',
+test_exec = executable(
   'gkbd-keyboard-drawing-test',
-  'gkbd-status-test',
-]
-
-foreach test_name : test_names
-  test_exec = executable(
-    test_name,
-    test_name + '.c',
-    dependencies: libgnomekbdui_dep,
-    c_args: [
-      '-DGNOMELOCALEDIR="@0@"'.format (get_option('prefix') / get_option('datadir') / 'locale'),
-    ],
-    build_by_default: true,
-  )
-endforeach
+  'gkbd-keyboard-drawing-test.c',
+  dependencies: libgnomekbdui_dep,
+  c_args: [
+    '-DGNOMELOCALEDIR="@0@"'.format (get_option('prefix') / get_option('datadir') / 'locale'),
+  ],
+  build_by_default: true,
+)


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