[gnome-builder/wip/cosimoc/flatpak-greeter: 9/9] greeter: don't add a toolbar button for addins with no title



commit 2634657644e7d64ea54f97ec67e7ce5db33ca139
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Dec 17 00:42:47 2016 -0800

    greeter: don't add a toolbar button for addins with no title
    
    It does not make sense to show it when there's no label.

 libide/greeter/ide-greeter-perspective.c |   34 +++++++++++++++--------------
 1 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/libide/greeter/ide-greeter-perspective.c b/libide/greeter/ide-greeter-perspective.c
index 418c3b9..8ea47dc 100644
--- a/libide/greeter/ide-greeter-perspective.c
+++ b/libide/greeter/ide-greeter-perspective.c
@@ -801,23 +801,25 @@ ide_greeter_perspective_genesis_added (PeasExtensionSet *set,
   g_assert (IDE_IS_GENESIS_ADDIN (addin));
   g_assert (IDE_IS_GREETER_PERSPECTIVE (self));
 
-  priority = ide_genesis_addin_get_priority (addin);
   title = ide_genesis_addin_get_label (addin);
-
-  button = g_object_new (GTK_TYPE_BUTTON,
-                         "name", G_OBJECT_TYPE_NAME (addin),
-                         "label", title,
-                         "visible", TRUE,
-                         NULL);
-  g_signal_connect_object (button,
-                           "clicked",
-                           G_CALLBACK (genesis_button_clicked),
-                           self,
-                           G_CONNECT_SWAPPED);
-  gtk_container_add_with_properties (GTK_CONTAINER (self->genesis_buttons), GTK_WIDGET (button),
-                                     "pack-type", GTK_PACK_START,
-                                     "priority", priority,
-                                     NULL);
+  if (title != NULL)
+    {
+      priority = ide_genesis_addin_get_priority (addin);
+      button = g_object_new (GTK_TYPE_BUTTON,
+                             "name", G_OBJECT_TYPE_NAME (addin),
+                             "label", title,
+                             "visible", TRUE,
+                             NULL);
+      g_signal_connect_object (button,
+                               "clicked",
+                               G_CALLBACK (genesis_button_clicked),
+                               self,
+                               G_CONNECT_SWAPPED);
+      gtk_container_add_with_properties (GTK_CONTAINER (self->genesis_buttons), GTK_WIDGET (button),
+                                         "pack-type", GTK_PACK_START,
+                                         "priority", priority,
+                                         NULL);
+    }
 
   child = ide_genesis_addin_get_widget (addin);
   gtk_container_add_with_properties (GTK_CONTAINER (self->genesis_stack), child,


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