Commit 35570e5a authored by Sean Davis's avatar Sean Davis 🕶

Initial port to GTK 3. It runs... but not well

parent e51f77e6
......@@ -58,12 +58,11 @@ XDT_I18N([@LINGUAS@])
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [2.14.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.20.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.20.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.7.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.7.0])
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.7.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0])
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.12.0])
XDT_CHECK_PACKAGE([LIBXML], [libxml-2.0], [2.4.0])
XDT_CHECK_PACKAGE([SOUP], [libsoup-2.4], [2.32.0])
XDT_CHECK_OPTIONAL_PACKAGE([UPOWER_GLIB], [upower-glib], [0.9.0], [upower],
......
......@@ -1146,19 +1146,18 @@ button_scrollbox_font_clicked(GtkWidget *button,
gpointer user_data)
{
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
GtkFontSelectionDialog *fsd;
GtkFontChooserDialog *fsd;
gchar *fontname;
gint result;
fsd = GTK_FONT_SELECTION_DIALOG
(gtk_font_selection_dialog_new(_("Select font")));
fsd = GTK_FONT_CHOOSER_DIALOG
(gtk_font_chooser_dialog_new(_("Select font"), dialog->dialog));
if (dialog->pd->scrollbox_font)
gtk_font_selection_dialog_set_font_name(fsd,
dialog->pd->scrollbox_font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (fsd), dialog->pd->scrollbox_font);
result = gtk_dialog_run(GTK_DIALOG(fsd));
if (result == GTK_RESPONSE_OK || result == GTK_RESPONSE_ACCEPT) {
fontname = gtk_font_selection_dialog_get_font_name(fsd);
fontname = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (fsd));
if (fontname != NULL) {
gtk_button_set_label(GTK_BUTTON(button), fontname);
g_free(dialog->pd->scrollbox_font);
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="2.24"/>
<requires lib="gtk+" version="3.20"/>
<requires lib="libxfce4ui-2" version="4.12"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">10</property>
......@@ -71,9 +72,8 @@
<property name="destroy_with_parent">True</property>
<property name="icon_name">xfce4-weather</property>
<property name="type_hint">dialog</property>
<property name="subtitle" translatable="yes">Preferences</property>
<child internal-child="vbox">
<object class="GtkVBox" id="box1">
<object class="GtkBox" id="box1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
......@@ -128,8 +128,8 @@
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
......@@ -139,10 +139,6 @@
<property name="mnemonic_widget">text_loc_name</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
......@@ -154,7 +150,6 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
......@@ -168,7 +163,6 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
......@@ -182,7 +176,6 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
......@@ -196,7 +189,6 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
......@@ -208,9 +200,7 @@
<property name="margin_bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">3</property>
</packing>
</child>
<child>
......@@ -225,9 +215,7 @@
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">3</property>
</packing>
</child>
<child>
......@@ -239,9 +227,14 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="button_loc_change">
<property name="label" translatable="yes">Change...</property>
......@@ -253,9 +246,26 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkHBox" id="box2">
<property name="visible">True</property>
......@@ -292,7 +302,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
......@@ -331,7 +340,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
......@@ -373,7 +381,6 @@ Altitude is given in meters above sea level, or alternatively in feet by changin
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
<child>
......@@ -386,7 +393,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
......@@ -395,11 +401,15 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="no_show_all">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
......@@ -419,8 +429,8 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
......@@ -430,10 +440,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="mnemonic_widget">combo_unit_temperature</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label11">
......@@ -445,7 +451,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
......@@ -459,7 +464,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
......@@ -473,7 +477,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
......@@ -487,7 +490,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
......@@ -499,9 +501,7 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="margin_bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">2</property>
</packing>
</child>
<child>
......@@ -513,7 +513,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="mnemonic_widget">combo_apparent_temperature</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
......@@ -529,9 +528,11 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkComboBoxText" id="combo_unit_pressure">
<property name="visible">True</property>
......@@ -631,8 +632,8 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
......@@ -643,10 +644,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="mnemonic_widget">combo_icon_theme</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="box5">
......@@ -682,7 +679,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -696,11 +692,12 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkHSeparator" id="separator3">
<property name="visible">True</property>
......@@ -709,11 +706,12 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="margin_bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
......@@ -724,7 +722,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
......@@ -751,11 +748,12 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="margin_bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
......@@ -766,7 +764,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
......@@ -794,7 +791,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
......@@ -820,11 +816,12 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="margin_bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkCheckButton" id="check_round_values">
<property name="label" translatable="yes">_Round values</property>
......@@ -835,11 +832,12 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">2</property>
......@@ -862,8 +860,8 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkCheckButton" id="check_scrollbox_show">
<property name="label" translatable="yes">Show scroll_box</property>
......@@ -874,10 +872,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label23">
......@@ -891,7 +885,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -906,7 +899,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
......@@ -917,7 +909,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
......@@ -941,19 +932,23 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="margin_bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkTable" id="grid5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkComboBoxText" id="options_datatypes">
<property name="visible">True</property>
......@@ -977,10 +972,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<item id="17" translatable="yes">Precipitation (R)</item>
</items>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrollwindow1">
......@@ -1000,7 +991,7 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="tooltip_text" translatable="yes">These are the values that will be shown in the scrollbox. Select a single value here and click the appropriate button to remove it or move it up and down in the list.</property>
<property name="model">liststore1</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection1" />
<object class="GtkTreeSelection" id="selection1"/>
</child>
</object>
</child>
......@@ -1008,7 +999,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
......@@ -1016,7 +1006,6 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<object class="GtkVBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="button_add">
......@@ -1099,17 +1088,22 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkCheckButton" id="check_scrollbox_animate">
<property name="label" translatable="yes">Animate _transitions between labels</property>
......@@ -1121,11 +1115,15 @@ Leave this field empty to use the timezone set by your system. Invalid entries w
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="button_scrollbox_font">
<property name="label" translatable="yes">Select _font</property>
......
......@@ -35,11 +35,16 @@
static void gtk_scrollbox_finalize(GObject *object);
static void gtk_scrollbox_size_request(GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_scrollbox_get_preferred_height (GtkWidget *widget,
gint *minimal_height,
gint *natural_height);
static gboolean gtk_scrollbox_expose_event(GtkWidget *widget,
GdkEventExpose *event);
static void gtk_scrollbox_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
gint *natural_width);
static gboolean gtk_scrollbox_draw_event(GtkWidget *widget,
cairo_t *cr);
static gboolean gtk_scrollbox_control_loop(gpointer user_data);
......@@ -56,8 +61,9 @@ gtk_scrollbox_class_init(GtkScrollboxClass *klass)
gobject_class->finalize = gtk_scrollbox_finalize;
widget_class = GTK_WIDGET_CLASS(klass);
widget_class->size_request = gtk_scrollbox_size_request;
widget_class->expose_event = gtk_scrollbox_expose_event;
widget_class->get_preferred_width = gtk_scrollbox_get_preferred_width;
widget_class->get_preferred_height = gtk_scrollbox_get_preferred_height;
widget_class->draw = gtk_scrollbox_draw_event;
}
......@@ -170,9 +176,35 @@ gtk_scrollbox_size_request(GtkWidget *widget,
}
static void
gtk_scrollbox_get_preferred_height (GtkWidget *widget,
gint *minimal_height,
gint *natural_height)
{
GtkRequisition requisition;
gtk_scrollbox_size_request (widget, &requisition);
*minimal_height = *natural_height = requisition.height;
}
static void
gtk_scrollbox_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
gint *natural_width)
{
GtkRequisition requisition;
gtk_scrollbox_size_request (widget, &requisition);
*minimal_width = *natural_width = requisition.width;
}
static gboolean
gtk_scrollbox_expose_event(GtkWidget *widget,
GdkEventExpose *event)
gtk_scrollbox_draw_event(GtkWidget *widget,
cairo_t *cr)
{
GtkScrollbox *self = GTK_SCROLLBOX(widget);
PangoLayout *layout;
......@@ -182,9 +214,9 @@ gtk_scrollbox_expose_event(GtkWidget *widget,
PangoMatrix matrix = PANGO_MATRIX_INIT;
GtkAllocation allocation;
if (GTK_WIDGET_CLASS(gtk_scrollbox_parent_class)->expose_event != NULL)
if (GTK_WIDGET_CLASS(gtk_scrollbox_parent_class)->draw != NULL)
result = GTK_WIDGET_CLASS
(gtk_scrollbox_parent_class)->expose_event(widget, event);
(gtk_scrollbox_parent_class)->draw(widget, cr);
if (self->active != NULL) {
layout = PANGO_LAYOUT(self->active->data);
......@@ -216,11 +248,11 @@ gtk_scrollbox_expose_event(GtkWidget *widget,
- PANGO_PIXELS(logical_rect.width)) / 2;
}
gtk_paint_layout(gtk_widget_get_style (GTK_WIDGET (widget)),