Updated version.
diff --git a/data/Makefile.am b/data/Makefile.am
index 1837a4f..185cc90 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -19,7 +19,8 @@ uidir=$(datadir)/lxpanel/ui
ui_in_files= \
ui/panel-pref.glade \
ui/launchtaskbar.glade \
- ui/netstatus.glade
+ ui/netstatus.glade \
+ ui/netstatus3.glade
ui_DATA = $(ui_in_files:.glade=.ui)
diff --git a/data/ui/netstatus3.glade b/data/ui/netstatus3.glade
new file mode 100644
index 0000000..359fb33
--- /dev/null
+++ b/data/ui/netstatus3.glade
@@ -0,0 +1,915 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkDialog" id="network_status_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="window_position">center</property>
+ <property name="default_width">300</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="helpbutton1">
+ <property name="label">gtk-help</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="configure_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-preferences</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label42">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Con_figure</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="notebook1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">5</property>
+ <child>
+ <object class="GtkBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkBox" id="connection_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Connection</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label43">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="connection_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkGrid" id="connection_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Status:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="status_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="name_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_entry">True</property>
+ <child internal-child="entry">
+ <object class="GtkEntry" id="combobox-entry">
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Name:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="activity_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Activity</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label44">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="table2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="received_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sent_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Received:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Sent:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="signal_strength_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label48">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Signal Strength</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox14">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label49">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkProgressBar" id="signal_strength_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pulse_step">0.10000000149</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="signal_strength_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">0%</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">General</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkBox" id="inet4_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label25">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Internet Protocol (IPv4)</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label45">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="inet4_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="inet4_addr_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Address:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_addr_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_bcast_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_mask_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_dest_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_dest_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Destination:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_bcast_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Broadcast:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet4_mask_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Subnet Mask:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="inet6_frame">
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Internet Protocol (IPv6)</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox12">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label46">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="table5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label39">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Address:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet6_addr_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label40">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Scope:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="inet6_scope_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="dev_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="dev_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Network Device</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox13">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label47">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="table6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="dev_addr_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Address:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="dev_addr_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="dev_type_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="dev_type_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Type:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Support</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">helpbutton1</action-widget>
+ <action-widget response="0">configure_button</action-widget>
+ <action-widget response="-7">close_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/plugins/dclock.c b/plugins/dclock.c
index e054a90..c854449 100644
--- a/plugins/dclock.c
+++ b/plugins/dclock.c
@@ -76,8 +76,8 @@ static GtkWidget * dclock_create_calendar(DClockPlugin * dc)
GtkWidget * win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(win), 180, 180);
gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
- gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
- gtk_container_set_border_width(GTK_CONTAINER(win), 5);
+ gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
+ gtk_container_set_border_width(GTK_CONTAINER(win), 5);
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(win), TRUE);
gtk_window_set_skip_pager_hint(GTK_WINDOW(win), TRUE);
gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_UTILITY);
diff --git a/plugins/launchtaskbar.c b/plugins/launchtaskbar.c
index fb0dd2a..63a47fb 100644
--- a/plugins/launchtaskbar.c
+++ b/plugins/launchtaskbar.c
@@ -63,6 +63,9 @@
# include "menu-policy.h"
#endif
+#if GTK_CHECK_VERSION (3,0,0)
+#include <gdk/gdkx.h>
+#endif
#define PANEL_ICON_SIZE 24 /* see the private.h */
@@ -1907,6 +1910,76 @@ static void task_delete(LaunchTaskBarPlugin * tb, Task * tk, gboolean unlink, gb
g_free(tk);
}
+#if GTK_CHECK_VERSION(3,0,0)
+static cairo_surface_t *
+_wnck_cairo_surface_get_from_pixmap (Screen *screen,
+ Pixmap xpixmap)
+{
+ cairo_surface_t *surface;
+ Display *display;
+ Window root_return;
+ int x_ret, y_ret;
+ unsigned int w_ret, h_ret, bw_ret, depth_ret;
+ XWindowAttributes attrs;
+
+ surface = NULL;
+ display = DisplayOfScreen (screen);
+
+ // _wnck_error_trap_push (display);
+
+ if (!XGetGeometry (display, xpixmap, &root_return,
+ &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
+ goto TRAP_POP;
+
+ if (depth_ret == 1)
+ {
+ surface = cairo_xlib_surface_create_for_bitmap (display,
+ xpixmap,
+ screen,
+ w_ret,
+ h_ret);
+ }
+ else
+ {
+ if (!XGetWindowAttributes (display, root_return, &attrs))
+ goto TRAP_POP;
+
+ surface = cairo_xlib_surface_create (display,
+ xpixmap,
+ attrs.visual,
+ w_ret, h_ret);
+ }
+
+TRAP_POP:
+// _wnck_error_trap_pop (display);
+
+ return surface;
+}
+
+
+GdkPixbuf*
+_wnck_gdk_pixbuf_get_from_pixmap (Screen *screen,
+ Pixmap xpixmap)
+{
+ cairo_surface_t *surface;
+ GdkPixbuf *retval;
+
+ surface = _wnck_cairo_surface_get_from_pixmap (screen, xpixmap);
+
+ if (surface == NULL)
+ return NULL;
+
+ retval = gdk_pixbuf_get_from_surface (surface,
+ 0,
+ 0,
+ cairo_xlib_surface_get_width (surface),
+ cairo_xlib_surface_get_height (surface));
+ cairo_surface_destroy (surface);
+
+ return retval;
+}
+
+#else
/* Get a pixbuf from a pixmap.
* Originally from libwnck, Copyright (C) 2001 Havoc Pennington. */
static GdkPixbuf * _wnck_gdk_pixbuf_get_from_pixmap(Pixmap xpixmap, int width, int height)
@@ -1966,6 +2039,7 @@ static GdkPixbuf * _wnck_gdk_pixbuf_get_from_pixmap(Pixmap xpixmap, int width, i
g_object_unref(G_OBJECT(drawable));
return retval;
}
+#endif
/* Apply a mask to a pixbuf.
* Originally from libwnck, Copyright (C) 2001 Havoc Pennington. */
@@ -2205,7 +2279,11 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
/* If we have an X pixmap and its geometry, convert it to a GDK pixmap. */
if (result == Success)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ pixmap = _wnck_gdk_pixbuf_get_from_pixmap(gdk_x11_screen_get_xscreen(gdk_screen_get_default()),xpixmap);
+#else
pixmap = _wnck_gdk_pixbuf_get_from_pixmap(xpixmap, w, h);
+#endif
result = ((pixmap != NULL) ? Success : -1);
}
@@ -2221,7 +2299,11 @@ static GdkPixbuf * get_wm_icon(Window task_win, guint required_width, guint requ
&unused_win, &unused, &unused, &w, &h, &unused_2, &unused_2))
{
/* Convert the X mask to a GDK pixmap. */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkPixbuf * mask = _wnck_gdk_pixbuf_get_from_pixmap(gdk_x11_screen_get_xscreen(gdk_screen_get_default()),xmask);
+#else
GdkPixbuf * mask = _wnck_gdk_pixbuf_get_from_pixmap(xmask, w, h);
+#endif
if (mask != NULL)
{
/* Apply the mask. */
diff --git a/plugins/netstat/netstat.c b/plugins/netstat/netstat.c
index f1fb809..717eebc 100644
--- a/plugins/netstat/netstat.c
+++ b/plugins/netstat/netstat.c
@@ -192,7 +192,9 @@ wireless_menu(netdev_info *ni)
signal_quality = gtk_progress_bar_new();
gtk_widget_set_size_request(signal_quality, 100, -1);
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(signal_quality), GTK_PROGRESS_LEFT_TO_RIGHT);
+#endif
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(signal_quality), quality_per);
gtk_box_pack_start(GTK_BOX(item_box), signal_quality, FALSE, FALSE, 0);
diff --git a/plugins/netstat/passwd_gui.c b/plugins/netstat/passwd_gui.c
index ad9b87b..54969dd 100644
--- a/plugins/netstat/passwd_gui.c
+++ b/plugins/netstat/passwd_gui.c
@@ -86,7 +86,11 @@ struct pgui *passwd_gui_new(ap_setting *aps)
/* create dialog */
pwdgui->dlg = gtk_dialog_new_with_buttons(_("Setting Encryption Key"),
NULL,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ 0,
+#else
GTK_DIALOG_NO_SEPARATOR,
+#endif
GTK_STOCK_OK, GTK_RESPONSE_OK,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL );
diff --git a/plugins/netstatus/netstatus-dialog.c b/plugins/netstatus/netstatus-dialog.c
index b6f3c9f..e06acaa 100644
--- a/plugins/netstatus/netstatus-dialog.c
+++ b/plugins/netstatus/netstatus-dialog.c
@@ -228,14 +228,18 @@ netstatus_dialog_update_inet4_support (NetstatusDialogData *data)
/* Address */
if (addr)
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_table_set_row_spacing (GTK_TABLE (data->inet4_table), 0, 6);
+#endif
gtk_label_set_text (GTK_LABEL (data->inet4_addr), addr);
gtk_widget_show (data->inet4_addr);
gtk_widget_show (data->inet4_addr_title);
}
else
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_table_set_row_spacing (GTK_TABLE (data->inet4_table), 0, 0);
+#endif
gtk_widget_hide (data->inet4_addr);
gtk_widget_hide (data->inet4_addr_title);
}
@@ -243,14 +247,18 @@ netstatus_dialog_update_inet4_support (NetstatusDialogData *data)
/* Destination */
if (dest)
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_table_set_row_spacing (GTK_TABLE (data->inet4_table), 1, 6);
+#endif
gtk_label_set_text (GTK_LABEL (data->inet4_dest), dest);
gtk_widget_show (data->inet4_dest);
gtk_widget_show (data->inet4_dest_title);
}
else
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_table_set_row_spacing (GTK_TABLE (data->inet4_table), 1, 0);
+#endif
gtk_widget_hide (data->inet4_dest);
gtk_widget_hide (data->inet4_dest_title);
}
@@ -258,14 +266,18 @@ netstatus_dialog_update_inet4_support (NetstatusDialogData *data)
/* Broadcast */
if (bcast)
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_table_set_row_spacing (GTK_TABLE (data->inet4_table), 2, 6);
+#endif
gtk_label_set_text (GTK_LABEL (data->inet4_bcast), bcast);
gtk_widget_show (data->inet4_bcast);
gtk_widget_show (data->inet4_bcast_title);
}
else
{
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_table_set_row_spacing (GTK_TABLE (data->inet4_table), 2, 0);
+#endif
gtk_widget_hide (data->inet4_bcast);
gtk_widget_hide (data->inet4_bcast_title);
}
@@ -744,7 +756,15 @@ netstatus_dialog_new (NetstatusIface *iface)
data = g_new0 (NetstatusDialogData, 1);
data->builder = gtk_builder_new();
- gtk_builder_add_from_file(data->builder, PACKAGE_UI_DIR "/netstatus.ui", NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if ( !gtk_builder_add_from_file(data->builder, PACKAGE_UI_DIR "/netstatus3.ui", NULL) )
+#else
+ if ( !gtk_builder_add_from_file(data->builder, PACKAGE_UI_DIR "/netstatus.ui", NULL) )
+#endif
+ {
+ g_object_unref(data->builder);
+ return;
+ }
data->dialog = (GtkWidget*)gtk_builder_get_object(data->builder, "network_status_dialog");
g_object_set_data (G_OBJECT (data->dialog), "netstatus-dialog-data", data);
diff --git a/plugins/netstatus/netstatus-icon.c b/plugins/netstatus/netstatus-icon.c
index 7746779..de2205b 100644
--- a/plugins/netstatus/netstatus-icon.c
+++ b/plugins/netstatus/netstatus-icon.c
@@ -447,7 +447,11 @@ netstatus_icon_signal_changed (NetstatusIface *iface,
}
static void
+#if GTK_CHECK_VERSION (3, 0, 0)
+netstatus_icon_destroy (GtkWidget *widget)
+#else
netstatus_icon_destroy (GtkObject *widget)
+#endif
{
NetstatusIcon *icon = (NetstatusIcon *) widget;
@@ -474,8 +478,11 @@ netstatus_icon_destroy (GtkObject *widget)
icon->priv->signal_changed_id = 0;
icon->priv->image = NULL;
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GTK_WIDGET_CLASS (parent_class)->destroy (widget);
+#else
GTK_OBJECT_CLASS (parent_class)->destroy (widget);
+#endif
}
static GdkPixbuf *
@@ -581,6 +588,7 @@ get_box_class (GtkOrientation orientation)
return g_type_class_peek(orientation == GTK_ORIENTATION_HORIZONTAL ? GTK_TYPE_HBOX : GTK_TYPE_VBOX);
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void
netstatus_icon_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@ -593,6 +601,7 @@ netstatus_icon_size_request (GtkWidget *widget,
if (GTK_WIDGET_CLASS (klass)->size_request)
GTK_WIDGET_CLASS (klass)->size_request (widget, requisition);
}
+#endif
static void
netstatus_icon_size_allocate (GtkWidget *widget,
@@ -670,7 +679,9 @@ netstatus_icon_realize (GtkWidget *widget)
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
+#if !GTK_CHECK_VERSION (3, 0, 0)
attributes.colormap = gtk_widget_get_colormap (widget);
+#endif
attributes.event_mask = gtk_widget_get_events (widget) |
GDK_BUTTON_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
@@ -678,9 +689,11 @@ netstatus_icon_realize (GtkWidget *widget)
GDK_EXPOSURE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK;
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+#else
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
+#endif
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
@@ -799,7 +812,9 @@ static void
netstatus_icon_class_init (NetstatusIconClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkObjectClass *gtkobject_class = (GtkObjectClass *) klass;
+#endif
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
parent_class = g_type_class_peek_parent (klass);
@@ -810,10 +825,15 @@ netstatus_icon_class_init (NetstatusIconClass *klass)
*/
gobject_class->finalize = netstatus_icon_finalize;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ widget_class->destroy = netstatus_icon_destroy;
+// widget_class->size_request = netstatus_icon_size_request;
+#else
gtkobject_class->destroy = netstatus_icon_destroy;
widget_class->size_request = netstatus_icon_size_request;
+#endif
widget_class->size_allocate = netstatus_icon_size_allocate;
widget_class->realize = netstatus_icon_realize;
widget_class->button_press_event = netstatus_icon_button_press_event;
diff --git a/plugins/netstatus/netstatus.c b/plugins/netstatus/netstatus.c
index 21e6216..a78c765 100644
--- a/plugins/netstatus/netstatus.c
+++ b/plugins/netstatus/netstatus.c
@@ -89,10 +89,10 @@ static gboolean on_button_press( GtkWidget* widget, GdkEventButton* evt, LXPanel
{
iface = netstatus_icon_get_iface( NETSTATUS_ICON(widget) );
ns->dlg = netstatus_dialog_new(iface);
-
+#if !GTK_CHECK_VERSION (3,0,0)
/* fix background */
gtk_widget_set_style(ns->dlg, panel_get_defstyle(p));
-
+#endif
netstatus_dialog_set_configuration_tool( ns->dlg, ns->config_tool );
g_signal_connect( ns->dlg, "response", G_CALLBACK(on_response), ns );
}
diff --git a/plugins/pager.c b/plugins/pager.c
index c5e9ed3..39be8e5 100644
--- a/plugins/pager.c
+++ b/plugins/pager.c
@@ -64,7 +64,11 @@ static GtkWidget *pager_constructor(LXPanel *panel, config_setting_t *settings)
int border = 1; /* NOTE: old 'pager' used 2, WnckPager has 1, need 1 more */
/* FIXME: use some global setting for border */
+#if GTK_CHECK_VERSION (3,0,0)
+ w = wnck_pager_new();
+#else
w = wnck_pager_new(NULL);
+#endif
g_return_val_if_fail(w != NULL, 0);
p = gtk_alignment_new(0, 0, 1.0, 1.0);
diff --git a/plugins/tray.c b/plugins/tray.c
index ace9713..2a58e53 100644
--- a/plugins/tray.c
+++ b/plugins/tray.c
@@ -34,6 +34,10 @@
#include "misc.h"
#include "icon-grid.h"
+#if GTK_CHECK_VERSION (3,0,0)
+#include <gtk/gtkx.h>
+#endif
+
/* Standards reference: http://standards.freedesktop.org/systemtray-spec/ */
/* Protocol constants. */
@@ -430,6 +434,9 @@ static void trayclient_request_dock(TrayPlugin * tr, XClientMessageEvent * xeven
/* Add the socket to the icon grid. */
gtk_container_add(GTK_CONTAINER(tr->plugin), tc->socket);
gtk_widget_show(tc->socket);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_set_composited (gtk_widget_get_window(tc->socket),TRUE);
+#endif
/* Connect the socket to the plug. This can only be done after the socket is realized. */
gtk_socket_add_id(GTK_SOCKET(tc->socket), tc->window);
@@ -442,7 +449,6 @@ static void trayclient_request_dock(TrayPlugin * tr, XClientMessageEvent * xeven
g_free(tc);
return;
}
-
/* Link the client structure into the client list. */
if (tc_pred == NULL)
{
@@ -546,6 +552,88 @@ static void tray_unmanage_selection(TrayPlugin * tr)
}
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+tray_set_visual_property (GtkWidget *invisible, GdkScreen* screen)
+{
+ GdkWindow *window;
+ GdkDisplay *display;
+ Visual *xvisual;
+ Atom visual_atom;
+ gulong data[1];
+
+ if (!invisible)
+ return;
+ window = gtk_widget_get_window (invisible);
+ if (!window)
+ return;
+
+ /* The visual property is a hint to the tray icons as to what visual they
+ * should use for their windows. If the X server has RGBA colormaps, then
+ * we tell the tray icons to use a RGBA colormap and we'll composite the
+ * icon onto its parents with real transparency. Otherwise, we just tell
+ * the icon to use our colormap, and we'll do some hacks with parent
+ * relative backgrounds to simulate transparency.
+ */
+
+ display = gtk_widget_get_display (invisible);
+ visual_atom = gdk_x11_get_xatom_by_name_for_display (display,
+ "_NET_SYSTEM_TRAY_VISUAL");
+
+ if (gdk_screen_get_rgba_visual (screen) != NULL &&
+ gdk_display_supports_composite (display))
+ {
+ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (screen));
+ }
+ else
+ {
+ /* We actually want the visual of the tray where the icons will
+ * be embedded. In almost all cases, this will be the same as the visual
+ * of the screen.
+ */
+ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen));
+ }
+
+ data[0] = XVisualIDFromVisual (xvisual);
+
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ visual_atom,
+ XA_VISUALID, 32,
+ PropModeReplace,
+ (guchar *) &data, 1);
+}
+
+static void
+tray_draw_icon (GtkWidget *widget, gpointer data)
+{
+ cairo_t *cr = data;
+ GtkAllocation allocation;
+ GtkAllocation parent_alloc;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_widget_get_allocation (gtk_widget_get_parent(widget), &parent_alloc);
+ cairo_save (cr);
+ gdk_cairo_set_source_window (cr,
+ gtk_widget_get_window (widget),
+ allocation.x-parent_alloc.x,
+ allocation.y-parent_alloc.y);
+ cairo_rectangle (cr, allocation.x-parent_alloc.x, allocation.y-parent_alloc.y, allocation.width, allocation.height);
+ cairo_clip (cr);
+ cairo_paint (cr);
+ cairo_restore (cr);
+}
+
+
+static void
+tray_draw_box (GtkWidget *box,
+ cairo_t *cr)
+{
+ gtk_container_foreach (GTK_CONTAINER (box), tray_draw_icon, cr);
+}
+
+#endif
+
/* Plugin constructor. */
static GtkWidget *tray_constructor(LXPanel *panel, config_setting_t *settings)
{
@@ -573,7 +661,9 @@ static GtkWidget *tray_constructor(LXPanel *panel, config_setting_t *settings)
GtkWidget * invisible = gtk_invisible_new_for_screen(screen);
gtk_widget_realize(invisible);
gtk_widget_add_events(invisible, GDK_PROPERTY_CHANGE_MASK | GDK_STRUCTURE_MASK);
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+ tray_set_visual_property (invisible, screen);
+#endif
/* Try to claim the _NET_SYSTEM_TRAY_Sn selection. */
guint32 timestamp = gdk_x11_get_server_time(gtk_widget_get_window(invisible));
if (gdk_selection_owner_set_for_display(
@@ -591,7 +681,11 @@ static GtkWidget *tray_constructor(LXPanel *panel, config_setting_t *settings)
xev.format = 32;
xev.data.l[0] = timestamp;
xev.data.l[1] = selection_atom;
+#if GTK_CHECK_VERSION (3,0,0)
+ xev.data.l[2] = GDK_WINDOW_XID(gtk_widget_get_window(invisible));
+#else
xev.data.l[2] = GDK_WINDOW_XWINDOW(gtk_widget_get_window(invisible));
+#endif
xev.data.l[3] = 0; /* manager specific data */
xev.data.l[4] = 0; /* manager specific data */
XSendEvent(GDK_DISPLAY_XDISPLAY(display), RootWindowOfScreen(xscreen), False, StructureNotifyMask, (XEvent *) &xev);
@@ -601,7 +695,11 @@ static GtkWidget *tray_constructor(LXPanel *panel, config_setting_t *settings)
gulong data = SYSTEM_TRAY_ORIENTATION_HORZ;
XChangeProperty(
GDK_DISPLAY_XDISPLAY(display),
+#if GTK_CHECK_VERSION (3,0,0)
+ GDK_WINDOW_XID(gtk_widget_get_window(invisible)),
+#else
GDK_WINDOW_XWINDOW(gtk_widget_get_window(invisible)),
+#endif
a_NET_SYSTEM_TRAY_ORIENTATION,
XA_CARDINAL, 32,
PropModeReplace,
@@ -622,13 +720,21 @@ static GtkWidget *tray_constructor(LXPanel *panel, config_setting_t *settings)
gdk_window_add_filter(NULL, (GdkFilterFunc) tray_event_filter, tr);
/* Reference the window since it is never added to a container. */
tr->invisible = g_object_ref_sink(G_OBJECT(invisible));
+#if GTK_CHECK_VERSION (3,0,0)
+ tr->invisible_window = GDK_WINDOW_XID(gtk_widget_get_window(invisible));
+#else
tr->invisible_window = GDK_WINDOW_XWINDOW(gtk_widget_get_window(invisible));
+#endif
/* Allocate top level widget and set into Plugin widget pointer. */
tr->plugin = p = panel_icon_grid_new(panel_get_orientation(panel),
panel_get_icon_size(panel),
panel_get_icon_size(panel),
3, 0, panel_get_height(panel));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_signal_connect (tr->plugin, "draw",
+ G_CALLBACK (tray_draw_box), NULL);
+#endif
lxpanel_plugin_set_data(p, tr, tray_destructor);
gtk_widget_set_name(p, "tray");
gtk_container_set_border_width(GTK_CONTAINER(p), 1);
diff --git a/plugins/xkb/xkb-plugin.c b/plugins/xkb/xkb-plugin.c
index 0219436..77ef67e 100644
--- a/plugins/xkb/xkb-plugin.c
+++ b/plugins/xkb/xkb-plugin.c
@@ -1203,7 +1203,11 @@ static GtkWidget *xkb_configure(LXPanel *panel, GtkWidget *p)
GtkWidget * dlg = gtk_dialog_new_with_buttons(
_("Keyboard Layout Handler"),
NULL,
+#if GTK_CHECK_VERSION (3, 0, 0)
+ 0,
+#else
GTK_DIALOG_NO_SEPARATOR,
+#endif
GTK_STOCK_CLOSE,
GTK_RESPONSE_OK,
NULL);
diff --git a/src/bg.c b/src/bg.c
index c9f0f0a..5a46bff 100644
--- a/src/bg.c
+++ b/src/bg.c
@@ -178,7 +178,116 @@ fb_bg_get_xrootpmap(FbBg *bg)
}
+//TODO:Background
+#if GTK_CHECK_VERSION(3,0,0)
+void fb_bg_apply_css (GtkWidget* widget, gchar* css,gboolean remove)
+{
+ GtkStyleContext* context;
+ GtkCssProvider *provider;
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_widget_reset_style(widget);
+ if (remove) {
+ gtk_style_context_remove_class (context, "-lxpanel-background");
+ gtk_style_context_add_class (context, "background");
+ }
+ else
+ {
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, css,
+ -1, NULL);
+ gtk_style_context_remove_class (context, "background");
+ gtk_style_context_add_class (context, "-lxpanel-background");
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+}
+
+gchar* fb_bg_generate_string(const char *filename, GdkRGBA color,gboolean no_image)
+{
+ gchar* returnie;
+ if (no_image) returnie = g_strdup_printf(".-lxpanel-background{\n"
+ " background-color: %s;\n"
+ " background-image: none;\n"
+ "}",gdk_rgba_to_string(&color));
+ else returnie = g_strdup_printf(".-lxpanel-background{\n"
+ " background-color: %s;\n"
+ " background-image: %s;\n"
+ "}",gdk_rgba_to_string(&color),filename);
+ return returnie;
+}
+cairo_pattern_t *
+fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename)
+{
+ ENTER;
+ GdkPixbuf *pixbuf;
+ cairo_t *cr;
+ cairo_surface_t *surface;
+ cairo_pattern_t *pattern;
+
+ pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+ if (!pixbuf) {
+ RET(NULL);
+ }
+ surface = gdk_window_create_similar_surface (gtk_widget_get_window(widget),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
+ cr = cairo_create(surface);
+ gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
+ cairo_paint(cr);
+ check_cairo_status(cr);
+ cairo_destroy(cr);
+
+ g_object_unref( pixbuf );
+ pattern = cairo_pattern_create_for_surface(surface);
+ cairo_pattern_set_extend(pattern,CAIRO_EXTEND_REPEAT);
+ cairo_surface_destroy(surface);
+ RET(pattern);
+}
+
+cairo_pattern_t *
+fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget)
+{
+ Window win;
+ Window dummy;
+ Pixmap bgpix;
+ cairo_t *cr;
+ cairo_surface_t *surface;
+ cairo_pattern_t *pattern;
+ GdkScreen *screen = gdk_window_get_screen(gtk_widget_get_window(widget));
+ guint width, height, border, depth;
+ int x, y;
+
+ ENTER;
+ win = GDK_WINDOW_XID(gtk_widget_get_window(widget));
+ if (!XGetGeometry(bg->dpy, win, &dummy, &x, &y, &width, &height, &border,
+ &depth)) {
+ g_warning("XGetGeometry failed\n");
+ RET(NULL);
+ }
+ XTranslateCoordinates(bg->dpy, win, bg->xroot, 0, 0, &x, &y, &dummy);
+ DBG("win=%x %dx%d%+d%+d\n", win, width, height, x, y);
+ bgpix=gdk_x11_window_get_xid(gtk_widget_get_window(widget));
+ surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen), bgpix,
+ GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
+ width, height);
+// gbgpix = gdk_pixmap_new(NULL, width, height, depth);
+// if (!gbgpix) {
+// g_critical("gdk_pixmap_new failed");
+// RET(NULL);
+// }
+// bgpix = gdk_x11_drawable_get_xid(gbgpix);
+// XSetTSOrigin(bg->dpy, bg->gc, -x, -y) ;
+// XFillRectangle(bg->dpy, bgpix, bg->gc, 0, 0, width, height);
+// RET(gbgpix);
+ pattern = cairo_pattern_create_for_surface(surface);
+ cairo_surface_destroy(surface);
+ RET(pattern);
+}
+
+#else
GdkPixmap *
fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget)
{
@@ -209,8 +318,40 @@ fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget)
RET(gbgpix);
}
+GdkPixmap *
+fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename)
+{
+ ENTER;
+ GdkPixbuf *pixbuf;
+ cairo_t *cr;
+ GdkPixmap *pixmap;
+
+ pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+ if (!pixbuf) {
+ GtkStyle *style = gtk_widget_get_style(widget);
+ if (style->bg_pixmap[0])
+ g_object_ref(style->bg_pixmap[0]);
+ RET(style->bg_pixmap[0]);
+ }
+ pixmap = gdk_pixmap_new(gtk_widget_get_window(widget), gdk_pixbuf_get_width(pixbuf),
+ gdk_pixbuf_get_height(pixbuf), -1);
+ cr = gdk_cairo_create(pixmap);
+ gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
+ cairo_paint(cr);
+ check_cairo_status(cr);
+ cairo_destroy(cr);
+
+ g_object_unref( pixbuf );
+ RET(pixmap);
+}
+#endif
+#if GTK_CHECK_VERSION (3,0,0)
+void
+fb_bg_composite(GdkWindow *base, GdkColor *tintcolor, gint alpha)
+#else
void
fb_bg_composite(GdkDrawable *base, GdkColor *tintcolor, gint alpha)
+#endif
{
cairo_t *cr;
FbBg *bg;
@@ -263,30 +404,3 @@ FbBg *fb_bg_get_for_display(void)
g_object_ref(default_bg);
RET(default_bg);
}
-
-GdkPixmap *
-fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename)
-{
- ENTER;
- GdkPixbuf *pixbuf;
- cairo_t *cr;
- GdkPixmap *pixmap;
-
- pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
- if (!pixbuf) {
- GtkStyle *style = gtk_widget_get_style(widget);
- if (style->bg_pixmap[0])
- g_object_ref(style->bg_pixmap[0]);
- RET(style->bg_pixmap[0]);
- }
- pixmap = gdk_pixmap_new(gtk_widget_get_window(widget), gdk_pixbuf_get_width(pixbuf),
- gdk_pixbuf_get_height(pixbuf), -1);
- cr = gdk_cairo_create(pixmap);
- gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
- cairo_paint(cr);
- check_cairo_status(cr);
- cairo_destroy(cr);
-
- g_object_unref( pixbuf );
- RET(pixmap);
-}
diff --git a/src/bg.h b/src/bg.h
index f1fd3fc..ceb2581 100644
--- a/src/bg.h
+++ b/src/bg.h
@@ -56,9 +56,17 @@ typedef struct _FbBg FbBg;
GType fb_bg_get_type (void);
#define fb_bg_new() (FbBg *)g_object_new(FB_TYPE_BG, NULL)
+#if GTK_CHECK_VERSION (3,0,0)
+void fb_bg_apply_css (GtkWidget* widget, gchar* css,gboolean remove);
+gchar* fb_bg_generate_string(const char *filename, GdkRGBA color,gboolean no_image);
+void fb_bg_composite(GdkWindow *base, GdkColor *tintcolor, gint alpha);
+cairo_pattern_t *fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget);
+cairo_pattern_t *fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename);
+#else
void fb_bg_composite(GdkDrawable *base, GdkColor *tintcolor, gint alpha);
GdkPixmap *fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget);
+GdkPixmap *fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename);
+#endif
void fb_bg_notify_changed_bg(FbBg *bg);
FbBg *fb_bg_get_for_display(void);
-GdkPixmap *fb_bg_get_pix_from_file(GtkWidget *widget, const char *filename);
#endif /* __FB_BG_H__ */
diff --git a/src/gtk-run.c b/src/gtk-run.c
index dc225c9..ae516f5 100644
--- a/src/gtk-run.c
+++ b/src/gtk-run.c
@@ -376,7 +376,11 @@ void gtk_run()
{
win = gtk_dialog_new_with_buttons( _("Run"),
NULL,
+#if GTK_CHECK_VERSION(3,0,0)
+ 0,
+#else
GTK_DIALOG_NO_SEPARATOR,
+#endif
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL );
diff --git a/src/icon-grid-old.c b/src/icon-grid-old.c
index 2e3d7b4..3bd2f81 100644
--- a/src/icon-grid-old.c
+++ b/src/icon-grid-old.c
@@ -17,6 +17,9 @@
*/
#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION (3,0,0)
+#include <gtk/gtkx.h>
+#endif
#include <string.h>
#include "icon-grid-old.h"
diff --git a/src/icon-grid.c b/src/icon-grid.c
index 4d4d780..c9d751b 100644
--- a/src/icon-grid.c
+++ b/src/icon-grid.c
@@ -73,8 +73,8 @@ static void panel_icon_grid_size_allocate(GtkWidget *widget,
GList *ige;
GtkWidget *child;
- /* Apply given allocation */
- gtk_widget_set_allocation(widget, allocation);
+ /* Apply given allocation */
+ gtk_widget_set_allocation(widget, allocation);
border = gtk_container_get_border_width(GTK_CONTAINER(widget));
#if GTK_CHECK_VERSION(2, 20, 0)
if (gtk_widget_get_realized(widget))
@@ -109,10 +109,11 @@ static void panel_icon_grid_size_allocate(GtkWidget *widget,
}
/* Get and save the desired container geometry. */
- if (ig->orientation == GTK_ORIENTATION_HORIZONTAL && allocation->height > 1)
- ig->target_dimension = allocation->height;
- else if (ig->orientation == GTK_ORIENTATION_VERTICAL && allocation->width > 1)
- ig->target_dimension = allocation->width;
+
+ if (ig->orientation == GTK_ORIENTATION_HORIZONTAL && allocation->height > 1)
+ ig->target_dimension = allocation->height;
+ else if (ig->orientation == GTK_ORIENTATION_VERTICAL && allocation->width > 1)
+ ig->target_dimension = allocation->width;
child_width = ig->child_width;
child_height = ig->child_height;
@@ -152,7 +153,11 @@ static void panel_icon_grid_size_allocate(GtkWidget *widget,
if (gtk_widget_get_visible(child))
{
/* Do necessary operations on the child. */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_preferred_size(child, &req, NULL);
+#else
gtk_widget_size_request(child, &req);
+#endif
child_allocation.x = x;
child_allocation.y = y;
child_allocation.width = child_width;
@@ -192,6 +197,32 @@ static void panel_icon_grid_size_allocate(GtkWidget *widget,
}
}
+#if GTK_CHECK_VERSION (3,0,0)
+static void
+panel_icon_grid_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+
+ panel_icon_grid_size_request (widget, &requisition);
+
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+panel_icon_grid_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+
+ panel_icon_grid_size_request (widget, &requisition);
+
+ *minimal_height = *natural_height = requisition.height;
+}
+#endif
+
/* Establish the geometry of an icon grid. */
static void panel_icon_grid_size_request(GtkWidget *widget,
GtkRequisition *requisition)
@@ -219,8 +250,8 @@ static void panel_icon_grid_size_request(GtkWidget *widget,
if (ig->rows == 0)
ig->rows = 1;
ig->columns = (visible_children + (ig->rows - 1)) / ig->rows;
- /* if ((ig->columns == 1) && (ig->rows > visible_children))
- ig->rows = visible_children; */
+ if ((ig->columns == 1) && (ig->rows > visible_children))
+ ig->rows = visible_children;
}
else
{
@@ -251,11 +282,12 @@ static void panel_icon_grid_size_request(GtkWidget *widget,
requisition->width = ig->child_width * ig->columns + column_spaces * ig->spacing + 2 * border;
requisition->height = ig->child_height * ig->rows + row_spaces * ig->spacing + 2 * border;
}
- if (ig->rows != old_rows || ig->columns != old_columns)
- gtk_widget_queue_resize(widget);
+ if (ig->rows != old_rows || ig->columns != old_columns)
+ gtk_widget_queue_resize(widget);
}
/* Handler for "size-request" event on the icon grid element. */
+#if !GTK_CHECK_VERSION (3,0,0)
static void icon_grid_element_size_request(GtkWidget * widget, GtkRequisition * requisition, PanelIconGrid * ig)
{
/* This is our opportunity to request space for the element. */
@@ -265,6 +297,18 @@ static void icon_grid_element_size_request(GtkWidget * widget, GtkRequisition *
requisition->width = ig->constrained_child_width;
requisition->height = ig->child_height;
}
+#endif
+#if GTK_CHECK_VERSION (3,0,0)
+static void icon_grid_element_get_preferred_width(GtkWidget * widget,gint* minimal_width, gint* natural_width, PanelIconGrid * ig){
+ *minimal_width = ig->child_width;
+ if ((ig->constrain_width) && (ig->constrained_child_width > 1))
+ *minimal_width = ig->constrained_child_width;
+ *natural_width=*minimal_width;
+}
+static void icon_grid_element_get_preferred_height(GtkWidget * widget,gint* minimal_height, gint* natural_height, PanelIconGrid * ig){
+ *natural_height=*minimal_height = ig->child_height;
+}
+#endif
/* Add an icon grid element and establish its initial visibility. */
static void panel_icon_grid_add(GtkContainer *container, GtkWidget *widget)
@@ -275,10 +319,17 @@ static void panel_icon_grid_add(GtkContainer *container, GtkWidget *widget)
ig->children = g_list_append(ig->children, widget);
/* Add the widget to the layout container. */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gint height,width,dummy;
+ icon_grid_element_get_preferred_height(widget,&height,&dummy,ig);
+ icon_grid_element_get_preferred_width(widget,&width,&dummy,ig);
+ gtk_widget_set_size_request(widget,width,height);
+#else
g_signal_connect(G_OBJECT(widget), "size-request",
G_CALLBACK(icon_grid_element_size_request), container);
+#endif
gtk_widget_set_parent(widget, GTK_WIDGET(container));
-// gtk_widget_queue_resize(GTK_WIDGET(container));
+ gtk_widget_queue_resize(GTK_WIDGET(container));
}
void panel_icon_grid_set_constrain_width(PanelIconGrid * ig, gboolean constrain_width)
@@ -319,9 +370,11 @@ static void panel_icon_grid_remove(GtkContainer *container, GtkWidget *widget)
gboolean was_visible = gtk_widget_get_visible(widget);
/* The child is found. Remove from child list and layout container. */
+#if !GTK_CHECK_VERSION (3,0,0)
g_signal_handlers_disconnect_by_func(widget,
icon_grid_element_size_request,
container);
+#endif
gtk_widget_unparent (widget);
ig->children = g_list_remove_link(ig->children, children);
g_list_free(children);
@@ -507,11 +560,14 @@ static void panel_icon_grid_realize(GtkWidget *widget)
if (visible_window)
{
attributes.visual = gtk_widget_get_visual(widget);
+#if GTK_CHECK_VERSION (3,0,0)
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+#else
attributes.colormap = gtk_widget_get_colormap(widget);
attributes.wclass = GDK_INPUT_OUTPUT;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+#endif
window = gdk_window_new(gtk_widget_get_parent_window(widget),
&attributes, attributes_mask);
gtk_widget_set_window(widget, window);
@@ -569,6 +625,16 @@ static void panel_icon_grid_unmap(GtkWidget *widget)
GTK_WIDGET_CLASS(panel_icon_grid_parent_class)->unmap(widget);
}
+#if GTK_CHECK_VERSION (3,0,0)
+static gboolean panel_icon_grid_draw(GtkWidget *widget, cairo_t *cr)
+{
+ if (gtk_widget_is_drawable(widget))
+ {
+ GTK_WIDGET_CLASS(panel_icon_grid_parent_class)->draw(widget, cr);
+ }
+ return FALSE;
+}
+#else
static gboolean panel_icon_grid_expose(GtkWidget *widget, GdkEventExpose *event)
{
if (gtk_widget_is_drawable(widget))
@@ -585,6 +651,7 @@ static gboolean panel_icon_grid_expose(GtkWidget *widget, GdkEventExpose *event)
}
return FALSE;
}
+#endif
static void panel_icon_grid_forall(GtkContainer *container,
gboolean include_internals,
@@ -608,22 +675,27 @@ static GType panel_icon_grid_child_type(GtkContainer *container)
return GTK_TYPE_WIDGET;
}
-static void panel_icon_grid_class_init(PanelIconGridClass *class)
+static void panel_icon_grid_class_init(PanelIconGridClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS(class);
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS(klass);
object_class->set_property = panel_icon_grid_set_property;
object_class->get_property = panel_icon_grid_get_property;
- widget_class->size_request = panel_icon_grid_size_request;
widget_class->size_allocate = panel_icon_grid_size_allocate;
widget_class->realize = panel_icon_grid_realize;
widget_class->unrealize = panel_icon_grid_unrealize;
widget_class->map = panel_icon_grid_map;
widget_class->unmap = panel_icon_grid_unmap;
+#if GTK_CHECK_VERSION (3,0,0)
+ widget_class->get_preferred_width = panel_icon_grid_get_preferred_width;
+ widget_class->get_preferred_height = panel_icon_grid_get_preferred_height;
+#else
+ widget_class->size_request = panel_icon_grid_size_request;
widget_class->expose_event = panel_icon_grid_expose;
+#endif
container_class->add = panel_icon_grid_add;
container_class->remove = panel_icon_grid_remove;
diff --git a/src/misc.c b/src/misc.c
index f15961b..03b27f6 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1030,7 +1030,9 @@ void
get_button_spacing(GtkRequisition *req, GtkContainer *parent, gchar *name)
{
GtkWidget *b;
-
+#if GTK_CHECK_VERSION (3,0,0)
+ GtkRequisition* minimal;
+#endif
ENTER;
b = gtk_button_new();
gtk_widget_set_name(GTK_WIDGET(b), name);
@@ -1042,7 +1044,11 @@ get_button_spacing(GtkRequisition *req, GtkContainer *parent, gchar *name)
gtk_container_add(parent, b);
gtk_widget_show(b);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_preferred_size(b, req, minimal);
+#else
gtk_widget_size_request(b, req);
+#endif
gtk_widget_destroy(b);
RET();
diff --git a/src/panel.c b/src/panel.c
index d5171e6..5d6f573 100644
--- a/src/panel.c
+++ b/src/panel.c
@@ -83,7 +83,11 @@ static void lxpanel_finalize(GObject *object)
G_OBJECT_CLASS(lxpanel_parent_class)->finalize(object);
}
+#if GTK_CHECK_VERSION(3,0,0)
+static void lxpanel_destroy(GtkWidget *object)
+#else
static void lxpanel_destroy(GtkObject *object)
+#endif
{
LXPanel *self = LXPANEL(object);
Panel *p = self->priv;
@@ -122,8 +126,11 @@ static void lxpanel_destroy(GtkObject *object)
g_source_remove(p->background_update_queued);
p->background_update_queued = 0;
}
-
+#if GTK_CHECK_VERSION(3,0,0)
+ GTK_WIDGET_CLASS(lxpanel_parent_class)->destroy(object);
+#else
GTK_OBJECT_CLASS(lxpanel_parent_class)->destroy(object);
+#endif
}
static gboolean idle_update_background(gpointer p)
@@ -175,13 +182,22 @@ static void lxpanel_style_set(GtkWidget *widget, GtkStyle* prev)
static void lxpanel_size_request(GtkWidget *widget, GtkRequisition *req)
{
Panel *p = LXPANEL(widget)->priv;
-
+#if GTK_CHECK_VERSION(3,0,0)
+ GTK_WIDGET_CLASS(lxpanel_parent_class)->get_preferred_height(widget, &req->height,&req->height);
+ GTK_WIDGET_CLASS(lxpanel_parent_class)->get_preferred_width(widget, &req->width,&req->width);
+ req->height=p->ah;
+ req->width=p->aw;
+#else
GTK_WIDGET_CLASS(lxpanel_parent_class)->size_request(widget, req);
-
+#endif
if (!p->visible)
/* When the panel is in invisible state, the content box also got hidden, thus always
* report 0 size. Ask the content box instead for its size. */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_get_preferred_size(p->box, req, NULL);
+#else
gtk_widget_size_request(p->box, req);
+#endif
/* FIXME: is this ever required? */
if (p->widthtype == WIDTH_REQUEST)
@@ -189,7 +205,6 @@ static void lxpanel_size_request(GtkWidget *widget, GtkRequisition *req)
if (p->heighttype == HEIGHT_REQUEST)
p->height = (p->orientation == GTK_ORIENTATION_HORIZONTAL) ? req->height : req->width;
calculate_position(p);
-
gtk_widget_set_size_request( widget, p->aw, p->ah );
}
@@ -197,20 +212,22 @@ static void lxpanel_size_allocate(GtkWidget *widget, GtkAllocation *a)
{
Panel *p = LXPANEL(widget)->priv;
- GTK_WIDGET_CLASS(lxpanel_parent_class)->size_allocate(widget, a);
-
+ GTK_WIDGET_CLASS(lxpanel_parent_class)->size_allocate(widget, a);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_allocation(widget,a);
+#endif
if (p->widthtype == WIDTH_REQUEST)
p->width = (p->orientation == GTK_ORIENTATION_HORIZONTAL) ? a->width : a->height;
if (p->heighttype == HEIGHT_REQUEST)
p->height = (p->orientation == GTK_ORIENTATION_HORIZONTAL) ? a->height : a->width;
calculate_position(p);
-
- if (a->width != p->aw || a->height != p->ah || a->x != p->ax || a->y != p->ay)
+ if (a->width != p->aw || a->height != p->ah || a->x != p->ax || a->y != p->ay)
{
gtk_window_move(GTK_WINDOW(widget), p->ax, p->ay);
_panel_set_wm_strut(LXPANEL(widget));
}
- else if (p->background_update_queued)
+ else
+ if (p->background_update_queued)
{
g_source_remove(p->background_update_queued);
p->background_update_queued = 0;
@@ -223,6 +240,30 @@ static void lxpanel_size_allocate(GtkWidget *widget, GtkAllocation *a)
}
}
+#if GTK_CHECK_VERSION (3,0,0)
+static void
+lxpanel_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+ lxpanel_size_request (widget, &requisition);
+
+ *minimal_width = *natural_width = requisition.width;
+}
+
+static void
+lxpanel_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+ lxpanel_size_request (widget, &requisition);
+
+ *minimal_height = *natural_height = requisition.height;
+}
+#endif
+
static gboolean lxpanel_configure_event (GtkWidget *widget, GdkEventConfigure *e)
{
Panel *p = LXPANEL(widget)->priv;
@@ -264,13 +305,24 @@ static gboolean lxpanel_button_press(GtkWidget *widget, GdkEventButton *event)
static void lxpanel_class_init(PanelToplevelClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *)klass;
+#if !GTK_CHECK_VERSION(3,0,0)
GtkObjectClass *gtk_object_class = (GtkObjectClass *)klass;
+#endif
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
gobject_class->finalize = lxpanel_finalize;
+#if GTK_CHECK_VERSION (3,0,0)
+ widget_class->destroy = lxpanel_destroy;
+#else
gtk_object_class->destroy = lxpanel_destroy;
+#endif
widget_class->realize = lxpanel_realize;
+#if GTK_CHECK_VERSION (3,0,0)
+ widget_class->get_preferred_width = lxpanel_get_preferred_width;
+ widget_class->get_preferred_height = lxpanel_get_preferred_height;
+#else
widget_class->size_request = lxpanel_size_request;
+#endif
widget_class->size_allocate = lxpanel_size_allocate;
widget_class->configure_event = lxpanel_configure_event;
widget_class->style_set = lxpanel_style_set;
@@ -311,6 +363,11 @@ static void lxpanel_init(PanelToplevel *self)
p->config = config_new();
p->defstyle = gtk_widget_get_default_style();
gtk_window_set_type_hint(GTK_WINDOW(self), GDK_WINDOW_TYPE_HINT_DOCK);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(self));
+ GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
+ gtk_widget_set_visual(GTK_WIDGET(self), visual);
+#endif
}
/* Allocate and initialize new Panel structure. */
@@ -595,9 +652,46 @@ void panel_determine_background_pixmap(Panel * panel, GtkWidget * widget, GdkWin
_panel_determine_background_pixmap(panel->topgwin, widget);
}
+#if GTK_CHECK_VERSION (3,0,0)
+void _panel_determine_background_css(LXPanel * panel, GtkWidget * widget)
+{
+ Panel * p = panel->priv;
+ gchar* css;
+ GdkRGBA color;
+ gboolean system;
+ if (( ! p->transparent) && (p->bg != NULL))
+ {
+ g_signal_handlers_disconnect_by_func(G_OBJECT(p->bg), on_root_bg_changed, panel);
+ g_object_unref(p->bg);
+ p->bg = NULL;
+ }
+ if (p->background)
+ {
+ /* User specified background pixmap. */
+ if (p->background_file != NULL)
+ css = fb_bg_generate_string(p->background_file,color,FALSE);
+ }
+ else if (p->transparent)
+ {
+ /* User specified background color. */
+ color.red=p->gtintcolor.red/255.0;
+ color.green=p->gtintcolor.green/255.0;
+ color.blue=p->gtintcolor.blue/255.0;
+ color.alpha=p->alpha/255.0;
+ css = fb_bg_generate_string(p->background_file,color,FALSE);
+ } else system=1;
+ g_print("CSS:%s",css);
+ fb_bg_apply_css(widget,css,system);
+ g_free(css);
+}
+#endif
void _panel_determine_background_pixmap(LXPanel * panel, GtkWidget * widget)
{
+#if GTK_CHECK_VERSION (3,0,0)
+ cairo_pattern_t* pixmap = NULL;
+#else
GdkPixmap * pixmap = NULL;
+#endif
GdkWindow * window = gtk_widget_get_window(widget);
Panel * p = panel->priv;
@@ -623,22 +717,37 @@ void _panel_determine_background_pixmap(LXPanel * panel, GtkWidget * widget)
{
p->bg = fb_bg_get_for_display();
g_signal_connect(G_OBJECT(p->bg), "changed", G_CALLBACK(on_root_bg_changed), panel);
- }
+ }
+#if GTK_CHECK_VERSION (3,0,0)
+ GdkRGBA rgba;
+ rgba.red=p->gtintcolor.red/255.0;
+ rgba.green=p->gtintcolor.green/255.0;
+ rgba.blue=p->gtintcolor.blue/255.0;
+ rgba.alpha=p->alpha/255.0;
+ gtk_widget_set_app_paintable(widget, TRUE);
+ gdk_window_set_background_rgba(gtk_widget_get_window(widget),&rgba);
+ return;
+#else
pixmap = fb_bg_get_xroot_pix_for_win(p->bg, widget);
if ((pixmap != NULL) && (pixmap != GDK_NO_BG) && (p->alpha != 0))
fb_bg_composite(pixmap, &p->gtintcolor, p->alpha);
+#endif
}
if (pixmap != NULL)
{
gtk_widget_set_app_paintable(widget, TRUE );
- gdk_window_set_back_pixmap(window, pixmap, FALSE);
- g_object_unref(pixmap);
+#if GTK_CHECK_VERSION (3,0,0)
+ gdk_window_set_background_pattern(window,pixmap);
+ cairo_pattern_destroy(pixmap);
+#else
+ gdk_window_set_back_pixmap(window, pixmap, FALSE);
+ g_object_unref(pixmap);
+#endif
}
else
gtk_widget_set_app_paintable(widget, FALSE);
}
-
/* Update the background of the entire panel.
* This function should only be called after the panel has been realized. */
void panel_update_background(Panel * p)
@@ -652,8 +761,10 @@ static void _panel_update_background(LXPanel * p)
GList *plugins, *l;
/* Redraw the top level widget. */
- _panel_determine_background_pixmap(p, w);
+ _panel_determine_background_pixmap(p, w);
+#if !GTK_CHECK_VERSION (3,0,0)
gdk_window_clear(gtk_widget_get_window(w));
+#endif
gtk_widget_queue_draw(w);
/* Loop over all plugins redrawing each plugin. */
@@ -1286,8 +1397,11 @@ panel_start_gui(LXPanel *panel)
gtk_widget_show(p->box);
if (p->round_corners)
make_round_corners(p);
-
+#if GTK_CHECK_VERSION (3,0,0)
+ p->topxwin = GDK_WINDOW_XID(gtk_widget_get_window(w));
+#else
p->topxwin = GDK_WINDOW_XWINDOW(gtk_widget_get_window(w));
+#endif
DBG("topxwin = %x\n", p->topxwin);
/* the settings that should be done before window is mapped */
diff --git a/src/plugin.c b/src/plugin.c
index 668c26e..896373b 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -35,6 +35,10 @@
#include <glib/gi18n.h>
#include <libfm/fm-gtk.h>
+#if GTK_CHECK_VERSION (3,0,0)
+#include <gtk/gtkx.h>
+#endif
+
//#define DEBUG
#include "dbg.h"
@@ -224,10 +228,29 @@ static void plugin_get_available_classes(void)
}
#endif
}
-
+//TODO:Background
/* Recursively set the background of all widgets on a panel background configuration change. */
void plugin_widget_set_background(GtkWidget * w, LXPanel * panel)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (w != NULL)
+ {
+ Panel *p = panel->priv;
+ if (gtk_widget_get_has_window(w))
+ {
+
+ if (gtk_widget_get_realized(w))
+ {
+ GdkWindow * window = gtk_widget_get_window(w);
+ GdkRGBA color;
+ gdk_rgba_parse(&color,"rgba(0,0,0,0)");
+ gdk_window_set_background_rgba(window, &color);
+ gdk_window_set_background_pattern(window, NULL);
+ gdk_window_invalidate_rect(gtk_widget_get_window(w), NULL, TRUE);
+ }
+ }
+ }
+#else
if (w != NULL)
{
Panel *p = panel->priv;
@@ -254,7 +277,7 @@ void plugin_widget_set_background(GtkWidget * w, LXPanel * panel)
#else
if (GTK_WIDGET_REALIZED(w))
#endif
- {
+ {
gdk_window_set_back_pixmap(gtk_widget_get_window(w), NULL, TRUE);
gtk_style_set_background(gtk_widget_get_style(w),
gtk_widget_get_window(w),
@@ -276,8 +299,8 @@ void plugin_widget_set_background(GtkWidget * w, LXPanel * panel)
if (GTK_IS_CONTAINER(w))
gtk_container_foreach(GTK_CONTAINER(w), (GtkCallback) plugin_widget_set_background, panel);
}
+#endif
}
-
/* Handler for "button_press_event" signal with Plugin as parameter.
* External so can be used from a plugin. */
static gboolean lxpanel_plugin_button_press_event(GtkWidget *plugin, GdkEventButton *event, LXPanel *panel)
@@ -534,8 +557,8 @@ static void on_size_allocate(GtkWidget *widget, GdkRectangle *allocation, LXPane
if (alloc->x == allocation->x && alloc->y == allocation->y &&
alloc->width == allocation->width && alloc->height == allocation->height)
return; /* not changed */
- *alloc = *allocation;
- /* g_debug("size-allocate on %s", PLUGIN_CLASS(widget)->name); */
+ *alloc = *allocation;
+ /* g_debug("size-allocate on %s, params: %d,%d\n", PLUGIN_CLASS(widget)->name,allocation->width,allocation->height); */
_panel_queue_update_background(p);
// _queue_panel_calculate_size(p);
}
------------------------------------------------------------------------------
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list