aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-01-11 21:57:19 -0800
committerPaul Eggert2011-01-11 21:57:19 -0800
commit7ea547574105f338c900d0c59390287c750a18c0 (patch)
treeebe2282d83447c9ecf34177320a2915e2201271d /src
parente8c53d3abf2f23dc40ed2bc748678025d5b5a5bc (diff)
parent529ee9edf2fd51f3e53f1fc4f7a9ba1859b0af99 (diff)
downloademacs-7ea547574105f338c900d0c59390287c750a18c0.tar.gz
emacs-7ea547574105f338c900d0c59390287c750a18c0.zip
Merge from mainline.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog42
-rw-r--r--src/dbusbind.c164
-rw-r--r--src/fns.c11
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/image.c11
5 files changed, 203 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 353f9c2d64a..b68c375b4a6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12011-01-09 Paul Eggert <eggert@cs.ucla.edu> 12011-01-11 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Give a name FLOAT_TO_STRING_BUFSIZE to the constant 350. 3 Give a name FLOAT_TO_STRING_BUFSIZE to the constant 350.
4 * lisp.h (FLOAT_TO_STRING_BUFSIZE): New macro. 4 * lisp.h (FLOAT_TO_STRING_BUFSIZE): New macro.
@@ -27,14 +27,50 @@
27 (float_to_string): Use dtoastr rather than rolling our own code, 27 (float_to_string): Use dtoastr rather than rolling our own code,
28 which had an off-by-one bug on non-IEEE hosts. 28 which had an off-by-one bug on non-IEEE hosts.
29 29
302011-01-08 Paul Eggert <eggert@cs.ucla.edu>
31
32 Automate syncing from gnulib. 30 Automate syncing from gnulib.
33 * Makefile.in (lib): New macro. 31 * Makefile.in (lib): New macro.
34 (ALL_CFLAGS): Add -I$(lib) -I$(srcdir)/../lib. 32 (ALL_CFLAGS): Add -I$(lib) -I$(srcdir)/../lib.
35 ($(lib)/libgnu.a): New rule. 33 ($(lib)/libgnu.a): New rule.
36 (temacs$(EXEEXT)): Also link $(lib)/libgnu.a. 34 (temacs$(EXEEXT)): Also link $(lib)/libgnu.a.
37 35
362011-01-11 Tassilo Horn <tassilo@member.fsf.org>
37
38 * image.c (imagemagick_load_image, Finit_image_library): Free
39 intermediate image after creating a MagickWand from it. Terminate
40 MagickWand environment after image loading.
41
422011-01-10 Michael Albinus <michael.albinus@gmx.de>
43
44 * dbusbind.c (Fdbus_register_service): Raise an error in case of
45 unexpected return values.
46 (Fdbus_register_method): Remove connection initialization.
47
482011-01-10 Jan Moringen <jan.moringen@uni-bielefeld.de>
49
50 * dbusbind.c (QCdbus_request_name_allow_replacement): New symbol;
51 used by Fdbus_register_service.
52 (QCdbus_request_name_replace_existing): Likewise.
53 (QCdbus_request_name_do_not_queue): Likewise.
54 (QCdbus_request_name_reply_primary_owner): Likewise.
55 (QCdbus_request_name_reply_in_queue): Likewise.
56 (QCdbus_request_name_reply_exists): Likewise.
57 (QCdbus_request_name_reply_already_owner): Likewise.
58 (Fdbus_register_service): New function.
59 (Fdbus_register_method): Use Fdbus_register_service to do the name
60 registration.
61 (syms_of_dbusbind): Add symbols dbus-register-service,
62 :allow-replacement, :replace-existing, :do-not-queue,
63 :primary-owner, :existing, :in-queue and :already-owner.
64
652011-01-09 Chong Yidong <cyd@stupidchicken.com>
66
67 * gtkutil.c (update_frame_tool_bar): Don't advance tool-bar index
68 when removing extra buttons.
69
702011-01-08 Chong Yidong <cyd@stupidchicken.com>
71
72 * fns.c (Fyes_or_no_p): Doc fix.
73
382011-01-08 Andreas Schwab <schwab@linux-m68k.org> 742011-01-08 Andreas Schwab <schwab@linux-m68k.org>
39 75
40 * fns.c (Fyes_or_no_p): Add usage. 76 * fns.c (Fyes_or_no_p): Add usage.
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 4ef962d1507..0c59c08f5b7 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -38,6 +38,7 @@ Lisp_Object Qdbus_call_method_asynchronously;
38Lisp_Object Qdbus_method_return_internal; 38Lisp_Object Qdbus_method_return_internal;
39Lisp_Object Qdbus_method_error_internal; 39Lisp_Object Qdbus_method_error_internal;
40Lisp_Object Qdbus_send_signal; 40Lisp_Object Qdbus_send_signal;
41Lisp_Object Qdbus_register_service;
41Lisp_Object Qdbus_register_signal; 42Lisp_Object Qdbus_register_signal;
42Lisp_Object Qdbus_register_method; 43Lisp_Object Qdbus_register_method;
43 44
@@ -50,6 +51,17 @@ Lisp_Object QCdbus_system_bus, QCdbus_session_bus;
50/* Lisp symbol for method call timeout. */ 51/* Lisp symbol for method call timeout. */
51Lisp_Object QCdbus_timeout; 52Lisp_Object QCdbus_timeout;
52 53
54/* Lisp symbols for name request flags. */
55Lisp_Object QCdbus_request_name_allow_replacement;
56Lisp_Object QCdbus_request_name_replace_existing;
57Lisp_Object QCdbus_request_name_do_not_queue;
58
59/* Lisp symbols for name request replies. */
60Lisp_Object QCdbus_request_name_reply_primary_owner;
61Lisp_Object QCdbus_request_name_reply_in_queue;
62Lisp_Object QCdbus_request_name_reply_exists;
63Lisp_Object QCdbus_request_name_reply_already_owner;
64
53/* Lisp symbols of D-Bus types. */ 65/* Lisp symbols of D-Bus types. */
54Lisp_Object QCdbus_type_byte, QCdbus_type_boolean; 66Lisp_Object QCdbus_type_byte, QCdbus_type_boolean;
55Lisp_Object QCdbus_type_int16, QCdbus_type_uint16; 67Lisp_Object QCdbus_type_int16, QCdbus_type_uint16;
@@ -1835,6 +1847,114 @@ xd_read_queued_messages (int fd, void *data, int for_read)
1835 xd_in_read_queued_messages = 0; 1847 xd_in_read_queued_messages = 0;
1836} 1848}
1837 1849
1850DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
1851 2, MANY, 0,
1852 doc: /* Register known name SERVICE on the D-Bus BUS.
1853
1854BUS is either a Lisp symbol, `:system' or `:session', or a string
1855denoting the bus address.
1856
1857SERVICE is the D-Bus service name that should be registered. It must
1858be a known name.
1859
1860FLAGS are keywords, which control how the service name is registered.
1861The following keywords are recognized:
1862
1863`:allow-replacement': Allow another service to become the primary
1864owner if requested.
1865
1866`:replace-existing': Request to replace the current primary owner.
1867
1868`:do-not-queue': If we can not become the primary owner do not place
1869us in the queue.
1870
1871The function returns a keyword, indicating the result of the
1872operation. One of the following keywords is returned:
1873
1874`:primary-owner': Service has become the primary owner of the
1875requested name.
1876
1877`:in-queue': Service could not become the primary owner and has been
1878placed in the queue.
1879
1880`:exists': Service is already in the queue.
1881
1882`:already-owner': Service is already the primary owner.
1883
1884Example:
1885
1886\(dbus-register-service :session dbus-service-emacs)
1887
1888 => :primary-owner.
1889
1890\(dbus-register-service
1891 :session "org.freedesktop.TextEditor"
1892 dbus-service-allow-replacement dbus-service-replace-existing)
1893
1894 => :already-owner.
1895
1896usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1897 (int nargs, register Lisp_Object *args)
1898{
1899 Lisp_Object bus, service;
1900 struct gcpro gcpro1, gcpro2;
1901 DBusConnection *connection;
1902 unsigned int i;
1903 unsigned int value;
1904 unsigned int flags = 0;
1905 int result;
1906 DBusError derror;
1907
1908 bus = args[0];
1909 service = args[1];
1910
1911 /* Check parameters. */
1912 CHECK_STRING (service);
1913
1914 /* Process flags. */
1915 for (i = 2; i < nargs; ++i) {
1916 value = ((EQ (args[i], QCdbus_request_name_replace_existing))
1917 ? DBUS_NAME_FLAG_REPLACE_EXISTING
1918 : (EQ (args[i], QCdbus_request_name_allow_replacement))
1919 ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT
1920 : (EQ (args[i], QCdbus_request_name_do_not_queue))
1921 ? DBUS_NAME_FLAG_DO_NOT_QUEUE
1922 : -1);
1923 if (value == -1)
1924 XD_SIGNAL2 (build_string ("Unrecognized name request flag"), args[i]);
1925 flags |= value;
1926 }
1927
1928 /* Open a connection to the bus. */
1929 connection = xd_initialize (bus, TRUE);
1930
1931 /* Request the known name from the bus. */
1932 dbus_error_init (&derror);
1933 result = dbus_bus_request_name (connection, SDATA (service), flags,
1934 &derror);
1935 if (dbus_error_is_set (&derror))
1936 XD_ERROR (derror);
1937
1938 /* Cleanup. */
1939 dbus_error_free (&derror);
1940
1941 /* Return object. */
1942 switch (result)
1943 {
1944 case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
1945 return QCdbus_request_name_reply_primary_owner;
1946 case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
1947 return QCdbus_request_name_reply_in_queue;
1948 case DBUS_REQUEST_NAME_REPLY_EXISTS:
1949 return QCdbus_request_name_reply_exists;
1950 case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
1951 return QCdbus_request_name_reply_already_owner;
1952 default:
1953 /* This should not happen. */
1954 XD_SIGNAL2 (build_string ("Could not register service"), service);
1955 }
1956}
1957
1838DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, 1958DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
1839 6, MANY, 0, 1959 6, MANY, 0,
1840 doc: /* Register for signal SIGNAL on the D-Bus BUS. 1960 doc: /* Register for signal SIGNAL on the D-Bus BUS.
@@ -2011,9 +2131,8 @@ discovering the still incomplete interface.*/)
2011 Lisp_Object dont_register_service) 2131 Lisp_Object dont_register_service)
2012{ 2132{
2013 Lisp_Object key, key1, value; 2133 Lisp_Object key, key1, value;
2014 DBusConnection *connection;
2015 int result;
2016 DBusError derror; 2134 DBusError derror;
2135 Lisp_Object args[2] = { bus, service };
2017 2136
2018 /* Check parameters. */ 2137 /* Check parameters. */
2019 CHECK_STRING (service); 2138 CHECK_STRING (service);
@@ -2025,21 +2144,9 @@ discovering the still incomplete interface.*/)
2025 /* TODO: We must check for a valid service name, otherwise there is 2144 /* TODO: We must check for a valid service name, otherwise there is
2026 a segmentation fault. */ 2145 a segmentation fault. */
2027 2146
2028 /* Open a connection to the bus. */ 2147 /* Request the name. */
2029 connection = xd_initialize (bus, TRUE);
2030
2031 /* Request the known name from the bus. We can ignore the result,
2032 it is set to -1 if there is an error - kind of redundancy. */
2033 if (NILP (dont_register_service)) 2148 if (NILP (dont_register_service))
2034 { 2149 Fdbus_register_service (2, args);
2035 dbus_error_init (&derror);
2036 result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
2037 if (dbus_error_is_set (&derror))
2038 XD_ERROR (derror);
2039
2040 /* Cleanup. */
2041 dbus_error_free (&derror);
2042 }
2043 2150
2044 /* Create a hash table entry. We use nil for the unique name, 2151 /* Create a hash table entry. We use nil for the unique name,
2045 because the method might be called from anybody. */ 2152 because the method might be called from anybody. */
@@ -2091,6 +2198,10 @@ syms_of_dbusbind (void)
2091 staticpro (&Qdbus_send_signal); 2198 staticpro (&Qdbus_send_signal);
2092 defsubr (&Sdbus_send_signal); 2199 defsubr (&Sdbus_send_signal);
2093 2200
2201 Qdbus_register_service = intern_c_string ("dbus-register-service");
2202 staticpro (&Qdbus_register_service);
2203 defsubr (&Sdbus_register_service);
2204
2094 Qdbus_register_signal = intern_c_string ("dbus-register-signal"); 2205 Qdbus_register_signal = intern_c_string ("dbus-register-signal");
2095 staticpro (&Qdbus_register_signal); 2206 staticpro (&Qdbus_register_signal);
2096 defsubr (&Sdbus_register_signal); 2207 defsubr (&Sdbus_register_signal);
@@ -2112,6 +2223,27 @@ syms_of_dbusbind (void)
2112 QCdbus_session_bus = intern_c_string (":session"); 2223 QCdbus_session_bus = intern_c_string (":session");
2113 staticpro (&QCdbus_session_bus); 2224 staticpro (&QCdbus_session_bus);
2114 2225
2226 QCdbus_request_name_allow_replacement = intern_c_string (":allow-replacement");
2227 staticpro (&QCdbus_request_name_allow_replacement);
2228
2229 QCdbus_request_name_replace_existing = intern_c_string (":replace-existing");
2230 staticpro (&QCdbus_request_name_replace_existing);
2231
2232 QCdbus_request_name_do_not_queue = intern_c_string (":do-not-queue");
2233 staticpro (&QCdbus_request_name_do_not_queue);
2234
2235 QCdbus_request_name_reply_primary_owner = intern_c_string (":primary-owner");
2236 staticpro (&QCdbus_request_name_reply_primary_owner);
2237
2238 QCdbus_request_name_reply_exists = intern_c_string (":exists");
2239 staticpro (&QCdbus_request_name_reply_exists);
2240
2241 QCdbus_request_name_reply_in_queue = intern_c_string (":in-queue");
2242 staticpro (&QCdbus_request_name_reply_in_queue);
2243
2244 QCdbus_request_name_reply_already_owner = intern_c_string (":already-owner");
2245 staticpro (&QCdbus_request_name_reply_already_owner);
2246
2115 QCdbus_timeout = intern_c_string (":timeout"); 2247 QCdbus_timeout = intern_c_string (":timeout");
2116 staticpro (&QCdbus_timeout); 2248 staticpro (&QCdbus_timeout);
2117 2249
diff --git a/src/fns.c b/src/fns.c
index 8fd5c7d291a..cd95f6c27fd 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2460,10 +2460,13 @@ do_yes_or_no_p (Lisp_Object prompt)
2460 2460
2461DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, MANY, 0, 2461DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, MANY, 0,
2462 doc: /* Ask user a yes-or-no question. Return t if answer is yes. 2462 doc: /* Ask user a yes-or-no question. Return t if answer is yes.
2463Takes one argument, which is the string to display to ask the question. 2463The string to display to ask the question is obtained by
2464It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it. 2464formatting the string PROMPT with arguments ARGS (see `format').
2465The user must confirm the answer with RET, 2465The result should end in a space; `yes-or-no-p' adds
2466and can edit it until it has been confirmed. 2466\"(yes or no) \" to it.
2467
2468The user must confirm the answer with RET, and can edit it until it
2469has been confirmed.
2467 2470
2468Under a windowing system a dialog box will be used if `last-nonmenu-event' 2471Under a windowing system a dialog box will be used if `last-nonmenu-event'
2469is nil, and `use-dialog-box' is non-nil. 2472is nil, and `use-dialog-box' is non-nil.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index fb003749493..905bbb1561d 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4439,7 +4439,7 @@ update_frame_tool_bar (FRAME_PTR f)
4439 /* Remove buttons not longer needed. */ 4439 /* Remove buttons not longer needed. */
4440 do 4440 do
4441 { 4441 {
4442 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), j++); 4442 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), j);
4443 if (ti) 4443 if (ti)
4444 gtk_container_remove (GTK_CONTAINER (wtoolbar), GTK_WIDGET (ti)); 4444 gtk_container_remove (GTK_CONTAINER (wtoolbar), GTK_WIDGET (ti));
4445 } while (ti != NULL); 4445 } while (ti != NULL);
diff --git a/src/image.c b/src/image.c
index bff56b5f961..1125309a9f7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7518,6 +7518,9 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7518 image. Interface :index is same as for GIF. First we "ping" the 7518 image. Interface :index is same as for GIF. First we "ping" the
7519 image to see how many sub-images it contains. Pinging is faster 7519 image to see how many sub-images it contains. Pinging is faster
7520 than loading the image to find out things about it. */ 7520 than loading the image to find out things about it. */
7521
7522 /* MagickWandGenesis() initializes the imagemagick library. */
7523 MagickWandGenesis ();
7521 image = image_spec_value (img->spec, QCindex, NULL); 7524 image = image_spec_value (img->spec, QCindex, NULL);
7522 ino = INTEGERP (image) ? XFASTINT (image) : 0; 7525 ino = INTEGERP (image) ? XFASTINT (image) : 0;
7523 ping_wand = NewMagickWand (); 7526 ping_wand = NewMagickWand ();
@@ -7546,6 +7549,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7546 img->data.lisp_val)); 7549 img->data.lisp_val));
7547 7550
7548 DestroyMagickWand (ping_wand); 7551 DestroyMagickWand (ping_wand);
7552
7549 /* Now, after pinging, we know how many images are inside the 7553 /* Now, after pinging, we know how many images are inside the
7550 file. If its not a bundle, just one. */ 7554 file. If its not a bundle, just one. */
7551 7555
@@ -7563,6 +7567,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7563 if (im_image != NULL) 7567 if (im_image != NULL)
7564 { 7568 {
7565 image_wand = NewMagickWandFromImage (im_image); 7569 image_wand = NewMagickWandFromImage (im_image);
7570 DestroyImage(im_image);
7566 status = MagickTrue; 7571 status = MagickTrue;
7567 } 7572 }
7568 else 7573 else
@@ -7573,7 +7578,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7573 image_wand = NewMagickWand (); 7578 image_wand = NewMagickWand ();
7574 status = MagickReadImageBlob (image_wand, contents, size); 7579 status = MagickReadImageBlob (image_wand, contents, size);
7575 } 7580 }
7576 image_error ("im read failed", Qnil, Qnil); 7581
7577 if (status == MagickFalse) goto imagemagick_error; 7582 if (status == MagickFalse) goto imagemagick_error;
7578 7583
7579 /* If width and/or height is set in the display spec assume we want 7584 /* If width and/or height is set in the display spec assume we want
@@ -7802,11 +7807,13 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7802 7807
7803 /* Final cleanup. image_wand should be the only resource left. */ 7808 /* Final cleanup. image_wand should be the only resource left. */
7804 DestroyMagickWand (image_wand); 7809 DestroyMagickWand (image_wand);
7810 MagickWandTerminus ();
7805 7811
7806 return 1; 7812 return 1;
7807 7813
7808 imagemagick_error: 7814 imagemagick_error:
7809 DestroyMagickWand (image_wand); 7815 DestroyMagickWand (image_wand);
7816 MagickWandTerminus ();
7810 /* TODO more cleanup. */ 7817 /* TODO more cleanup. */
7811 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); 7818 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
7812 return 0; 7819 return 0;
@@ -8678,8 +8685,6 @@ of `dynamic-library-alist', which see). */)
8678#if defined (HAVE_IMAGEMAGICK) 8685#if defined (HAVE_IMAGEMAGICK)
8679 if (EQ (type, Qimagemagick)) 8686 if (EQ (type, Qimagemagick))
8680 { 8687 {
8681 /* MagickWandGenesis() initializes the imagemagick library. */
8682 MagickWandGenesis ();
8683 return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions, 8688 return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions,
8684 libraries); 8689 libraries);
8685 } 8690 }