[gnome-notes/111-auto-reveal-of-formatting-bar-gets-annoying] editor-toolbar: Make it always visible



commit 4f54fd2f494592d1a8b650de46567cc97e962fb5
Author: Isaque Galdino <igaldino gmail com>
Date:   Thu Oct 25 00:33:01 2018 -0300

    editor-toolbar: Make it always visible

 data/resources/editor-toolbar.ui |  3 ---
 src/bjb-editor-toolbar.c         | 26 +-------------------------
 src/bjb-note-view.c              |  1 -
 3 files changed, 1 insertion(+), 29 deletions(-)
---
diff --git a/data/resources/editor-toolbar.ui b/data/resources/editor-toolbar.ui
index 694b98a..d1b4a8d 100644
--- a/data/resources/editor-toolbar.ui
+++ b/data/resources/editor-toolbar.ui
@@ -27,9 +27,6 @@
   <template class="BjbEditorToolbar" parent="GtkActionBar">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <style>
-      <class name="osd" />
-    </style>
     <child>
       <object class="GtkButtonBox">
         <property name="visible">True</property>
diff --git a/src/bjb-editor-toolbar.c b/src/bjb-editor-toolbar.c
index c859f66..ffe524b 100644
--- a/src/bjb-editor-toolbar.c
+++ b/src/bjb-editor-toolbar.c
@@ -56,24 +56,11 @@ struct _BjbEditorToolbar
 
 G_DEFINE_TYPE (BjbEditorToolbar, bjb_editor_toolbar, GTK_TYPE_ACTION_BAR)
 
-static gboolean
-on_release_event (GtkWidget        *widget,
-                  GdkEvent         *event,
-                  BjbEditorToolbar *self)
-{
-  gtk_widget_set_visible (GTK_WIDGET (self),
-                          biji_note_obj_editor_has_selection (self->note));
-
-  return FALSE;
-}
-
 static void
 on_cut_clicked (GtkButton        *button,
                 BjbEditorToolbar *self)
 {
   biji_note_obj_editor_cut (self->note);
-
-  gtk_widget_hide (GTK_WIDGET (self));
 }
 
 static void
@@ -88,8 +75,6 @@ on_paste_clicked (GtkButton        *button,
                   BjbEditorToolbar *self)
 {
   biji_note_obj_editor_paste (self->note);
-
-  gtk_widget_hide (GTK_WIDGET (self));
 }
 
 static void
@@ -140,7 +125,7 @@ on_link_clicked (GtkButton        *button,
 
   link = biji_note_obj_editor_get_selection (self->note);
 
-  if (link == NULL)
+  if (link == NULL || strlen (link) == 0)
     return;
 
   window = bjb_note_view_get_base_window (self->view);
@@ -198,7 +183,6 @@ static void
 bjb_editor_toolbar_constructed (GObject *object)
 {
   BjbEditorToolbar *self;
-  GtkWidget        *view;
   GtkWidget        *window;
   gboolean          can_format;
 
@@ -218,14 +202,6 @@ bjb_editor_toolbar_constructed (GObject *object)
   gtk_widget_add_accelerator (self->strike_button, "clicked", self->accel,
                               GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
 
-  view = biji_note_obj_get_editor (self->note);
-
-  g_signal_connect (view,"button-release-event",
-                    G_CALLBACK (on_release_event), self);
-
-  g_signal_connect (view,"key-release-event",
-                   G_CALLBACK (on_release_event), self);
-
   can_format = biji_note_obj_can_format (self->note);
 
   gtk_widget_set_sensitive (self->bold_button, can_format);
diff --git a/src/bjb-note-view.c b/src/bjb-note-view.c
index 1293a8d..7c4f35c 100644
--- a/src/bjb-note-view.c
+++ b/src/bjb-note-view.c
@@ -233,7 +233,6 @@ bjb_note_view_constructed (GObject *obj)
   /* Edition Toolbar for text selection */
   self->edit_bar = bjb_editor_toolbar_new (self, self->note);
   gtk_box_pack_start (GTK_BOX (self->box), self->edit_bar, FALSE, TRUE, 0);
-  gtk_widget_hide (self->edit_bar);
 }
 
 BjbNoteView *


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