unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: joakim@verona.se
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] xwidget 9fe732a 2/2: Better changelog for xwidgets
Date: Tue, 03 Feb 2015 15:42:45 -0800	[thread overview]
Message-ID: <54D15CF5.3020809@cs.ucla.edu> (raw)
In-Reply-To: <m3egq6hb8b.fsf@exodia.verona.se>

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

joakim@verona.se wrote:
> There seems to be a bunch of gtk warnings I cant really do anything about.

You should be able to fix them all.  The attached patch did that for me, on 
Ubuntu 14.10 anyway.  This patch uses the usual GNU Emacs style in the code I 
fixed; similar fixes are needed for the rest of the xwidget code, but one thing 
at a time.)

>    --enable-gtk-deprecation-warnings
>
> seems to be good as well.

That's disabled by default due to its false alarms.  It is helpful to enable it 
occasionally, and you can still build despite the warnings by using 'make 
WERROR_CFLAGS='.  I don't recommend this for ordinary development, though.

[-- Attachment #2: xwidget-warn.diff --]
[-- Type: text/x-patch, Size: 4208 bytes --]

diff --git a/src/xwidget.c b/src/xwidget.c
index 5c816cf..45f2507 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -97,6 +97,13 @@
 
 #include "xwidget.h"
 
+/* Convert STRING, a string constant, to a type acceptable as glib data.  */
+static char *
+gstr (char const *string)
+{
+  return (char *) string;
+}
+
 //TODO embryo of lisp allocators for xwidgets
 //TODO xwidget* should be Lisp_xwidget*
 static struct xwidget*
@@ -146,7 +153,7 @@ gboolean webkit_osr_navigation_policy_decision_requested_callback(WebKitWebView
                                                         WebKitWebPolicyDecision   *policy_decision,
                                                                   gpointer                   user_data);
 
-static GtkWidget* xwgir_create(unsigned char* class, unsigned char* namespace);
+static GtkWidget *xwgir_create (char *, char *);
 
 
 
@@ -223,9 +230,14 @@ TYPE is a symbol which can take one of the following values:
       }
       if(EQ(xw->type, Qsocket_osr))
           xw->widget_osr = gtk_socket_new();
-      if(!NILP (Fget(xw->type, QCxwgir_class)))
-          xw->widget_osr = xwgir_create(SDATA(Fcar(Fcdr(Fget(xw->type, QCxwgir_class)))),
-                                        SDATA(Fcar(Fget(xw->type, QCxwgir_class))));
+
+      Lisp_Object xwgir_class = Fget (xw->type, QCxwgir_class);
+      if (!NILP (xwgir_class))
+	{
+	  char *class = SSDATA (Fcar (Fcdr (xwgir_class)));
+	  char *namespace = SSDATA (XCDR (xwgir_class));
+	  xw->widget_osr = xwgir_create (class, namespace);
+	}
 
       gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height);
 
@@ -610,7 +622,9 @@ DEFUN ("xwgir-require-namespace", Fxwgir_require_namespace, Sxwgir_require_names
   return Qt;
 }
 
-GtkWidget* xwgir_create(unsigned char* class, unsigned char* namespace){
+GtkWidget *
+xwgir_create (char *class, char *namespace)
+{
   //TODO this is more or less the same as xwgir-call-method, so should be refactored
   //create a gtk widget, given its name
   //find the constructor
@@ -838,16 +852,20 @@ xwidget_init_view (struct xwidget *xww,
   //widget creation
   if(EQ(xww->type, Qbutton))
     {
-      xv->widget = gtk_button_new_with_label (XSTRING(xww->title)->data);
+      xv->widget = gtk_button_new_with_label (SSDATA (xww->title));
       g_signal_connect (G_OBJECT (xv->widget), "clicked",
                         G_CALLBACK (buttonclick_handler), xv); // the view rather than the model
     } else if (EQ(xww->type, Qtoggle)) {
-    xv->widget = gtk_toggle_button_new_with_label (XSTRING(xww->title)->data);
+    xv->widget = gtk_toggle_button_new_with_label (SSDATA (xww->title));
     //xv->widget = gtk_entry_new ();//temp hack to experiment with key propagation TODO entry widget is useful for testing
   } else if (EQ(xww->type, Qsocket)) {
     xv->widget = gtk_socket_new ();
-    g_signal_connect_after(xv->widget, "plug-added", G_CALLBACK(xwidget_plug_added), "plug added");
-    g_signal_connect_after(xv->widget, "plug-removed", G_CALLBACK(xwidget_plug_removed), "plug removed");
+    g_signal_connect_after (xv->widget, "plug-added",
+			    G_CALLBACK (xwidget_plug_added),
+			    gstr ("plug added"));
+    g_signal_connect_after (xv->widget, "plug-removed",
+			    G_CALLBACK (xwidget_plug_removed),
+			    gstr ("plug removed"));
     //TODO these doesnt help
     gtk_widget_add_events(xv->widget, GDK_KEY_PRESS);
     gtk_widget_add_events(xv->widget, GDK_KEY_RELEASE);
@@ -856,7 +874,9 @@ xwidget_init_view (struct xwidget *xww,
       //gtk_hscale_new (GTK_ADJUSTMENT(gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 10.0)));
       gtk_hscale_new_with_range ( 0.0, 100.0, 10.0);
     gtk_scale_set_draw_value (GTK_SCALE (xv->widget), FALSE);	//i think its emacs role to show text and stuff, so disable the widgets own text
-    xv->handler_id = g_signal_connect_after(xv->widget, "value-changed", G_CALLBACK(xwidget_slider_changed), "slider changed");
+    xv->handler_id = g_signal_connect_after (xv->widget, "value-changed",
+					     G_CALLBACK (xwidget_slider_changed),
+					     gstr ("slider changed"));
   } else if (EQ(xww->type, Qcairo)) {
     //Cairo view
     //uhm cairo is differentish in gtk 3.

  reply	other threads:[~2015-02-03 23:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150201003025.18138.95966@vcs.savannah.gnu.org>
     [not found] ` <E1YHiQk-0004jf-UH@vcs.savannah.gnu.org>
2015-02-01  6:11   ` [Emacs-diffs] xwidget 9fe732a 2/2: Better changelog for xwidgets Dmitry Gutov
2015-02-01  8:50     ` joakim
2015-02-01 10:53       ` Paul Eggert
2015-02-01 15:46         ` joakim
2015-02-01 16:09           ` Dmitry Gutov
2015-02-01 16:17             ` joakim
2015-02-01 16:30               ` Dmitry Gutov
2015-02-01 19:48                 ` joakim
2015-02-01 19:53                 ` Paul Eggert
2015-02-01 19:59                   ` joakim
2015-02-01 20:05                   ` Dmitry Gutov
2015-02-01 20:08             ` David Engster
2015-02-01 20:18               ` Dmitry Gutov
2015-02-01 20:21                 ` David Engster
2015-02-03 22:38         ` joakim
2015-02-03 23:42           ` Paul Eggert [this message]
2015-02-04 15:59             ` joakim
2015-02-04 18:57               ` joakim
2015-02-05  0:38                 ` Paul Eggert
2015-02-05 15:54                   ` joakim
2015-02-05 16:17                     ` Paul Eggert
2015-02-09 11:50                       ` joakim
2015-02-09 11:56                   ` joakim
2015-02-09 19:47                     ` Paul Eggert
2015-02-09 20:24                       ` joakim
2015-02-09 22:20                         ` Paul Eggert
2015-02-10 18:27                           ` joakim
2015-02-01 15:36     ` Eli Zaretskii
2015-02-01 15:51       ` David Engster
2015-02-01 15:52       ` joakim
2015-02-01 16:04         ` David Engster
2015-02-01 16:04         ` Eli Zaretskii
2015-02-01 16:05         ` Andreas Schwab
2015-02-01 16:11           ` David Engster
2015-02-01 16:15             ` Andreas Schwab
2015-02-01 16:18               ` joakim
2015-02-01 19:29               ` David Engster
2015-02-01 19:39                 ` Dmitry Gutov
2015-02-01 19:56                   ` Eli Zaretskii
2015-02-01 20:41                     ` Dmitry Gutov
2015-02-02  3:30                       ` Eli Zaretskii
2015-02-02  8:03                         ` David Engster
2015-02-02 10:53                           ` Ulrich Mueller
2015-02-02 16:30                           ` Eli Zaretskii
2015-02-02 23:19                             ` Stefan Monnier
2015-02-02  1:35                 ` Stephen J. Turnbull
2015-02-02  1:57                   ` Dmitry Gutov
2015-02-02  2:12                     ` Stephen J. Turnbull
2015-02-02  2:21                       ` Dmitry Gutov
2015-02-02  3:45                         ` Stephen J. Turnbull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D15CF5.3020809@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).