After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 584847 - Get rid of libsexy, use new GtkLabel link support
Get rid of libsexy, use new GtkLabel link support
Status: RESOLVED FIXED
Product: policykit-gnome
Classification: Platform
Component: authorizations tool
unspecified
Other All
: Normal trivial
: ---
Assigned To: policykit-gnome-maint
policykit-gnome-maint
Depends on:
Blocks: 585385
 
 
Reported: 2009-06-04 17:16 UTC by Javier Jardón (IRC: jjardon)
Modified: 2009-06-22 16:37 UTC
See Also:
GNOME target: 2.30.x
GNOME version: 2.27/2.28


Attachments
Get rid of libsexy, use new GtkLabel link support (60.43 KB, patch)
2009-06-04 17:17 UTC, Javier Jardón (IRC: jjardon)
needs-work Details | Review
Get rid of libsexy, use new GtkLabel link support v2 (59.92 KB, patch)
2009-06-12 20:18 UTC, Javier Jardón (IRC: jjardon)
none Details | Review
Get rid of libsexy, use new GtkLabel link support v3 (59.37 KB, patch)
2009-06-12 20:26 UTC, Javier Jardón (IRC: jjardon)
committed Details | Review

Description Javier Jardón (IRC: jjardon) 2009-06-04 17:16:22 UTC
Now that GtkLabel link support has been added to GTK+ (9dbb304), it would
be nice for policykit-gnome to switch to it.

Trivial patch attached, but untested as I don't have gtk 2.17.1 installed here
Comment 1 Javier Jardón (IRC: jjardon) 2009-06-04 17:17:59 UTC
Created attachment 135961 [details] [review]
Get rid of libsexy, use new GtkLabel link support
Comment 2 Luis Menina 2009-06-12 01:53:54 UTC
<snip>
-static void
-vendor_url_activated (SexyUrlLabel *url_label, char *url, gpointer user_data)
+static gboolean
+vendor_url_activated (GtkLabel *url_label, gpointer user_data)
 {
+  gchar *url;
+
+  gtk_label_get_current_uri (GTK_LABEL (url_label));
   if (url != NULL)
-    gtk_show_uri (NULL, url, GDK_CURRENT_TIME, NULL);
+    {
+      gtk_show_uri (NULL, url, GDK_CURRENT_TIME, NULL);
+      g_free (url);
+      return TRUE;
+    }
+  return FALSE;
 }
</snip>


There's a bug :
+  gtk_label_get_current_uri (GTK_LABEL (url_label));
should be 
+  url = gtk_label_get_current_uri (GTK_LABEL (url_label));

Moreover the url should not be freed, as specified in 
http://library.gnome.org/devel/gtk/unstable/GtkLabel.html#gtk-label-get-current-uri

The whole thing would be nicer this way:
static gboolean
vendor_url_activated (GtkLabel *url_label, gpointer user_data)
 {
  gchar *url;

  url = gtk_label_get_current_uri (GTK_LABEL (url_label));
  if (url == NULL)
    return FALSE;

  return gtk_show_uri (NULL, url, GDK_CURRENT_TIME, NULL);
 }


In another part of the patch, we see :
-    }
+    l

which is certainly an error.

Then, the signal connection part. http://library.gnome.org/devel/gtk/unstable/GtkLabel.html#GtkLabel-activate-link specifies that "Applications may connect to [the activate-link signal] to override the default behaviour, which is to call gtk_show_uri()". But what we want *is* the default behavior, so it seems neither the callback not the signal connection are useful.

I haven't checked the rest of the patch, but it already needs some work. Feel free to submit an improved version.
Comment 3 Javier Jardón (IRC: jjardon) 2009-06-12 20:18:17 UTC
Created attachment 136471 [details] [review]
Get rid of libsexy, use new GtkLabel link support v2

New patch.

Thank you Luis for your review!
Comment 4 Javier Jardón (IRC: jjardon) 2009-06-12 20:26:50 UTC
Created attachment 136472 [details] [review]
Get rid of libsexy, use new GtkLabel link support v3

I've forgotten the part about the signals in the last patch

Thank you again Luis.
Comment 5 Luis Menina 2009-06-13 19:27:05 UTC
Looks good. The only concern I have is that your patch touches a #if 0'ed area. So with the blessing of the maintainer, it would be nicer to remove the dead code (the callback and the signal connection). Could the maintainer please give an advice here ?
Comment 6 David Zeuthen (not reading bugmail) 2009-06-22 15:54:22 UTC
Committed something based on the patch in comment 5. Thanks!
Comment 7 Javier Jardón (IRC: jjardon) 2009-06-22 16:37:33 UTC
Hello David,

I think that you mean comment 4 ? ;)