Codebase list lightdm-gtk-greeter-settings / 6953b42
IconEntry: using GtkMenuButton Andrew P. 9 years ago
2 changed file(s) with 26 addition(s) and 43 deletion(s). Raw diff Collapse all Expand all
570570 </packing>
571571 </child>
572572 <child>
573 <object class="GtkToggleButton" id="greeter_default-user-image_button">
574 <property name="visible">True</property>
575 <property name="can_focus">False</property>
576 <property name="receives_default">True</property>
577 <property name="halign">start</property>
578 <property name="valign">start</property>
579 <child>
580 <object class="GtkImage" id="greeter_default-user-image_image">
581 <property name="visible">True</property>
582 <property name="can_focus">False</property>
583 <property name="pixel_size">64</property>
584 <property name="icon_name">avatar-default</property>
585 </object>
586 </child>
587 </object>
588 <packing>
589 <property name="left_attach">1</property>
590 <property name="top_attach">9</property>
591 </packing>
592 </child>
593 <child>
594573 <object class="GtkCheckButton" id="greeter_user-background_value">
595574 <property name="label" translatable="yes" context="option|greeter|user-background">Use user wallpaper if available</property>
596575 <property name="visible">True</property>
672651 <packing>
673652 <property name="left_attach">1</property>
674653 <property name="top_attach">8</property>
654 </packing>
655 </child>
656 <child>
657 <object class="GtkMenuButton" id="greeter_default-user-image_button">
658 <property name="visible">True</property>
659 <property name="can_focus">True</property>
660 <property name="receives_default">True</property>
661 <property name="halign">start</property>
662 <property name="popup">greeter_default-user-image_menu</property>
663 <child>
664 <object class="GtkImage" id="greeter_default-user-image_image">
665 <property name="visible">True</property>
666 <property name="can_focus">False</property>
667 <property name="pixel_size">64</property>
668 <property name="icon_name">avatar-default</property>
669 </object>
670 </child>
671 </object>
672 <packing>
673 <property name="left_attach">1</property>
674 <property name="top_attach">9</property>
675675 </packing>
676676 </child>
677677 </object>
683683 <object class="GtkLabel" id="label1">
684684 <property name="visible">True</property>
685685 <property name="can_focus">False</property>
686 <property name="label" translatable="yes">Appearance</property>
686 <property name="label" translatable="yes" context="tabs">Appearance</property>
687687 </object>
688688 <packing>
689689 <property name="tab_expand">True</property>
966966 <object class="GtkLabel" id="label2">
967967 <property name="visible">True</property>
968968 <property name="can_focus">False</property>
969 <property name="label" translatable="yes">Panel</property>
969 <property name="label" translatable="yes" context="tabs">Panel</property>
970970 </object>
971971 <packing>
972972 <property name="position">1</property>
991991 <property name="visible">True</property>
992992 <property name="can_focus">False</property>
993993 <property name="halign">start</property>
994 <property name="label" translatable="yes" context="option|greeter|position">Select base point and its position</property>
994 <property name="label" translatable="yes" context="option|greeter|position">Select base point and its position.</property>
995995 <attributes>
996996 <attribute name="style" value="oblique"/>
997997 </attributes>
12541254 <object class="GtkLabel" id="label5">
12551255 <property name="visible">True</property>
12561256 <property name="can_focus">False</property>
1257 <property name="label" translatable="yes">Window position</property>
1257 <property name="label" translatable="yes" context="tabs">Window position</property>
12581258 </object>
12591259 <packing>
12601260 <property name="position">2</property>
15541554 <object class="GtkLabel" id="label3">
15551555 <property name="visible">True</property>
15561556 <property name="can_focus">False</property>
1557 <property name="label" translatable="yes">Misc.</property>
1557 <property name="label" translatable="yes" context="tabs">Misc.</property>
15581558 </object>
15591559 <packing>
15601560 <property name="position">3</property>
349349 self._path_dialog_preview = widgets['path_dialog_preview']
350350 self._icon_dialog = None
351351
352 self._button.connect('toggled', self._on_button_toggled)
353 self._menu.connect('hide', self._on_menu_hide)
354352 self._icon_item.connect('activate', self._on_select_icon)
355353 self._path_item.connect('activate', self._on_select_path)
356354 self._path_dialog.connect('update-preview', self._on_update_path_preview)
393391 else:
394392 self._path_item.get_child().set_markup(
395393 C_('option-entry|icon', 'Select file...'))
396
397 def _get_menu_position(self, menu, widget):
398 allocation = widget.get_allocation()
399 x, y = widget.get_window().get_position()
400 x += allocation.x
401 y += allocation.y + allocation.height
402 return (x, y, False)
403
404 def _on_button_toggled(self, toggle):
405 if toggle.props.active:
406 self._menu.popup(None, None, self._get_menu_position,
407 self._button, 3, Gtk.get_current_event_time())
408
409 def _on_menu_hide(self, toggle):
410 self._button.props.active = False
411394
412395 def _on_select_icon(self, item):
413396 if not self._icon_dialog: