Re: [PATCH 1/2] sepolicy: Switch main selection menu to GtkPopover

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 8, 2022 at 2:54 PM Petr Lautrbach <lautrbach@xxxxxxxxxx> wrote:
>
> Fixes: https://github.com/SELinuxProject/selinux/issues/206
>
> Signed-off-by: Petr Lautrbach <lautrbach@xxxxxxxxxx>

For these two patches:
Acked-by: James Carter <jwcart2@xxxxxxxxx>

> ---
>  python/sepolicy/sepolicy/gui.py         | 20 ++++----------------
>  python/sepolicy/sepolicy/sepolicy.glade |  9 +--------
>  2 files changed, 5 insertions(+), 24 deletions(-)
>
> diff --git a/python/sepolicy/sepolicy/gui.py b/python/sepolicy/sepolicy/gui.py
> index c8f33f522a2d..53f3c6148b58 100644
> --- a/python/sepolicy/sepolicy/gui.py
> +++ b/python/sepolicy/sepolicy/gui.py
> @@ -135,9 +135,8 @@ class SELinuxGui():
>          builder.add_from_file(glade_file)
>          self.outer_notebook = builder.get_object("outer_notebook")
>          self.window = builder.get_object("SELinux_window")
> -        self.main_selection_window = builder.get_object("Main_selection_menu")
> +        self.main_selection_popover = builder.get_object("Main_selection_menu")
>          self.main_advanced_label = builder.get_object("main_advanced_label")
> -        self.popup = 0
>          self.applications_selection_button = builder.get_object("applications_selection_button")
>          self.revert_button = builder.get_object("Revert_button")
>          self.busy_cursor = Gdk.Cursor(Gdk.CursorType.WATCH)
> @@ -531,7 +530,6 @@ class SELinuxGui():
>          dic = {
>              "on_combo_button_clicked": self.open_combo_menu,
>              "on_disable_ptrace_toggled": self.on_disable_ptrace,
> -            "on_SELinux_window_configure_event": self.hide_combo_menu,
>              "on_entrycompletion_obj_match_selected": self.set_application_label,
>              "on_filter_changed": self.get_filter_data,
>              "on_save_changes_file_equiv_clicked": self.update_to_file_equiv,
> @@ -808,18 +806,8 @@ class SELinuxGui():
>          return self.help_show_page()
>
>      def open_combo_menu(self, *args):
> -        if self.popup == 0:
> -            self.popup = 1
> -            location = self.window.get_position()
> -            self.main_selection_window.move(location[0] + 2, location[1] + 65)
> -            self.main_selection_window.show()
> -        else:
> -            self.main_selection_window.hide()
> -            self.popup = 0
> -
> -    def hide_combo_menu(self, *args):
> -        self.main_selection_window.hide()
> -        self.popup = 0
> +        self.main_selection_popover.set_relative_to(self.applications_selection_button)
> +        self.main_selection_popover.popup()
>
>      def set_application_label(self, *args):
>          self.set_application_label = True
> @@ -2335,7 +2323,7 @@ class SELinuxGui():
>              self.active_button = self.network_radio_button
>
>      def clearbuttons(self, clear=True):
> -        self.main_selection_window.hide()
> +        self.main_selection_popover.hide()
>          self.boolean_radio_button.set_visible(False)
>          self.files_radio_button.set_visible(False)
>          self.network_radio_button.set_visible(False)
> diff --git a/python/sepolicy/sepolicy/sepolicy.glade b/python/sepolicy/sepolicy/sepolicy.glade
> index 0724d6c8caa4..30e7b03f21c2 100644
> --- a/python/sepolicy/sepolicy/sepolicy.glade
> +++ b/python/sepolicy/sepolicy/sepolicy.glade
> @@ -10,11 +10,8 @@
>        <column type="gchararray"/>
>      </columns>
>    </object>
> -  <object class="GtkWindow" id="Main_selection_menu">
> +  <object class="GtkPopover" id="Main_selection_menu">
>      <property name="can_focus">False</property>
> -    <property name="default_width">265</property>
> -    <property name="default_height">100</property>
> -    <property name="decorated">False</property>
>      <child>
>        <object class="GtkBox" id="vbox2">
>          <property name="visible">True</property>
> @@ -53,7 +50,6 @@
>                  <property name="primary_icon_stock">gtk-find</property>
>                  <property name="primary_icon_activatable">False</property>
>                  <property name="secondary_icon_activatable">False</property>
> -                <signal name="activate" handler="on_SELinux_window_configure_event" swapped="no"/>
>                  <signal name="changed" handler="on_completion_entry_changed" swapped="no"/>
>                </object>
>                <packing>
> @@ -306,7 +302,6 @@
>      </columns>
>    </object>
>    <object class="GtkEntryCompletion" id="entrycompletion_obj">
> -    <signal name="match-selected" handler="on_SELinux_window_configure_event" swapped="no"/>
>      <signal name="match-selected" handler="on_completion_entry_changed" swapped="no"/>
>      <signal name="match-selected" handler="on_entrycompletion_obj_match_selected" swapped="no"/>
>    </object>
> @@ -1707,9 +1702,7 @@
>      <property name="window_position">center-always</property>
>      <property name="default_width">650</property>
>      <property name="default_height">420</property>
> -    <signal name="configure-event" handler="on_SELinux_window_configure_event" swapped="no"/>
>      <signal name="delete-event" handler="on_confirmation_close" swapped="no"/>
> -    <signal name="focus-in-event" handler="on_SELinux_window_configure_event" swapped="no"/>
>      <child>
>        <object class="GtkBox" id="vbox1">
>          <property name="visible">True</property>
> --
> 2.38.1
>



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux