"/ui/MenuBar/FileMenu/FileClose",
"/ui/MenuBar/EditMenu/EditCut",
"/ui/MenuBar/EditMenu/EditCopy",
- "/ui/MenuBar/EditMenu/EditPaste",
"/ui/MenuBar/EditMenu/EditDelete",
"/ui/MenuBar/EditMenu/EditSelectAll",
"/ui/MenuBar/EditMenu/EditUnSelectAll",
NULL
};
+static gchar* paste_verbs [] = {
+ "/ui/MenuBar/EditMenu/EditPaste",
+
+ NULL
+};
+
static gchar* selection_verbs [] = {
"/ui/MenuBar/EditMenu/EditCut",
"/ui/MenuBar/EditMenu/EditCopy",
gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
+ gl_ui_util_set_verb_list_sensitive (ui, paste_verbs, FALSE);
gl_debug (DEBUG_UI, "END");
!gl_view_is_zoom_min (view));
gl_ui_util_set_verb_list_sensitive (ui, selection_verbs,
- !gl_label_is_selection_empty (view->label));
+ !gl_label_is_selection_empty (label));
gl_ui_util_set_verb_list_sensitive (ui, atomic_selection_verbs,
- gl_label_is_selection_atomic (view->label));
+ gl_label_is_selection_atomic (label));
gl_ui_util_set_verb_list_sensitive (ui, multi_selection_verbs,
- !gl_label_is_selection_empty (view->label)
- && !gl_label_is_selection_atomic (view->label));
-
- gl_debug (DEBUG_UI, "END");
-}
-
-
-/*****************************************************************************/
-/** Update all verbs of given UI component to "no document" state. */
-/*****************************************************************************/
-void
-gl_ui_update_nodoc (GtkUIManager *ui)
-{
- gl_debug (DEBUG_UI, "START");
-
- gl_ui_util_set_verb_list_sensitive (ui, doc_verbs, FALSE);
+ !gl_label_is_selection_empty (label)
+ && !gl_label_is_selection_atomic (label));
gl_debug (DEBUG_UI, "END");
}
}
+/*****************************************************************************/
+/** Update paste verbs of given UI component. */
+/*****************************************************************************/
+void
+gl_ui_update_paste_verbs (GtkUIManager *ui,
+ gboolean can_paste)
+{
+ gl_debug (DEBUG_UI, "START");
+
+ gl_ui_util_set_verb_list_sensitive (ui, paste_verbs, can_paste);
+
+ gl_debug (DEBUG_UI, "END");
+}
+
+
/*****************************************************************************/
/** Update undo/redo verbs of given UI component. */
/*****************************************************************************/
#define CURSOR_INFO_WIDTH 150
#define ZOOM_INFO_WIDTH 50
+#define GLABELS_CLIPBOARD gdk_atom_intern ("GLABELS", FALSE)
+
/*===========================================================================*/
/* Private globals */
static void modified_changed_cb (glLabel *label,
glWindow *window);
+static void clipboard_changed_cb (GtkClipboard *clipboard,
+ GdkEvent *event,
+ glWindow *window);
+
/****************************************************************************/
/* Boilerplate Object stuff. */
gl_window_set_label (glWindow *window,
glLabel *label)
{
- gchar *string;
+ gchar *string;
+ GtkClipboard *clipboard;
gl_debug (DEBUG_WINDOW, "START");
gtk_label_set_text (GTK_LABEL(window->zoom_info), string);
g_free (string);
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GLABELS_CLIPBOARD);
+ gl_ui_update_paste_verbs (window->ui,
+ gtk_clipboard_wait_is_text_available (clipboard));
+
+
g_signal_connect (G_OBJECT(window->label), "selection_changed",
G_CALLBACK(selection_changed_cb), window);
g_signal_connect (G_OBJECT(label), "modified_changed",
G_CALLBACK(modified_changed_cb), window);
+ g_signal_connect (G_OBJECT(clipboard), "owner_change",
+ G_CALLBACK(clipboard_changed_cb), window);
+
gl_debug (DEBUG_WINDOW, "END");
}
}
+static void
+clipboard_changed_cb (GtkClipboard *clipboard,
+ GdkEvent *event,
+ glWindow *window)
+{
+ gl_debug (DEBUG_WINDOW, "START");
+
+ g_return_if_fail (window && GL_IS_WINDOW (window));
+
+ gl_ui_update_paste_verbs (window->ui,
+ gtk_clipboard_wait_is_text_available (clipboard));
+
+ gl_debug (DEBUG_WINDOW, "END");
+}
+
+
/*
* Local Variables: -- emacs