Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,540
    • Issues 1,540
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 221
    • Merge requests 221
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gtkgtk
  • Issues
  • #163
Closed
Open
Issue created Apr 07, 2018 by Michael Heyns@beanaroo

Unable to explicitly set GtkModelButton role

Steps to reproduce

  1. Create ModelButton with a stateful action-name and a role
  2. Try using the pygobject widget props attribute
  3. Try using the set_property method
    def _set_profile_menu(self):
        self.profile_menu_button_label.set_label(App().session.active.profile_name)

        if len(App().session.available_profiles) > 1:
            self.profile_menu = Gtk.PopoverMenu()

            profile_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, margin=10)
            self.profile_menu.add(profile_box)

            for profile in App().session.available_profiles:
                if profile != App().session.active.profile_name:

                    profile_menu_item = Gtk.ModelButton(
                        text=profile, role=Gtk.ButtonRole.NORMAL,
                        action_name="app.switch_profile", action_target=GLib.Variant.new_string(profile))
                    profile_menu_item.props.role = Gtk.ButtonRole.NORMAL
                    profile_menu_item.set_property('role', Gtk.ButtonRole.NORMAL)

                    profile_box.add(profile_menu_item)

            profile_box.show_all()
            self.profile_menu_button.set_popover(self.profile_menu)

Current behavior

screenshot-1523080137 GtkModelButton still assumes role from action-name

Expected outcome

Explicitly set role property is preserved.

Version information

  • Arch Linux
  • gtk3 3.22.29+4+gb485cf91b5-1
  • python-gobject 3.28.1-1

Additional information

Trying to override the radio CSS node (even interactively), documented here, has no effect. Is this worthy of an additional bug report? i.e.

modelbutton radio {
  opacity: 0;
}

Workaround

I have worked around this by calling the set_property method in a realize signal handler for each button.I am not sure if this is good practice.

Assignee
Assign to
Time tracking