[bijiben] noteMenu: add detach if the note is not already



commit 82bb76d7fcd54b04e16a856359a4fbb15ece2205
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Fri Jan 24 21:59:20 2014 +0100

    noteMenu: add detach if the note is not already
    
    Main window, while note view, can detach the note to another win.

 src/bjb-main-toolbar.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 85b0a29..5febb4a 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -702,16 +702,43 @@ trash_item_callback (GtkWidget *item, gpointer user_data)
 }
 
 
+static void
+on_detached_clicked_cb (BjbMainToolbar *self)
+{
+  BijiNoteObj *note;
+
+  note = bjb_window_base_get_note (BJB_WINDOW_BASE (self->priv->window));
+  bjb_window_base_switch_to (BJB_WINDOW_BASE (self->priv->window),
+                             BJB_WINDOW_BASE_MAIN_VIEW);
+  bijiben_new_window_for_note (g_application_get_default (), note);
+}
+
+
 GtkWidget *
 bjb_note_menu_new (BjbMainToolbar *self)
 {
   BjbMainToolbarPrivate *priv = self->priv;
   GtkWidget             *result, *item;
   BijiWebkitEditor      *editor;
+  gboolean               detached;
 
   result = gtk_menu_new();
   editor = BIJI_WEBKIT_EDITOR (biji_note_obj_get_editor (priv->note));
 
+  /* Detach and separator */
+  detached = bjb_window_base_is_detached (BJB_WINDOW_BASE (self->priv->window));
+  if (detached == FALSE)
+  {
+    item = gtk_menu_item_new_with_label (_("Open in another window"));
+    gtk_menu_shell_append (GTK_MENU_SHELL (result), item);
+    g_signal_connect_swapped (item, "activate",
+                              G_CALLBACK (on_detached_clicked_cb), self);
+
+
+    item = gtk_separator_menu_item_new ();
+    gtk_menu_shell_append (GTK_MENU_SHELL (result), item);
+  }
+
   /* Undo Redo separator */
   item = gtk_menu_item_new_with_label (_("Undo"));
   gtk_menu_shell_append (GTK_MENU_SHELL (result), item);


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