@@ -87,12 +87,13 @@ rowview_attach(Rowview *rview, GtkWidget *child, int x)
8787 GtkWidget * parent = gtk_widget_get_parent (child );
8888 if (parent ) {
8989 if (IS_ROWVIEW (parent )) {
90- // if the parent is the rview, this is the first _attach of a
91- // template child and it will have a single ref, held by
92- // rview
93- //
94- // add an extra ref (dropped in _dispose) to keep the child alive
95- // across any later reparenting during row drag
90+ /* If the parent is the rview, this is the first _attach of a
91+ * template child and it will have a single ref, held by
92+ * rview.
93+ *
94+ * Add an extra ref (dropped in _dispose) to keep the child alive
95+ * across any later reparenting during row drag.
96+ */
9697 gtk_widget_unparent (child );
9798 g_object_ref (child );
9899 }
@@ -437,28 +438,24 @@ static void
437438rowview_action (GSimpleAction * action , GVariant * parameter , View * view )
438439{
439440 Rowview * rview = ROWVIEW (view );
440- View * graphic = rview -> rhsview -> graphic ;
441441 Row * row = ROW (VOBJECT (rview )-> iobject );
442- Rhs * rhs = row -> child_rhs ;
442+ Model * graphic = row -> child_rhs -> graphic ;
443443 Workspace * ws = row -> ws ;
444444 const char * name = g_action_get_name (G_ACTION (action ));
445445
446- if (graphic &&
447- g_str_equal (name , "row-edit" ))
448- model_edit (GTK_WIDGET (rview ), MODEL (rhs ));
446+ if (g_str_equal (name , "row-edit" ) && graphic )
447+ model_edit (GTK_WIDGET (rview ), MODEL (graphic ));
449448 else if (g_str_equal (name , "row-duplicate" ))
450449 rowview_duplicate (rview );
451- else if (g_str_equal (name , "row-saveas" ) &&
452- rhs -> graphic )
453- classmodel_graphic_save (CLASSMODEL (rhs -> graphic ), GTK_WIDGET (rview ));
450+ else if (g_str_equal (name , "row-saveas" ) && graphic )
451+ classmodel_graphic_save (CLASSMODEL (graphic ), GTK_WIDGET (rview ));
454452 else if (g_str_equal (name , "row-delete" )) {
455453 if (workspace_selected_num (ws ) < 2 )
456454 row_select (row );
457455 workspace_selected_remove_yesno (ws , view_get_window (VIEW (rview )));
458456 }
459- else if (g_str_equal (name , "row-replace" ) &&
460- rhs -> graphic )
461- classmodel_graphic_replace (CLASSMODEL (rhs -> graphic ), GTK_WIDGET (rview ));
457+ else if (g_str_equal (name , "row-replace" ) && graphic )
458+ classmodel_graphic_replace (CLASSMODEL (graphic ), GTK_WIDGET (rview ));
462459 else if (g_str_equal (name , "row-group" ))
463460 rowview_group (rview );
464461 else if (g_str_equal (name , "row-ungroup" ))
@@ -580,3 +577,16 @@ rowview_get_visible(Rowview *rview)
580577{
581578 return rview -> visible ;
582579}
580+
581+ Rowview *
582+ rowview_get_top (Rowview * rview )
583+ {
584+ View * enclosing = VIEW (rview )-> parent -> parent ;
585+
586+ if (IS_COLUMNVIEW (enclosing ))
587+ // rview in a subcolumnview in a columnview, so a top-level rowview
588+ return rview ;
589+ else
590+ // rview in a subcolumnview in a rhsview, so a nested rowview
591+ return rowview_get_top (RHSVIEW (enclosing )-> rview );
592+ }
0 commit comments