aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGrégoire Jadi2013-07-16 19:39:20 +0200
committerGrégoire Jadi2013-07-16 19:39:20 +0200
commitb849935e98818a36b2561332514b1f7b6ea356bd (patch)
treeb867bcae0e2a44d4402d778219cdda374fd3a9cc /src
parent53e29768677204cca7eeb012aa70740b14e1162b (diff)
downloademacs-b849935e98818a36b2561332514b1f7b6ea356bd.tar.gz
emacs-b849935e98818a36b2561332514b1f7b6ea356bd.zip
* src/xwidget.c: Add a `query-on-exit' flag to determine whether we can
kill xwidget when the buffer is killed without confirmation. (Fset_xwidget_query_on_exit_flag): New function to set the `query-on-exit' flag. (Fxwidget_query_on_exit_flag): New function to retrieve the value of the `query-on-exit' flag. (Fmake_xwidget): Set the `query-on-exit' flag to t by default. * src/xwidget.h (xwidget): Add new field `kill_without_query'. * lisp/xwidget.el (xwidget-kill-buffer-query-function): Ask for confirmation before killing the buffer if a xwidget is present only if its `query-on-exit' flag is enabled.
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c27
-rw-r--r--src/xwidget.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index 7834e5b0bea..9a039d9a745 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -209,6 +209,7 @@ TYPE is a symbol which can take one of the following values:
209 209
210 xw->height = XFASTINT(height); 210 xw->height = XFASTINT(height);
211 xw->width = XFASTINT(width); 211 xw->width = XFASTINT(width);
212 xw->kill_without_query = 1;
212 XSETXWIDGET (val, xw); // set the vectorlike_header of VAL with the correct value 213 XSETXWIDGET (val, xw); // set the vectorlike_header of VAL with the correct value
213 Vxwidget_list = Fcons (val, Vxwidget_list); 214 Vxwidget_list = Fcons (val, Vxwidget_list);
214 xw->widgetwindow_osr = NULL; 215 xw->widgetwindow_osr = NULL;
@@ -1598,6 +1599,30 @@ DEFUN ("set-xwidget-plist", Fset_xwidget_plist, Sset_xwidget_plist,
1598 return plist; 1599 return plist;
1599} 1600}
1600 1601
1602DEFUN ("set-xwidget-query-on-exit-flag",
1603 Fset_xwidget_query_on_exit_flag, Sset_xwidget_query_on_exit_flag,
1604 2, 2, 0,
1605 doc: /* Specify if query is needed for XWIDGET when Emacs is
1606exited. If the second argument FLAG is non-nil, Emacs will query the
1607user before exiting or killing a buffer if XWIDGET is running. This
1608function returns FLAG. */)
1609 (Lisp_Object xwidget, Lisp_Object flag)
1610{
1611 CHECK_XWIDGET (xwidget);
1612 XXWIDGET (xwidget)->kill_without_query = NILP (flag);
1613 return flag;
1614}
1615
1616DEFUN ("xwidget-query-on-exit-flag",
1617 Fxwidget_query_on_exit_flag, Sxwidget_query_on_exit_flag,
1618 1, 1, 0,
1619 doc: /* Return the current value of query-on-exit flag for XWIDGET. */)
1620 (Lisp_Object xwidget)
1621{
1622 CHECK_XWIDGET (xwidget);
1623 return (XXWIDGET (xwidget)->kill_without_query ? Qnil : Qt);
1624}
1625
1601void 1626void
1602syms_of_xwidget (void) 1627syms_of_xwidget (void)
1603{ 1628{
@@ -1615,6 +1640,8 @@ syms_of_xwidget (void)
1615 defsubr (&Sxwidget_view_model); 1640 defsubr (&Sxwidget_view_model);
1616 defsubr (&Sxwidget_view_window); 1641 defsubr (&Sxwidget_view_window);
1617 defsubr (&Sxwidget_view_lookup); 1642 defsubr (&Sxwidget_view_lookup);
1643 defsubr (&Sxwidget_query_on_exit_flag);
1644 defsubr (&Sset_xwidget_query_on_exit_flag);
1618 1645
1619#ifdef HAVE_WEBKIT_OSR 1646#ifdef HAVE_WEBKIT_OSR
1620 defsubr (&Sxwidget_webkit_goto_uri); 1647 defsubr (&Sxwidget_webkit_goto_uri);
diff --git a/src/xwidget.h b/src/xwidget.h
index 01be2b29281..1495c5bef5a 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -34,6 +34,8 @@ struct xwidget{
34 //for offscreen widgets, unused if not osr 34 //for offscreen widgets, unused if not osr
35 GtkWidget* widget_osr; 35 GtkWidget* widget_osr;
36 GtkContainer* widgetwindow_osr; 36 GtkContainer* widgetwindow_osr;
37 /* Non-nil means kill silently if Emacs is exited. */
38 unsigned int kill_without_query : 1;
37 39
38 //TODO these are WIP 40 //TODO these are WIP
39 41