[Shotwell] crop_tool_window layout changes when selecting "Custom" cropping
Paul Novak
pnovak at alumni.caltech.edu
Thu Apr 15 19:41:31 PDT 2010
On 04/15/2010 11:00 AM, Jim Nelson wrote:
> Hi Paul,
>
> Yes, that's certainly not behavior by design. I've created a ticket for
> this: http://trac.yorba.org/ticket/1795
>
> We'd love it if you patched this. The code you mentioned is exactly where
> you want to start: in EditingTools.vala, the CropToolWindow class. That
> class is internal to CropTool, which does a lot of the work to rearrange the
> controls when the custom constraint is selected. I suspect most (if not
> all) of the patch would be in these two classes.
>
> -- Jim
>
> On Wed, Apr 14, 2010 at 9:13 PM, Paul Novak <pnovak at alumni.caltech.edu>wrote:
>
>> Hello,
>>
>> I have built shotwell from SVN on Fedora 12. When I use the crop tool,
>> and select the "Custom" crop constraint, the layout of the crop tool
>> window changes so the "Cancel" and "OK" buttons are on the left. This
>> layout persists when I change to any other crop constraint. I think this
>> happens because the tool window layout is initialized by (from
>> EditingTools.vala)
>>
>> Gtk.HBox response_layout = new Gtk.HBox(true, CONTROL_SPACING);
>> response_layout.add(cancel_button);
>> response_layout.add(ok_button);
>>
>> layout = new Gtk.HBox(false, CONTROL_SPACING);
>> layout.add(constraint_combo);
>> layout.add(pivot_reticle_button);
>> layout.add(response_layout);
>>
>> but when the constraint type changes, response_layout is not removed,
>> just its children, cancel_button and the ok_button. I'm not sure how to
>> fix it, because I don't know how to access response_layout to remove its
>> children first (cancel_button and ok_button), and then remove
>> response_layout.
>>
>> I'd be glad to create the patch if someone pointed me in the right
>> direction.
>>
>> Thanks,
>> Paul
>> _______________________________________________
>> Shotwell mailing list
>> Shotwell at lists.yorba.org
>> http://lists.yorba.org/cgi-bin/mailman/listinfo/shotwell
>>
>
This patch makes response_layout public, then removing and adding it
(and its children widgets) places it in in the appropriate location. It
works, but I'm not sure if it is the best solution.
Paul
Index: src/EditingTools.vala
===================================================================
--- src/EditingTools.vala (revision 1496)
+++ src/EditingTools.vala (working copy)
@@ -477,6 +477,7 @@
public Gtk.Entry custom_height_entry = new Gtk.Entry();
public Gtk.Label custom_mulsign_label = new
Gtk.Label.with_mnemonic("x");
public Gtk.Entry most_recently_edited = null;
+ public Gtk.HBox response_layout = null;
public Gtk.HBox layout = null;
public int normal_width = -1;
public int normal_height = -1;
@@ -506,7 +507,7 @@
custom_height_entry.set_width_chars(4);
custom_height_entry.editable = true;
- Gtk.HBox response_layout = new Gtk.HBox(true, CONTROL_SPACING);
+ response_layout = new Gtk.HBox(true, CONTROL_SPACING);
response_layout.add(cancel_button);
response_layout.add(ok_button);
@@ -778,16 +779,14 @@
crop_tool_window.layout.remove(crop_tool_window.constraint_combo);
crop_tool_window.layout.remove(crop_tool_window.pivot_reticle_button);
- crop_tool_window.layout.remove(crop_tool_window.cancel_button);
- crop_tool_window.layout.remove(crop_tool_window.ok_button);
+ crop_tool_window.layout.remove(crop_tool_window.response_layout);
crop_tool_window.layout.add(crop_tool_window.constraint_combo);
crop_tool_window.layout.add(crop_tool_window.custom_height_entry);
crop_tool_window.layout.add(crop_tool_window.custom_mulsign_label);
crop_tool_window.layout.add(crop_tool_window.custom_width_entry);
crop_tool_window.layout.add(crop_tool_window.pivot_reticle_button);
- crop_tool_window.layout.add(crop_tool_window.cancel_button);
- crop_tool_window.layout.add(crop_tool_window.ok_button);
+ crop_tool_window.layout.add(crop_tool_window.response_layout);
if (reticle_orientation == ReticleOrientation.LANDSCAPE) {
crop_tool_window.custom_width_entry.set_text("%d".printf(custom_init_width));
@@ -819,13 +818,11 @@
crop_tool_window.layout.remove(crop_tool_window.custom_mulsign_label);
crop_tool_window.layout.remove(crop_tool_window.custom_height_entry);
crop_tool_window.layout.remove(crop_tool_window.pivot_reticle_button);
- crop_tool_window.layout.remove(crop_tool_window.cancel_button);
- crop_tool_window.layout.remove(crop_tool_window.ok_button);
+ crop_tool_window.layout.remove(crop_tool_window.response_layout);
crop_tool_window.layout.add(crop_tool_window.constraint_combo);
crop_tool_window.layout.add(crop_tool_window.pivot_reticle_button);
- crop_tool_window.layout.add(crop_tool_window.cancel_button);
- crop_tool_window.layout.add(crop_tool_window.ok_button);
+ crop_tool_window.layout.add(crop_tool_window.response_layout);
crop_tool_window.resize(crop_tool_window.normal_width,
crop_tool_window.normal_height);
More information about the Shotwell
mailing list