[gnome-builder] actions: trigger opacity with command bar



commit cf72e61c0e0a8a0de07175d72a29adc5b74e7f2b
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jan 16 14:15:36 2016 -0800

    actions: trigger opacity with command bar
    
    Apparently setting your editor opacity is a thing[1]. I'm mostly being
    funny with this commit. I'll probably revert it after I've had a good
    laugh.
    
     # in the command bar
     > opacity 50
    
    [1] https://github.com/transcranial/atom-transparency

 libide/ide-workbench-actions.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-workbench-actions.c b/libide/ide-workbench-actions.c
index 1c75da4..26cd76d 100644
--- a/libide/ide-workbench-actions.c
+++ b/libide/ide-workbench-actions.c
@@ -159,11 +159,27 @@ ide_workbench_actions_save_all_quit (GSimpleAction *action,
                                      g_object_ref (workbench));
 }
 
+static void
+ide_workbench_actions_opacity (GSimpleAction *action,
+                               GVariant      *variant,
+                               gpointer       user_data)
+{
+  IdeWorkbench *workbench = user_data;
+  gdouble opacity;
+
+  g_assert (IDE_IS_WORKBENCH (workbench));
+  g_assert (g_variant_is_of_type (variant, G_VARIANT_TYPE_INT32));
+
+  opacity = CLAMP (g_variant_get_int32 (variant), 10, 100) / 100.0;
+  gtk_widget_set_opacity (GTK_WIDGET (workbench), opacity);
+}
+
 void
 ide_workbench_actions_init (IdeWorkbench *self)
 {
   GPropertyAction *action;
   const GActionEntry actions[] = {
+    { "opacity", NULL, "i", "100", ide_workbench_actions_opacity },
     { "open-with-dialog", ide_workbench_actions_open_with_dialog },
     { "save-all", ide_workbench_actions_save_all },
     { "save-all-quit", ide_workbench_actions_save_all_quit },


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