[gnome-settings-daemon] media-keys: Remove screencast key handling



commit f47dbce92a636406aa20636f83838ac079282c4e
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sun Dec 26 20:40:56 2021 +0300

    media-keys: Remove screencast key handling
    
    gnome-shell itself now handles the screencast key too.

 ...ttings-daemon.plugins.media-keys.gschema.xml.in |  16 ---
 plugins/media-keys/gsd-media-keys-manager.c        | 118 ---------------------
 plugins/media-keys/media-keys.h                    |   1 -
 plugins/media-keys/shortcuts-list.h                |   1 -
 4 files changed, 136 deletions(-)
---
diff --git a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in 
b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in
index 513bf9f3..ef5be625 100644
--- a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in
+++ b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in
@@ -96,11 +96,6 @@
       <summary>Microphone mute/unmute</summary>
       <description>Binding to mute/unmute the microphone.</description>
     </key>
-    <key name="screencast" type="s">
-      <default>'&lt;Ctrl&gt;&lt;Shift&gt;&lt;Alt&gt;R'</default>
-      <summary>Record a short video of the screen</summary>
-      <description>Binding to record a short video of the screen</description>
-    </key>
     <key name="www" type="s">
       <default>'XF86WWW'</default>
       <summary>Launch web browser</summary>
@@ -287,11 +282,6 @@
       <summary>Microphone mute/unmute</summary>
       <description>Binding to mute/unmute the microphone.</description>
     </key>
-    <key name="screencast" type="as">
-      <default>['&lt;Ctrl&gt;&lt;Shift&gt;&lt;Alt&gt;R']</default>
-      <summary>Record a short video of the screen</summary>
-      <description>Binding to record a short video of the screen</description>
-    </key>
     <key name="www" type="as">
       <default>['']</default>
       <summary>Launch web browser</summary>
@@ -680,12 +670,6 @@
       <summary>Bluetooth RF kill</summary>
       <description>Static binding to toggle bluetooth airplane mode.</description>
     </key>
-
-    <key name="max-screencast-length" type="u">
-      <default>30</default>
-      <summary>Maximum length of screen recordings</summary>
-      <description>The maximum length of single screen cast recordings in seconds or 0 for 
unlimited</description>
-    </key>
   </schema>
 
   <schema gettext-domain="@GETTEXT_PACKAGE@" 
id="org.gnome.settings-daemon.plugins.media-keys.custom-keybinding">
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index e03cc9f6..15e96e0e 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -198,12 +198,6 @@ typedef struct
         /* ScreenSaver stuff */
         GsdScreenSaver  *screen_saver_proxy;
 
-        /* Screencast stuff */
-        GDBusProxy      *screencast_proxy;
-        guint            screencast_timeout_id;
-        gboolean         screencast_recording;
-        GCancellable    *screencast_cancellable;
-
         /* Rotation */
         guint            iio_sensor_watch_id;
         gboolean         has_accel;
@@ -746,10 +740,6 @@ gsettings_changed_cb (GSettings           *settings,
         if (g_str_equal (settings_key, "custom-keybindings"))
                return;
 
-       /* not needed here */
-        if (g_str_equal (settings_key, "max-screencast-length"))
-               return;
-
         /* Find the key that was modified */
         if (priv->keys == NULL)
                 return;
@@ -2330,75 +2320,6 @@ do_rfkill_action (GsdMediaKeysManager *manager,
                  data->property, new_state ? "true" : "false");
 }
 
-static void
-screencast_stop (GsdMediaKeysManager *manager)
-{
-        GsdMediaKeysManagerPrivate *priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
-
-        if (priv->screencast_timeout_id > 0) {
-                g_source_remove (priv->screencast_timeout_id);
-                priv->screencast_timeout_id = 0;
-        }
-
-        g_dbus_proxy_call (priv->screencast_proxy,
-                           "StopScreencast", NULL,
-                           G_DBUS_CALL_FLAGS_NONE, -1,
-                           priv->screencast_cancellable,
-                           NULL, NULL);
-
-        priv->screencast_recording = FALSE;
-}
-
-static gboolean
-screencast_timeout (gpointer user_data)
-{
-        GsdMediaKeysManager *manager = user_data;
-        screencast_stop (manager);
-        return G_SOURCE_REMOVE;
-}
-
-static void
-screencast_start (GsdMediaKeysManager *manager)
-{
-        GsdMediaKeysManagerPrivate *priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
-        guint max_length;
-        g_dbus_proxy_call (priv->screencast_proxy,
-                           "Screencast",
-                           g_variant_new_parsed ("(%s, @a{sv} {})",
-                                                 /* Translators: this is a filename used for screencast
-                                                  * recording, where "%d" and "%t" date and time, e.g.
-                                                  * "Screencast from 07-17-2013 10:00:46 PM.webm" */
-                                                 /* xgettext:no-c-format */
-                                                 _("Screencast from %d %t.webm")),
-                           G_DBUS_CALL_FLAGS_NONE, -1,
-                           priv->screencast_cancellable,
-                           NULL, NULL);
-
-        max_length = g_settings_get_uint (priv->settings, "max-screencast-length");
-
-        if (max_length > 0) {
-                priv->screencast_timeout_id = g_timeout_add_seconds (max_length,
-                                                                     screencast_timeout,
-                                                                     manager);
-                g_source_set_name_by_id (priv->screencast_timeout_id, "[gnome-settings-daemon] 
screencast_timeout");
-        }
-        priv->screencast_recording = TRUE;
-}
-
-static void
-do_screencast_action (GsdMediaKeysManager *manager)
-{
-        GsdMediaKeysManagerPrivate *priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
-
-        if (priv->screencast_proxy == NULL)
-                return;
-
-        if (!priv->screencast_recording)
-                screencast_start (manager);
-        else
-                screencast_stop (manager);
-}
-
 static void
 do_custom_action (GsdMediaKeysManager *manager,
                   const gchar         *device_node,
@@ -2480,9 +2401,6 @@ do_action (GsdMediaKeysManager *manager,
         case HELP_KEY:
                 do_url_action (manager, "ghelp", timestamp);
                 break;
-        case SCREENCAST_KEY:
-                do_screencast_action (manager);
-                break;
         case WWW_KEY:
                 do_url_action (manager, "http", timestamp);
                 break;
@@ -2836,25 +2754,6 @@ initialize_volume_handler (GsdMediaKeysManager *manager)
         gnome_settings_profile_end ("gvc_mixer_control_new");
 }
 
-static void
-on_screencast_proxy_ready (GObject      *source,
-                           GAsyncResult *result,
-                           gpointer      data)
-{
-        GsdMediaKeysManager *manager = data;
-        GsdMediaKeysManagerPrivate *priv = GSD_MEDIA_KEYS_MANAGER_GET_PRIVATE (manager);
-        GError *error = NULL;
-
-        priv->screencast_proxy =
-                g_dbus_proxy_new_for_bus_finish (result, &error);
-
-        if (!priv->screencast_proxy) {
-                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                        g_warning ("Failed to create proxy for screencast: %s", error->message);
-                g_error_free (error);
-        }
-}
-
 static void
 on_key_grabber_ready (GObject      *source,
                       GAsyncResult *result,
@@ -2892,7 +2791,6 @@ shell_presence_changed (GsdMediaKeysManager *manager)
 
         g_ptr_array_set_size (priv->keys, 0);
         g_clear_object (&priv->key_grabber);
-        g_clear_object (&priv->screencast_proxy);
 
         if (name_owner) {
                 shell_key_grabber_proxy_new_for_bus (G_BUS_TYPE_SESSION,
@@ -2983,7 +2881,6 @@ start_media_keys_idle_cb (GsdMediaKeysManager *manager)
        priv->icon_theme = g_settings_get_string (priv->interface_settings, "icon-theme");
 
         priv->grab_cancellable = g_cancellable_new ();
-        priv->screencast_cancellable = g_cancellable_new ();
         priv->rfkill_cancellable = g_cancellable_new ();
 
         priv->shell_proxy = gnome_settings_bus_get_shell_proxy ();
@@ -2991,14 +2888,6 @@ start_media_keys_idle_cb (GsdMediaKeysManager *manager)
                                   G_CALLBACK (shell_presence_changed), manager);
         shell_presence_changed (manager);
 
-        g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
-                                  0, NULL,
-                                  SHELL_DBUS_NAME ".Screencast",
-                                  SHELL_DBUS_PATH "/Screencast",
-                                  SHELL_DBUS_NAME ".Screencast",
-                                  priv->screencast_cancellable,
-                                  on_screencast_proxy_ready, manager);
-
         priv->rfkill_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                                   "org.gnome.SettingsDaemon.Rfkill",
                                                   G_BUS_NAME_WATCHER_FLAGS_NONE,
@@ -3086,7 +2975,6 @@ migrate_keybinding_settings (void)
                 { "volume-mute",                "volume-mute",                  map_keybinding },
                 { "volume-up",                  "volume-up",                    map_keybinding },
                 { "mic-mute",                   "mic-mute",                     map_keybinding },
-                { "screencast",                 "screencast",                   map_keybinding },
                 { "www",                        "www",                          map_keybinding },
                 { "magnifier",                  "magnifier",                    map_keybinding },
                 { "screenreader",               "screenreader",                 map_keybinding },
@@ -3191,7 +3079,6 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
         g_clear_object (&priv->power_keyboard_proxy);
         g_clear_object (&priv->composite_device);
         g_clear_object (&priv->mpris_controller);
-        g_clear_object (&priv->screencast_proxy);
         g_clear_object (&priv->iio_sensor_proxy);
         g_clear_pointer (&priv->chassis_type, g_free);
         g_clear_object (&priv->connection);
@@ -3232,11 +3119,6 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
                 g_clear_object (&priv->grab_cancellable);
         }
 
-        if (priv->screencast_cancellable != NULL) {
-                g_cancellable_cancel (priv->screencast_cancellable);
-                g_clear_object (&priv->screencast_cancellable);
-        }
-
         if (priv->rfkill_cancellable != NULL) {
                 g_cancellable_cancel (priv->rfkill_cancellable);
                 g_clear_object (&priv->rfkill_cancellable);
diff --git a/plugins/media-keys/media-keys.h b/plugins/media-keys/media-keys.h
index f642d8fc..801a13be 100644
--- a/plugins/media-keys/media-keys.h
+++ b/plugins/media-keys/media-keys.h
@@ -42,7 +42,6 @@ typedef enum {
         CONTROL_CENTER_KEY,
         SCREENSAVER_KEY,
         HELP_KEY,
-        SCREENCAST_KEY,
         WWW_KEY,
         PLAY_KEY,
         PAUSE_KEY,
diff --git a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h
index 9d994254..c8f084c8 100644
--- a/plugins/media-keys/shortcuts-list.h
+++ b/plugins/media-keys/shortcuts-list.h
@@ -64,7 +64,6 @@ static struct {
         { CONTROL_CENTER_KEY, "control-center", TRUE, GSD_ACTION_MODE_LAUNCHER, 
META_KEY_BINDING_IGNORE_AUTOREPEAT },
         { SCREENSAVER_KEY, "screensaver", TRUE, SCREENSAVER_MODE, META_KEY_BINDING_IGNORE_AUTOREPEAT },
         { HELP_KEY, "help", FALSE, GSD_ACTION_MODE_LAUNCHER, META_KEY_BINDING_IGNORE_AUTOREPEAT },
-        { SCREENCAST_KEY, "screencast", FALSE, NO_LOCK_MODE, META_KEY_BINDING_IGNORE_AUTOREPEAT },
         { WWW_KEY, "www", TRUE, GSD_ACTION_MODE_LAUNCHER, META_KEY_BINDING_IGNORE_AUTOREPEAT },
         { PLAY_KEY, "play", TRUE, SHELL_ACTION_MODE_ALL, META_KEY_BINDING_IGNORE_AUTOREPEAT },
         { PAUSE_KEY, "pause", TRUE, SHELL_ACTION_MODE_ALL, META_KEY_BINDING_IGNORE_AUTOREPEAT },


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