[Pkg-xfce-commits] r3289 - in goodies/trunk/xfce4-weather-plugin/debian: . patches
Yves-Alexis Perez
corsac at alioth.debian.org
Tue Jun 9 08:14:38 UTC 2009
Author: corsac
Date: 2009-06-09 20:14:38 +0000 (Tue, 09 Jun 2009)
New Revision: 3289
Added:
goodies/trunk/xfce4-weather-plugin/debian/patches/02_correct-orientation.patch
goodies/trunk/xfce4-weather-plugin/debian/patches/03_use-gtk-2.12-api.patch
goodies/trunk/xfce4-weather-plugin/debian/patches/04_handle-network-config-changes.patch
Modified:
goodies/trunk/xfce4-weather-plugin/debian/changelog
Log:
* debian/patches:
- 02_correct-orientation added, use panel orientation to display text
more legibly.
- 03_use-gtk-2.12-api added, prettify tooltips using gtk 2.12 API.
- 04_handle-network-config-changes added, correctly handle network
reconfiguration.
Modified: goodies/trunk/xfce4-weather-plugin/debian/changelog
===================================================================
--- goodies/trunk/xfce4-weather-plugin/debian/changelog 2009-06-09 19:14:12 UTC (rev 3288)
+++ goodies/trunk/xfce4-weather-plugin/debian/changelog 2009-06-09 20:14:38 UTC (rev 3289)
@@ -3,8 +3,14 @@
* debian/control:
- update standards version to 3.8.1.
- switch to xfce section.
+ * debian/patches:
+ - 02_correct-orientation added, use panel orientation to display text
+ more legibly.
+ - 03_use-gtk-2.12-api added, prettify tooltips using gtk 2.12 API.
+ - 04_handle-network-config-changes added, correctly handle network
+ reconfiguration.
- -- Yves-Alexis Perez <corsac at debian.org> Tue, 09 Jun 2009 21:13:50 +0200
+ -- Yves-Alexis Perez <corsac at debian.org> Tue, 09 Jun 2009 22:14:17 +0200
xfce4-weather-plugin (0.6.2-2) unstable; urgency=low
Added: goodies/trunk/xfce4-weather-plugin/debian/patches/02_correct-orientation.patch
===================================================================
--- goodies/trunk/xfce4-weather-plugin/debian/patches/02_correct-orientation.patch (rev 0)
+++ goodies/trunk/xfce4-weather-plugin/debian/patches/02_correct-orientation.patch 2009-06-09 20:14:38 UTC (rev 3289)
@@ -0,0 +1,201 @@
+Index: panel-plugin/weather.c
+===================================================================
+--- panel-plugin/weather.c (revision 7507)
++++ panel-plugin/weather.c (working copy)
+@@ -43,8 +43,6 @@
+ #define BORDER 8
+ #define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-weather-plugin"
+
+-
+-
+ gboolean
+ check_envproxy (gchar **proxy_host,
+ gint *proxy_port)
+@@ -88,10 +86,11 @@
+
+
+ static gchar *
+-make_label (xml_weather *weatherdata,
+- datas opt,
+- units unit,
+- gint size)
++make_label (xml_weather *weatherdata,
++ datas opt,
++ units unit,
++ gint size,
++ GtkOrientation orientation)
+ {
+
+ gchar *str, *value;
+@@ -138,6 +137,9 @@
+ }
+
+ /* arbitrary, choose something that works */
++ if (orientation == GTK_ORIENTATION_HORIZONTAL)
++ size += 24;
++
+ if (size > 36)
+ txtsize = "medium";
+ else if (size > 30)
+@@ -203,6 +205,10 @@
+ }
+
+ /* arbitrary, choose something that works */
++
++ if (data->orientation == GTK_ORIENTATION_HORIZONTAL)
++ size += 24;
++
+ if (size > 36)
+ txtsize = "medium";
+ else if (size > 30)
+@@ -220,7 +226,10 @@
+
+ gtk_widget_get_size_request (data->scrollbox, NULL, &height);
+
+- icon = get_icon ("99", data->size - height - 2);
++ if (data->orientation == GTK_ORIENTATION_VERTICAL)
++ icon = get_icon ("99", data->size - height - 2);
++ else
++ icon = get_icon ("99", data->size);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (data->iconimage), icon);
+
+@@ -246,7 +255,7 @@
+ {
+ opt = g_array_index (data->labels, datas, i);
+
+- str = make_label (data->weatherdata, opt, data->unit, data->size);
++ str = make_label (data->weatherdata, opt, data->unit, data->size, data->orientation);
+
+ gtk_scrollbox_set_label (GTK_SCROLLBOX (data->scrollbox), -1, str);
+
+@@ -262,7 +271,10 @@
+ else
+ {
+ gtk_widget_get_size_request (data->scrollbox, NULL, &height);
+- size = data->size - height - 2;
++ if (data->orientation == GTK_ORIENTATION_VERTICAL)
++ size = data->size - height - 2;
++ else
++ size = data->size;
+ }
+
+ icon = get_icon (get_data (data->weatherdata, WICON), size);
+@@ -671,7 +683,7 @@
+ xfceweather_create_control (XfcePanelPlugin *plugin)
+ {
+ xfceweather_data *data = panel_slice_new0 (xfceweather_data);
+- GtkWidget *vbox, *refresh;
++ GtkWidget *refresh;
+ datas lbl;
+ GdkPixbuf *icon = NULL;
+
+@@ -685,20 +697,24 @@
+
+ icon = get_icon ("99", 16);
+ data->iconimage = gtk_image_new_from_pixbuf (icon);
+- gtk_misc_set_alignment (GTK_MISC (data->iconimage), 0.5, 1);
+
+ if (G_LIKELY (icon))
+ g_object_unref (G_OBJECT (icon));
+
+ data->labels = g_array_new (FALSE, TRUE, sizeof (datas));
+
+- vbox = gtk_vbox_new (FALSE, 0);
++ data->vbox_center_scrollbox = gtk_vbox_new(FALSE, 0);
++ data->top_hbox = gtk_hbox_new (FALSE, 0);
++ gtk_misc_set_alignment (GTK_MISC (data->iconimage), 1, 0.5);
++ gtk_box_pack_start (GTK_BOX (data->top_hbox), data->iconimage, TRUE, FALSE, 0);
++ gtk_box_pack_start (GTK_BOX (data->vbox_center_scrollbox), data->scrollbox, TRUE, FALSE, 0);
++ gtk_box_pack_start (GTK_BOX (data->top_hbox), data->vbox_center_scrollbox, TRUE, FALSE, 0);
+
+- gtk_box_pack_start (GTK_BOX (vbox), data->iconimage, TRUE, FALSE, 0);
+- gtk_box_pack_start (GTK_BOX (vbox), data->scrollbox, TRUE, TRUE, 0);
++ data->top_vbox = gtk_vbox_new (FALSE, 0);
++ gtk_box_pack_start (GTK_BOX (data->top_vbox), data->top_hbox, TRUE, FALSE, 0);
+
+ data->tooltipbox = gtk_event_box_new ();
+- gtk_container_add (GTK_CONTAINER (data->tooltipbox), vbox);
++ gtk_container_add (GTK_CONTAINER (data->tooltipbox), data->top_vbox);
+ gtk_widget_show_all (data->tooltipbox);
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET(data->tooltipbox), GTK_NO_WINDOW);
+
+@@ -789,8 +805,38 @@
+ return TRUE;
+ }
+
++static gboolean
++xfceweather_set_orientation (XfcePanelPlugin *panel,
++ GtkOrientation orientation,
++ xfceweather_data *data)
++{
++ GtkWidget *parent = gtk_widget_get_parent(data->vbox_center_scrollbox);
+
++ data->orientation = orientation;
+
++ g_object_ref(G_OBJECT(data->vbox_center_scrollbox));
++ gtk_container_remove(GTK_CONTAINER(parent), data->vbox_center_scrollbox);
++
++ if (data->orientation == GTK_ORIENTATION_HORIZONTAL) {
++ gtk_box_pack_start (GTK_BOX (data->top_hbox), data->vbox_center_scrollbox, TRUE, FALSE, 0);
++ } else {
++ gtk_box_pack_start (GTK_BOX (data->top_vbox), data->vbox_center_scrollbox, TRUE, FALSE, 0);
++ }
++ g_object_unref(G_OBJECT(data->vbox_center_scrollbox));
++
++ gtk_scrollbox_clear (GTK_SCROLLBOX (data->scrollbox));
++
++ if (data->weatherdata)
++ set_icon_current (data);
++ else
++ set_icon_error (data);
++
++ /* we handled the orientation */
++ return TRUE;
++}
++
++
++
+ static void
+ weather_construct (XfcePanelPlugin *plugin)
+ {
+@@ -805,6 +851,7 @@
+ xfceweather_set_visibility (data);
+
+ xfceweather_set_size (plugin, xfce_panel_plugin_get_size (plugin), data);
++ xfceweather_set_orientation (plugin, xfce_panel_plugin_get_orientation(plugin), data);
+
+ gtk_container_add (GTK_CONTAINER (plugin), data->tooltipbox);
+
+@@ -817,6 +864,9 @@
+ g_signal_connect (G_OBJECT (plugin), "size-changed",
+ G_CALLBACK (xfceweather_set_size), data);
+
++ g_signal_connect (G_OBJECT (plugin), "orientation-changed",
++ G_CALLBACK (xfceweather_set_orientation), data);
++
+ xfce_panel_plugin_menu_show_configure (plugin);
+ g_signal_connect (G_OBJECT (plugin), "configure-plugin",
+ G_CALLBACK (xfceweather_create_options), data);
+Index: panel-plugin/weather.h
+===================================================================
+--- panel-plugin/weather.h (revision 7507)
++++ panel-plugin/weather.h (working copy)
+@@ -31,6 +31,9 @@
+
+ GtkTooltips *tooltips;
+
++ GtkWidget *top_vbox;
++ GtkWidget *top_hbox;
++ GtkWidget *vbox_center_scrollbox;
+ GtkWidget *scrollbox;
+ GtkWidget *iconimage;
+ GtkWidget *tooltipbox;
+@@ -40,6 +43,7 @@
+ GArray *labels;
+
+ gint size;
++ GtkOrientation orientation;
+ gint updatetimeout;
+
+ gchar *location_code;
Added: goodies/trunk/xfce4-weather-plugin/debian/patches/03_use-gtk-2.12-api.patch
===================================================================
--- goodies/trunk/xfce4-weather-plugin/debian/patches/03_use-gtk-2.12-api.patch (rev 0)
+++ goodies/trunk/xfce4-weather-plugin/debian/patches/03_use-gtk-2.12-api.patch 2009-06-09 20:14:38 UTC (rev 3289)
@@ -0,0 +1,116 @@
+diff -u panel-plugin/weather.c panel-plugin/weather.c
+--- panel-plugin/weather.c (working copy)
++++ panel-plugin/weather.c (working copy)
+@@ -236,8 +236,10 @@
+ if (G_LIKELY (icon))
+ g_object_unref (G_OBJECT (icon));
+
++#if !GTK_CHECK_VERSION(2,12,0)
+ gtk_tooltips_set_tip (data->tooltips, data->tooltipbox,
+ _("Cannot update weather data"), NULL);
++#endif
+ }
+
+
+@@ -284,9 +286,11 @@
+ if (G_LIKELY (icon))
+ g_object_unref (G_OBJECT (icon));
+
++#if !GTK_CHECK_VERSION(2,12,0)
+ gtk_tooltips_set_tip (data->tooltips, data->tooltipbox,
+ translate_desc (get_data (data->weatherdata, TRANS)),
+ NULL);
++#endif
+ }
+
+
+@@ -677,6 +681,34 @@
+ gtk_widget_show (dlg);
+ }
+
++static gboolean weather_get_tooltip_cb (GtkWidget *widget,
++ gint x,
++ gint y,
++ gboolean keyboard_mode,
++ GtkTooltip *tooltip,
++ xfceweather_data *data)
++{
++ GdkPixbuf *icon;
++ gchar *markup_text;
++
++ if (data->weatherdata == NULL) {
++ gtk_tooltip_set_text (tooltip, _("Cannot update weather data"));
++ } else {
++ markup_text = g_markup_printf_escaped(
++ "<b>%s</b>\n"
++ "%s",
++ get_data (data->weatherdata, DNAM),
++ translate_desc (get_data (data->weatherdata, TRANS))
++ );
++ gtk_tooltip_set_markup (tooltip, markup_text);
++ g_free(markup_text);
++ }
++ icon = get_icon (get_data (data->weatherdata, WICON), 32);
++ gtk_tooltip_set_icon (tooltip, icon);
++ g_object_unref (G_OBJECT(icon));
++
++ return TRUE;
++}
+
+
+ static xfceweather_data *
+@@ -689,10 +721,11 @@
+
+ data->plugin = plugin;
+
++#if !GTK_CHECK_VERSION(2,12,0)
+ data->tooltips = gtk_tooltips_new ();
+ g_object_ref (data->tooltips);
+ gtk_object_sink (GTK_OBJECT (data->tooltips));
+-
++#endif
+ data->scrollbox = gtk_scrollbox_new ();
+
+ icon = get_icon ("99", 16);
+@@ -718,10 +751,17 @@
+ gtk_widget_show_all (data->tooltipbox);
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET(data->tooltipbox), GTK_NO_WINDOW);
+
++#if GTK_CHECK_VERSION(2,12,0)
++ g_object_set (G_OBJECT(data->tooltipbox), "has-tooltip", TRUE, NULL);
++ g_signal_connect(G_OBJECT(data->tooltipbox), "query-tooltip",
++ G_CALLBACK(weather_get_tooltip_cb),
++ data);
++#endif
+ xfce_panel_plugin_add_action_widget (plugin, data->tooltipbox);
+
+ g_signal_connect (G_OBJECT (data->tooltipbox), "button-press-event",
+ G_CALLBACK (cb_click), data);
++ gtk_widget_add_events(data->scrollbox, GDK_BUTTON_PRESS_MASK);
+
+ /* add refresh button to right click menu, for people who missed the middle mouse click feature */
+ refresh = gtk_image_menu_item_new_from_stock ("gtk-refresh", NULL);
+@@ -772,8 +812,10 @@
+ xmlCleanupParser ();
+
+ /* Free Tooltip */
++#if !GTK_CHECK_VERSION(2,12,0)
+ gtk_tooltips_set_tip (data->tooltips, data->tooltipbox, NULL, NULL);
+ g_object_unref (G_OBJECT (data->tooltips));
++#endif
+
+ /* Free chars */
+ g_free (data->location_code);
+diff -u panel-plugin/weather.h panel-plugin/weather.h
+--- panel-plugin/weather.h (working copy)
++++ panel-plugin/weather.h (working copy)
+@@ -29,7 +29,9 @@
+ {
+ XfcePanelPlugin *plugin;
+
++#if !GTK_CHECK_VERSION(2,12,0)
+ GtkTooltips *tooltips;
++#endif
+
+ GtkWidget *top_vbox;
+ GtkWidget *top_hbox;
Added: goodies/trunk/xfce4-weather-plugin/debian/patches/04_handle-network-config-changes.patch
===================================================================
--- goodies/trunk/xfce4-weather-plugin/debian/patches/04_handle-network-config-changes.patch (rev 0)
+++ goodies/trunk/xfce4-weather-plugin/debian/patches/04_handle-network-config-changes.patch 2009-06-09 20:14:38 UTC (rev 3289)
@@ -0,0 +1,84 @@
+Index: panel-plugin/weather-http.c
+===================================================================
+--- panel-plugin/weather-http.c (revision 4855)
++++ panel-plugin/weather-http.c (working copy)
+@@ -23,6 +23,7 @@
+
+ #include <sys/types.h>
+ #include <sys/socket.h>
++#include <sys/stat.h>
+ #include <errno.h>
+ #include <netdb.h>
+ #include <fcntl.h>
+@@ -30,6 +31,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <netinet/in.h>
++#include <resolv.h>
+
+ #include <glib.h>
+ #include <gtk/gtk.h>
+@@ -118,7 +120,25 @@
+ return FALSE;
+ }
+
++static void refresh_resolvers(void)
++{
++#ifdef G_OS_UNIX
++ static time_t resolv_conf_changed = (time_t)NULL;
++ struct stat s;
+
++ /* This makes the glibc re-read resolv.conf, if it changed
++ * since our startup.
++ * Why doesn't the glibc do it by itself?
++ */
++ if (stat("/etc/resolv.conf", &s) == 0) {
++ if (s.st_mtime > resolv_conf_changed) {
++ resolv_conf_changed = s.st_mtime;
++ res_init();
++ }
++ } /* else
++ we'll have bigger problems. */
++#endif /*G_OS_UNIX*/
++}
+
+ static gboolean
+ weather_http_receive_data_idle (gpointer user_data)
+@@ -135,6 +155,9 @@
+ /* set the current time */
+ g_get_current_time (&timeout);
+
++ /* force the libc to get resolvers right, if they changed for some reason */
++ refresh_resolvers();
++
+ /* try to get the hostname */
+ host = gethostbyname (connection->proxy_host ? connection->proxy_host : connection->hostname);
+ if (G_UNLIKELY (host == NULL))
+Index: panel-plugin/Makefile.am
+===================================================================
+--- panel-plugin/Makefile.am (revision 4855)
++++ panel-plugin/Makefile.am (working copy)
+@@ -45,7 +45,8 @@
+ $(LIBXFCE4UTIL_LIBS) \
+ $(LIBXFCEGUI4_LIBS) \
+ $(GTK_LIBS) \
+- $(LIBXML_LIBS)
++ $(LIBXML_LIBS) \
++ $(LIBRESOLV)
+
+ desktopdir = $(datadir)/xfce4/panel-plugins
+ desktop_in_in_files = weather.desktop.in.in
+Index: configure.in
+===================================================================
+--- configure.in (revision 4855)
++++ configure.in (working copy)
+@@ -63,6 +63,9 @@
+ XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.1])
+ XDT_CHECK_PACKAGE([LIBXML], [libxml-2.0], [2.4.0])
+
++AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
++AC_SUBST(LIBRESOLV)
++
+ dnl ***********************************
+ dnl *** Check for debugging support ***
+ dnl ***********************************
More information about the Pkg-xfce-commits
mailing list