[gnome-builder] buildlog: add clear and stop buttons for build log



commit 20a26408e6e9b143ebd487d01f7d7e250fc55a74
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 1 14:55:27 2017 -0800

    buildlog: add clear and stop buttons for build log
    
    This allows you to either stop the build (duplicate of the top bar) or
    clear the build log from the build log panel. We might also consider adding
    a save action here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779425

 libide/buildui/ide-build-log-panel.c  |   22 +++++++++++++
 libide/buildui/ide-build-log-panel.ui |   54 +++++++++++++++++++++++++++++++-
 po/POTFILES.in                        |    1 +
 3 files changed, 75 insertions(+), 2 deletions(-)
---
diff --git a/libide/buildui/ide-build-log-panel.c b/libide/buildui/ide-build-log-panel.c
index 5817c59..82fd542 100644
--- a/libide/buildui/ide-build-log-panel.c
+++ b/libide/buildui/ide-build-log-panel.c
@@ -705,8 +705,26 @@ ide_build_log_panel_class_init (IdeBuildLogPanelClass *klass)
 }
 
 static void
+ide_build_log_panel_clear_activate (GSimpleAction *action,
+                                    GVariant      *param,
+                                    gpointer       user_data)
+{
+  IdeBuildLogPanel *self = user_data;
+
+  g_assert (G_IS_SIMPLE_ACTION (action));
+  g_assert (IDE_IS_BUILD_LOG_PANEL (self));
+
+  gtk_text_buffer_set_text (self->buffer, "", 0);
+}
+
+static void
 ide_build_log_panel_init (IdeBuildLogPanel *self)
 {
+  static GActionEntry entries[] = {
+    { "clear", ide_build_log_panel_clear_activate },
+  };
+  g_autoptr(GSimpleActionGroup) actions = NULL;
+
   self->css = gtk_css_provider_new ();
 
   gtk_widget_init_template (GTK_WIDGET (self));
@@ -722,4 +740,8 @@ ide_build_log_panel_init (IdeBuildLogPanel *self)
                            self,
                            G_CONNECT_SWAPPED);
   ide_build_log_panel_changed_font_name (self, "font-name", self->settings);
+
+  actions = g_simple_action_group_new ();
+  g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), self);
+  gtk_widget_insert_action_group (GTK_WIDGET (self), "build-log", G_ACTION_GROUP (actions));
 }
diff --git a/libide/buildui/ide-build-log-panel.ui b/libide/buildui/ide-build-log-panel.ui
index 93a1463..4bba28d 100644
--- a/libide/buildui/ide-build-log-panel.ui
+++ b/libide/buildui/ide-build-log-panel.ui
@@ -1,9 +1,59 @@
 <interface>
   <template class="IdeBuildLogPanel" parent="PnlDockWidget">
     <child>
-      <object class="GtkScrolledWindow" id="scroller">
-        <property name="expand">true</property>
+      <object class="GtkBox">
+        <property name="orientation">horizontal</property>
         <property name="visible">true</property>
+        <child>
+          <object class="GtkScrolledWindow" id="scroller">
+            <property name="expand">true</property>
+            <property name="visible">true</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="border-width">2</property>
+            <property name="hexpand">false</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">2</property>
+            <property name="vexpand">true</property>
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkButton" id="clear_button">
+                <property name="action-name">build-log.clear</property>
+                <property name="expand">false</property>
+                <property name="tooltip-text" translatable="yes">Clear build log</property>
+                <property name="visible">true</property>
+                <style>
+                  <class name="flat"/>
+                </style>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">edit-clear-all-symbolic</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="stop_button">
+                <property name="action-name">build-manager.cancel</property>
+                <property name="expand">false</property>
+                <property name="tooltip-text" translatable="yes">Cancel build</property>
+                <property name="visible">true</property>
+                <style>
+                  <class name="flat"/>
+                </style>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">process-stop-symbolic</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
       </object>
     </child>
   </template>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index daf2f21..5ea312c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -48,6 +48,7 @@ libide/buildsystem/ide-configuration-manager.c
 libide/buildui/ide-build-configuration-row.ui
 libide/buildui/ide-build-configuration-view.ui
 libide/buildui/ide-build-log-panel.c
+libide/buildui/ide-build-log-panel.ui
 libide/buildui/ide-build-panel.c
 libide/buildui/ide-build-panel.ui
 libide/buildui/ide-build-perspective.c


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