[gnome-flashback] shell: add monitor labeler (not implemented yet)



commit 7f64b5440950121d02e67d8d5093207890f2809a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Mar 27 07:06:35 2015 +0200

    shell: add monitor labeler (not implemented yet)

 gnome-flashback/libshell/Makefile.am               |    2 +
 .../libshell/flashback-monitor-labeler.c           |   57 ++++++++++++++++++++
 .../libshell/flashback-monitor-labeler.h           |   39 +++++++++++++
 gnome-flashback/libshell/flashback-shell.c         |   40 +++++++++++---
 4 files changed, 130 insertions(+), 8 deletions(-)
---
diff --git a/gnome-flashback/libshell/Makefile.am b/gnome-flashback/libshell/Makefile.am
index 90d2408..ff4daf2 100644
--- a/gnome-flashback/libshell/Makefile.am
+++ b/gnome-flashback/libshell/Makefile.am
@@ -10,6 +10,8 @@ libshell_la_SOURCES = \
        flashback-dbus-shell.h \
        flashback-key-bindings.c \
        flashback-key-bindings.h \
+       flashback-monitor-labeler.c \
+       flashback-monitor-labeler.h \
        flashback-shell.c \
        flashback-shell.h
 
diff --git a/gnome-flashback/libshell/flashback-monitor-labeler.c 
b/gnome-flashback/libshell/flashback-monitor-labeler.c
new file mode 100644
index 0000000..14902aa
--- /dev/null
+++ b/gnome-flashback/libshell/flashback-monitor-labeler.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2015 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include "flashback-monitor-labeler.h"
+
+struct _FlashbackMonitorLabeler
+{
+  GObject parent;
+};
+
+G_DEFINE_TYPE (FlashbackMonitorLabeler, flashback_monitor_labeler, G_TYPE_OBJECT)
+
+static void
+flashback_monitor_labeler_class_init (FlashbackMonitorLabelerClass *labeler_class)
+{
+}
+
+static void
+flashback_monitor_labeler_init (FlashbackMonitorLabeler *labeler)
+{
+}
+
+FlashbackMonitorLabeler *
+flashback_monitor_labeler_new (void)
+{
+  return g_object_new (FLASHBACK_TYPE_MONITOR_LABELER, NULL);
+}
+
+void
+flashback_monitor_labeler_show (FlashbackMonitorLabeler *labeler,
+                                const gchar             *sender,
+                                GVariant                *params)
+{
+  g_warning ("shell: show monitor labels");
+}
+
+void
+flashback_monitor_labeler_hide (FlashbackMonitorLabeler *labeler,
+                                const gchar             *sender)
+{
+  g_warning ("shell: hide monitor labels");
+}
diff --git a/gnome-flashback/libshell/flashback-monitor-labeler.h 
b/gnome-flashback/libshell/flashback-monitor-labeler.h
new file mode 100644
index 0000000..b8bb613
--- /dev/null
+++ b/gnome-flashback/libshell/flashback-monitor-labeler.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FLASHBACK_MONITOR_LABELER_H
+#define FLASHBACK_MONITOR_LABELER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define FLASHBACK_TYPE_MONITOR_LABELER flashback_monitor_labeler_get_type ()
+G_DECLARE_FINAL_TYPE (FlashbackMonitorLabeler, flashback_monitor_labeler,
+                      FLASHBACK, MONITOR_LABELER, GObject)
+
+FlashbackMonitorLabeler *flashback_monitor_labeler_new  (void);
+
+void                     flashback_monitor_labeler_show (FlashbackMonitorLabeler *labeler,
+                                                         const gchar             *sender,
+                                                         GVariant                *params);
+void                     flashback_monitor_labeler_hide (FlashbackMonitorLabeler *labeler,
+                                                         const gchar             *sender);
+
+G_END_DECLS
+
+#endif
diff --git a/gnome-flashback/libshell/flashback-shell.c b/gnome-flashback/libshell/flashback-shell.c
index f419aa5..21519cf 100644
--- a/gnome-flashback/libshell/flashback-shell.c
+++ b/gnome-flashback/libshell/flashback-shell.c
@@ -19,6 +19,7 @@
 #include <gtk/gtk.h>
 #include "flashback-dbus-shell.h"
 #include "flashback-key-bindings.h"
+#include "flashback-monitor-labeler.h"
 #include "flashback-shell.h"
 
 #define SHELL_DBUS_NAME "org.gnome.Shell"
@@ -32,14 +33,18 @@ typedef struct
 
 struct _FlashbackShell
 {
-  GObject                 parent;
+  GObject                  parent;
 
-  gint                    bus_name;
-  GDBusInterfaceSkeleton *iface;
+  gint                     bus_name;
+  GDBusInterfaceSkeleton  *iface;
 
-  FlashbackKeyBindings   *bindings;
-  GHashTable             *grabbed_accelerators;
-  GHashTable             *grabbers;
+  /* key-grabber */
+  FlashbackKeyBindings    *bindings;
+  GHashTable              *grabbed_accelerators;
+  GHashTable              *grabbers;
+
+  /* monitor labeler */
+  FlashbackMonitorLabeler *labeler;
 };
 
 G_DEFINE_TYPE (FlashbackShell, flashback_shell, G_TYPE_OBJECT)
@@ -182,16 +187,32 @@ handle_show_monitor_labels (FlashbackDBusShell    *dbus_shell,
                             GVariant              *params,
                             gpointer               user_data)
 {
+  FlashbackShell *shell;
+  const gchar *sender;
+
+  shell = FLASHBACK_SHELL (user_data);
+  sender = g_dbus_method_invocation_get_sender (invocation);
+
+  flashback_monitor_labeler_show (shell->labeler, params, sender);
+
   flashback_dbus_shell_complete_show_monitor_labels (dbus_shell, invocation);
 
   return TRUE;
 }
 
 static gboolean
-handle_hide_minitor_labels (FlashbackDBusShell    *dbus_shell,
+handle_hide_monitor_labels (FlashbackDBusShell    *dbus_shell,
                             GDBusMethodInvocation *invocation,
                             gpointer               user_data)
 {
+  FlashbackShell *shell;
+  const gchar *sender;
+
+  shell = FLASHBACK_SHELL (user_data);
+  sender = g_dbus_method_invocation_get_sender (invocation);
+
+  flashback_monitor_labeler_hide (shell->labeler, sender);
+
   flashback_dbus_shell_complete_hide_monitor_labels (dbus_shell, invocation);
 
   return TRUE;
@@ -328,7 +349,7 @@ name_appeared_handler (GDBusConnection *connection,
   g_signal_connect (skeleton, "handle-show-monitor-labels",
                     G_CALLBACK (handle_show_monitor_labels), shell);
   g_signal_connect (skeleton, "handle-hide-monitor-labels",
-                    G_CALLBACK (handle_hide_minitor_labels), shell);
+                    G_CALLBACK (handle_hide_monitor_labels), shell);
   g_signal_connect (skeleton, "handle-focus-app",
                     G_CALLBACK (handle_focus_app), shell);
   g_signal_connect (skeleton, "handle-show-applications",
@@ -383,6 +404,7 @@ flashback_shell_finalize (GObject *object)
     }
 
   g_clear_object (&shell->bindings);
+  g_clear_object (&shell->labeler);
 
   G_OBJECT_CLASS (flashback_shell_parent_class)->finalize (object);
 }
@@ -407,6 +429,8 @@ flashback_shell_init (FlashbackShell *shell)
   g_signal_connect (shell->bindings, "binding-activated",
                     G_CALLBACK (binding_activated), shell);
 
+  shell->labeler = flashback_monitor_labeler_new ();
+
   shell->bus_name = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                       SHELL_DBUS_NAME,
                                       G_BUS_NAME_WATCHER_FLAGS_NONE,


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