view pui-prefs-window.ui @ 31:9905d4ae351c

Fix continuos loop of update checks if the refresh cache interval is 0 If the interval for refreshing the cache is set to 0 each check for available updates refreshes the cache and causes an "updates-changed" signal to be emitted after a short delay which in turn triggers another check for updates. The "updates-changed" signal does not actually mean that the number of available updates has changed but rather that the package metadata cache has been invalidated. Fix this by blocking the "updates-changed" signal handler from when a periodic or irregular check is started until 4 seconds after it has finished. This is necessary since the signal will be delivered with a delay after a transaction has been completed. In addition prevent checks for updates triggered by the "updates-changed" signal from refreshing the cache even the interval is 0 since the emission of the signal implies that the cache has just been refreshed.
author Guido Berhoerster <guido+pui@berhoerster.name>
date Thu, 29 Aug 2019 13:48:47 +0200
parents 3d72ca76538d
children
line wrap: on
line source

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkListStore" id="refresh-interval-list">
    <columns>
      <!-- column-name id -->
      <column type="gchararray"/>
      <!-- column-name title -->
      <column type="gchararray"/>
      <!-- column-name interval -->
      <column type="guint"/>
    </columns>
    <data>
      <row>
        <col id="0">always</col>
        <col id="1" translatable="yes">always</col>
        <col id="2">0</col>
      </row>
      <row>
        <col id="0">one-hour</col>
        <col id="1" translatable="yes">every hour</col>
        <col id="2">3600</col>
      </row>
      <row>
        <col id="0">eight-hours</col>
        <col id="1" translatable="yes">every 8 hours</col>
        <col id="2">28800</col>
      </row>
      <row>
        <col id="0">twelve-hours</col>
        <col id="1" translatable="yes">twice a day</col>
        <col id="2">43200</col>
      </row>
      <row>
        <col id="0">one-day</col>
        <col id="1" translatable="yes">daily</col>
        <col id="2">86400</col>
      </row>
      <row>
        <col id="0">one-week</col>
        <col id="1" translatable="yes">weekly</col>
        <col id="2">604800</col>
      </row>
      <row>
        <col id="0">never</col>
        <col id="1" translatable="yes">never</col>
        <col id="2">4294967295</col>
      </row>
    </data>
  </object>
  <object class="GtkWindow" id="window">
    <property name="can_focus">False</property>
    <property name="resizable">False</property>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="margin_left">18</property>
        <property name="margin_right">18</property>
        <property name="margin_top">18</property>
        <property name="margin_bottom">18</property>
        <property name="orientation">vertical</property>
        <property name="spacing">18</property>
        <child>
          <object class="GtkGrid">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="row_spacing">18</property>
            <property name="column_spacing">12</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">end</property>
                <property name="label" translatable="yes">_Refresh cache:</property>
                <property name="use_underline">True</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">end</property>
                <property name="label" translatable="yes">_Command for installing updates:</property>
                <property name="use_underline">True</property>
                <property name="mnemonic_widget">update-command</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="update-command">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="width_chars">32</property>
                <signal name="changed" handler="on_command_changed" swapped="no"/>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBox" id="refresh-interval">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="model">refresh-interval-list</property>
                <property name="id_column">0</property>
                <child>
                  <object class="GtkCellRendererText"/>
                  <attributes>
                    <attribute name="text">1</attribute>
                  </attributes>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkCheckButton" id="use-mobile-connection">
                <property name="label" translatable="yes">Use _mobile connection</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">False</property>
                <property name="use_underline">True</property>
                <property name="draw_indicator">True</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">2</property>
                <property name="width">2</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkButtonBox">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="layout_style">end</property>
            <child>
              <object class="GtkButton">
                <property name="label">gtk-close</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="action_name">app.quit</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="expand">True</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>